From eb90271ed12a538a190a55b0e594740a6e729386 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期二, 09 七月 2024 09:58:43 +0800
Subject: [PATCH] 1、上行数据处理任务中,过滤掉心跳数据处理,以加快处理速度。

---
 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java |   33 ++++++++++++++++++++++++++-------
 1 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java
index f5825b3..7a7f9c4 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java
@@ -26,6 +26,7 @@
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.RandomStringUtils;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.MediaType;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.BindingResult;
@@ -51,7 +52,9 @@
     private final CommandSv commandSv;
     private final SeVirtualCardMapper seVirtualCardMapper;
     private final IDLongGenerator idLongGenerator;
-    private String rtuResultSendWebUrl = "http://127.0.0.1:8087/wx/comRes/receive";
+
+    @Value("${mw.rtuCallbackUrl_wx}")
+    private String rtuCallbackUrl_wx;
 
     /**
      * 灏忕▼搴忚繙绋嬪紑闃�
@@ -67,9 +70,23 @@
         }
 
         Long intakeId = valve.getIntakeId();
+        String intakeName = valve.getIntakeName();
         Long vcId = valve.getVcId();
+        Boolean forceOpen = valve.getForceOpen();
         Long operator = valve.getOperator();
         Long comId = idLongGenerator.generate();
+
+        if(intakeId == null && intakeName == null) {
+            return BaseResponseUtils.buildErrorMsg(WechatResultCode.PLEASE_SELECT_A_INTAKE.getMessage());
+        }
+
+        // intakeName鎹ntakeId
+        if(intakeId == null) {
+            intakeId = commandSv.getIntakeIdByName(intakeName);
+            if(intakeId == null) {
+                return BaseResponseUtils.buildErrorMsg(WechatResultCode.PLEASE_SELECT_A_INTAKE.getMessage());
+            }
+        }
 
         /**
          * 濡傛灉鍐滄埛閫夋嫨浜嗚櫄鎷熷崱锛屽垯浣跨敤璇ヨ櫄鎷熷崱
@@ -93,7 +110,9 @@
         if (vc == null) {
             return BaseResponseUtils.buildErrorMsg(WechatResultCode.PLEASE_SELECT_A_VC.getMessage());
         }
-        if (vc.getInUse() == 1) {
+
+        // 铏氭嫙鍗$姸鎬佷负浣跨敤涓紝涓斾笉鏄己鍒跺紑闃�鏃舵彁绀�
+        if (vc.getInUse() == 1 && !forceOpen) {
             return BaseResponseUtils.buildErrorMsg(WechatResultCode.IN_USE_VC_CANNOT_OPEN_VALVE.getMessage());
         }
 
@@ -142,7 +161,7 @@
             myParam.setProtocol(protocol);
             myParam.setVcId(vcId);
             myParam.setParam(param);
-            myParam.setRtuResultSendWebUrl(rtuResultSendWebUrl);
+            myParam.setRtuResultSendWebUrl(rtuCallbackUrl_wx);
             myParam.setOperator(operator);
             return dealWithCommandResult(myParam);
 
@@ -172,7 +191,7 @@
             myParam.setProtocol(protocol);
             myParam.setVcId(vcId);
             myParam.setParam(param);
-            myParam.setRtuResultSendWebUrl(rtuResultSendWebUrl);
+            myParam.setRtuResultSendWebUrl(rtuCallbackUrl_wx);
             myParam.setOperator(operator);
             return dealWithCommandResult(myParam);
         } else {
@@ -241,7 +260,7 @@
             myParam.setProtocol(protocol);
             myParam.setVcId(vcId);
             myParam.setParam(param);
-            myParam.setRtuResultSendWebUrl(rtuResultSendWebUrl);
+            myParam.setRtuResultSendWebUrl(rtuCallbackUrl_wx);
             myParam.setOperator(operator);
             return dealWithCommandResult(myParam);
         } else if (protocol.equals("p206V1_0_1")) {
@@ -268,7 +287,7 @@
             myParam.setProtocol(protocol);
             myParam.setVcId(vcId);
             myParam.setParam(param);
-            myParam.setRtuResultSendWebUrl(rtuResultSendWebUrl);
+            myParam.setRtuResultSendWebUrl(rtuCallbackUrl_wx);
             myParam.setOperator(operator);
             return dealWithCommandResult(myParam);
         } else {
@@ -363,7 +382,7 @@
             myParam.setRtuAddr(rtuAddr);
             myParam.setProtocol(protocol);
             myParam.setParam(param);
-            myParam.setRtuResultSendWebUrl(rtuResultSendWebUrl);
+            myParam.setRtuResultSendWebUrl(rtuCallbackUrl_wx);
             myParam.setOperator(operator);
             return dealWithCommandResult(myParam);
         } else if(protocol.equals("p206V1_0_1")) {

--
Gitblit v1.8.0