ソースを参照

修复设备列表排序按照在线离线创建时间倒序排序;增加topic列表菜单

fuyuchuan 1 ヶ月 前
コミット
813b58ac7e

+ 38 - 23
service-iot/service-iot-biz/src/main/java/com/usky/iot/controller/web/DmpDeviceInfoController.java

@@ -13,6 +13,7 @@ import com.usky.iot.domain.DmpDeviceInfo;
 import com.usky.iot.service.DmpDeviceInfoService;
 import com.usky.iot.service.vo.BaseFacilityDeviceVO;
 import com.usky.iot.service.vo.DmpDeviceInfoRequest;
+import com.usky.iot.service.vo.DmpTopicResponseVO;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -44,7 +45,7 @@ public class DmpDeviceInfoController {
      * @return
      */
     @PostMapping
-    public ApiResult<Void> add(@RequestBody DmpDeviceInfo dmpDeviceInfo){
+    public ApiResult<Void> add(@RequestBody DmpDeviceInfo dmpDeviceInfo) {
         dmpDeviceInfoService.add(dmpDeviceInfo);
         return ApiResult.success();
     }
@@ -55,7 +56,7 @@ public class DmpDeviceInfoController {
      * @return
      */
     @PutMapping
-    public ApiResult<Void> edit(@RequestBody DmpDeviceInfo dmpDeviceInfo){
+    public ApiResult<Void> edit(@RequestBody DmpDeviceInfo dmpDeviceInfo) {
         dmpDeviceInfoService.update(dmpDeviceInfo);
         return ApiResult.success();
     }
@@ -67,8 +68,7 @@ public class DmpDeviceInfoController {
      * @return
      */
     @PostMapping("/page")
-    public ApiResult<CommonPage<DmpDeviceInfo>> page(@RequestBody DmpDeviceInfoRequest dmpDeviceInfoRequest)
-    {
+    public ApiResult<CommonPage<DmpDeviceInfo>> page(@RequestBody DmpDeviceInfoRequest dmpDeviceInfoRequest) {
         return ApiResult.success(dmpDeviceInfoService.page(dmpDeviceInfoRequest));
     }
 
@@ -79,8 +79,7 @@ public class DmpDeviceInfoController {
      * @return
      */
     @PostMapping("/pageWhite")
-    public ApiResult<CommonPage<DmpDeviceInfo>> pageWhite(@RequestBody DmpDeviceInfoRequest dmpDeviceInfoRequest)
-    {
+    public ApiResult<CommonPage<DmpDeviceInfo>> pageWhite(@RequestBody DmpDeviceInfoRequest dmpDeviceInfoRequest) {
         return ApiResult.success(dmpDeviceInfoService.pageWhite(dmpDeviceInfoRequest));
     }
 
@@ -88,8 +87,7 @@ public class DmpDeviceInfoController {
      * 删除记录
      */
     @DeleteMapping("/{id}")
-    public ApiResult<Void> remove(@PathVariable("id") Integer id)
-    {
+    public ApiResult<Void> remove(@PathVariable("id") Integer id) {
         dmpDeviceInfoService.remove(id);
         return ApiResult.success();
     }
@@ -100,7 +98,7 @@ public class DmpDeviceInfoController {
      * @return
      */
     @PostMapping("/addByFile")
-    public ApiResult<Void> addByFile(@RequestParam(value = "file") MultipartFile multipartFiles){
+    public ApiResult<Void> addByFile(@RequestParam(value = "file") MultipartFile multipartFiles) {
         dmpDeviceInfoService.addByFile(multipartFiles);
         return ApiResult.success();
     }
@@ -112,7 +110,7 @@ public class DmpDeviceInfoController {
      * @return
      */
     @PostMapping("/importDeviceInfo")
-    public ApiResult<Void> importDeviceInfo(@RequestBody List<DmpDeviceInfo> list){
+    public ApiResult<Void> importDeviceInfo(@RequestBody List<DmpDeviceInfo> list) {
         dmpDeviceInfoService.importDeviceInfo(list);
         return ApiResult.success();
     }
@@ -124,8 +122,8 @@ public class DmpDeviceInfoController {
      * @return
      */
     @PostMapping("/export")
-    public void export(@RequestBody DmpDeviceInfoRequest dmpDeviceInfoRequest, HttpServletResponse response){
-        dmpDeviceInfoService.export(dmpDeviceInfoRequest,response);
+    public void export(@RequestBody DmpDeviceInfoRequest dmpDeviceInfoRequest, HttpServletResponse response) {
+        dmpDeviceInfoService.export(dmpDeviceInfoRequest, response);
     }
 
     /**
@@ -139,12 +137,12 @@ public class DmpDeviceInfoController {
      * @return
      */
     @GetMapping("deviceCurrentDataList")
-    public ApiResult<CommonPage<Object>> deviceCurrentDataList(@RequestParam(value = "deviceName",required = false) String deviceName,
-                                                               @RequestParam(value = "installAddress",required = false) String installAddress,
-                                                               @RequestParam(value = "productCode",required = false) String productCode,
+    public ApiResult<CommonPage<Object>> deviceCurrentDataList(@RequestParam(value = "deviceName", required = false) String deviceName,
+                                                               @RequestParam(value = "installAddress", required = false) String installAddress,
+                                                               @RequestParam(value = "productCode", required = false) String productCode,
                                                                @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
-                                                               @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize){
-        return ApiResult.success(dmpDeviceInfoService.deviceCurrentDataList(deviceName,installAddress,productCode,pageNum,pageSize));
+                                                               @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
+        return ApiResult.success(dmpDeviceInfoService.deviceCurrentDataList(deviceName, installAddress, productCode, pageNum, pageSize));
     }
 
     /**
@@ -154,7 +152,7 @@ public class DmpDeviceInfoController {
      * @return
      */
     @PostMapping("dataTVList")
-    public ApiResult<CommonPage<DataTVResponseVO>> dataTVList(@RequestBody DataTVRequestVO requestVO){
+    public ApiResult<CommonPage<DataTVResponseVO>> dataTVList(@RequestBody DataTVRequestVO requestVO) {
         return ApiResult.success(dmpDeviceInfoService.dataTVList(requestVO));
     }
 
@@ -165,7 +163,7 @@ public class DmpDeviceInfoController {
      * @return
      */
     @PostMapping("dataTVStatistic")
-    public ApiResult<List<DataTVStatisticResponseVO>> dataTVStatistic(@RequestBody DataTVRequestVO requestVO){
+    public ApiResult<List<DataTVStatisticResponseVO>> dataTVStatistic(@RequestBody DataTVRequestVO requestVO) {
         return ApiResult.success(dmpDeviceInfoService.dataTVStatistic(requestVO));
     }
 
@@ -176,7 +174,7 @@ public class DmpDeviceInfoController {
      */
     @PostMapping("deviceDataTotal")
     @ApiOperation("获取设备某个时间端内的汇总值")
-    public ApiResult<List<Map<String,Object>>> deviceDataTotal(@RequestBody DataTotalRequestVO requestVO){
+    public ApiResult<List<Map<String, Object>>> deviceDataTotal(@RequestBody DataTotalRequestVO requestVO) {
         return ApiResult.success(dmpDeviceInfoService.deviceDataTotal(requestVO));
     }
 
@@ -187,7 +185,7 @@ public class DmpDeviceInfoController {
      */
     @PostMapping("deviceDataAverage")
     @ApiOperation("获取设备日平均、月平均、年平均值")
-    public ApiResult<List<DataAverageResponseVO>> deviceDataAverage(@RequestBody DataAverageRequestVO requestVO){
+    public ApiResult<List<DataAverageResponseVO>> deviceDataAverage(@RequestBody DataAverageRequestVO requestVO) {
         return ApiResult.success(dmpDeviceInfoService.deviceDataAverage(requestVO));
     }
 
@@ -198,10 +196,27 @@ public class DmpDeviceInfoController {
      * @throws IOException
      */
     @PostMapping("deviceDataAverageExport")
-    public void export(@RequestBody DataAverageRequestVO requestVO, HttpServletResponse response) throws IOException{
+    public void export(@RequestBody DataAverageRequestVO requestVO, HttpServletResponse response) throws IOException {
         List<DataAverageExportVO> list = dmpDeviceInfoService.DataAverageExport(requestVO);
         ExcelUtil<DataAverageExportVO> util = new ExcelUtil<DataAverageExportVO>(DataAverageExportVO.class);
-        util.exportExcel(response,list,requestVO.getSheetName(),requestVO.getTitleName());
+        util.exportExcel(response, list, requestVO.getSheetName(), requestVO.getTitleName());
+    }
+
+    /**
+     * 获取设备topic列表
+     * @param productCode 产品编码
+     * @param deviceId 设备自身的唯一标识
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @GetMapping("topic")
+    public ApiResult<CommonPage<DmpTopicResponseVO>> topic(@RequestParam(value = "productCode") String productCode,
+                                                     @RequestParam(value = "deviceId") String deviceId,
+                                                     @RequestParam(value = "deviceUuid") String deviceUuid,
+                                                     @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
+                                                     @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
+        return ApiResult.success(dmpDeviceInfoService.topic(productCode, deviceId, deviceUuid, pageNum, pageSize));
     }
 }
 

+ 11 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/DmpDeviceInfoService.java

@@ -6,6 +6,7 @@ import com.usky.common.mybatis.core.CrudService;
 import com.usky.iot.domain.DmpDeviceInfo;
 import com.usky.iot.service.vo.BaseFacilityDeviceVO;
 import com.usky.iot.service.vo.DmpDeviceInfoRequest;
+import com.usky.iot.service.vo.DmpTopicResponseVO;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.multipart.MultipartFile;
@@ -73,4 +74,14 @@ public interface DmpDeviceInfoService extends CrudService<DmpDeviceInfo> {
     List<DataAverageExportVO> DataAverageExport(DataAverageRequestVO requestVO);
 
     Map<String,Object> control(String productCode, String deviceUuid, String commandCode, String commandValue, String domain, Long userId, String userName);
+
+    /**
+     * @description: 获取设备topic列表
+     * @author: fyc
+     * @email yuchuan.fu@chinausky.com
+     * @date: 2025/2/7 17:49
+     * @param: [pageNum, pageSize]
+     * @return: java.util.List<com.usky.iot.service.vo.DmpTopicResponseVO>
+     **/
+    CommonPage<DmpTopicResponseVO> topic(String productCode, String deviceId, String deviceUuid, Integer pageNum, Integer pageSize);
 }

+ 34 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/enums/TopicInfo.java

@@ -0,0 +1,34 @@
+package com.usky.iot.service.enums;
+
+/**
+ *
+ * @author fyc
+ * @email yuchuan.fu@chinausky.com
+ * @date 2025/2/7
+ */
+public enum TopicInfo {
+
+    GATEWAY_DEVICE("网关设备","gatewayDevice"),
+    IOT_PLATFORM("物联网平台","IoTPlatform"),
+    ADD_REMARKS("网关设备添加子设备","add"),
+    INFO_REMARKS("网关设备指标数据上报","info"),
+    CONTROL_REMARKS("网关设备命令下发","control"),
+    CONTROL_RESPONSE_REMARKS("网关设备命令响应","controlResponse");
+
+    private String value;
+    private String letter;
+
+    TopicInfo(String value, String letter){
+        this.value = value;
+        this.letter = letter;
+    }
+
+
+    public String getValue() {
+        return value;
+    }
+
+    public String getLetter(){
+        return letter;
+    }
+}

ファイルの差分が大きいため隠しています
+ 328 - 265
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/DmpDeviceInfoServiceImpl.java


+ 35 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/vo/DmpTopicResponseVO.java

@@ -0,0 +1,35 @@
+package com.usky.iot.service.vo;
+
+import lombok.Data;
+
+/**
+ *
+ * @author fyc
+ * @email yuchuan.fu@chinausky.com
+ * @date 2025/2/7
+ */
+@Data
+public class DmpTopicResponseVO {
+
+    /**
+     * topic
+     **/
+    private String topic;
+
+    /**
+     * 发布者
+     **/
+    private String publisher;
+
+    /**
+     * 订阅者
+     **/
+    private String subscriber;
+
+    /**
+     * 备注
+     **/
+    private String remarks;
+
+
+}

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません