From 0e877574ab499260677ab81c2c0298eb25fe4fd0 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期一, 13 五月 2024 16:19:23 +0800
Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV

---
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeControllerMapper.xml                                          |   22 +++
 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/IntakeControllerSv.java     |   36 ++++++
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerTrampMapper.xml                                           |   43 ++++++
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeControllerMapper.java                           |    7 +
 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/IntakeControllerCtrl.java   |  156 ++++++++++++++++++++------
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrControllerTramp.java                                 |    2 
 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/TrampControllerQueryVo.java |   34 +++++
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml                                                |    2 
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml                                                    |    4 
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrControllerTrampMapper.java                            |   14 ++
 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java                 |   15 ++
 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/DtoIntakeController.java    |    6 
 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/result/ProjectResultCode.java                |    7 +
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoIntake.java                                            |   10 +
 14 files changed, 311 insertions(+), 47 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrControllerTrampMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrControllerTrampMapper.java
index 4d1b995..27cb1d3 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrControllerTrampMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrControllerTrampMapper.java
@@ -6,6 +6,7 @@
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Author liurunyu
@@ -77,4 +78,17 @@
      * @return
      */
     PrControllerTramp getTrampControllerInfo(@Param("controllerId") Long controllerId);
+
+    /**
+     * 鏉′欢鏌ヨ娴佹氮鎺у埗鍣ㄤ俊鎭�
+     * @param
+     * @return
+     */
+    List<PrControllerTramp> getTrampControllers(Map<?, ?> params);
+    /**
+     * 鏉′欢鏌ヨ娴佹氮鎺у埗鍣ㄦ暟閲�
+     * @param
+     * @return  recordCount
+     */
+    Long getTrampControllersCount(Map<?, ?> params);
 }
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeControllerMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeControllerMapper.java
index bf71fdc..09e26e5 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeControllerMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeControllerMapper.java
@@ -52,4 +52,11 @@
      * @return 鍙栨按鍙d笌鎺у埗鍣ㄧ粦瀹氬垪琛�
      */
     List<Map<String, Object>> getBindsByControllerId(@Param("controllerId") Long controllerId);
+
+    /**
+     * 淇敼缁戝畾璁板綍閫氳繃鍙栨按鍙�
+     * @param record
+     * @return
+     */
+    int updateByIntakeSelective(PrIntakeController record);
 }
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrControllerTramp.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrControllerTramp.java
index 02e942e..b133303 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrControllerTramp.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrControllerTramp.java
@@ -61,7 +61,7 @@
      * 鍙戠幇鏃堕棿
      */
     @Schema(description = "鍙戠幇鏃堕棿", requiredMode = Schema.RequiredMode.REQUIRED)
-    @NotNull(message = "鍙戠幇鏃堕棿涓嶈兘涓虹┖")
+//    @NotNull(message = "鍙戠幇鏃堕棿涓嶈兘涓虹┖")
     public Date findDt;//鍙戠幇鏃堕棿锛� yyyy-mm-dd HH:MM:SS锛�
 
 }
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoIntake.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoIntake.java
index d6d1963..c8b7ece 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoIntake.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoIntake.java
@@ -88,4 +88,14 @@
     @ExcelProperty("澶囨敞")
     @ColumnWidth(250)
     private String remarks;
+
+    @Schema(title = "鎺у埗鍣↖D")
+    @ExcelProperty("鎺у埗鍣↖D")
+    @ColumnWidth(15)
+    private String controllerId;
+
+    @Schema(title = "鎺у埗鍣ㄥ湴鍧�")
+    @ExcelProperty("鎺у埗鍣ㄥ湴鍧�")
+    @ColumnWidth(15)
+    private String rtuAddr;
 }
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml
index d9edbe5..1c5ffbd 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml
@@ -247,7 +247,7 @@
     SELECT COUNT(*) AS recordCount FROM pr_controller WHERE deleted = 0 AND id = ${controllerId}
   </select>
 
-  <!--鏍规嵁鎺у埗鍣ㄧ紪鍙疯幏鍙栧凡缁戝畾璁板綍鏁�-->
+  <!--鏍规嵁娴佹氮鎺у埗鍣ㄧ紪鍙疯幏鍙栧凡缁戝畾璁板綍鏁�-->
   <select id="getBindedCount" resultType="java.lang.Integer">
     SELECT COUNT(*) AS recordCount FROM pr_controller WHERE rtuAddr = (SELECT rtuAddr FROM pr_controller_tramp WHERE id = ${controllerId}) AND intakeId IS NOT NULL
   </select>
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerTrampMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerTrampMapper.xml
index 3753a1b..877c01d 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerTrampMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerTrampMapper.xml
@@ -15,7 +15,7 @@
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
     <!--@mbg.generated-->
-    select 
+    select
     <include refid="Base_Column_List" />
     from pr_controller_tramp
     where id = #{id,jdbcType=BIGINT}
@@ -36,7 +36,7 @@
   </delete>
   <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoPr.PrControllerTramp">
     <!--@mbg.generated-->
-    insert into pr_controller_tramp (id, rtuAddr, protocol, 
+    insert into pr_controller_tramp (id, rtuAddr, protocol,
       findDt)
     values (#{id,jdbcType=BIGINT}, #{rtuAddr,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR},
       #{findDt,jdbcType=TIMESTAMP})
@@ -107,4 +107,43 @@
   <select id="getTrampControllerInfo" resultMap="BaseResultMap">
     SELECT rtuAddr, protocol, findDt FROM pr_controller_tramp WHERE id = ${controllerId}
   </select>
+
+    <!--    鏍规嵁鏉′欢鑾峰彇娴佹氮鎺у埗鍣ㄤ俊鎭�-->
+    <select id="getTrampControllers" resultMap="BaseResultMap">
+        select CAST(id AS char)AS id,
+        rtuAddr,
+        protocol,
+        findDt
+        FROM pr_controller_tramp
+        <where>
+            <if test="id != null and id !=''">
+                id = #{id,jdbcType=VARCHAR}
+            </if>
+            <if test="rtuAddr != null and rtuAddr != ''">
+                AND   rtuAddr = #{rtuAddr,jdbcType=VARCHAR}
+            </if>
+            <if test="protocol != null and protocol != ''">
+                AND  protocol = #{protocol,jdbcType=VARCHAR}
+            </if>
+
+        </where>
+    </select>
+    <!--    鏍规嵁鏉′欢鑾峰彇娴佹氮鎺у埗鍣ㄦ暟閲�-->
+    <select id="getTrampControllersCount" resultType="java.lang.Long">
+        select
+        COUNT(*) AS recordCount
+        FROM pr_controller_tramp
+        <where>
+            <if test="id != null and id !=''">
+                  id = #{id,jdbcType=VARCHAR}
+            </if>
+            <if test="rtuAddr != null and rtuAddr != ''">
+                AND   rtuAddr = #{rtuAddr,jdbcType=VARCHAR}
+            </if>
+            <if test="protocol != null and protocol != ''">
+                AND  protocol = #{protocol,jdbcType=VARCHAR}
+            </if>
+
+        </where>
+    </select>
 </mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeControllerMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeControllerMapper.xml
index 9e87a44..96d940c 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeControllerMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeControllerMapper.xml
@@ -186,4 +186,26 @@
     </if>
     ORDER BY ic.operateDt DESC
   </select>
+  <!--鏍规嵁鍙栨按鍙g紪鍙蜂慨鏀圭粦瀹氳褰曞垪琛�-->
+  <update id="updateByIntakeSelective">
+    update pr_intake_controller
+    <set>
+      <if test="controllerid != null">
+        controllerId = #{controllerid,jdbcType=BIGINT},
+      </if>
+      <if test="operatetype != null">
+        operateType = #{operatetype,jdbcType=TINYINT},
+      </if>
+      <if test="remarks != null">
+        remarks = #{remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="operator != null">
+        `operator` = #{operator,jdbcType=BIGINT},
+      </if>
+      <if test="operatedt != null">
+        operateDt = #{operatedt,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where intakeId = #{intakeid,jdbcType=BIGINT}
+  </update>
 </mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
index 720841c..5a25cea 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
@@ -219,6 +219,7 @@
     LEFT JOIN ba_district country ON ge.countyId = country.id
     LEFT JOIN ba_district town ON ge.townId = town.id
     LEFT JOIN ba_district village ON ge.villageId = village.id
+    LEFT JOIN pr_controller cont ON ge.id = cont.intakeId
     <where>
       ge.deleted = 0
       AND divi.deleted = 0
@@ -259,6 +260,8 @@
     divi.`name`                                         AS divideName,
     CAST(blo.id AS char)                                AS blockId,
     blo.`name`                                          AS blockName,
+    CAST(cont.id AS char)                               AS controllerId,
+    cont.rtuAddr                                        AS rtuAddr,
     ge.lng,
     ge.lat,
     ge.remarks,
@@ -275,6 +278,7 @@
     LEFT JOIN ba_district country ON ge.countyId = country.id
     LEFT JOIN ba_district town ON ge.townId = town.id
     LEFT JOIN ba_district village ON ge.villageId = village.id
+    LEFT JOIN pr_controller cont ON ge.id = cont.intakeId
     <where>
       ge.deleted = 0
       AND divi.deleted = 0
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java
index e0d70d1..090d07f 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java
@@ -4,6 +4,8 @@
 import com.alibaba.fastjson2.JSONArray;
 import com.alibaba.fastjson2.JSONObject;
 import com.dy.common.mw.protocol.Command;
+import com.dy.common.webUtil.BaseResponse;
+import com.dy.common.webUtil.BaseResponseUtils;
 import com.dy.common.webUtil.QueryResultVo;
 import com.dy.pipIrrGlobal.daoPr.PrControllerMapper;
 import com.dy.pipIrrGlobal.daoPr.PrIntakeControllerMapper;
@@ -11,6 +13,7 @@
 import com.dy.pipIrrGlobal.pojoPr.PrController;
 import com.dy.pipIrrGlobal.pojoPr.PrIntakeController;
 import com.dy.pipIrrGlobal.voPr.VoController;
+import com.dy.pipIrrProject.result.ProjectResultCode;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.common.utils.PojoUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -80,7 +83,10 @@
      * @return
      */
     public Integer addController(PrController po) {
-        prControllerMapper.insert(po);
+        int rows = prControllerMapper.insert(po);
+        if(rows == 0) {
+            return 0;
+        }
         PrIntakeController addPrIntakeController = new PrIntakeController();
         addPrIntakeController.setIntakeid(po.getIntakeId());
         addPrIntakeController.setControllerid(po.getId());
@@ -88,8 +94,11 @@
         addPrIntakeController.setOperator(po.getOperator());
         addPrIntakeController.setOperatedt(po.getOperateDt());
         addPrIntakeController.setRemarks("缁戝畾");
-        prIntakeControllerMapper.insert(addPrIntakeController);
-        return 1;
+        int rec = prIntakeControllerMapper.insert(addPrIntakeController);
+        if(rec == 0) {
+            return 0;
+        }
+        return 1 ;
     }
 
     /**
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/DtoIntakeController.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/DtoIntakeController.java
index 05e545b..c49197c 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/DtoIntakeController.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/DtoIntakeController.java
@@ -26,10 +26,10 @@
     private Long intakeId;
 
     /**
-     * 鎺у埗鍣↖D
+     * 锛堟祦娴級鎺у埗鍣↖D
      */
-    @Schema(description = "鎺у埗鍣↖D", requiredMode = Schema.RequiredMode.REQUIRED)
-    @NotNull(message = "鎺у埗鍣↖D涓嶈兘涓虹┖")
+    @Schema(description = "缁戝畾鏃朵负娴佹氮鎺у埗鍣↖D/瑙g粦鏃朵负鎺у埗鍣↖D", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotNull(message = "锛堟祦娴級鎺у埗鍣↖D涓嶈兘涓虹┖")
     private Long controllerId;
 
     /**
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/IntakeControllerCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/IntakeControllerCtrl.java
index 5311d90..252376c 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/IntakeControllerCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/IntakeControllerCtrl.java
@@ -1,5 +1,7 @@
 package com.dy.pipIrrProject.intakeController;
 
+
+import cn.hutool.core.date.DateTime;
 import com.dy.common.aop.SsoAop;
 import com.dy.common.webUtil.BaseResponse;
 import com.dy.common.webUtil.BaseResponseUtils;
@@ -40,7 +42,7 @@
 @Slf4j
 @Tag(name = "鍙栨按鍙�/鎺у埗鍣ㄥ叧鑱旂鐞�", description = "鍙栨按鍙�/鎺у埗鍣ㄥ叧鑱旀搷浣�")
 @RestController
-@RequestMapping(path="intake_controller")
+@RequestMapping(path = "intake_controller")
 @RequiredArgsConstructor
 public class IntakeControllerCtrl {
     private final IntakeControllerSv intakeControllerSv;
@@ -51,9 +53,10 @@
      * 鍙栨按鍙g粦瀹氭帶鍒跺櫒
      * 1. 鎺ユ敹鍙栨按鍙D鍙婃祦娴帶鍒跺櫒ID锛屽苟楠岃瘉鍙栨按鍙e拰鎺у埗鍣ㄦ槸鍚﹀瓨鍦�
      * 2. 鍒ゆ柇璇ユ帶鍒跺櫒鏄惁瀛樺湪鏈В缁戣褰曪紝濡傛灉瀛樺湪鎻愮ず鐢ㄦ埛璇ユ帶鍒跺櫒瀛樺湪鏈В缁戣褰�
-     * 3. 缁勮鎺у埗鍣ㄥ璞℃彃鍏ユ帶鍒跺櫒琛ㄤ腑
-     * 4. 娣诲姞缁戝畾璁板綍
+     * 3. 缁勮鎺у埗鍣ㄥ璞℃彃鍏ユ帶鍒跺櫒琛ㄤ腑锛堝強娣诲姞缁戝畾璁板綍锛�
+     * 4. 淇敼缁戝畾璁板綍璁剧疆澶囨敞
      * 5. 鍒犻櫎娴佹氮鎺у埗鍣紙鐗╃悊鍒犻櫎锛�
+     *
      * @param po
      * @param bindingResult
      * @return
@@ -72,26 +75,26 @@
     @SsoAop()
     public BaseResponse<Boolean> bind(@RequestBody @Valid DtoIntakeController po, BindingResult bindingResult) throws ParseException {
         SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        if(bindingResult != null && bindingResult.hasErrors()){
+        if (bindingResult != null && bindingResult.hasErrors()) {
             return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
         }
         // 鎺ユ敹鍙傛暟
         Long intakeId = po.getIntakeId();
-        Long controllerId = po.getControllerId();
+        Long trampControllerId = po.getControllerId();
         String remarks = po.getRemarks();
         Long operator = po.getOperator();
 
         // 鏍规嵁缂栧彿鍒嗗埆鑾峰彇鍙栨按鍙h褰曟暟銆佹祦娴帶鍒跺櫒淇℃伅锛屽垽鏂彇姘村彛鍙婃帶鍒跺櫒鏄惁瀛樺湪
         Integer recIntke = Optional.ofNullable(intakeSv.getRecordCountOfIntake(intakeId)).orElse(0);
-        PrControllerTramp prControllerTramp = intakeControllerSv.getTrampControllerInfo(controllerId);
+        PrControllerTramp prControllerTramp = intakeControllerSv.getTrampControllerInfo(trampControllerId);
         //Map map_TrampController = Optional.ofNullable(intakeControllerSv.getTrampControllerInfo(controllerId)).orElse(new HashMap());
-        if(recIntke == 0 || prControllerTramp == null) {
+        if (recIntke == 0 || prControllerTramp == null) {
             return BaseResponseUtils.buildFail(ProjectResultCode.INTAKE_OR_CONTROLLER_NO_EXIST.getMessage());
         }
 
         // 鏍规嵁鎺у埗鍣ㄧ紪鍙峰垽鏂鎺у埗鍣ㄦ槸鍚﹀瓨鍦ㄦ湭瑙g粦璁板綍
-        Integer recBinded = Optional.ofNullable(controllerSv.getBindedCount(controllerId)).orElse(0);
-        if(recBinded > 0) {
+        Integer recBinded = Optional.ofNullable(controllerSv.getBindedCount(trampControllerId)).orElse(0);
+        if (recBinded > 0) {
             return BaseResponseUtils.buildFail(ProjectResultCode.CONTROLLER_BINDED.getMessage());
         }
 
@@ -101,29 +104,31 @@
         prController.setRtuAddr(prControllerTramp.getRtuAddr());
         prController.setProtocol(prControllerTramp.getProtocol());
         prController.setFindDt(prControllerTramp.getFindDt());
-        prController.setAddWays((byte)1);
+        prController.setAddWays((byte) 1);
         prController.setOperator(operator);
         Date operateTime = new Date();
         prController.setOperateDt(operateTime);
-        prController.setDeleted((byte)0);
+        prController.setDeleted((byte) 0);
         Integer rec_addController = Optional.ofNullable(controllerSv.addController(prController)).orElse(0);
-        if(rec_addController == 0) {
+        if (rec_addController == 0) {
             return BaseResponseUtils.buildFail(ProjectResultCode.BIND_FAIL.getMessage());
         }
 
-        // 娣诲姞缁戝畾璁板綍
-        PrIntakeController prIntakeController = DtoToPojo.INSTANCT.po2vo(po);
-        prIntakeController.setOperatedt(operateTime);
-        prIntakeController.setOperatetype((byte)1);
-        Integer rec = Optional.ofNullable(intakeControllerSv.addRecord(prIntakeController)).orElse(0);
-        if(rec == 0) {
+
+        // 淇敼缁戝畾璁板綍
+        PrIntakeController prIntakeController = new PrIntakeController();
+        prIntakeController.setRemarks(remarks);
+        prIntakeController.setIntakeid(intakeId);
+
+        Integer rec = Optional.ofNullable(intakeControllerSv.updateBindRecord(prIntakeController)).orElse(0);
+        if (rec == 0) {
             return BaseResponseUtils.buildFail(ProjectResultCode.BIND_FAIL.getMessage());
         }
 
         // 鏍规嵁娴佹氮鎺у埗鍣ㄧ紪鍙峰垹闄ゆ祦娴帶鍒跺櫒璁板綍
-        intakeControllerSv.deleteTrampController(controllerId);
+        intakeControllerSv.deleteTrampController(trampControllerId);
 
-        return BaseResponseUtils.buildSuccess(true) ;
+        return BaseResponseUtils.buildSuccess(true);
     }
 
     /**
@@ -131,6 +136,7 @@
      * 1. 鎺ユ敹鍙栨按鍙D鍙婃祦娴帶鍒跺櫒ID锛屽苟楠岃瘉鍙栨按鍙e拰鎺у埗鍣ㄦ槸鍚﹀瓨鍦�
      * 2. 娣诲姞瑙g粦璁板綍
      * 3. 鍒犻櫎鎺у埗鍣ㄥ閿�
+     *
      * @param po
      * @param bindingResult
      * @return
@@ -147,15 +153,15 @@
     @PostMapping(path = "unbind", consumes = MediaType.APPLICATION_JSON_VALUE)
     @Transactional(rollbackFor = Exception.class)
     @SsoAop()
-    public BaseResponse<Boolean> unbind(@RequestBody @Valid DtoIntakeController po, BindingResult bindingResult){
-        if(bindingResult != null && bindingResult.hasErrors()){
+    public BaseResponse<Boolean> unbind(@RequestBody @Valid DtoIntakeController po, BindingResult bindingResult) {
+        if (bindingResult != null && bindingResult.hasErrors()) {
             return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
         }
 
         // 鏍规嵁缂栧彿鍒嗗埆鑾峰彇鍙栨按鍙c�佹帶鍒跺櫒鏈垹闄よ褰曟暟
         Integer recIntke = Optional.ofNullable(intakeSv.getRecordCountOfIntake(po.getIntakeId())).orElse(0);
         Integer recController = Optional.ofNullable(controllerSv.getRecordCountOfController(po.getControllerId())).orElse(0);
-        if(recIntke == 0 || recController == 0) {
+        if (recIntke == 0 || recController == 0) {
             return BaseResponseUtils.buildFail(ProjectResultCode.INTAKE_OR_CONTROLLER_NO_EXIST.getMessage());
         }
 
@@ -169,23 +175,24 @@
         PrIntakeController prIntakeController = DtoToPojo.INSTANCT.po2vo(po);
         Date operateTime = new Date();
         prIntakeController.setOperatedt(operateTime);
-        prIntakeController.setOperatetype((byte)2);
+        prIntakeController.setOperatetype((byte) 2);
         Integer rec = Optional.ofNullable(intakeControllerSv.addRecord(prIntakeController)).orElse(0);
-        if(rec == 0) {
+        if (rec == 0) {
             return BaseResponseUtils.buildFail(ProjectResultCode.BIND_FAIL.getMessage());
         }
 
         // 鍒犻櫎鎺у埗鍣ㄥ閿�
         Integer rec_deleteIntakeId = Optional.ofNullable(controllerSv.deleteIntakeId(po.getControllerId())).orElse(0);
-        if(rec_deleteIntakeId == 0) {
+        if (rec_deleteIntakeId == 0) {
             return BaseResponseUtils.buildFail(ProjectResultCode.BIND_FAIL.getMessage());
         }
 
-        return BaseResponseUtils.buildSuccess(true) ;
+        return BaseResponseUtils.buildSuccess(true);
     }
 
     /**
      * 鏍规嵁鍙栨按鍙g紪鍙疯幏鍙栫粦瀹氳褰曞垪琛�
+     *
      * @param intakeId 鍙栨按鍙g紪鍙�
      * @return 鍙栨按鍙d笅鎺у埗鍣ㄧ殑缁戝畾銆佽В缁戣褰�
      */
@@ -200,22 +207,23 @@
     })
     @GetMapping(path = "intake_binds")
     @SsoAop()
-    public BaseResponse<QueryResultVo<List<Map<String, Object>>>> getBindsByIntakeId(Long intakeId){
+    public BaseResponse<QueryResultVo<List<Map<String, Object>>>> getBindsByIntakeId(Long intakeId) {
         try {
             List<Map<String, Object>> list = Optional.ofNullable(intakeControllerSv.getBindsByIntakeId(intakeId)).orElse(new ArrayList<>());
-            if(list.size() <= 0) {
+            if (list.size() <= 0) {
                 //鏃犵粦瀹氳褰曚篃杩斿洖鎴愬姛 浣嗘暟鎹负绌�
                 return BaseResponseUtils.buildSuccess(list);
             }//鎴愬姛杩斿洖缁戝畾璁板綍鏁版嵁
             return BaseResponseUtils.buildSuccess(list);
         } catch (Exception e) {
-            log.error("鏌ヨ鍐滄埛寮傚父", e);
-            return BaseResponseUtils.buildException(e.getMessage()) ;
+            log.error("鏌ヨ寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage());
         }
     }
 
     /**
      * 鏍规嵁鎺у埗鍣ㄧ紪鍙疯幏鍙栫粦瀹氳褰曞垪琛�
+     *
      * @param controllerId 鎺у埗鍣ㄧ紪鍙�
      * @return 涓庤鎺у埗鍣ㄧ浉鍏崇殑缁戝畾銆佽В缁戣褰�
      */
@@ -230,16 +238,92 @@
     })
     @GetMapping(path = "controller_binds")
     @SsoAop()
-    public BaseResponse<QueryResultVo<List<Map<String, Object>>>> getBindsByControllerId(Long controllerId){
+    public BaseResponse<QueryResultVo<List<Map<String, Object>>>> getBindsByControllerId(Long controllerId) {
         try {
             List<Map<String, Object>> list = Optional.ofNullable(intakeControllerSv.getBindsByControllerId(controllerId)).orElse(new ArrayList<>());
-            if(list.size() <= 0) {
-                return BaseResponseUtils.buildFail(ProjectResultCode.CONTROLLER_NO_RECORDS.getMessage());
+            if (list.size() <= 0) {
+                //鏃犵粦瀹氳褰曚篃杩斿洖鎴愬姛 浣嗘暟鎹负绌�
+                return BaseResponseUtils.buildSuccess(list);
             }
             return BaseResponseUtils.buildSuccess(list);
         } catch (Exception e) {
-            log.error("鏌ヨ鍐滄埛寮傚父", e);
-            return BaseResponseUtils.buildException(e.getMessage()) ;
+            log.error("鏌ヨ寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage());
         }
     }
+
+
+    /**
+     * 鏍规嵁鎸囧畾鏉′欢鑾峰彇娴佹氮鎺у埗鍣ㄥ垪琛�
+     *
+     * @param vo 鏌ヨ鏉′欢
+     * @return 绗﹀悎鏉′欢鐨勬帶鍒跺櫒鍒楄〃
+     */
+    @Operation(summary = "鑾峰緱涓�椤垫祦娴帶鍒跺櫒璁板綍", description = "杩斿洖涓�椤垫祦娴帶鍒跺櫒鏁版嵁")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "杩斿洖涓�椤垫祦娴帶鍒跺櫒鏁版嵁锛圔aseResponse.content:QueryResultVo[{}]锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = PrControllerTramp.class))}
+            )
+    })
+    @GetMapping(path = "/getTrampControllers")
+    @SsoAop()
+    public BaseResponse<QueryResultVo<List<PrControllerTramp>>> getTrampControllers(TrampControllerQueryVo vo) {
+
+        try {
+            QueryResultVo<List<PrControllerTramp>> res = intakeControllerSv.getTrampControllers(vo);
+            if (res.itemTotal != null && res.itemTotal > 0) {
+                return BaseResponseUtils.buildSuccess(res);
+            } else {
+                //璇锋眰鎴愬姛浣嗘暟鎹负绌�
+                return BaseResponseUtils.buildSuccess(res);
+            }
+            //return BaseResponseUtils.buildSuccess(res);
+        } catch (Exception e) {
+            log.error("鑾峰彇娴佹氮鎺у埗鍣ㄨ褰曞紓甯�", e);
+            return BaseResponseUtils.buildException(e.getMessage());
+        }
+    }
+
+    /**
+     * 娣诲姞娴佹氮鎺у埗鍣�
+     *
+     * @param pct
+     * @return
+     */
+    @PostMapping("addTrampController")
+    @Transactional(rollbackFor = Exception.class)
+    @SsoAop()
+    public BaseResponse<Boolean> addTrampController(@RequestBody PrControllerTramp pct) {
+        pct.setFindDt(new Date());
+        Integer rows = intakeControllerSv.addTrampController(pct);
+        if (rows == 0) {
+            return BaseResponseUtils.buildFail(ProjectResultCode.ADD_TRAMP_CONTROLLER_FAIL.getMessage());
+        }
+        return BaseResponseUtils.buildSuccess(true);
+    }
+
+    /**
+     * 鍒犻櫎娴佹氮鎺у埗鍣�
+     *
+     * @param id
+     * @return
+     */
+    @PostMapping("deleteTrampController")
+    @Transactional(rollbackFor = Exception.class)
+    @SsoAop()
+    public BaseResponse<Boolean> deleteTrampController(Long id) {
+        PrControllerTramp controllerInfo = intakeControllerSv.getTrampControllerInfo(id);
+        if (controllerInfo == null) {
+            return BaseResponseUtils.buildFail(ProjectResultCode.NO_EXIST_TRAMP_CONTROLLER.getMessage());
+        }
+
+        Integer rows = intakeControllerSv.deleteTrampController(id);
+        if (rows == 0) {
+            return BaseResponseUtils.buildFail(ProjectResultCode.DELETE_TRAMP_CONTROLLER_FAIL.getMessage());
+        }
+        return BaseResponseUtils.buildSuccess(true);
+    }
 }
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/IntakeControllerSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/IntakeControllerSv.java
index 11928ca..043a59c 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/IntakeControllerSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/IntakeControllerSv.java
@@ -1,13 +1,19 @@
 package com.dy.pipIrrProject.intakeController;
 
+import cn.hutool.core.date.DateTime;
+import com.dy.common.webUtil.QueryResultVo;
 import com.dy.pipIrrGlobal.daoPr.PrControllerTrampMapper;
 import com.dy.pipIrrGlobal.daoPr.PrIntakeControllerMapper;
 import com.dy.pipIrrGlobal.pojoPr.PrControllerTramp;
 import com.dy.pipIrrGlobal.pojoPr.PrIntakeController;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.common.utils.PojoUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -91,4 +97,34 @@
     public Integer deleteTrampController(Long controllerId) {
         return prControllerTrampMapper.deleteByPrimaryKey(controllerId);
     }
+
+    //娴佹氮鎺у埗鍣ㄥ
+    public Integer addTrampController(PrControllerTramp record){
+        return prControllerTrampMapper.insertSelective(record);
+    }
+
+
+/*娴佹氮鎺у埗鍣ㄦ煡*/
+    public QueryResultVo<List<PrControllerTramp>> getTrampControllers(TrampControllerQueryVo queryVo){
+        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
+
+        Long itemTotal = prControllerTrampMapper.getTrampControllersCount(params);
+
+        QueryResultVo<List<PrControllerTramp>> rsVo = new QueryResultVo<>();
+        rsVo.pageSize = queryVo.pageSize;
+        rsVo.pageCurr = queryVo.pageCurr;
+
+        rsVo.calculateAndSet(itemTotal, params);
+        rsVo.obj = prControllerTrampMapper.getTrampControllers(params);
+
+        return rsVo;
+    }
+    /**
+     * 淇敼缁戝畾璁板綍閫氳繃鍙栨按鍙�
+     * @param record
+     * @return
+     */
+    public Integer updateBindRecord(PrIntakeController record){
+        return prIntakeControllerMapper.updateByIntakeSelective(record);
+    }
 }
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/TrampControllerQueryVo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/TrampControllerQueryVo.java
new file mode 100644
index 0000000..b3be90f
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/TrampControllerQueryVo.java
@@ -0,0 +1,34 @@
+package com.dy.pipIrrProject.intakeController;
+
+import com.dy.common.webUtil.QueryConditionVo;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+
+import java.util.Date;
+
+/**
+ * @author :WuZeYu
+ * @Date :2024/5/8  14:16
+ * @LastEditTime :2024/5/8  14:16
+ * @Description
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@ToString(callSuper = true)
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+@Schema(name = "娴佹氮鎺у埗鍣ㄦ煡璇㈡潯浠�")
+public class TrampControllerQueryVo extends QueryConditionVo {
+
+    @Schema(description = "娴佹氮鎺у埗鍣↖D")
+    private String id;
+
+    @Schema(description = "鎺у埗鍣ㄥ湴鍧�")
+    private String rtuAddr;
+
+    @Schema(description = "閫氳鍗忚")
+    public String protocol;
+
+
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/result/ProjectResultCode.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/result/ProjectResultCode.java
index 2df9954..e2f42c4 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/result/ProjectResultCode.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/result/ProjectResultCode.java
@@ -37,7 +37,12 @@
     NO_RECORDS(30002, "娌℃湁绗﹀悎鏉′欢鐨勬帶鍒跺櫒鏁版嵁"),
     PLEASE_INPUT_CONTROLLER_ID(30003, "璇疯緭鍏ユ帶鍒跺櫒缂栧彿"),
     DELETE_CONTROLLER_FAIL(30004, "鎺у埗鍣ㄥ垹闄ゅけ璐�"),
-
+    /**
+     * 娴佹氮鎺у埗鍣�
+     */
+    ADD_TRAMP_CONTROLLER_FAIL(80001, "娴佹氮鎺у埗鍣ㄦ坊鍔犲け璐�"),
+    DELETE_TRAMP_CONTROLLER_FAIL(80002, "娴佹氮鎺у埗鍣ㄥ垹闄ゅけ璐�"),
+    NO_EXIST_TRAMP_CONTROLLER(80003, "璇ユ祦娴帶鍒跺櫒涓嶅瓨鍦�"),
     /**
      * 鍙栨按鍙c�佹帶鍒跺櫒鍏宠仈
      */

--
Gitblit v1.8.0