| | |
| | | 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.*; |
| | |
| | | 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; |
| | |
| | | public static final String BEAN_ID = "bhznGrainv1.analysisService"; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | @Autowired |
| | | private CoreSerService coreSerService; |
| | | @Autowired |
| | | private BhznGrainV1ServerEngine serverEngine; |
| | |
| | | */ |
| | | 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()); |
| | |
| | | |
| | | //根据分机地址获取分机信息 |
| | | |
| | | DeviceSer ser = coreSerService.getCacheSer("5323", message.getAddr()); |
| | | DeviceSer ser = coreSerService.getCacheSer(message.getCompanyId(), message.getAddr()); |
| | | if (ser == null) { |
| | | replayGrain(message); |
| | | log.error("主机-------->>平台,解析粮情失败,未获取到系统粮情主机配置:" + message.getAddr()); |
| | |
| | | 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]); |
| | |
| | | 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]); |
| | |
| | | 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); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | 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]); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | Grain grain = new Grain(); |
| | | grain.setDepotId(depotConf.getDepotId()); |
| | | grain.setCompanyId(depotConf.getCompanyId()); |
| | |
| | | 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("粮情解析中获取到的温湿度信息={}", thDto.toString()); |
| | |
| | | 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); |