| | |
| | | device.setStatus(Constant.YN_Y); |
| | | device.setCode("SUCCESS"); |
| | | device.setMsg("设备上线"); |
| | | device.setSn(device.getSn()); |
| | | device.setId(device.getId()); |
| | | device.setOnlineTime(new Date()); |
| | | contextDeviceMap.put(device.getIp(), device); |
| | | log.info("设备上线:" + ip); |
| | |
| | | device.setStatus(Constant.YN_N); |
| | | device.setCode("ERROR"); |
| | | device.setMsg("设备离线"); |
| | | device.setId(device.getId()); |
| | | contextDeviceMap.put(device.getIp(), device); |
| | | |
| | | return device; |
| | |
| | | GRAIN_YOUXIAN0_2023("GRAIN_YOUXIAN0_2023", "粮情-游仙主库协议"), |
| | | GRAIN_YOUXIAN1_2023("GRAIN_YOUXIAN1_2023", "粮情-游仙分库协议"), |
| | | GRAIN_WUJIA_2023("GRAIN_WUJIA_2023", "粮情-吴家粮库协议"), |
| | | GRAIN_XSYK_2023("GRAIN_WUJIA_2023", "油情-西山油库协议"), |
| | | GRAIN_XSYK_2023("GRAIN_XSYK_2023", "油情-西山油库协议"), |
| | | DEVICE_WEIGHT_HTTP("DEVICE_WEIGHT_HTTP", "地磅-HTTP协议"), |
| | | DEVICE_WEIGHT_TCP_YH("DEVICE_WEIGHT_TCP_YH", "地磅-耀华TCP协议"), |
| | | DEVICE_IDCARD_HTTP("DEVICE_IDCARD_HTTP", "身份证-HTTP协议"), |
| | |
| | | import com.fzzy.api.utils.DateUtil; |
| | | import com.fzzy.data.ConfigData; |
| | | import com.fzzy.gateway.api.GatewayRemoteManager; |
| | | import com.fzzy.gateway.api.GatewayRemoteService; |
| | | import com.fzzy.gateway.api.GatewaySyncGranService; |
| | | import com.fzzy.gateway.data.BaseReqData; |
| | | import com.fzzy.gateway.data.BaseResp; |
| | | import com.fzzy.gateway.data.WeatherWebDto; |
| | |
| | | gatewayRemoteManager.getDeviceReportService(device.getPushProtocol()).reportGrainDataByHand(reqData); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * <p> |
| | | * 粮情每天8点采集粮情 |
| | | */ |
| | | @Scheduled(cron = "0 32 7 ? * *") |
| | | public void scheduledGrain2() { |
| | | //获取设备配置,只针对粮情设备进行执行 |
| | | log.info("定时粮情采集kafka推送"); |
| | | List<GatewayDevice> list = gatewayDeviceTestPR.listAll(); |
| | | |
| | | if (null == list || list.isEmpty()) { |
| | | log.error("为获取到系统中设备配置,取消执行\""); |
| | | return ; |
| | | } |
| | | BaseReqData reqData = new BaseReqData(); |
| | | BaseResp resp; |
| | | for (GatewayDevice device : list) { |
| | | try{ |
| | | //如果不是粮情分机跳过 |
| | | if (!GatewayDeviceType.TYPE_07.getCode().equals(device.getType())) { |
| | | continue; |
| | | } |
| | | reqData.setDeviceId(device.getDeviceId()); |
| | | reqData.setProductId(device.getProductId()); |
| | | reqData.setDeviceName(device.getDeviceName()); |
| | | reqData.setDevice(device); |
| | | reqData.setAutoReplay(true); |
| | | GatewaySyncGranService syncGrainService = gatewayRemoteManager.getSyncGrainService(device.getSyncProtocol()); |
| | | resp = syncGrainService.syncGrain(reqData); |
| | | log.info("命令发送结果:"+resp.toString()); |
| | | }catch (Exception e){ |
| | | log.error(e.getMessage(),e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * <p> |
| | | * 每间隔3秒执行一次事件 |
| | |
| | | import com.fzzy.gateway.data.BaseReqData; |
| | | import com.fzzy.gateway.data.BaseResp; |
| | | import com.fzzy.gateway.entity.GatewayDevice; |
| | | import com.fzzy.gateway.hx2023.data.GrainData; |
| | | import com.fzzy.gateway.hx2023.data.KafaGrainData; |
| | | |
| | | |
| | |
| | | */ |
| | | BaseResp reportGrainData(BaseReqData reqData); |
| | | |
| | | |
| | | BaseResp reportGrainDataByKafka(BaseReqData reqData); |
| | | |
| | | BaseResp reportWeightData(BaseReqData reqData); |
| | | |
| | | BaseResp reportLprData(BaseReqData reqData); |
| | | |
| | | BaseResp reportGrainDataByHand(BaseReqData reqData); |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | BaseResp grainData2GatewayApiInfo(Fz40Grain grainData, GatewayDevice gatewayDevice); |
| | | |
| | | |
| | | /** |
| | | * 粮情业务数据转换为,当前网关需要的报文 |
| | | * @param grainData 第三个软件粮情数据报文 |
| | | * @param gatewayDevice 网关中设备配置信息 |
| | | * @return |
| | | */ |
| | | |
| | | BaseResp grainData2GatewayApiInfoKafka(GrainData grainData, GatewayDevice device); |
| | | } |
| | |
| | | if ("testGrain".equals(param.getBizType())) { |
| | | return testGrain(param); |
| | | } |
| | | |
| | | if ("testGrain".equals(param.getBizType())) { |
| | | return testGrain(param); |
| | | } |
| | | if ("ajaxTestKafkaGrain".equals(param.getBizType())) { |
| | | return ajaxTestKafkaGrain(param); |
| | | } |
| | |
| | | package com.fzzy.gateway.hx2023.service; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.fzzy.api.data.DepotType; |
| | | import com.fzzy.api.data.PushProtocol; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | |
| | | log.info("-----TOPIC-----{}", topic); |
| | | log.info("-----Message-----{}", reqData.getData()); |
| | | |
| | | return new BaseResp(); |
| | | } |
| | | @Override |
| | | public BaseResp reportGrainDataByKafka(BaseReqData reqData) { |
| | | String topic = ScConstant.TOPIC_ZLJ_GRAIN_TEMPERATURE; |
| | | //如果是测试模式不执行推送 |
| | | if (configData.getActive().indexOf("dev") >= 0) { |
| | | log.info("----------------------------推送KAFKA粮情信息,注:调试模式不推送---------------------------"); |
| | | log.info("-----TOPIC-----{}", topic); |
| | | log.info("-----Message-----{}", reqData.getData()); |
| | | |
| | | return new BaseResp(); |
| | | } |
| | | |
| | | kafkaDeviceReportService.publishWithTopic(reqData.getData(), topic); |
| | | return new BaseResp(); |
| | | } |
| | | |
| | |
| | | return resp; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // ---------------------------------------------------- |
| | | |
| | | @Override |
| | | public BaseResp grainData2GatewayApiInfoKafka(GrainData grainData, GatewayDevice device) { |
| | | |
| | | BaseResp resp = new BaseResp(); |
| | | |
| | | GrainCableData cableData = GatewayUtils.getCableData(device); |
| | | |
| | | if (null == device.getDepotType()) device.setDepotType(DepotType.TYPE_01.getCode()); |
| | | |
| | | // //表示筒仓 |
| | | // if (DepotType.TYPE_02.getCode().equals(device.getDepotType()) || DepotType.TYPE_04.getCode().equals(device.getDepotType())) { |
| | | // return grainData2GatewayApiInfo2(grainData, device, cableData); |
| | | // } |
| | | // |
| | | // //表示为筒仓包括油罐仓 |
| | | // if (DepotType.TYPE_03.getCode().equals(device.getDepotType())) { |
| | | // return grainData2GatewayApiInfo3(grainData, device, cableData); |
| | | // } |
| | | GrainOutPut output = JSONObject.parseObject(grainData.getOutput(),GrainOutPut.class); |
| | | KafaGrainData result = new KafaGrainData(); |
| | | result.setMessageId(ScConstant.getMessageId()); |
| | | result.setMessgeId(result.getMessageId()); |
| | | result.setDeviceID(device.getDeviceId()); |
| | | result.setAvgTemperature(output.getAvgTemperature()); |
| | | result.setMinTemperature(output.getMinTemperature()); |
| | | result.setMaxTemperature(output.getMaxTemperature() ); |
| | | result.setCollectTime(DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss")); |
| | | |
| | | //层行列 |
| | | int cableZ = cableData.getCableZ(); |
| | | int cableY = cableData.getCableY(); |
| | | int cableX = cableData.getCableX(); |
| | | |
| | | //温度集合 |
| | | List<GrainTemp> attr = output.getTemperature(); |
| | | |
| | | //根号 |
| | | int cableNum = 1, position = 0; |
| | | String curTemp; |
| | | List<KafkaGrainDataDetail1> temperature = new ArrayList<>(); |
| | | |
| | | int x = 0, y = 0, z = 0; |
| | | for (int i = 0; i < attr.size(); i++) { |
| | | position = i; |
| | | z = i % cableZ + 1; |
| | | x = i / (cableZ * cableY); |
| | | y = x * (cableZ * cableY); |
| | | y = (i - y) / cableZ; |
| | | // 倒转X轴 |
| | | x = cableX - 1 - x; |
| | | //根号 |
| | | cableNum = (i / cableZ) + 1; |
| | | curTemp = attr.get(i).getTemperature(); |
| | | |
| | | |
| | | //如果是异常值,执行调整数据 TODO |
| | | if (Double.valueOf(curTemp) < -99.9) { |
| | | |
| | | curTemp = output.getAvgTemperature(); |
| | | |
| | | } else { |
| | | //判断最大 |
| | | if (curTemp.equals(result.getMaxTemperature())) { |
| | | result.setMaxX(x + ""); |
| | | result.setMaxY(y + ""); |
| | | result.setMaxZ(position + ""); |
| | | } |
| | | //判断最小 |
| | | if (curTemp.equals(result.getMinTemperature())) { |
| | | result.setMinX(x + ""); |
| | | result.setMinY(y + ""); |
| | | result.setMinZ(position + ""); |
| | | } |
| | | } |
| | | |
| | | temperature.add(new KafkaGrainDataDetail1(cableNum + "", z + "", curTemp, position + "", x + "", y + "")); |
| | | } |
| | | |
| | | //粮温信息 |
| | | JSONObject trhInfo = new JSONObject(); |
| | | // TRHInfo trhInfo = new TRHInfo(); |
| | | trhInfo.put("temperature", temperature); |
| | | |
| | | |
| | | //仓温度信息 |
| | | KafkaGrainTH grainTH = new KafkaGrainTH(); |
| | | List<GrainTH> ths= output.getTemperatureAndhumidity(); |
| | | grainTH.setHumidity(ths.get(0).getHumidity()); |
| | | grainTH.setTemperature(ths.get(0).getTemperature() ); |
| | | |
| | | GrainWeather weather = JSON.parseObject(grainData.getWeatherStation(),GrainWeather.class); |
| | | grainTH.setAirHumidity(weather.getHumidity()); |
| | | grainTH.setAirTemperature(weather.getTemperature() ); |
| | | |
| | | List<KafkaGrainTH> temperatureAndhumidity = new ArrayList<>(); |
| | | temperatureAndhumidity.add(grainTH); |
| | | |
| | | trhInfo.put("temperatureAndhumidity", temperatureAndhumidity); |
| | | |
| | | |
| | | JSONObject params = new JSONObject(); |
| | | params.put("TRHInfo", trhInfo); |
| | | |
| | | result.setParams(params); |
| | | |
| | | |
| | | resp.setData(JSONObject.toJSONString(result)); |
| | | |
| | | return resp; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取当点所在圈 |
| | | * |
| | | * @param cableNum |
| | | * @param cableData |
| | | * @return |
| | | */ |
| | | private int getCirCleKafka(int position, int cableNum, GrainCableData cableData) { |
| | | |
| | | int num1 = 1, num2 = 2; |
| | | String[] attCable = cableData.getCableRule().split("-"); |
| | | |
| | | if (cableData.getTotalCircle() == 1) return 1; |
| | | |
| | | if (cableData.getTotalCircle() == 2) { |
| | | num1 = Integer.valueOf(attCable[0]); |
| | | |
| | | if (cableNum <= num1) return 1; |
| | | |
| | | return 2; |
| | | } |
| | | |
| | | if (cableData.getTotalCircle() == 3) { |
| | | num1 = Integer.valueOf(attCable[0]); |
| | | num2 = num1 + Integer.valueOf(attCable[1]); |
| | | if (cableNum <= num1) return 1; |
| | | |
| | | if (cableNum <= num2) return 2; |
| | | |
| | | return 3; |
| | | } |
| | | |
| | | if (cableData.getTotalCircle() == 4) { |
| | | num1 = Integer.valueOf(attCable[0]); |
| | | num2 = num1 + Integer.valueOf(attCable[1]); |
| | | if (cableNum <= num1) return 1; |
| | | |
| | | if (cableNum <= num2) return 2; |
| | | |
| | | num2 = num1 + Integer.valueOf(attCable[1]) + Integer.valueOf(attCable[2]); |
| | | |
| | | if (cableNum <= num2) return 3; |
| | | |
| | | return 4; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | device.setPort(commonDevice.getPort()); |
| | | device.setOnlineTime(new Date()); |
| | | device.setStatus(Constant.YN_Y); |
| | | |
| | | device.setDeviceSn(commonDevice.getSn()); |
| | | GatewayUtils.add2Cache(device); |
| | | } |
| | | } |
| | |
| | | <Property name="exClassName">toolbar-button-push</Property> |
| | | </ToolBarButton> |
| | | <ToolBarButton> |
| | | <ClientEvent name="onClick">var data = view.get("#dsMain.data:#");
 |
| | | var param = {
 |
| | | deviceId:data.get("deviceId"),
 |
| | | bizType:"testGrain"
 |
| | | }
 |
| | | testDevice(param);</ClientEvent> |
| | | <ClientEvent name="onClick">$confirm("确认测试粮情?",function(){
 |
| | | var data = view.get("#dsMain.data:#");
 |
| | | var param = {
 |
| | | deviceId:data.get("deviceId"),
 |
| | | bizType:"testGrain"
 |
| | | }
 |
| | | testDevice(param);
 |
| | | });
 |
| | | </ClientEvent> |
| | | <Property name="caption">粮情调试</Property> |
| | | <Property name="iconClass">fa fa-wrench</Property> |
| | | <Property name="exClassName">toolbar-button-push</Property> |
| | |
| | | grain.setProperties(properties); |
| | | reqData.setData(JSONObject.toJSONString(grain)); |
| | | |
| | | doPushGrain(reqData); |
| | | doPushGrain(reqData,grain); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | reqData.setData(JSONObject.toJSONString(grain)); |
| | | |
| | | doPushGrain(reqData); |
| | | doPushGrain(reqData,grain); |
| | | } |
| | | |
| | | private void doPushGrain(BaseReqData reqData) { |
| | | private void doPushGrain(BaseReqData reqData,GrainData grainData) { |
| | | |
| | | GatewayDeviceReportService reportService = gatewayRemoteManager.getDeviceReportService(reqData.getDevice().getPushProtocol()); |
| | | if (null == reportService) { |
| | |
| | | return; |
| | | } |
| | | reportService.reportGrainData(reqData); |
| | | reqData.setData(reportService.grainData2GatewayApiInfoKafka(grainData,reqData.getDevice()).getData()); |
| | | reportService.reportGrainDataByKafka(reqData); |
| | | } |
| | | |
| | | |
| | |
| | | GatewayDevice device = reqData.getDevice(); |
| | | |
| | | //获取连接中的设备信息 |
| | | ApiCommonDevice apiCommonDevice = Constant.getCommonDeviceCache(device.getIp()); |
| | | ApiCommonDevice apiCommonDevice = Constant.getCommonDeviceCacheByIp(device.getIp()); |
| | | |
| | | if (null == apiCommonDevice) { |
| | | resp.setCode(500); |
| | |
| | | |
| | | reqData.setData(JSONObject.toJSONString(grain)); |
| | | |
| | | doPushGrain(reqData); |
| | | doPushGrain(reqData,grain); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | reqData.setData(JSONObject.toJSONString(grain)); |
| | | |
| | | doPushGrain(reqData); |
| | | doPushGrain(reqData,grain); |
| | | } |
| | | |
| | | private void doPushGrain(BaseReqData reqData) { |
| | | private void doPushGrain(BaseReqData reqData,GrainData grainData) { |
| | | |
| | | GatewayDeviceReportService reportService = gatewayRemoteManager.getDeviceReportService(reqData.getDevice().getPushProtocol()); |
| | | if (null == reportService) { |
| | |
| | | return; |
| | | } |
| | | reportService.reportGrainData(reqData); |
| | | reqData.setData(reportService.grainData2GatewayApiInfoKafka(grainData,reqData.getDevice()).getData()); |
| | | reportService.reportGrainDataByKafka(reqData); |
| | | } |
| | | |
| | | |
| | |
| | | log.info("---粮情机械封装完成----开始执行推送"); |
| | | |
| | | reqData.setData(JSONObject.toJSONString(grain)); |
| | | doPushGrain(reqData); |
| | | doPushGrain(reqData,grain); |
| | | } |
| | | |
| | | private void doPushGrain(BaseReqData reqData) { |
| | | private void doPushGrain(BaseReqData reqData,GrainData grainData) { |
| | | |
| | | GatewayDeviceReportService reportService = gatewayRemoteManager.getDeviceReportService(reqData.getDevice().getPushProtocol()); |
| | | if (null == reportService) { |
| | |
| | | return; |
| | | } |
| | | reportService.reportGrainData(reqData); |
| | | reqData.setData(reportService.grainData2GatewayApiInfoKafka(grainData,reqData.getDevice()).getData()); |
| | | reportService.reportGrainDataByKafka(reqData); |
| | | } |
| | | |
| | | private void returnMsg(ApiCommonDevice ser) { |
| | |
| | | device.setIp(reMessage.getIp()); |
| | | device.setPort(reMessage.getPort()); |
| | | device.setSn(reMessage.getSn()); |
| | | device.setId(reMessage.getIedId()); |
| | | device.setId(d.getId()); |
| | | device.setOnlineTime(new Date()); |
| | | device.setCode("SUCCESS"); |
| | | Constant.updateCache(device); |
| | |
| | | if (null == apiCommonDevice) { |
| | | resp.setCode(500); |
| | | resp.setMsg("系统未获取到下行连接设备信息,无法执行"); |
| | | log.error("----------------系统未获取到下行连接设备信息,无法执行---------"); |
| | | log.error("----------------系统未获取到下行连接设备信息,无法执行---------"+device.toString()); |
| | | return resp; |
| | | } |
| | | |
| | |
| | | |
| | | reqData.setData(JSONObject.toJSONString(grain)); |
| | | |
| | | doPushGrain(reqData); |
| | | doPushGrain(reqData,grain); |
| | | } |
| | | |
| | | private void doPushGrain(BaseReqData reqData) { |
| | | private void doPushGrain(BaseReqData reqData,GrainData grainData) { |
| | | |
| | | GatewayDeviceReportService reportService = gatewayRemoteManager.getDeviceReportService(reqData.getDevice().getPushProtocol()); |
| | | if (null == reportService) { |
| | | log.error("------------粮情推送失败,系统不存在当前协议执行类----{}", reqData.getDevice().getDeviceName()); |
| | | return; |
| | | } |
| | | |
| | | reportService.reportGrainData(reqData); |
| | | reqData.setData(reportService.grainData2GatewayApiInfoKafka(grainData,reqData.getDevice()).getData()); |
| | | reportService.reportGrainDataByKafka(reqData); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.fzzy.api.utils.BytesUtil; |
| | | import com.fzzy.api.utils.SpringUtil; |
| | | import com.fzzy.protocol.youxian0.analysis.AnalysisService; |
| | | import com.fzzy.protocol.youxian0.client.ClientEngine; |
| | | import com.fzzy.protocol.wujia.analysis.AnalysisService; |
| | | import io.netty.channel.ChannelHandlerContext; |
| | | import io.netty.channel.SimpleChannelInboundHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | |
| | | private AnalysisService analysisService; |
| | | |
| | | private static String msgStr = ""; |
| | | @Override |
| | | public void channelActive(ChannelHandlerContext ctx) { |
| | | InetSocketAddress socketAddress = (InetSocketAddress) ctx.channel() |
| | |
| | | InetSocketAddress socketAddress = (InetSocketAddress) ctx.channel().remoteAddress(); |
| | | |
| | | log.info("连接终端掉线,IP={},port={}", socketAddress.getAddress(), socketAddress.getPort()); |
| | | ClientEngine.defaultChannel = null; |
| | | //ClientEngine.defaultChannel = null; |
| | | |
| | | } |
| | | |
| | |
| | | String strMsg = BytesUtil.bytesToString(bytes); |
| | | |
| | | log.info("终端返回信息,IP={},port={},msg={}", socketAddress.getAddress(), socketAddress.getPort(), strMsg); |
| | | msgStr+= strMsg; |
| | | |
| | | if (null == analysisService) { |
| | | analysisService = SpringUtil.getBean(AnalysisService.class); |
| | | if(msgStr.endsWith("AABBCC")){ |
| | | |
| | | log.info("消息接收完整开始解析,IP={},port={},msg={}", socketAddress.getAddress(), socketAddress.getPort(), msgStr); |
| | | |
| | | if (null == analysisService) { |
| | | analysisService = SpringUtil.getBean(AnalysisService.class); |
| | | } |
| | | try{ |
| | | analysisService.analysis(socketAddress.getAddress(), socketAddress.getPort(), msgStr); |
| | | }catch (Exception e){ |
| | | log.error(e.getMessage(),e); |
| | | } |
| | | msgStr = ""; |
| | | }else{ |
| | | log.info("消息不完整,等待消息完整,IP={},port={},msg={}", socketAddress.getAddress(), socketAddress.getPort(), strMsg); |
| | | |
| | | } |
| | | |
| | | try{ |
| | | analysisService.analysis(socketAddress.getAddress(), socketAddress.getPort(), strMsg); |
| | | }catch (Exception e){ |
| | | log.error(e.getMessage(),e); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | static { |
| | | depotGrainCmdMap.put("KEY_1", "FC0101010314030100BDDB"); |
| | | depotGrainCmdMap.put("KEY_2", "FC0102040318030200BDDB"); |
| | | depotGrainCmdMap.put("KEY_3", "FC0203010318040100BDDB"); |
| | | depotGrainCmdMap.put("KEY_4", "FC0304010318040100BDDB"); |
| | | depotGrainCmdMap.put("KEY_5", "FC0305040318040200BDDB"); |
| | | depotGrainCmdMap.put("KEY_6", "FC0406010210030100BDDB"); |
| | | depotGrainCmdMap.put("KEY_7", "FC0407030314030200BDDB"); |
| | | depotGrainCmdMap.put("KEY_8", "FC0408060314030300BDDB"); |
| | | depotGrainCmdMap.put("KEY_9", "FC050901042A040100BDDB"); |
| | | depotGrainCmdMap.put("KEY_10", "FC050A010324040100BDDB"); |
| | | depotGrainCmdMap.put("KEY_11", "FC060B04042A040200BDDB"); |
| | | depotGrainCmdMap.put("KEY_1", "FC01010103140301EBBDDB"); |
| | | depotGrainCmdMap.put("KEY_2", "FC01020403180302EBBDDB"); |
| | | depotGrainCmdMap.put("KEY_3", "FC02030103180401EBBDDB"); |
| | | depotGrainCmdMap.put("KEY_4", "FC03040103180401EBBDDB"); |
| | | depotGrainCmdMap.put("KEY_5", "FC03050403180402EBBDDB"); |
| | | depotGrainCmdMap.put("KEY_6", "FC04060102100301EBBDDB"); |
| | | depotGrainCmdMap.put("KEY_7", "FC04070303140302EBBDDB"); |
| | | depotGrainCmdMap.put("KEY_8", "FC04080603140303EBBDDB"); |
| | | depotGrainCmdMap.put("KEY_9", "FC050901042A0401EBBDDB"); |
| | | depotGrainCmdMap.put("KEY_10", "FC050A0103240401EBBDDB"); |
| | | depotGrainCmdMap.put("KEY_11", "FC060B04042A0402EBBDDB"); |
| | | } |
| | | |
| | | /** |
| | | * FC 64 01 01 00 09 01 1A 10 BD DB |
| | | * FC 01 01 01 03 14 03 01 EB BD DB |
| | | * |
| | | * 1仓: FC 01 01 01 03 14 03 01 00 BD DB |
| | | * 2仓: FC 01 02 04 03 18 03 02 00 BD DB |
| | | * 3仓: FC 02 03 01 03 18 04 01 00 BD DB |
| | |
| | | |
| | | reqData.setData(JSONObject.toJSONString(grain)); |
| | | |
| | | doPushGrain(reqData); |
| | | doPushGrain(reqData,grain); |
| | | } |
| | | |
| | | private void doPushGrain(BaseReqData reqData) { |
| | | private void doPushGrain(BaseReqData reqData,GrainData grainData) { |
| | | |
| | | GatewayDeviceReportService reportService = gatewayRemoteManager.getDeviceReportService(reqData.getDevice().getPushProtocol()); |
| | | if (null == reportService) { |
| | | log.error("------------粮情推送失败,系统不存在当前协议执行类----{}", reqData.getDevice().getDeviceName()); |
| | | return; |
| | | } |
| | | |
| | | reportService.reportGrainData(reqData); |
| | | reqData.setData(reportService.grainData2GatewayApiInfoKafka(grainData,reqData.getDevice()).getData()); |
| | | reportService.reportGrainDataByKafka(reqData); |
| | | } |
| | | } |
| | |
| | | |
| | | reqData.setData(JSONObject.toJSONString(grain)); |
| | | |
| | | doPushGrain(reqData); |
| | | doPushGrain(reqData,grain); |
| | | } |
| | | |
| | | private void doPushGrain(BaseReqData reqData) { |
| | | private void doPushGrain(BaseReqData reqData,GrainData grainData) { |
| | | |
| | | GatewayDeviceReportService reportService = gatewayRemoteManager.getDeviceReportService(reqData.getDevice().getPushProtocol()); |
| | | if (null == reportService) { |
| | | log.error("------------粮情推送失败,系统不存在当前协议执行类----{}", reqData.getDevice().getDeviceName()); |
| | | return; |
| | | } |
| | | |
| | | reportService.reportGrainData(reqData); |
| | | reqData.setData(reportService.grainData2GatewayApiInfoKafka(grainData,reqData.getDevice()).getData()); |
| | | reportService.reportGrainDataByKafka(reqData); |
| | | } |
| | | |
| | | private synchronized void add2GrainMap(GrainRoot grainRoot) { |
| | |
| | | |
| | | reqData.setData(JSONObject.toJSONString(grain)); |
| | | |
| | | doPushGrain(reqData); |
| | | doPushGrain(reqData,grain); |
| | | } |
| | | |
| | | |
| | | private void doPushGrain(BaseReqData reqData) { |
| | | private void doPushGrain(BaseReqData reqData,GrainData grainData) { |
| | | |
| | | GatewayDeviceReportService reportService = gatewayRemoteManager.getDeviceReportService(reqData.getDevice().getPushProtocol()); |
| | | if (null == reportService) { |
| | | log.error("------------粮情推送失败,系统不存在当前协议执行类----{}", reqData.getDevice().getDeviceName()); |
| | | return; |
| | | } |
| | | |
| | | reportService.reportGrainData(reqData); |
| | | reqData.setData(reportService.grainData2GatewayApiInfoKafka(grainData,reqData.getDevice()).getData()); |
| | | reportService.reportGrainDataByKafka(reqData); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | reqData.setData(JSONObject.toJSONString(grain)); |
| | | |
| | | doPushGrain(reqData); |
| | | doPushGrain(reqData,grain); |
| | | } |
| | | |
| | | private void doPushGrain(BaseReqData reqData) { |
| | | private void doPushGrain(BaseReqData reqData,GrainData grainData) { |
| | | |
| | | GatewayDeviceReportService reportService = gatewayRemoteManager.getDeviceReportService(reqData.getDevice().getPushProtocol()); |
| | | if (null == reportService) { |
| | |
| | | return; |
| | | } |
| | | reportService.reportGrainData(reqData); |
| | | reqData.setData(reportService.grainData2GatewayApiInfoKafka(grainData,reqData.getDevice()).getData()); |
| | | reportService.reportGrainDataByKafka(reqData); |
| | | } |
| | | |
| | | |