From c314c7f4898e368202ddbdfaf026678a2d37b94b Mon Sep 17 00:00:00 2001
From: wuzeyu <1223318623@qq.com>
Date: 星期三, 18 十二月 2024 11:08:32 +0800
Subject: [PATCH] 实现接口 aPP修改取水口经纬度

---
 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeCtrl.java |   28 ++++++++++++++
 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeSv.java   |    9 ++++
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeMapper.java               |    9 ++++
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/IntakeUpdateLngLat.java            |   30 +++++++++++++++
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml                              |   17 ++++++++
 5 files changed, 93 insertions(+), 0 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeMapper.java
index d50e077..9a94c28 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeMapper.java
@@ -2,6 +2,7 @@
 
 
 import com.dy.pipIrrGlobal.pojoPr.PrIntake;
+import com.dy.pipIrrGlobal.voPr.IntakeUpdateLngLat;
 import com.dy.pipIrrGlobal.voPr.VoAllIntake;
 import com.dy.pipIrrGlobal.voPr.VoIntake;
 import com.dy.pipIrrGlobal.voPr.VoOnLineIntake;
@@ -181,4 +182,12 @@
      */
     List<Long> getIntakeIdByNameExcludeId(@Param("id")Long id, @Param("intakeName")String intakeName);
 
+
+    /**
+     * app淇敼鍙栨按鍙g粡绾害
+     * @param record
+     * @return
+     */
+    int updateByPrimaryKeySelective1(IntakeUpdateLngLat record);
+
 }
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/IntakeUpdateLngLat.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/IntakeUpdateLngLat.java
new file mode 100644
index 0000000..5295733
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/IntakeUpdateLngLat.java
@@ -0,0 +1,30 @@
+package com.dy.pipIrrGlobal.voPr;
+
+import com.dy.common.po.BaseEntity;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+import lombok.ToString;
+
+import java.util.Date;
+
+/**
+ * @author :WuZeYu
+ * @Date :2024/12/18  10:43
+ * @LastEditTime :2024/12/18  10:43
+ * @Description
+ */
+@Data
+@ToString
+public class IntakeUpdateLngLat implements BaseEntity {
+
+    @NotNull
+    private Long id;
+
+    @NotNull(message = "缁忓害涓嶈兘涓虹┖")
+    private Double lng;
+
+    @NotNull(message = "缁忓害涓嶈兘涓虹┖")
+    private Double lat;
+
+    private Date operateDt;
+}
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 5873b07..71d988d 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
@@ -709,4 +709,21 @@
         WHERE id != #{id}
         and `name` = #{intakeName}
     </select>
+    <!--app淇敼鍙栨按鍙g粡绾害-->
+    <update id="updateByPrimaryKeySelective1" parameterType="com.dy.pipIrrGlobal.voPr.IntakeUpdateLngLat">
+        <!--@mbg.generated-->
+        update pr_intake
+        <set>
+            <if test="lng != null">
+                lng = #{lng,jdbcType=DOUBLE},
+            </if>
+            <if test="lat != null">
+                lat = #{lat,jdbcType=DOUBLE},
+            </if>
+            <if test="operateDt != null">
+                operateDt = #{operateDt,jdbcType=TIMESTAMP},
+            </if>
+        </set>
+        where id = #{id,jdbcType=BIGINT}
+    </update>
 </mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeCtrl.java
index 6bd5789..a1cf5ef 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeCtrl.java
@@ -13,6 +13,7 @@
 import com.dy.pipIrrGlobal.voPr.VoIntake;
 import com.dy.pipIrrGlobal.voPr.VoOnLineIntake;
 import com.dy.pipIrrGlobal.voSe.VoActiveCard;
+import com.dy.pipIrrGlobal.voPr.IntakeUpdateLngLat;
 import com.dy.pipIrrProject.result.ProjectResultCode;
 import com.taobao.api.ApiException;
 import io.swagger.v3.oas.annotations.Operation;
@@ -205,6 +206,33 @@
     }
 
     /**
+     * app淇敼鍙栨按鍙g粡绾害
+     * @param po
+     * @param bindingResult
+     * @return
+     */
+    @PostMapping(path = "updateIntakeLngLat", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @SsoAop()
+    public BaseResponse<Boolean> updateIntakeLngLat(@RequestBody @Parameter(description = "form琛ㄥ崟json鏁版嵁", required = true) @Valid IntakeUpdateLngLat po, @Parameter(hidden = true) BindingResult bindingResult) {
+        if (bindingResult != null && bindingResult.hasErrors()) {
+            return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+        }
+        int count;
+        po.setOperateDt(new Date());
+        try {
+            count = this.intakeSv.updateIntakeLngLat(po);
+        } catch (Exception e) {
+            log.error("淇濆瓨鍙栨按鍙g粡绾害寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage());
+        }
+        if (count <= 0) {
+            return BaseResponseUtils.buildErrorMsg(ProjectResultCode.UPDATE_INTAKE.getMessage());
+        } else {
+            return BaseResponseUtils.buildSuccess(true);
+        }
+    }
+
+    /**
      * 鍒犻櫎鍙栨按鍙�
      *
      * @param map 鍙栨按鍙D
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeSv.java
index 97843f9..e13d639 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeSv.java
@@ -12,6 +12,7 @@
 import com.dy.pipIrrGlobal.daoPr.PrDivideMapper;
 import com.dy.pipIrrGlobal.daoPr.PrIntakeMapper;
 import com.dy.pipIrrGlobal.pojoPr.PrIntake;
+import com.dy.pipIrrGlobal.voPr.IntakeUpdateLngLat;
 import com.dy.pipIrrGlobal.voPr.VoAllIntake;
 import com.dy.pipIrrGlobal.voPr.VoIntake;
 import com.dy.pipIrrGlobal.voPr.VoOnLineIntake;
@@ -342,4 +343,12 @@
     }
 
 
+    /**
+     * app淇敼鍙栨按鍙g粡绾害
+     * @param po
+     * @return
+     */
+    public int updateIntakeLngLat(IntakeUpdateLngLat po) {
+        return prIntakeMapper.updateByPrimaryKeySelective1(po);
+    }
 }

--
Gitblit v1.8.0