Browse Source

1、兼容蒸汽流量计;

dev
mh 4 months ago
parent
commit
30a31d8098
  1. 4
      user-service/src/main/java/com/mh/user/constants/Constant.java
  2. 5
      user-service/src/main/java/com/mh/user/mapper/MeterManageMapper.java
  3. 5
      user-service/src/main/java/com/mh/user/service/impl/MeterManageServiceImpl.java
  4. 2
      user-service/src/main/java/com/mh/user/strategy/ModbusProtocolStrategy.java
  5. 8
      user-service/src/test/java/com/mh/user/SysUserTest.java

4
user-service/src/main/java/com/mh/user/constants/Constant.java

@ -23,7 +23,9 @@ public class Constant {
public static Long COOLING_METER = 2L; // 冷量计 public static Long COOLING_METER = 2L; // 冷量计
public static Long DIG_DISPLAY_METER = 3L; // 数显电表 public static Long DIG_DISPLAY_METER = 3L;
public static Long FLOW_METER = 4L; // 蒸汽流量计
public static float CARBON_EMISSION_FACTOR = 0.6379f; public static float CARBON_EMISSION_FACTOR = 0.6379f;

5
user-service/src/main/java/com/mh/user/mapper/MeterManageMapper.java

@ -30,8 +30,9 @@ public interface MeterManageMapper extends BaseMapper<MeterManageEntity> {
@Param("registerAddr") String registerAddr); @Param("registerAddr") String registerAddr);
@Select("select count(1) from meter_manage " + @Select("select count(1) from meter_manage " +
" where project_id=#{projectId} and mt_type = 2 and func_code = '03' and register_addr = #{registerAddr} ") " where project_id=#{projectId} and mt_type = #{mtType} and func_code = '03' and register_addr = #{registerAddr} ")
int queryIsHotCollection(@Param("systemId") String systemId, int queryIsHotCollection(@Param("systemId") String systemId,
@Param("projectId") String projectId, @Param("projectId") String projectId,
@Param("registerAddr") String registerAddr); @Param("registerAddr") String registerAddr,
@Param("mtType") Long mtType);
} }

5
user-service/src/main/java/com/mh/user/service/impl/MeterManageServiceImpl.java

@ -8,6 +8,7 @@ import com.mh.common.page.MybatisPageHelper;
import com.mh.common.page.PageRequest; import com.mh.common.page.PageRequest;
import com.mh.common.page.PageResult; import com.mh.common.page.PageResult;
import com.mh.common.utils.StringUtils; import com.mh.common.utils.StringUtils;
import com.mh.user.constants.Constant;
import com.mh.user.entity.MeterManageEntity; import com.mh.user.entity.MeterManageEntity;
import com.mh.user.mapper.MeterManageMapper; import com.mh.user.mapper.MeterManageMapper;
import com.mh.user.service.DeviceCodeParamService; import com.mh.user.service.DeviceCodeParamService;
@ -116,10 +117,10 @@ public class MeterManageServiceImpl implements MeterManageService {
@Override @Override
public int queryIsHotCollection(String systemId, String projectId) { public int queryIsHotCollection(String systemId, String projectId) {
if (meterManageMapper.queryIsHotCollection(systemId, projectId, "0077") > 0) { if (meterManageMapper.queryIsHotCollection(systemId, projectId, "0077", Constant.COOLING_METER) > 0) {
// 判断是否存在热量计 // 判断是否存在热量计
return 1; return 1;
} else if (meterManageMapper.queryIsHotCollection(systemId, projectId, "0004") > 0) { } else if (meterManageMapper.queryIsHotCollection(systemId, projectId, "0004", Constant.FLOW_METER) > 0) {
// 判断是否包含蒸汽流量计 // 判断是否包含蒸汽流量计
return 2; return 2;
} else { } else {

2
user-service/src/main/java/com/mh/user/strategy/ModbusProtocolStrategy.java

@ -130,7 +130,7 @@ public class ModbusProtocolStrategy implements ProtocolStrategy {
// 入库数据 // 入库数据
// 冷量表 // 冷量表
if ("2".equals(deviceCodeParamEntity.getDeviceType())) { if ("2".equals(deviceCodeParamEntity.getDeviceType()) || "4".equals(deviceCodeParamEntity.getDeviceType())) {
analysisCloudOrder485(sValue, deviceCodeParamEntity); analysisCloudOrder485(sValue, deviceCodeParamEntity);
} else if ("0".equals(deviceCodeParamEntity.getDeviceType())) { } else if ("0".equals(deviceCodeParamEntity.getDeviceType())) {
analysisChillerOrder485(sValue, deviceCodeParamEntity); analysisChillerOrder485(sValue, deviceCodeParamEntity);

8
user-service/src/test/java/com/mh/user/SysUserTest.java

@ -32,8 +32,14 @@ public class SysUserTest {
private static final SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private static final SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public static void main(String[] args) throws ParseException, IOException { public static void main(String[] args) throws ParseException, IOException {
String s = String.valueOf(Math.abs(ExchangeStringUtil.hexToSingle("40AA5048"))); String s = String.valueOf(Math.abs(ExchangeStringUtil.hexToSingle("432d7d1b")));
System.out.println(s); System.out.println(s);
String data = "01030444D3200006FA";
data = data.substring(data.length() - 8, data.length() - 6)
+ data.substring(data.length() - 6, data.length() - 4)
+ data.substring(data.length() - 12, data.length() - 10)
+ data.substring(data.length() - 10, data.length() - 8);
System.out.println(data);
// String dateStr = ""; // String dateStr = "";
// Date date = new Date(); // Date date = new Date();
// if (ExchangeStringUtil.isInDate(date, "00:00:00", "00:00:30")) { // if (ExchangeStringUtil.isInDate(date, "00:00:00", "00:00:30")) {

Loading…
Cancel
Save