From c206acfaedc69c390fb67daa81bc686f58a212ef Mon Sep 17 00:00:00 2001 From: CZT <czt18638530771@163.com> Date: 星期一, 27 十一月 2023 16:12:11 +0800 Subject: [PATCH] 提交配置信息2 --- igds-protocol-bhzn/src/main/java/com/ld/igds/protocol/bhzn/grainv1/msg/AnalysisService.java | 38 +++++++++++++++++++++++++++++++------- 1 files changed, 31 insertions(+), 7 deletions(-) diff --git a/igds-protocol-bhzn/src/main/java/com/ld/igds/protocol/bhzn/grainv1/msg/AnalysisService.java b/igds-protocol-bhzn/src/main/java/com/ld/igds/protocol/bhzn/grainv1/msg/AnalysisService.java index 7772715..6a883f3 100644 --- a/igds-protocol-bhzn/src/main/java/com/ld/igds/protocol/bhzn/grainv1/msg/AnalysisService.java +++ b/igds-protocol-bhzn/src/main/java/com/ld/igds/protocol/bhzn/grainv1/msg/AnalysisService.java @@ -6,7 +6,9 @@ import com.ld.igds.constant.BizType; import com.ld.igds.constant.Constant; import com.ld.igds.constant.DepotType; +import com.ld.igds.constant.RedisConst; import com.ld.igds.grain.GrainUtil; +import com.ld.igds.grain.dto.GrainData; import com.ld.igds.grain.dto.GrainItemInfo; import com.ld.igds.io.notify.NotifyGrainInvoker; import com.ld.igds.models.*; @@ -19,6 +21,7 @@ import com.ld.igds.protocol.bhzn.grainv1.server.BhznGrainV1ServerUtils; import com.ld.igds.util.BytesUtil; import com.ld.igds.util.ContextUtil; +import com.ld.igds.util.RedisUtil; import com.ld.igds.warn.WarnUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -49,6 +52,8 @@ public static final String BEAN_ID = "bhznGrainv1.analysisService"; @Autowired + private RedisUtil redisUtil; + @Autowired private CoreSerService coreSerService; @Autowired private BhznGrainV1ServerEngine serverEngine; @@ -68,12 +73,19 @@ */ public void analysis(String sessionKey, IoMessage message) throws Exception { + String companyId = ContextUtil.getDefaultCompanyId(); + //FZZY浜戞湇鍔″櫒-璁告槍鍐涚伯 + if("1000".equals(companyId)){ + companyId = "5323"; + } + message.setCompanyId(companyId); //娉ㄥ唽 if (BhznGrainV1ServerUtils.FUNCTION_ID_F1.equals(message.getFunctionId())) { //DO NOTHING log.info("涓绘満------->>骞冲彴锛氭敞鍐屼俊鎭姤鏂�={}", message); - DeviceSer ser = coreSerService.getCacheSerBySn("5323",message.getAddr()); + + DeviceSer ser = coreSerService.getCacheSerBySn(message.getCompanyId(), message.getAddr()); if(ser!= null ){ ser.setIp(message.getIp()); ser.setPort(message.getPort()); @@ -111,7 +123,7 @@ //鏍规嵁鍒嗘満鍦板潃鑾峰彇鍒嗘満淇℃伅 - DeviceSer ser = coreSerService.getCacheSer("5323", message.getAddr()); + DeviceSer ser = coreSerService.getCacheSer(message.getCompanyId(), message.getAddr()); if (ser == null) { replayGrain(message); log.error("涓绘満-------->>骞冲彴锛岃В鏋愮伯鎯呭け璐ワ紝鏈幏鍙栧埌绯荤粺绮儏涓绘満閰嶇疆锛�" + message.getAddr()); @@ -158,7 +170,7 @@ int cableY = 1; int cableX = 1; - if(DepotType.TYPE_01.equals(depot.getDepotType())){ + if(DepotType.TYPE_01.getCode().equals(depot.getDepotType())){ cableZ = Integer.valueOf(attCable[0]); cableY = Integer.valueOf(attCable[1]); cableX = Integer.valueOf(attCable[2]); @@ -239,7 +251,7 @@ int cableY = 1; int cableX = 1; - if(DepotType.TYPE_01.equals(depot.getDepotType())){ + if(DepotType.TYPE_01.getCode().equals(depot.getDepotType())){ cableZ = Integer.valueOf(attCable[0]); cableY = Integer.valueOf(attCable[1]); cableX = Integer.valueOf(attCable[2]); @@ -286,12 +298,13 @@ if (null != thDto) { log.debug("-------THDto--={}", thDto.toString()); } + + //娓呯┖ String key = "GRAIN_" + message.getAddr(); contextMapGrain.put(key, null); // 灏嗛泦鍚堣В鏋愭垚鍧愭爣鏁版嵁 addPoint1(temps, depotConf, ser, exeRequest, thDto, sysConf, batchId); - } @@ -326,7 +339,7 @@ int cableY = 1; int cableX = 1; - if(DepotType.TYPE_01.equals(depot.getDepotType())){ + if(DepotType.TYPE_01.getCode().equals(depot.getDepotType())){ cableZ = Integer.valueOf(attCable[0]); cableY = Integer.valueOf(attCable[1]); cableX = Integer.valueOf(attCable[2]); @@ -337,6 +350,9 @@ } + + + Grain grain = new Grain(); grain.setDepotId(depotConf.getDepotId()); grain.setCompanyId(depotConf.getCompanyId()); @@ -345,6 +361,14 @@ grain.setBatchId(batchId); grain.setTempIn(Constant.ERROR_TEMP); grain.setHumidityIn(Constant.ERROR_TEMP); + + //濡傛灉鏄补缃愪粨 + if(DepotType.TYPE_03.getCode().equals(depot.getDepotType())){ + GrainData tempData = (GrainData) redisUtil.get(RedisConst.buildKey(ser.getCompanyId(),RedisConst.KEY_DEPOT_HEIGHT,depot.getId())); + if(null != tempData){ + //TODO + } + } if (null != thDto) { log.debug("绮儏瑙f瀽涓幏鍙栧埌鐨勬俯婀垮害淇℃伅={}", thDto.toString()); @@ -476,7 +500,7 @@ private void analysisTh(IoMessage message) { try { THDto th = new THDto(); - th.setCompanyId("5323"); + th.setCompanyId(message.getCompanyId()); String data = message.getContent(); String houseNo = data.substring(0, 2); String t = data.substring(4, 8); -- Gitblit v1.9.3