From 3087ff4ccc174d5952e9650ac3fae61eff477554 Mon Sep 17 00:00:00 2001
From: wuzeyu <1223318623@qq.com>
Date: 星期一, 01 四月 2024 10:42:55 +0800
Subject: [PATCH] 修改 流量计实体增加监测站ID外键和驼峰命名     流量计监测站绑定接口(同步修改流量计的监测站ID外键 和 绑定记录表)     流量计监测站解绑接口(同步修改流量计的监测站ID外键 和 绑定记录表)     条件查询监测站(绑定状态判定)     条件查询已绑定的流量计     回退误修改的获取绑定记录

---
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrFlowmeterMapper.java                            |    6 ++
 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/MoniFlowCtrl.java       |   19 +++++
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoFlowMonitoring.java                              |    2 
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrFlowmeter.java                                 |   17 ++++-
 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterCtrl.java      |    4 
 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterSv.java        |    9 +++
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowmeterMapper.xml                                           |   76 +++++++++++++-----------
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrMonitoringFlowmeterMapper.xml                                 |    2 
 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/DtoToFlowmeterPojo.java |   12 ++--
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowMonitoringMapper.xml                                      |   27 ++++++---
 10 files changed, 112 insertions(+), 62 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrFlowmeterMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrFlowmeterMapper.java
index 4f365a5..7cd45f5 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrFlowmeterMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrFlowmeterMapper.java
@@ -63,4 +63,10 @@
      * @return 鍏ㄩ儴瀹炰綋
      * */
     List<PrFlowmeter> selectAll();
+    /**
+     * 缁欐祦閲忚琛ㄥ姞鐩戞祴绔橧D澶栭敭
+     * @param
+     * @return
+     */
+    int flowmeterAddMonId(PrFlowmeter record);
 }
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrFlowmeter.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrFlowmeter.java
index 892d5cd..5c60c14 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrFlowmeter.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrFlowmeter.java
@@ -16,7 +16,7 @@
 /**
  * @author ZhuBaoMin
  * @date 2024-01-05 9:04
- * @LastEditTime 2024-01-05 9:04
+ * @LastEditTime 2024-04-01 9:04 wuzeyu
  * @Description
  */
 
@@ -39,6 +39,13 @@
     private Long id;
 
     /**
+     * 澶栭敭 鐩戞祴绔橧D
+     */
+    @Schema(description = "鐩戞祴绔橧D", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+    @Length(message = "鐩戞祴绔橧D涓嶅ぇ浜巤max}瀛楋紝涓嶅皬浜巤min}瀛�", min = 1, max = 25)
+    private String monitoringId;
+
+    /**
     * 娴侀噺璁$紪鍙�
     */
     @Schema(description = "娴侀噺璁$紪鍙�", requiredMode = Schema.RequiredMode.REQUIRED)
@@ -58,19 +65,19 @@
     * 鍦ㄧ嚎鐘舵��;1-鍦ㄧ嚎锛�2-绂荤嚎
     */
     @Schema(description = "鍦ㄧ嚎鐘舵��", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
-    private Byte onlinestate;
+    private Byte onlineState;
 
     /**
     * 鏈�杩戜笂鎶ユ椂闂�
     */
     @Schema(description = "鏈�杩戜笂鎶ユ椂闂�", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
-    private Date reporttime;
+    private Date reportTime;
 
     /**
     * 娣诲姞鏂瑰紡;1-绯荤粺鑷姩锛�2-鎵嬪姩
     */
     @Schema(description = "娣诲姞鏂瑰紡", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
-    private Byte addways;
+    private Byte addWays;
 
     /**
     * 鎿嶄綔浜篒D
@@ -82,7 +89,7 @@
     * 鎿嶄綔鏃堕棿
     */
     @Schema(description = "鎿嶄綔鏃堕棿", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
-    private Date operatedt;
+    private Date operateDt;
 
     /**
     * 澶囨敞淇℃伅
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoFlowMonitoring.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoFlowMonitoring.java
index 7973e6f..df43622 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoFlowMonitoring.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoFlowMonitoring.java
@@ -31,7 +31,7 @@
     @Schema(title = "缁戝畾鐘舵��")
     @ExcelProperty("缁戝畾鐘舵��")
     @ColumnWidth(15)
-    private Integer bindState;
+    private String bindState;
 
     @Schema(title = "鍦板潃")
     @ExcelProperty("鍦板潃")
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowMonitoringMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowMonitoringMapper.xml
index 0691e30..29835ac 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowMonitoringMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowMonitoringMapper.xml
@@ -211,7 +211,7 @@
     <select id="getRecordCountOfFlowMonitoring" resultType="java.lang.Integer">
         SELECT COUNT(*) AS recordCountOfFlowMonitoring
         from    pr_flow_monitoring pfm
-        LEFT JOIN pr_monitoring_flowmeter pmofl ON pmofl.monitoringId = pfm.id
+        LEFT JOIN pr_flowmeter pf ON pf.monitoringId = pfm.id
         LEFT JOIN ba_district country ON pfm.countyId = country.id
         LEFT JOIN ba_district town ON pfm.townId = town.id
         LEFT JOIN ba_district village ON pfm.villageId = village.id
@@ -220,20 +220,26 @@
             <if test = "name != null and name !=''">
                 AND pfm.`name` like CONCAT('%',#{name},'%')
             </if>
-            <if test = "bindState != null and bindState > 0">
-                AND pmofl.operateType = ${bindState}
+            <if test = "bindState ==1 ">
+                AND pf.monitoringId IS NOT NULL
+            </if>
+            <if test = "bindState ==2 or bindState =='' ">
+                AND pf.monitoringId IS  NULL
             </if>
         </where>
     </select>
 
     <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇娴侀噺鐩戞祴绔欏疄浣撹褰�-->
     <select id="getPrFlowMonitoring" parameterType="map" resultType="com.dy.pipIrrGlobal.voPr.VoFlowMonitoring">
-        select  CAST(pfm.id AS char)                                 AS id,
+        select  CAST(pfm.id AS char)                                AS id,
                 CONCAT(country.`name`, town.`name`, village.`name`) AS address,
                 pfm.`name`                                          AS `name`,
-                pmofl.operateType                                   AS bindState
+                (CASE
+                 WHEN pf.monitoringId IS NOT NULL THEN "宸茬粦瀹�"
+                 WHEN pf.monitoringId IS  NULL  THEN "鏈粦瀹�"
+                 END)                                               AS bindState
         from    pr_flow_monitoring pfm
-        LEFT JOIN pr_monitoring_flowmeter pmofl ON pmofl.monitoringId = pfm.id
+        LEFT JOIN pr_flowmeter pf ON pf.monitoringId = pfm.id
         LEFT JOIN ba_district country ON pfm.countyId = country.id
         LEFT JOIN ba_district town ON pfm.townId = town.id
         LEFT JOIN ba_district village ON pfm.villageId = village.id
@@ -243,11 +249,14 @@
             <if test = "name != null and name !=''">
                 AND pfm.`name` like CONCAT('%',#{name},'%')
             </if>
-            <if test = "bindState != null and bindState > 0">
-                AND pmofl.operateType = ${bindState}
+            <if test = "bindState ==1 ">
+                AND pf.monitoringId IS NOT NULL
+            </if>
+            <if test = "bindState ==2 or bindState =='' ">
+                AND pf.monitoringId IS  NULL
             </if>
         </where>
-        ORDER BY pmofl.operateDt DESC
+        ORDER BY pfm.operateDt DESC
         <trim prefix="limit " >
             <if test="start != null and count != null">
                 #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowmeterMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowmeterMapper.xml
index c74808b..408b346 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowmeterMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowmeterMapper.xml
@@ -5,19 +5,20 @@
     <!--@mbg.generated-->
     <!--@Table pr_flowmeter-->
     <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="monitoringId" jdbcType="BIGINT" property="monitoringId" />
     <result column="code" jdbcType="VARCHAR" property="code" />
     <result column="protocol" jdbcType="VARCHAR" property="protocol" />
-    <result column="onlineState" jdbcType="TINYINT" property="onlinestate" />
-    <result column="reportTime" jdbcType="TIMESTAMP" property="reporttime" />
-    <result column="addWays" jdbcType="TINYINT" property="addways" />
+    <result column="onlineState" jdbcType="TINYINT" property="onlineState" />
+    <result column="reportTime" jdbcType="TIMESTAMP" property="reportTime" />
+    <result column="addWays" jdbcType="TINYINT" property="addWays" />
     <result column="operator" jdbcType="BIGINT" property="operator" />
-    <result column="operateDt" jdbcType="TIMESTAMP" property="operatedt" />
+    <result column="operateDt" jdbcType="TIMESTAMP" property="operateDt" />
     <result column="remarks" jdbcType="VARCHAR" property="remarks" />
     <result column="deleted" jdbcType="TINYINT" property="deleted" />
   </resultMap>
   <sql id="Base_Column_List">
     <!--@mbg.generated-->
-    id, code, protocol, onlineState, reportTime, addWays, `operator`, operateDt, remarks, 
+    id, monitoringId, code, protocol, onlineState, reportTime, addWays, `operator`, operateDt, remarks,
     deleted
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
@@ -40,8 +41,8 @@
       `operator`, operateDt, remarks, 
       deleted)
     values (#{id,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, 
-      #{onlinestate,jdbcType=TINYINT}, #{reporttime,jdbcType=TIMESTAMP}, #{addways,jdbcType=TINYINT}, 
-      #{operator,jdbcType=BIGINT}, #{operatedt,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, 
+      #{onlineState,jdbcType=TINYINT}, #{reportTime,jdbcType=TIMESTAMP}, #{addWays,jdbcType=TINYINT},
+      #{operator,jdbcType=BIGINT}, #{operateDt,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR},
       #{deleted,jdbcType=TINYINT})
   </insert>
 
@@ -58,19 +59,19 @@
       <if test="protocol != null">
         protocol,
       </if>
-      <if test="onlinestate != null">
+      <if test="onlineState != null">
         onlineState,
       </if>
-      <if test="reporttime != null">
+      <if test="reportTime != null">
         reportTime,
       </if>
-      <if test="addways != null">
+      <if test="addWays != null">
         addWays,
       </if>
       <if test="operator != null">
         `operator`,
       </if>
-      <if test="operatedt != null">
+      <if test="operateDt != null">
         operateDt,
       </if>
       <if test="remarks != null">
@@ -90,20 +91,20 @@
       <if test="protocol != null">
         #{protocol,jdbcType=VARCHAR},
       </if>
-      <if test="onlinestate != null">
-        #{onlinestate,jdbcType=TINYINT},
+      <if test="onlineState != null">
+        #{onlineState,jdbcType=TINYINT},
       </if>
-      <if test="reporttime != null">
-        #{reporttime,jdbcType=TIMESTAMP},
+      <if test="reportTime != null">
+        #{reportTime,jdbcType=TIMESTAMP},
       </if>
-      <if test="addways != null">
-        #{addways,jdbcType=TINYINT},
+      <if test="addWays != null">
+        #{addWays,jdbcType=TINYINT},
       </if>
       <if test="operator != null">
         #{operator,jdbcType=BIGINT},
       </if>
-      <if test="operatedt != null">
-        #{operatedt,jdbcType=TIMESTAMP},
+      <if test="operateDt != null">
+        #{operateDt,jdbcType=TIMESTAMP},
       </if>
       <if test="remarks != null">
         #{remarks,jdbcType=VARCHAR},
@@ -123,20 +124,20 @@
       <if test="protocol != null">
         protocol = #{protocol,jdbcType=VARCHAR},
       </if>
-      <if test="onlinestate != null">
-        onlineState = #{onlinestate,jdbcType=TINYINT},
+      <if test="onlineState != null">
+        onlineState = #{onlineState,jdbcType=TINYINT},
       </if>
-      <if test="reporttime != null">
-        reportTime = #{reporttime,jdbcType=TIMESTAMP},
+      <if test="reportTime != null">
+        reportTime = #{reportTime,jdbcType=TIMESTAMP},
       </if>
-      <if test="addways != null">
-        addWays = #{addways,jdbcType=TINYINT},
+      <if test="addWays != null">
+        addWays = #{addWays,jdbcType=TINYINT},
       </if>
       <if test="operator != null">
         `operator` = #{operator,jdbcType=BIGINT},
       </if>
-      <if test="operatedt != null">
-        operateDt = #{operatedt,jdbcType=TIMESTAMP},
+      <if test="operateDt != null">
+        operateDt = #{operateDt,jdbcType=TIMESTAMP},
       </if>
       <if test="remarks != null">
         remarks = #{remarks,jdbcType=VARCHAR},
@@ -152,11 +153,11 @@
     update pr_flowmeter
     set code = #{code,jdbcType=VARCHAR},
       protocol = #{protocol,jdbcType=VARCHAR},
-      onlineState = #{onlinestate,jdbcType=TINYINT},
-      reportTime = #{reporttime,jdbcType=TIMESTAMP},
-      addWays = #{addways,jdbcType=TINYINT},
+      onlineState = #{onlineState,jdbcType=TINYINT},
+      reportTime = #{reportTime,jdbcType=TIMESTAMP},
+      addWays = #{addWays,jdbcType=TINYINT},
       `operator` = #{operator,jdbcType=BIGINT},
-      operateDt = #{operatedt,jdbcType=TIMESTAMP},
+      operateDt = #{operateDt,jdbcType=TIMESTAMP},
       remarks = #{remarks,jdbcType=VARCHAR},
       deleted = #{deleted,jdbcType=TINYINT}
     where id = #{id,jdbcType=BIGINT}
@@ -176,8 +177,7 @@
   <select id="getRecordCountOfFlowMeterByOthers" resultType="_integer">
     SELECT COUNT(*) AS recordCountOfFlowmeter
     from pr_flowmeter pfm
-    Left join pr_monitoring_flowmeter pmofl on pmofl.flowmeterId = pfm.id
-    Left join pr_flow_monitoring pfmt on pfmt.id = pmofl.monitoringId
+    Left join pr_flow_monitoring pfmt on pfmt.id = pfm.monitoringId
     <where>
       pfm.deleted = 0 AND pfmt.deleted = 0
       <if test = "code != null and code !=''">
@@ -197,8 +197,7 @@
       pfmt.`name`                                               AS `name`,
       pfm.operateDt                                             AS operateDt
     from pr_flowmeter pfm
-    Left join pr_monitoring_flowmeter pmofl on pmofl.flowmeterId = pfm.id
-    Left join pr_flow_monitoring pfmt on pfmt.id = pmofl.monitoringId
+    Left join pr_flow_monitoring pfmt on pfmt.id = pfm.monitoringId
     <where>
       pfm.deleted = 0 AND pfmt.deleted = 0
       <if test = "code != null and code !=''">
@@ -223,4 +222,11 @@
     from pr_flowmeter pfm
     where deleted != 1
   </select>
+  <update id="flowmeterAddMonId">
+    update pr_flowmeter
+    set monitoringId = #{monitoringId,jdbcType=BIGINT},
+    `operator` = #{operator,jdbcType=BIGINT},
+    operateDt = #{operateDt,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=BIGINT}
+  </update>
 </mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrMonitoringFlowmeterMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrMonitoringFlowmeterMapper.xml
index 26100bb..916a032 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrMonitoringFlowmeterMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrMonitoringFlowmeterMapper.xml
@@ -158,8 +158,6 @@
     `operator`,
     operateDt
     from pr_monitoring_flowmeter pmf
-    INNER JOIN (SELECT monitoringId AS a,MAX(operateDt) AS b FROM `pr_monitoring_flowmeter`
-    GROUP BY monitoringId) AS b ON monitoringId=a AND operateDt=b
     where
     monitoringId=#{monitoringId,jdbcType=BIGINT}
     order by operateDt desc
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/DtoToFlowmeterPojo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/DtoToFlowmeterPojo.java
index 32ae88f..408f593 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/DtoToFlowmeterPojo.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/DtoToFlowmeterPojo.java
@@ -15,11 +15,11 @@
 @Mapper
 public interface DtoToFlowmeterPojo {
     DtoToFlowmeterPojo INSTANCT = Mappers.getMapper(DtoToFlowmeterPojo.class);
-    @Mapping(target = "code", source = "code")
-    @Mapping(target = "protocol", source = "protocol")
-    @Mapping(target = "onlinestate", source = "onlineState")
-    @Mapping(target = "addways", source = "addWays")
-    @Mapping(target = "operator", source = "operator")
-    @Mapping(target = "remarks", source = "remarks")
+//    @Mapping(target = "code", source = "code")
+//    @Mapping(target = "protocol", source = "protocol")
+//    @Mapping(target = "onlineState", source = "onlineState")
+//    @Mapping(target = "addWays", source = "addWays")
+//    @Mapping(target = "operator", source = "operator")
+//    @Mapping(target = "remarks", source = "remarks")
     PrFlowmeter po2vo(DtoFlowmeter po);
 }
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterCtrl.java
index 2e3f6b5..3cbbdeb 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterCtrl.java
@@ -59,9 +59,9 @@
 
         PrFlowmeter prFlowmeter = DtoToFlowmeterPojo.INSTANCT.po2vo(po);
         Date operateTime = new Date();
-        prFlowmeter.setOperatedt(operateTime);
+        prFlowmeter.setOperateDt(operateTime);
         prFlowmeter.setDeleted((byte) 0);
-        prFlowmeter.setReporttime(operateTime);
+        prFlowmeter.setReportTime(operateTime);
         Integer rec = Optional.ofNullable(flowmeterSv.addFlowmeter(prFlowmeter)).orElse(0);
         if (rec == 0) {
             return BaseResponseUtils.buildFail(ProjectResultCode.ADD_FLOWMETER_FAIL.getMessage());
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterSv.java
index 48a6315..a1803ac 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterSv.java
@@ -80,4 +80,13 @@
         List<PrFlowmeter> all = prFlowmeterMapper.selectAll();
         return all;
     }
+
+    /**
+     * 缁欐祦閲忚琛ㄥ姞鐩戞祴绔橧D澶栭敭
+     * @param
+     * @return
+     */
+    public Integer flowmeterAddMonId(PrFlowmeter record){
+        return prFlowmeterMapper.flowmeterAddMonId(record);
+    }
 }
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/MoniFlowCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/MoniFlowCtrl.java
index fe2fd37..79b50a8 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/MoniFlowCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/MoniFlowCtrl.java
@@ -5,6 +5,7 @@
 import com.dy.common.webUtil.BaseResponseUtils;
 import com.dy.common.webUtil.ResultCodeMsg;
 import com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring;
+import com.dy.pipIrrGlobal.pojoPr.PrFlowmeter;
 import com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter;
 import com.dy.pipIrrProject.result.ProjectResultCode;
 import io.swagger.v3.oas.annotations.Operation;
@@ -85,8 +86,15 @@
         prMonitoringFlowmeter.setOperatedt(operateTime);
         prMonitoringFlowmeter.setOperatetype((byte) 1);
 
+        PrFlowmeter flowmeter = new PrFlowmeter();
+        flowmeter.setMonitoringId(po.getMonitoringId().toString());
+        flowmeter.setId(po.getFlowmeterId());
+        flowmeter.setOperator(po.getOperator());
+        flowmeter.setOperateDt(operateTime);
+        Integer shu = flowmeterSv.flowmeterAddMonId(flowmeter);
+
         Integer rec = Optional.ofNullable(moniFlowSv.addRecord(prMonitoringFlowmeter)).orElse(0);
-        if (rec == 0) {
+        if (rec == 0 || shu == 0) {
             return BaseResponseUtils.buildFail(ProjectResultCode.MONITORING_FLOWMETER_BIND_FAIL.getMessage());
         }
         return BaseResponseUtils.buildSuccess(true);
@@ -127,8 +135,15 @@
         prMonitoringFlowmeter.setOperatedt(operateTime);
         prMonitoringFlowmeter.setOperatetype((byte) 2);
 
+        PrFlowmeter flowmeter = new PrFlowmeter();
+        flowmeter.setMonitoringId(null);
+        flowmeter.setId(po.getFlowmeterId());
+        flowmeter.setOperator(po.getOperator());
+        flowmeter.setOperateDt(operateTime);
+        Integer shu = flowmeterSv.flowmeterAddMonId(flowmeter);
+
         Integer rec = Optional.ofNullable(moniFlowSv.addRecord(prMonitoringFlowmeter)).orElse(0);
-        if (rec == 0) {
+        if (rec == 0 || shu == 0) {
             return BaseResponseUtils.buildFail(ProjectResultCode.MONITORING_FLOWMETER_BIND_FAIL.getMessage());
         }
         return BaseResponseUtils.buildSuccess(true);

--
Gitblit v1.8.0