Browse Source

视联网,物联网,云广播增加按分类查询统计数量

Wang-Xiao-Ran 1 year ago
parent
commit
ff558331d1

+ 3 - 0
src/main/java/com/sooka/sponest/mobile/remoteapi/RemoteSystemBaseService.java

@@ -212,4 +212,7 @@ public interface RemoteSystemBaseService {
 
     @GetMapping("/dept/getChildren/{deptId}/{postId}")
     AjaxResult getChildren(@PathVariable("deptId") String deptId, @PathVariable("postId") String postId);
+
+    @GetMapping("/dict/data/internetOfThings/{dictType}")
+    AjaxResult getSortByTypeAndCount(@PathVariable("dictType") String dictType);
 }

+ 5 - 0
src/main/java/com/sooka/sponest/mobile/remoteapi/factory/RemoteSystemBaseServiceFallbackFactory.java

@@ -181,6 +181,11 @@ public class RemoteSystemBaseServiceFallbackFactory implements FallbackFactory<R
             public AjaxResult getChildren(String deptId, String postId) {
                 return null;
             }
+
+            @Override
+            public AjaxResult getSortByTypeAndCount(String dictType) {
+                return null;
+            }
         };
     }
 

+ 20 - 1
src/main/java/com/sooka/sponest/mobile/system/camera/controller/AppCameraController.java

@@ -228,7 +228,6 @@ public class AppCameraController extends AppBaseController {
      * camera_use 视联网
      * device_type 物联网
      * broadcast_use 云广播
-     *
      * @return
      */
     @GetMapping("/getSortByType")
@@ -244,6 +243,26 @@ public class AppCameraController extends AppBaseController {
         }
     }
 
+    /**
+     * 根据类型查询分类并统计数量
+     * camera_use 视联网
+     * device_type 物联网
+     * broadcast_use 云广播
+     * @return
+     */
+    @GetMapping("/getSortByTypeAndCount")
+    public AjaxResult getSortByTypeAndCount(@RequestParam("dictType") String dictType) {
+        if ("device_type".equals(dictType)) {
+            AjaxResult result = remoteSystemBaseService.getSortByTypeAndCount(dictType);
+            List<Map<String, Object>> data = (List<Map<String, Object>>) result.get("data");
+            List<Map<String, Object>> cameraUse = (List<Map<String, Object>>) remoteSystemBaseService.getSortByTypeAndCount("camera_use").get("data");
+            data.addAll(screenSort(cameraUse));
+            return result;
+        } else {
+            return remoteSystemBaseService.getSortByTypeAndCount(dictType);
+        }
+    }
+
     public List<Map<String, Object>> screenSort(List<Map<String, Object>> data) {
         List<Map<String, Object>> result = data.stream()
                 .filter(datum -> {