| | |
| | | import com.fzzy.api.utils.BytesUtil; |
| | | import com.fzzy.api.utils.SpringUtil; |
| | | import com.fzzy.gateway.GatewayUtils; |
| | | import com.fzzy.gateway.api.DeviceReportService; |
| | | import com.fzzy.gateway.api.GatewayRemoteManager; |
| | | import com.fzzy.gateway.data.BaseReqData; |
| | | import com.fzzy.gateway.entity.GatewayDevice; |
| | | import com.fzzy.gateway.hx2023.service.HxGatewaySyncWeightImpl1; |
| | | import com.ld.io.api.IoMsgConsumer; |
| | | import com.ld.io.api.IoSession; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | |
| | | private long timeTag = 0; |
| | | |
| | | private GatewayRemoteManager reportService; |
| | | private GatewayRemoteManager gatewayRemoteManager; |
| | | |
| | | @Override |
| | | public void consume(IoSession session, byte[] bytes) { |
| | |
| | | timeTag = System.currentTimeMillis(); |
| | | |
| | | String temp = strMsg.substring(2, 4); |
| | | String symbol = HexASCIIToConvert(temp); |
| | | //String symbol = HexASCIIToConvert(temp); |
| | | temp = strMsg.substring(4, 16); |
| | | String w = HexASCIIToConvert(temp); |
| | | temp = strMsg.substring(16, 18); |
| | |
| | | } |
| | | |
| | | //直接调用实现类,更多实现类单独调用 |
| | | if (null == reportService) { |
| | | reportService = SpringUtil.getBean(GatewayRemoteManager.class); |
| | | if (null == gatewayRemoteManager) { |
| | | gatewayRemoteManager = SpringUtil.getBean(GatewayRemoteManager.class); |
| | | } |
| | | |
| | | reportService.getDeviceReportService(device.getProvinceProtocol()).report2GatewayBySn(weigh, device); |
| | | //数据封装推送 |
| | | BaseReqData reqData = new BaseReqData(); |
| | | reqData.setDevice(device); |
| | | reqData.setDeviceId(device.getDeviceId()); |
| | | reqData.setProductId(device.getProductId()); |
| | | reqData.setDeviceName(device.getDeviceName()); |
| | | reqData.setWeight(weigh); |
| | | gatewayRemoteManager.getDeviceReportService(device.getPushProtocol()).reportWeightData(reqData); |
| | | } |
| | | |
| | | /** |