Browse Source

1、优化批量插入设备资料;

dev
25604 4 days ago
parent
commit
d37fa4e88a
  1. 26
      user-service/src/main/java/com/mh/user/controller/DeviceInstallController.java
  2. 2
      user-service/src/main/java/com/mh/user/service/impl/DeviceInstallServiceImpl.java

26
user-service/src/main/java/com/mh/user/controller/DeviceInstallController.java

@ -244,21 +244,24 @@ public class DeviceInstallController {
rolName = "波特率";
break;
case 6 :
rolName = "倍率";
rolName = "校验位";
break;
case 7 :
rolName = "品牌";
rolName = "倍率";
break;
case 8 :
rolName = "型号";
rolName = "品牌";
break;
case 9 :
rolName = "安装人员";
rolName = "型号";
break;
case 10 :
rolName = "所属楼栋";
rolName = "安装人员";
break;
case 11 :
rolName = "所属楼栋";
break;
case 12 :
rolName = "是否启用";
break;
}
@ -276,12 +279,13 @@ public class DeviceInstallController {
uploadEntity.setDeviceType(deviceList.get(2));//设备类型
uploadEntity.setDataCom(deviceList.get(3));//通讯端口
uploadEntity.setBaudRate(Integer.parseInt(deviceList.get(4)));//波特率
uploadEntity.setRatio(Double.parseDouble(deviceList.get(5)));//倍率
uploadEntity.setBrand(deviceList.get(6));//品牌
uploadEntity.setModel(deviceList.get(7));//型号
uploadEntity.setInstaller(deviceList.get(8));//安装人员
uploadEntity.setBuildingName(deviceList.get(9));//所属楼栋
if (deviceList.get(10).equals("是")){
uploadEntity.setParity(deviceList.get(5));//波特率
uploadEntity.setRatio(Double.parseDouble(deviceList.get(6)));//倍率
uploadEntity.setBrand(deviceList.get(7));//品牌
uploadEntity.setModel(deviceList.get(8));//型号
uploadEntity.setInstaller(deviceList.get(9));//安装人员
uploadEntity.setBuildingName(deviceList.get(10));//所属楼栋
if (deviceList.get(11).equals("是")){
uploadEntity.setIsUse(1);
}else{
uploadEntity.setIsUse(0);

2
user-service/src/main/java/com/mh/user/service/impl/DeviceInstallServiceImpl.java

@ -47,7 +47,7 @@ public class DeviceInstallServiceImpl implements DeviceInstallService {
} else if (StringUtil.isEmpty(deviceInstallEntity.getBuildingName()) && !StringUtil.isEmpty(deviceInstallEntity.getBuildingId())) {
deviceInstallEntity.setBuildingName(buildingService.selectBuildingNameById(deviceInstallEntity.getBuildingId()));
}
if ("电表".equalsIgnoreCase(deviceInstallEntity.getDeviceType())) {
if ("电表".equalsIgnoreCase(deviceInstallEntity.getDeviceType()) && !deviceInstallEntity.getBrand().contains("广仪MODBUS")) {
// 000005500773
deviceInstallEntity.setDeviceAddr(ExchangeStringUtil.addZeroForNum(deviceInstallEntity.getDeviceAddr(), 12));
} else if ("水表".equalsIgnoreCase(deviceInstallEntity.getDeviceType())

Loading…
Cancel
Save