Browse Source

采集参数优化

prod_202403
mh 10 months ago
parent
commit
d3c672b64d
  1. 9
      user-service/src/main/java/com/mh/user/controller/DeviceInstallController.java
  2. 13
      user-service/src/main/java/com/mh/user/mapper/DeviceCodeParamMapper.java
  3. 3
      user-service/src/main/java/com/mh/user/mapper/DeviceInstallMapper.java
  4. 6
      user-service/src/main/java/com/mh/user/service/DeviceInstallService.java
  5. 140
      user-service/src/main/java/com/mh/user/service/impl/DeviceInstallServiceImpl.java
  6. 211
      user-service/src/main/java/com/mh/user/utils/GetReadOrder485.java

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

@ -51,9 +51,16 @@ public class DeviceInstallController {
@SysLogger(title="基表信息",optDesc = "修改基表信息") @SysLogger(title="基表信息",optDesc = "修改基表信息")
@PostMapping(value="/update") @PostMapping(value="/update")
public HttpResult updateDevice(@RequestBody DeviceInstallEntity deviceInstallEntity) { public HttpResult updateDevice(@RequestBody DeviceInstallEntity deviceInstallEntity) {
// 根据id查询对应的deviceInstall
DeviceInstallEntity oldEntity = deviceInstallService.selectDeviceById(deviceInstallEntity.getId());
// 删除全部的device_code_param值
deviceInstallService.deleteParamCode(oldEntity);
// 在创建新的device_code_param值
deviceInstallService.createParamCode(deviceInstallEntity);
// 更新device_install
deviceInstallService.updateDevice(deviceInstallEntity); deviceInstallService.updateDevice(deviceInstallEntity);
String isUse=""; String isUse="";
if (deviceInstallEntity.isUse()==true){ if (deviceInstallEntity.isUse()){
isUse="1"; isUse="1";
}else{ }else{
isUse="0"; isUse="0";

13
user-service/src/main/java/com/mh/user/mapper/DeviceCodeParamMapper.java

@ -1,6 +1,7 @@
package com.mh.user.mapper; package com.mh.user.mapper;
import com.mh.user.entity.DeviceCodeParamEntity; import com.mh.user.entity.DeviceCodeParamEntity;
import com.mh.user.entity.DeviceInstallEntity;
import com.mh.user.entity.OrderMessageEntity; import com.mh.user.entity.OrderMessageEntity;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
@ -164,4 +165,16 @@ public interface DeviceCodeParamMapper {
//查询插入水位开关 //查询插入水位开关
@Insert("insert into device_code_param3(device_addr,device_name,device_type,data_com,baudrate,parity,brand,create_time,building_id) select device_addr,device_name,device_type,data_com,baudrate,parity,brand,getDate(),building_id from device_install where device_type='水位开关' ") @Insert("insert into device_code_param3(device_addr,device_name,device_type,data_com,baudrate,parity,brand,create_time,building_id) select device_addr,device_name,device_type,data_com,baudrate,parity,brand,getDate(),building_id from device_install where device_type='水位开关' ")
void selectInsertDeviceCodeParam3(); void selectInsertDeviceCodeParam3();
@Delete("delete from device_code_param " +
" where device_addr=#{deviceAddr} and device_type = #{deviceType} and data_com = #{dataCom} and building_id = #{buildingId}")
void deleteParamCode1(DeviceInstallEntity oldEntity);
@Delete("delete from device_code_param2 " +
" where device_addr=#{deviceAddr} and device_type = #{deviceType} and data_com = #{dataCom} and building_id = #{buildingId}")
void deleteParamCode2(DeviceInstallEntity oldEntity);
@Delete("delete from device_code_param3 " +
" where device_addr=#{deviceAddr} and device_type = #{deviceType} and data_com = #{dataCom} and building_id = #{buildingId}")
void deleteParamCode3(DeviceInstallEntity oldEntity);
} }

3
user-service/src/main/java/com/mh/user/mapper/DeviceInstallMapper.java

@ -319,4 +319,7 @@ public interface DeviceInstallMapper {
Double selectDeviceDeviation(@Param("deviceAddr") String deviceAddr, Double selectDeviceDeviation(@Param("deviceAddr") String deviceAddr,
@Param("deviceType") String deviceType, @Param("deviceType") String deviceType,
@Param("buildingId") String buildingId); @Param("buildingId") String buildingId);
@Select("select * from device_install where id = #{id} ")
DeviceInstallEntity selectDeviceById(@Param("id") Long id);
} }

6
user-service/src/main/java/com/mh/user/service/DeviceInstallService.java

@ -16,6 +16,8 @@ import java.util.List;
public interface DeviceInstallService { public interface DeviceInstallService {
void createParamCode(DeviceInstallEntity deviceInstallEntity);
/** /**
* 设备管理模块 * 设备管理模块
* 保存设备信息 * 保存设备信息
@ -175,4 +177,8 @@ public interface DeviceInstallService {
boolean updateDeviation(Integer buildingId, Integer deviceType, Integer param, String readValue, String realValue); boolean updateDeviation(Integer buildingId, Integer deviceType, Integer param, String readValue, String realValue);
Double selectDeviceDeviation(String deviceAddr, String deviceType, String buildingId); Double selectDeviceDeviation(String deviceAddr, String deviceType, String buildingId);
DeviceInstallEntity selectDeviceById(Long id);
void deleteParamCode(DeviceInstallEntity oldEntity);
} }

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

@ -1,10 +1,12 @@
package com.mh.user.service.impl; package com.mh.user.service.impl;
import com.mh.user.entity.DeviceCodeParamEntity;
import com.mh.user.entity.DeviceInstallEntity; import com.mh.user.entity.DeviceInstallEntity;
import com.mh.user.entity.DeviceInstallTempEntity; import com.mh.user.entity.DeviceInstallTempEntity;
import com.mh.user.entity.UploadDeviceInstallEntity; import com.mh.user.entity.UploadDeviceInstallEntity;
import com.mh.user.exception.CommonNum; import com.mh.user.exception.CommonNum;
import com.mh.user.exception.ServiceRuntimeException; import com.mh.user.exception.ServiceRuntimeException;
import com.mh.user.mapper.DeviceCodeParamMapper;
import com.mh.user.mapper.DeviceInstallMapper; import com.mh.user.mapper.DeviceInstallMapper;
import com.mh.user.mapper.provider.DeviceInstallProvider; import com.mh.user.mapper.provider.DeviceInstallProvider;
import com.mh.user.model.DeviceModel; import com.mh.user.model.DeviceModel;
@ -15,12 +17,15 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.SelectProvider; import org.apache.ibatis.annotations.SelectProvider;
import org.checkerframework.checker.units.qual.A; import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Random;
@Slf4j @Slf4j
@Service @Service
@ -32,13 +37,136 @@ public class DeviceInstallServiceImpl implements DeviceInstallService {
@Autowired @Autowired
private BuildingService buildingService; private BuildingService buildingService;
@Autowired
private DeviceCodeParamMapper deviceCodeParamMapper;
@Override @Override
public int saveDevice(DeviceInstallEntity deviceInstallEntity) { public int saveDevice(DeviceInstallEntity deviceInstallEntity) {
String buildingName = buildingService.selectBuildingNameById(deviceInstallEntity.getBuildingId()); String buildingName = buildingService.selectBuildingNameById(deviceInstallEntity.getBuildingId());
deviceInstallEntity.setBuildingName(buildingName); deviceInstallEntity.setBuildingName(buildingName);
this.createParamCode(deviceInstallEntity);
return deviceInstallMapper.saveDevice(deviceInstallEntity); return deviceInstallMapper.saveDevice(deviceInstallEntity);
} }
/**
* 生成采集信息内容
* @param deviceInstallEntity
*/
@Override
public void createParamCode(DeviceInstallEntity deviceInstallEntity) {
DeviceCodeParamEntity deviceCodeParamEntity = new DeviceCodeParamEntity();
BeanUtils.copyProperties(deviceInstallEntity,deviceCodeParamEntity);
deviceCodeParamEntity.setBaudrate(deviceInstallEntity.getBaudRate());
deviceCodeParamEntity.setThread(String.valueOf(new Random().nextInt(10)));
// 顺便生成采集信息
switch (deviceInstallEntity.getDeviceType()) {
case "压变":
case "温度变送器":
case "温控":
deviceCodeParamMapper.insertDeviceCodeParamList(Collections.singletonList(deviceCodeParamEntity));
break;
case "电表":
case "水表":
case "状态检测":
case "热泵状态":
deviceCodeParamMapper.insertDeviceCodeParamList2(Collections.singletonList(deviceCodeParamEntity));
break;
case "水位开关":
switch (deviceInstallEntity.getBrand()) {
case "远向":
deviceCodeParamEntity.setRegisterAddr("0018");//读水位设定
deviceCodeParamEntity.setFunCode("03");
deviceCodeParamMapper.insertDeviceCodeParamList3(Collections.singletonList(deviceCodeParamEntity));
deviceCodeParamEntity.setRegisterAddr("0010");//读热泵状态、上水用水状态
deviceCodeParamEntity.setFunCode("03");
break;
case "中凯":
deviceCodeParamEntity.setRegisterAddr("0017");//读水位设定
deviceCodeParamEntity.setFunCode("03");
break;
default:
deviceCodeParamEntity.setRegisterAddr("0102");//读水位设定
deviceCodeParamEntity.setFunCode("0102");
break;
}
deviceCodeParamMapper.insertDeviceCodeParamList3(Collections.singletonList(deviceCodeParamEntity));
break;
case "热泵":
// 需要区分型号,然后在设置值到表里面
switch (deviceInstallEntity.getBrand()) {
case "美的":
// 插入device_code_param表
deviceCodeParamEntity.setRegisterAddr("0007"); //实际水温
deviceCodeParamEntity.setFunCode("03");
deviceCodeParamMapper.insertDeviceCodeParamList(Collections.singletonList(deviceCodeParamEntity));
// 插入device_code_param1表
deviceCodeParamEntity.setRegisterAddr("0641"); //运行状态
deviceCodeParamEntity.setFunCode("03");
deviceCodeParamMapper.insertDeviceCodeParamList2(Collections.singletonList(deviceCodeParamEntity));
// 插入device_code_param2表
deviceCodeParamEntity.setRegisterAddr("0642"); //设定温度
deviceCodeParamEntity.setFunCode("03");
deviceCodeParamMapper.insertDeviceCodeParamList(Collections.singletonList(deviceCodeParamEntity));
// 插入device_code_param2表
deviceCodeParamEntity.setRegisterAddr("000B"); //故障状态
deviceCodeParamEntity.setFunCode("03");
deviceCodeParamMapper.insertDeviceCodeParamList(Collections.singletonList(deviceCodeParamEntity));
break;
case "美的2":
// 插入device_code_param表
deviceCodeParamEntity.setRegisterAddr("0064"); //实际水温
deviceCodeParamEntity.setFunCode("03");
deviceCodeParamMapper.insertDeviceCodeParamList(Collections.singletonList(deviceCodeParamEntity));
// 插入device_code_param1表
deviceCodeParamEntity.setRegisterAddr("0BBD"); //运行状态
deviceCodeParamEntity.setFunCode("03");
deviceCodeParamMapper.insertDeviceCodeParamList2(Collections.singletonList(deviceCodeParamEntity));
// 插入device_code_param2表
deviceCodeParamEntity.setRegisterAddr("0003"); //设定温度
deviceCodeParamEntity.setFunCode("03");
deviceCodeParamMapper.insertDeviceCodeParamList(Collections.singletonList(deviceCodeParamEntity));
// 插入device_code_param2表
deviceCodeParamEntity.setRegisterAddr("0BBB"); //故障状态
deviceCodeParamEntity.setFunCode("03");
deviceCodeParamMapper.insertDeviceCodeParamList(Collections.singletonList(deviceCodeParamEntity));
break;
case "瑞星":
// 插入device_code_param表
deviceCodeParamEntity.setRegisterAddr("0046"); //实际水温
deviceCodeParamEntity.setFunCode("03");
deviceCodeParamMapper.insertDeviceCodeParamList(Collections.singletonList(deviceCodeParamEntity));
// 插入device_code_param1表
deviceCodeParamEntity.setRegisterAddr("0001"); //运行状态
deviceCodeParamEntity.setFunCode("03");
deviceCodeParamMapper.insertDeviceCodeParamList2(Collections.singletonList(deviceCodeParamEntity));
// 插入device_code_param2表
deviceCodeParamEntity.setRegisterAddr("000A"); //设定温度
deviceCodeParamEntity.setFunCode("03");
deviceCodeParamMapper.insertDeviceCodeParamList(Collections.singletonList(deviceCodeParamEntity));
// 插入device_code_param2表
deviceCodeParamEntity.setRegisterAddr("0050"); //故障状态
deviceCodeParamEntity.setFunCode("03");
deviceCodeParamMapper.insertDeviceCodeParamList(Collections.singletonList(deviceCodeParamEntity));
break;
default:
break;
}
break;
default:
break;
}
}
@Override @Override
public int updateDevice(DeviceInstallEntity deviceInstallEntity) { public int updateDevice(DeviceInstallEntity deviceInstallEntity) {
return deviceInstallMapper.updateDevice(deviceInstallEntity); return deviceInstallMapper.updateDevice(deviceInstallEntity);
@ -272,5 +400,17 @@ public class DeviceInstallServiceImpl implements DeviceInstallService {
public Double selectDeviceDeviation(String deviceAddr, String deviceType, String buildingId) { public Double selectDeviceDeviation(String deviceAddr, String deviceType, String buildingId) {
return deviceInstallMapper.selectDeviceDeviation(deviceAddr, deviceType, buildingId); return deviceInstallMapper.selectDeviceDeviation(deviceAddr, deviceType, buildingId);
} }
@Override
public DeviceInstallEntity selectDeviceById(Long id) {
return deviceInstallMapper.selectDeviceById(id);
}
@Override
public void deleteParamCode(DeviceInstallEntity oldEntity) {
deviceCodeParamMapper.deleteParamCode1(oldEntity);
deviceCodeParamMapper.deleteParamCode2(oldEntity);
deviceCodeParamMapper.deleteParamCode3(oldEntity);
}
} }

211
user-service/src/main/java/com/mh/user/utils/GetReadOrder485.java

@ -639,15 +639,15 @@ public class GetReadOrder485 {
List<DeviceInstallEntity> deviceList1; List<DeviceInstallEntity> deviceList1;
deviceCodeParamService.selectInsertDeviceCodeParam(); //查询插入设备采集参数,包括压变、温控、温度变送器、热泵状态 deviceCodeParamService.selectInsertDeviceCodeParam(); //查询插入设备采集参数,包括压变、温控、温度变送器、热泵状态
deviceList1 = deviceInstallService.selectDeviceParams();//查找多个采集参数的设备,包括热泵 deviceList1 = deviceInstallService.selectDeviceParams();//查找多个采集参数的设备,包括热泵
System.out.println(deviceList1); // System.out.println(deviceList1);
for (DeviceInstallEntity devices : deviceList1) { for (DeviceInstallEntity devices : deviceList1) {
List<DeviceCodeParamEntity> deviceCodeParamEntityList = new ArrayList<>(); List<DeviceCodeParamEntity> deviceCodeParamEntityList = new ArrayList<>();
if (devices.getDeviceType().equals("热泵")) { if (devices.getDeviceType().equals("热泵")) {
if (devices.getBrand().equals("美的")) {
DeviceCodeParamEntity deviceCodeParamEntity3 = new DeviceCodeParamEntity(); DeviceCodeParamEntity deviceCodeParamEntity3 = new DeviceCodeParamEntity();
deviceCodeParamEntity3.setRegisterAddr("0007");//水温 switch(devices.getBrand()) {
case "美的":
deviceCodeParamEntity3.setRegisterAddr("0007");//实际水温
deviceCodeParamEntity3.setFunCode("03"); deviceCodeParamEntity3.setFunCode("03");
deviceCodeParamEntity3.setDeviceAddr(devices.getDeviceAddr()); deviceCodeParamEntity3.setDeviceAddr(devices.getDeviceAddr());
deviceCodeParamEntity3.setDeviceName(devices.getDeviceName()); deviceCodeParamEntity3.setDeviceName(devices.getDeviceName());
@ -658,11 +658,9 @@ public class GetReadOrder485 {
deviceCodeParamEntity3.setBuildingId(devices.getBuildingId()); deviceCodeParamEntity3.setBuildingId(devices.getBuildingId());
deviceCodeParamEntity3.setParity(devices.getParity()); deviceCodeParamEntity3.setParity(devices.getParity());
deviceCodeParamEntityList.add(deviceCodeParamEntity3); deviceCodeParamEntityList.add(deviceCodeParamEntity3);
break;
} else if (devices.getBrand().equals("美的2")) { case "美的2":
deviceCodeParamEntity3.setRegisterAddr("0064");//实际水温
DeviceCodeParamEntity deviceCodeParamEntity3 = new DeviceCodeParamEntity();
deviceCodeParamEntity3.setRegisterAddr("0064");//水温
deviceCodeParamEntity3.setFunCode("03"); deviceCodeParamEntity3.setFunCode("03");
deviceCodeParamEntity3.setDeviceAddr(devices.getDeviceAddr()); deviceCodeParamEntity3.setDeviceAddr(devices.getDeviceAddr());
deviceCodeParamEntity3.setDeviceName(devices.getDeviceName()); deviceCodeParamEntity3.setDeviceName(devices.getDeviceName());
@ -673,7 +671,52 @@ public class GetReadOrder485 {
deviceCodeParamEntity3.setBuildingId(devices.getBuildingId()); deviceCodeParamEntity3.setBuildingId(devices.getBuildingId());
deviceCodeParamEntity3.setParity(devices.getParity()); deviceCodeParamEntity3.setParity(devices.getParity());
deviceCodeParamEntityList.add(deviceCodeParamEntity3); deviceCodeParamEntityList.add(deviceCodeParamEntity3);
} break;
case "瑞星":
deviceCodeParamEntity3.setRegisterAddr("0046");//实际水温
deviceCodeParamEntity3.setFunCode("03");
deviceCodeParamEntity3.setDeviceAddr(devices.getDeviceAddr());
deviceCodeParamEntity3.setDeviceName(devices.getDeviceName());
deviceCodeParamEntity3.setDeviceType(devices.getDeviceType());
deviceCodeParamEntity3.setBaudrate(devices.getBaudRate());
deviceCodeParamEntity3.setBrand(devices.getBrand());
deviceCodeParamEntity3.setDataCom(devices.getDataCom());
deviceCodeParamEntity3.setBuildingId(devices.getBuildingId());
deviceCodeParamEntity3.setParity(devices.getParity());
deviceCodeParamEntityList.add(deviceCodeParamEntity3);
break;
default:
break;
}
// if (devices.getBrand().equals("美的")) {
// DeviceCodeParamEntity deviceCodeParamEntity3 = new DeviceCodeParamEntity();
// deviceCodeParamEntity3.setRegisterAddr("0007");//水温
// deviceCodeParamEntity3.setFunCode("03");
// deviceCodeParamEntity3.setDeviceAddr(devices.getDeviceAddr());
// deviceCodeParamEntity3.setDeviceName(devices.getDeviceName());
// deviceCodeParamEntity3.setDeviceType(devices.getDeviceType());
// deviceCodeParamEntity3.setBaudrate(devices.getBaudRate());
// deviceCodeParamEntity3.setBrand(devices.getBrand());
// deviceCodeParamEntity3.setDataCom(devices.getDataCom());
// deviceCodeParamEntity3.setBuildingId(devices.getBuildingId());
// deviceCodeParamEntity3.setParity(devices.getParity());
// deviceCodeParamEntityList.add(deviceCodeParamEntity3);
//
// } else if (devices.getBrand().equals("美的2")) {
//
// DeviceCodeParamEntity deviceCodeParamEntity3 = new DeviceCodeParamEntity();
// deviceCodeParamEntity3.setRegisterAddr("0064");//水温
// deviceCodeParamEntity3.setFunCode("03");
// deviceCodeParamEntity3.setDeviceAddr(devices.getDeviceAddr());
// deviceCodeParamEntity3.setDeviceName(devices.getDeviceName());
// deviceCodeParamEntity3.setDeviceType(devices.getDeviceType());
// deviceCodeParamEntity3.setBaudrate(devices.getBaudRate());
// deviceCodeParamEntity3.setBrand(devices.getBrand());
// deviceCodeParamEntity3.setDataCom(devices.getDataCom());
// deviceCodeParamEntity3.setBuildingId(devices.getBuildingId());
// deviceCodeParamEntity3.setParity(devices.getParity());
// deviceCodeParamEntityList.add(deviceCodeParamEntity3);
// }
} }
deviceCodeParamService.insertDeviceCodeParamList(deviceCodeParamEntityList); deviceCodeParamService.insertDeviceCodeParamList(deviceCodeParamEntityList);
} }
@ -689,8 +732,9 @@ public class GetReadOrder485 {
for (DeviceInstallEntity devices : deviceList1) { for (DeviceInstallEntity devices : deviceList1) {
List<DeviceCodeParamEntity> deviceCodeParamEntityList = new ArrayList<>(); List<DeviceCodeParamEntity> deviceCodeParamEntityList = new ArrayList<>();
if (devices.getDeviceType().equals("热泵")) { if (devices.getDeviceType().equals("热泵")) {
if (devices.getBrand().equals("美的")) {
DeviceCodeParamEntity deviceCodeParamEntity1 = new DeviceCodeParamEntity(); DeviceCodeParamEntity deviceCodeParamEntity1 = new DeviceCodeParamEntity();
switch (devices.getBrand()) {
case "美的":
deviceCodeParamEntity1.setRegisterAddr("0641"); //运行状态 deviceCodeParamEntity1.setRegisterAddr("0641"); //运行状态
deviceCodeParamEntity1.setFunCode("03"); deviceCodeParamEntity1.setFunCode("03");
deviceCodeParamEntity1.setDeviceAddr(devices.getDeviceAddr()); deviceCodeParamEntity1.setDeviceAddr(devices.getDeviceAddr());
@ -702,8 +746,8 @@ public class GetReadOrder485 {
deviceCodeParamEntity1.setBuildingId(devices.getBuildingId()); deviceCodeParamEntity1.setBuildingId(devices.getBuildingId());
deviceCodeParamEntity1.setParity(devices.getParity()); deviceCodeParamEntity1.setParity(devices.getParity());
deviceCodeParamEntityList.add(deviceCodeParamEntity1);//添加到列表 deviceCodeParamEntityList.add(deviceCodeParamEntity1);//添加到列表
} else if (devices.getBrand().equals("美的2")) { break;
DeviceCodeParamEntity deviceCodeParamEntity1 = new DeviceCodeParamEntity(); case "美的2":
deviceCodeParamEntity1.setRegisterAddr("0BBD"); //运行状态 deviceCodeParamEntity1.setRegisterAddr("0BBD"); //运行状态
deviceCodeParamEntity1.setFunCode("03"); deviceCodeParamEntity1.setFunCode("03");
deviceCodeParamEntity1.setDeviceAddr(devices.getDeviceAddr()); deviceCodeParamEntity1.setDeviceAddr(devices.getDeviceAddr());
@ -715,7 +759,51 @@ public class GetReadOrder485 {
deviceCodeParamEntity1.setBuildingId(devices.getBuildingId()); deviceCodeParamEntity1.setBuildingId(devices.getBuildingId());
deviceCodeParamEntity1.setParity(devices.getParity()); deviceCodeParamEntity1.setParity(devices.getParity());
deviceCodeParamEntityList.add(deviceCodeParamEntity1);//添加到列表 deviceCodeParamEntityList.add(deviceCodeParamEntity1);//添加到列表
} break;
case "瑞星":
deviceCodeParamEntity1.setRegisterAddr("0001"); //运行状态
deviceCodeParamEntity1.setFunCode("03");
deviceCodeParamEntity1.setDeviceAddr(devices.getDeviceAddr());
deviceCodeParamEntity1.setDeviceName(devices.getDeviceName());
deviceCodeParamEntity1.setDeviceType(devices.getDeviceType());
deviceCodeParamEntity1.setBaudrate(devices.getBaudRate());
deviceCodeParamEntity1.setBrand(devices.getBrand());
deviceCodeParamEntity1.setDataCom(devices.getDataCom());
deviceCodeParamEntity1.setBuildingId(devices.getBuildingId());
deviceCodeParamEntity1.setParity(devices.getParity());
deviceCodeParamEntityList.add(deviceCodeParamEntity1);//添加到列表
break;
default:
break;
}
// if (devices.getBrand().equals("美的")) {
// DeviceCodeParamEntity deviceCodeParamEntity1 = new DeviceCodeParamEntity();
// deviceCodeParamEntity1.setRegisterAddr("0641"); //运行状态
// deviceCodeParamEntity1.setFunCode("03");
// deviceCodeParamEntity1.setDeviceAddr(devices.getDeviceAddr());
// deviceCodeParamEntity1.setDeviceName(devices.getDeviceName());
// deviceCodeParamEntity1.setDeviceType(devices.getDeviceType());
// deviceCodeParamEntity1.setBaudrate(devices.getBaudRate());
// deviceCodeParamEntity1.setBrand(devices.getBrand());
// deviceCodeParamEntity1.setDataCom(devices.getDataCom());
// deviceCodeParamEntity1.setBuildingId(devices.getBuildingId());
// deviceCodeParamEntity1.setParity(devices.getParity());
// deviceCodeParamEntityList.add(deviceCodeParamEntity1);//添加到列表
// } else if (devices.getBrand().equals("美的2")) {
// DeviceCodeParamEntity deviceCodeParamEntity1 = new DeviceCodeParamEntity();
// deviceCodeParamEntity1.setRegisterAddr("0BBD"); //运行状态
// deviceCodeParamEntity1.setFunCode("03");
// deviceCodeParamEntity1.setDeviceAddr(devices.getDeviceAddr());
// deviceCodeParamEntity1.setDeviceName(devices.getDeviceName());
// deviceCodeParamEntity1.setDeviceType(devices.getDeviceType());
// deviceCodeParamEntity1.setBaudrate(devices.getBaudRate());
// deviceCodeParamEntity1.setBrand(devices.getBrand());
// deviceCodeParamEntity1.setDataCom(devices.getDataCom());
// deviceCodeParamEntity1.setBuildingId(devices.getBuildingId());
// deviceCodeParamEntity1.setParity(devices.getParity());
// deviceCodeParamEntityList.add(deviceCodeParamEntity1);//添加到列表
// }
} }
deviceCodeParamService.insertDeviceCodeParamList2(deviceCodeParamEntityList); deviceCodeParamService.insertDeviceCodeParamList2(deviceCodeParamEntityList);
} }
@ -731,8 +819,10 @@ public class GetReadOrder485 {
for (DeviceInstallEntity devices : deviceList1) { for (DeviceInstallEntity devices : deviceList1) {
List<DeviceCodeParamEntity> deviceCodeParamEntityList = new ArrayList<>(); List<DeviceCodeParamEntity> deviceCodeParamEntityList = new ArrayList<>();
if (devices.getDeviceType().equals("热泵")) { if (devices.getDeviceType().equals("热泵")) {
if (devices.getBrand().equals("美的")) {
DeviceCodeParamEntity deviceCodeParamEntity2 = new DeviceCodeParamEntity(); DeviceCodeParamEntity deviceCodeParamEntity2 = new DeviceCodeParamEntity();
DeviceCodeParamEntity deviceCodeParamEntity4 = new DeviceCodeParamEntity();
switch (devices.getBrand()) {
case "美的":
deviceCodeParamEntity2.setRegisterAddr("0642");//设定温度 deviceCodeParamEntity2.setRegisterAddr("0642");//设定温度
deviceCodeParamEntity2.setFunCode("03"); deviceCodeParamEntity2.setFunCode("03");
deviceCodeParamEntity2.setDeviceAddr(devices.getDeviceAddr()); deviceCodeParamEntity2.setDeviceAddr(devices.getDeviceAddr());
@ -745,7 +835,6 @@ public class GetReadOrder485 {
deviceCodeParamEntity2.setParity(devices.getParity()); deviceCodeParamEntity2.setParity(devices.getParity());
deviceCodeParamEntityList.add(deviceCodeParamEntity2); deviceCodeParamEntityList.add(deviceCodeParamEntity2);
DeviceCodeParamEntity deviceCodeParamEntity4 = new DeviceCodeParamEntity();
deviceCodeParamEntity4.setRegisterAddr("000B");//故障状态 deviceCodeParamEntity4.setRegisterAddr("000B");//故障状态
deviceCodeParamEntity4.setFunCode("03"); deviceCodeParamEntity4.setFunCode("03");
deviceCodeParamEntity4.setDeviceAddr(devices.getDeviceAddr()); deviceCodeParamEntity4.setDeviceAddr(devices.getDeviceAddr());
@ -757,10 +846,8 @@ public class GetReadOrder485 {
deviceCodeParamEntity4.setBuildingId(devices.getBuildingId()); deviceCodeParamEntity4.setBuildingId(devices.getBuildingId());
deviceCodeParamEntity4.setParity(devices.getParity()); deviceCodeParamEntity4.setParity(devices.getParity());
deviceCodeParamEntityList.add(deviceCodeParamEntity4); deviceCodeParamEntityList.add(deviceCodeParamEntity4);
break;
} else if (devices.getBrand().equals("美的2")) { case "美的2":
DeviceCodeParamEntity deviceCodeParamEntity2 = new DeviceCodeParamEntity();
deviceCodeParamEntity2.setRegisterAddr("0003");//设定温度 deviceCodeParamEntity2.setRegisterAddr("0003");//设定温度
deviceCodeParamEntity2.setFunCode("03"); deviceCodeParamEntity2.setFunCode("03");
deviceCodeParamEntity2.setDeviceAddr(devices.getDeviceAddr()); deviceCodeParamEntity2.setDeviceAddr(devices.getDeviceAddr());
@ -773,7 +860,6 @@ public class GetReadOrder485 {
deviceCodeParamEntity2.setParity(devices.getParity()); deviceCodeParamEntity2.setParity(devices.getParity());
deviceCodeParamEntityList.add(deviceCodeParamEntity2); deviceCodeParamEntityList.add(deviceCodeParamEntity2);
DeviceCodeParamEntity deviceCodeParamEntity4 = new DeviceCodeParamEntity();
deviceCodeParamEntity4.setRegisterAddr("0BBB");//故障状态 deviceCodeParamEntity4.setRegisterAddr("0BBB");//故障状态
deviceCodeParamEntity4.setFunCode("03"); deviceCodeParamEntity4.setFunCode("03");
deviceCodeParamEntity4.setDeviceAddr(devices.getDeviceAddr()); deviceCodeParamEntity4.setDeviceAddr(devices.getDeviceAddr());
@ -785,7 +871,88 @@ public class GetReadOrder485 {
deviceCodeParamEntity4.setBuildingId(devices.getBuildingId()); deviceCodeParamEntity4.setBuildingId(devices.getBuildingId());
deviceCodeParamEntity4.setParity(devices.getParity()); deviceCodeParamEntity4.setParity(devices.getParity());
deviceCodeParamEntityList.add(deviceCodeParamEntity4); deviceCodeParamEntityList.add(deviceCodeParamEntity4);
} break;
case "瑞星":
deviceCodeParamEntity2.setRegisterAddr("000A");//设定温度
deviceCodeParamEntity2.setFunCode("03");
deviceCodeParamEntity2.setDeviceAddr(devices.getDeviceAddr());
deviceCodeParamEntity2.setDeviceName(devices.getDeviceName());
deviceCodeParamEntity2.setDeviceType(devices.getDeviceType());
deviceCodeParamEntity2.setBaudrate(devices.getBaudRate());
deviceCodeParamEntity2.setBrand(devices.getBrand());
deviceCodeParamEntity2.setDataCom(devices.getDataCom());
deviceCodeParamEntity2.setBuildingId(devices.getBuildingId());
deviceCodeParamEntity2.setParity(devices.getParity());
deviceCodeParamEntityList.add(deviceCodeParamEntity2);
deviceCodeParamEntity4.setRegisterAddr("0050");//故障状态
deviceCodeParamEntity4.setFunCode("03");
deviceCodeParamEntity4.setDeviceAddr(devices.getDeviceAddr());
deviceCodeParamEntity4.setDeviceName(devices.getDeviceName());
deviceCodeParamEntity4.setDeviceType(devices.getDeviceType());
deviceCodeParamEntity4.setBaudrate(devices.getBaudRate());
deviceCodeParamEntity4.setBrand(devices.getBrand());
deviceCodeParamEntity4.setDataCom(devices.getDataCom());
deviceCodeParamEntity4.setBuildingId(devices.getBuildingId());
deviceCodeParamEntity4.setParity(devices.getParity());
deviceCodeParamEntityList.add(deviceCodeParamEntity4);
break;
}
// if (devices.getBrand().equals("美的")) {
// DeviceCodeParamEntity deviceCodeParamEntity2 = new DeviceCodeParamEntity();
// deviceCodeParamEntity2.setRegisterAddr("0642");//设定温度
// deviceCodeParamEntity2.setFunCode("03");
// deviceCodeParamEntity2.setDeviceAddr(devices.getDeviceAddr());
// deviceCodeParamEntity2.setDeviceName(devices.getDeviceName());
// deviceCodeParamEntity2.setDeviceType(devices.getDeviceType());
// deviceCodeParamEntity2.setBaudrate(devices.getBaudRate());
// deviceCodeParamEntity2.setBrand(devices.getBrand());
// deviceCodeParamEntity2.setDataCom(devices.getDataCom());
// deviceCodeParamEntity2.setBuildingId(devices.getBuildingId());
// deviceCodeParamEntity2.setParity(devices.getParity());
// deviceCodeParamEntityList.add(deviceCodeParamEntity2);
//
// DeviceCodeParamEntity deviceCodeParamEntity4 = new DeviceCodeParamEntity();
// deviceCodeParamEntity4.setRegisterAddr("000B");//故障状态
// deviceCodeParamEntity4.setFunCode("03");
// deviceCodeParamEntity4.setDeviceAddr(devices.getDeviceAddr());
// deviceCodeParamEntity4.setDeviceName(devices.getDeviceName());
// deviceCodeParamEntity4.setDeviceType(devices.getDeviceType());
// deviceCodeParamEntity4.setBaudrate(devices.getBaudRate());
// deviceCodeParamEntity4.setBrand(devices.getBrand());
// deviceCodeParamEntity4.setDataCom(devices.getDataCom());
// deviceCodeParamEntity4.setBuildingId(devices.getBuildingId());
// deviceCodeParamEntity4.setParity(devices.getParity());
// deviceCodeParamEntityList.add(deviceCodeParamEntity4);
//
// } else if (devices.getBrand().equals("美的2")) {
//
// DeviceCodeParamEntity deviceCodeParamEntity2 = new DeviceCodeParamEntity();
// deviceCodeParamEntity2.setRegisterAddr("0003");//设定温度
// deviceCodeParamEntity2.setFunCode("03");
// deviceCodeParamEntity2.setDeviceAddr(devices.getDeviceAddr());
// deviceCodeParamEntity2.setDeviceName(devices.getDeviceName());
// deviceCodeParamEntity2.setDeviceType(devices.getDeviceType());
// deviceCodeParamEntity2.setBaudrate(devices.getBaudRate());
// deviceCodeParamEntity2.setBrand(devices.getBrand());
// deviceCodeParamEntity2.setDataCom(devices.getDataCom());
// deviceCodeParamEntity2.setBuildingId(devices.getBuildingId());
// deviceCodeParamEntity2.setParity(devices.getParity());
// deviceCodeParamEntityList.add(deviceCodeParamEntity2);
//
// DeviceCodeParamEntity deviceCodeParamEntity4 = new DeviceCodeParamEntity();
// deviceCodeParamEntity4.setRegisterAddr("0BBB");//故障状态
// deviceCodeParamEntity4.setFunCode("03");
// deviceCodeParamEntity4.setDeviceAddr(devices.getDeviceAddr());
// deviceCodeParamEntity4.setDeviceName(devices.getDeviceName());
// deviceCodeParamEntity4.setDeviceType(devices.getDeviceType());
// deviceCodeParamEntity4.setBaudrate(devices.getBaudRate());
// deviceCodeParamEntity4.setBrand(devices.getBrand());
// deviceCodeParamEntity4.setDataCom(devices.getDataCom());
// deviceCodeParamEntity4.setBuildingId(devices.getBuildingId());
// deviceCodeParamEntity4.setParity(devices.getParity());
// deviceCodeParamEntityList.add(deviceCodeParamEntity4);
// }
} }
if (devices.getDeviceType().equals("水位开关")) { if (devices.getDeviceType().equals("水位开关")) {
if (devices.getBrand().equals("远向")) { if (devices.getBrand().equals("远向")) {

Loading…
Cancel
Save