From 178c71496d5508dae69110f4d988cf128723d740 Mon Sep 17 00:00:00 2001 From: CZT <czt18638530771@163.com> Date: 星期三, 30 八月 2023 14:58:41 +0800 Subject: [PATCH] 配置Modbus协议:增加能耗信息 --- igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/command/AnalysisService.java | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/command/AnalysisService.java b/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/command/AnalysisService.java index 59b1fbf..be6703b 100644 --- a/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/command/AnalysisService.java +++ b/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/command/AnalysisService.java @@ -2,9 +2,12 @@ import com.ld.igds.common.CoreDeviceService; import com.ld.igds.constant.BizType; +import com.ld.igds.es.dto.EsData; +import com.ld.igds.es.service.CoreEsService; import com.ld.igds.gas.CoreGasService; import com.ld.igds.io.constant.OrderRespEnum; import com.ld.igds.io.notify.NotifyWebInvoker; +import com.ld.igds.io.request.BaseRequest; import com.ld.igds.io.request.CheckGasRequest; import com.ld.igds.io.request.DeviceControlRequest; import com.ld.igds.models.Gas; @@ -35,6 +38,8 @@ private NotifyWebInvoker notifyInvoker; @Autowired private CoreGasService gasService; + @Autowired + private CoreEsService esService; /** @@ -156,4 +161,33 @@ notifyInvoker.notifyWeb(gas.getCompanyId(), OrderRespEnum.MSG_SUCCESS, BizType.GAS, request.getDepotId() + " 姘斾綋妫�娴嬶細缁撴灉杩斿洖鎴愬姛."); log.info("鎺у埗鏌�----->>>骞冲彴锛氭皵浣撹В鏋愬畬鎴�-浠撳簱={}", request.getDepotId()); } + + /** + * 瑙f瀽鑳借�楁暟鎹� + * + * @param request + * @param result + */ + public void analysisEs(BaseRequest request, Number result) { + + log.debug("----------寮�濮嬫墽琛岃兘鑰楃粨鏋滆В鏋�----{}", request.getDepotId()); + + + //鏈夊姛鐢佃兘鍒ゆ柇鏄惁杩斿洖鏈夋晥鏁版嵁 + if (null == result) { + log.error("---鑳借�楁暟鎹繑鍥炴暟鎹笉瀹屾暣锛屽仠姝㈣В鏋�----{}", result.toString()); + return; + } + + EsData esData = new EsData(); + esData.setCompanyId(request.getCompanyId()); + esData.setDepotId(request.getDepotId()); + esData.setUpdateTime(new Date()); + + esData.setEp(result.doubleValue()); + esData.setEs(result.doubleValue()); + + log.info("Modbus鐢佃〃----->>>骞冲彴锛氳兘鑰楁暟鎹В鏋愬畬鎴�-浠撳簱={}", esData.getDepotId()); + esService.saveAndUpdateInc(esData); + } } -- Gitblit v1.9.3