From e35849618cc8d0615c09335959b76d0cca667679 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期三, 13 八月 2025 16:54:04 +0800
Subject: [PATCH] 有wechat模块中增加查询水肥机、墒情站、气象站所有实体的功能

---
 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/mqtt/MqttVo.java             |   20 +++++
 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/mqtt/MqttCtrl.java           |  151 +++++++++++++++++++++++++++++++++++++
 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/mqtt/MqttSv.java             |   41 ++++++++++
 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/PipIrrWechatApplication.java |    9 ++
 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/mqtt/说明.txt                  |    1 
 5 files changed, 221 insertions(+), 1 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/PipIrrWechatApplication.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/PipIrrWechatApplication.java
index 10e0d98..a695285 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/PipIrrWechatApplication.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/PipIrrWechatApplication.java
@@ -18,7 +18,14 @@
                 })
         }
 )
-@MapperScan(basePackages={"com.dy.pipIrrGlobal.daoRm", "com.dy.pipIrrGlobal.daoPr", "com.dy.pipIrrGlobal.daoSe", "com.dy.pipIrrGlobal.daoBa","com.dy.pipIrrGlobal.daoFi", "com.dy.pipIrrGlobal.daoIr"})
+@MapperScan(basePackages={
+        "com.dy.pipIrrGlobal.daoRm",
+        "com.dy.pipIrrGlobal.daoPr",
+        "com.dy.pipIrrGlobal.daoSe",
+        "com.dy.pipIrrGlobal.daoBa",
+        "com.dy.pipIrrGlobal.daoFi",
+        "com.dy.pipIrrGlobal.daoIr"
+})
 public class PipIrrWechatApplication {
 
     public static void main(String[] args) {
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/mqtt/MqttCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/mqtt/MqttCtrl.java
new file mode 100644
index 0000000..2632209
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/mqtt/MqttCtrl.java
@@ -0,0 +1,151 @@
+package com.dy.pipIrrWechat.mqtt;
+
+import com.dy.common.aop.SsoAop;
+import com.dy.common.webUtil.BaseResponse;
+import com.dy.common.webUtil.BaseResponseUtils;
+import com.dy.common.webUtil.ResultCodeMsg;
+import com.dy.pipIrrGlobal.voPr.VoMqttSimple;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @Author: liurunyu
+ * @Date: 2025/8/13 16:41
+ * @Description
+ */
+@Slf4j
+@Tag(name = "鍐滀笟鐏屾簤缁煎悎绔�", description = "鍐滀笟鐏屾簤缁煎悎绔欑鐞�")
+@RestController
+@RequestMapping(path = "mqtt")
+@RequiredArgsConstructor
+public class MqttCtrl {
+
+    private MqttSv sv ;
+
+    @Autowired
+    public void setSv(MqttSv sv) {
+        this.sv = sv;
+    }
+
+
+    /**
+     * 瀹㈡埛绔姹傚緱鍒版墍鏈夋按鑲ユ満銆佹皵璞$珯銆佸鎯呯珯绠�鍗曚俊鎭�
+     * @return 鎵�鏈夋按鑲ユ満銆佹皵璞$珯銆佸鎯呯珯绠�鍗曚俊鎭�
+     */
+    @Operation(summary = "鑾峰緱鍏ㄩ儴姘磋偉鏈恒�佹皵璞$珯銆佸鎯呯珯绠�鍗曚俊鎭�", description = "杩斿洖鍏ㄩ儴姘磋偉鏈恒�佹皵璞$珯銆佸鎯呯珯绠�鍗曚俊鎭�")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "杩斿洖鍏ㄩ儴姘磋偉鏈恒�佹皵璞$珯銆佸鎯呯珯绠�鍗曚俊鎭暟鎹紙BaseResponse.content:TypesVo[{}]锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = MqttVo.class))}
+            )
+    })
+    @GetMapping(path = "allSimple")
+    @SsoAop()
+    public BaseResponse<MqttVo> allSimple() {
+        try {
+            MqttVo reVo = new MqttVo() ;
+            reVo.manures = this.sv.allManureSimple() ;
+            reVo.soils = this.sv.allSoilSimple() ;
+            reVo.weathers = this.sv.allWeatherSimple() ;
+            return BaseResponseUtils.buildSuccess(reVo);
+        } catch (Exception e) {
+            log.error("鏌ヨ鍏ㄩ儴姘磋偉鏈恒�佹皵璞$珯銆佸鎯呯珯绠�鍗曚俊鎭紓甯�", e);
+            return BaseResponseUtils.buildException(e.getMessage());
+        }
+    }
+
+
+
+    /**
+     * 瀹㈡埛绔姹傚緱鍒版墍鏈夋按鑲ユ満绠�鍗曚俊鎭�
+     * @return 鎵�鏈夋按鑲ユ満绠�鍗曚俊鎭�
+     */
+    @Operation(summary = "鑾峰緱鍏ㄩ儴姘磋偉鏈虹畝鍗曚俊鎭�", description = "杩斿洖鍏ㄩ儴姘磋偉鏈虹畝鍗曚俊鎭�")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "杩斿洖鍏ㄩ儴姘磋偉鏈恒�佹皵璞$珯銆佸鎯呯珯绠�鍗曚俊鎭暟鎹紙BaseResponse.content:TypesVo[{}]锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = VoMqttSimple.class))}
+            )
+    })
+    @GetMapping(path = "allManureSimple")
+    @SsoAop()
+    public BaseResponse<List<VoMqttSimple>> allManureSimple() {
+        try {
+            List<VoMqttSimple> list = this.sv.allManureSimple() ;
+            return BaseResponseUtils.buildSuccess(list);
+        } catch (Exception e) {
+            log.error("鏌ヨ鍏ㄩ儴姘磋偉鏈虹畝鍗曚俊鎭紓甯�", e);
+            return BaseResponseUtils.buildException(e.getMessage());
+        }
+    }
+
+
+    /**
+     * 瀹㈡埛绔姹傚緱鍒版墍鏈夊鎯呯珯绠�鍗曚俊鎭�
+     * @return 鎵�鏈夊鎯呯珯绠�鍗曚俊鎭�
+     */
+    @Operation(summary = "鑾峰緱鍏ㄩ儴澧掓儏绔欑畝鍗曚俊鎭�", description = "杩斿洖鍏ㄩ儴澧掓儏绔欑畝鍗曚俊鎭�")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "杩斿洖鍏ㄩ儴澧掓儏绔欑畝鍗曚俊鎭暟鎹紙BaseResponse.content:TypesVo[{}]锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = VoMqttSimple.class))}
+            )
+    })
+    @GetMapping(path = "allSoilSimple")
+    @SsoAop()
+    public BaseResponse<List<VoMqttSimple>> allSoilSimple() {
+        try {
+            List<VoMqttSimple> list = this.sv.allSoilSimple() ;
+            return BaseResponseUtils.buildSuccess(list);
+        } catch (Exception e) {
+            log.error("鏌ヨ鍏ㄩ儴澧掓儏绔欑畝鍗曚俊鎭紓甯�", e);
+            return BaseResponseUtils.buildException(e.getMessage());
+        }
+    }
+
+
+    /**
+     * 瀹㈡埛绔姹傚緱鍒版墍鏈夋皵璞$珯绠�鍗曚俊鎭�
+     * @return 鎵�鏈夋皵璞$珯绠�鍗曚俊鎭�
+     */
+    @Operation(summary = "鑾峰緱鍏ㄩ儴姘旇薄绔欑畝鍗曚俊鎭�", description = "杩斿洖鍏ㄩ儴姘旇薄绔欑畝鍗曚俊鎭�")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "杩斿洖鍏ㄩ儴姘旇薄绔欑畝鍗曚俊鎭暟鎹紙BaseResponse.content:TypesVo[{}]锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = MqttVo.class))}
+            )
+    })
+    @GetMapping(path = "allWeatherSimple")
+    @SsoAop()
+    public BaseResponse<List<VoMqttSimple>> allWeatherSimple() {
+        try {
+            List<VoMqttSimple> list = this.sv.allWeatherSimple() ;
+            return BaseResponseUtils.buildSuccess(list);
+        } catch (Exception e) {
+            log.error("鏌ヨ鍏ㄩ儴姘旇薄绔欑畝鍗曚俊鎭紓甯�", e);
+            return BaseResponseUtils.buildException(e.getMessage());
+        }
+    }
+
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/mqtt/MqttSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/mqtt/MqttSv.java
new file mode 100644
index 0000000..9813b61
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/mqtt/MqttSv.java
@@ -0,0 +1,41 @@
+package com.dy.pipIrrWechat.mqtt;
+
+import com.dy.pipIrrGlobal.daoPr.PrStManureMapper;
+import com.dy.pipIrrGlobal.daoPr.PrStSoilMapper;
+import com.dy.pipIrrGlobal.daoPr.PrStWeatherMapper;
+import com.dy.pipIrrGlobal.voPr.VoMqttSimple;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @Author: liurunyu
+ * @Date: 2025/8/13 16:41
+ * @Description
+ */
+@Slf4j
+@Service
+public class MqttSv {
+
+    @Autowired
+    private PrStManureMapper manureDao;
+    @Autowired
+    private PrStSoilMapper soilDao;
+    @Autowired
+    private PrStWeatherMapper weatherDao;
+
+    public List<VoMqttSimple> allManureSimple(){
+        return this.manureDao.selectAllSimple() ;
+    }
+
+    public List<VoMqttSimple> allSoilSimple(){
+        return this.soilDao.selectAllSimple() ;
+    }
+
+    public List<VoMqttSimple> allWeatherSimple(){
+        return this.weatherDao.selectAllSimple() ;
+    }
+
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/mqtt/MqttVo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/mqtt/MqttVo.java
new file mode 100644
index 0000000..cab4db0
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/mqtt/MqttVo.java
@@ -0,0 +1,20 @@
+package com.dy.pipIrrWechat.mqtt;
+
+import com.dy.pipIrrGlobal.voPr.VoMqttSimple;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Author: liurunyu
+ * @Date: 2025/8/13 16:41
+ * @Description
+ */
+@Data
+public class MqttVo {
+    public List<VoMqttSimple> manures;
+
+    public List<VoMqttSimple> soils;
+
+    public List<VoMqttSimple> weathers;
+}
diff --git "a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/mqtt/\350\257\264\346\230\216.txt" "b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/mqtt/\350\257\264\346\230\216.txt"
new file mode 100644
index 0000000..d0f1e72
--- /dev/null
+++ "b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/mqtt/\350\257\264\346\230\216.txt"
@@ -0,0 +1 @@
+鍩轰簬MQTT鍗忚鐨勬按鑲ユ満銆佹皵璞°�佸鎯呯珯
\ No newline at end of file

--
Gitblit v1.8.0