From bd8147d7890bf60d88e4007c1af726ba5f364cf5 Mon Sep 17 00:00:00 2001
From: baizonghao <1719256278@qq.com>
Date: 星期二, 14 三月 2023 11:24:31 +0800
Subject: [PATCH] 拼接地址

---
 ycl-platform/src/main/java/com/ycl/controller/cockpit/aiIot/AIIotController.java |   46 +++++++++++++++++++++++++++++++++-------------
 1 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/ycl-platform/src/main/java/com/ycl/controller/cockpit/aiIot/AIIotController.java b/ycl-platform/src/main/java/com/ycl/controller/cockpit/aiIot/AIIotController.java
index a95b420..678e003 100644
--- a/ycl-platform/src/main/java/com/ycl/controller/cockpit/aiIot/AIIotController.java
+++ b/ycl-platform/src/main/java/com/ycl/controller/cockpit/aiIot/AIIotController.java
@@ -1,11 +1,17 @@
 package com.ycl.controller.cockpit.aiIot;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ycl.api.CommonResult;
+import com.ycl.entity.video.VideoPoint;
+import com.ycl.service.carManage.ICarSlagcarService;
+import com.ycl.service.equipment.IHandheldTerminalService;
+import com.ycl.service.equipment.ILoudspeakerService;
 import com.ycl.service.video.impl.IVideoPointService;
 import com.ycl.util.CheckApiUtil;
 import com.ycl.util.VideoUtil;
 import com.ycl.vo.cockpit.CockpitVO;
 import com.ycl.vo.cockpit.aiIot.AIIotVO;
+import com.ycl.vo.cockpit.aiIot.EfficiencyVO;
 import com.ycl.vo.cockpit.aiIot.VideoVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -39,17 +45,24 @@
     private IVideoPointService iVideoPointService;
     @Autowired
     private VideoUtil videoUtil;
+    @Autowired
+    IHandheldTerminalService iHandheldTerminalService;
+    @Autowired
+    ILoudspeakerService loudspeakerService;
+    @Autowired
+    ICarSlagcarService iCarSlagcarService;
 
     @ApiOperation(value = "鐩戞祴鏁版嵁")
     @GetMapping("/detection")
     public CommonResult<AIIotVO.DetectionVO> detection(@Validated CockpitVO params) {
         checkApiUtil.cockpit(params);
         AIIotVO.DetectionVO detectionVO = new AIIotVO.DetectionVO();
-        detectionVO.setVideo(121);
-        detectionVO.setIndividual(20);
-        detectionVO.setLampblack(154);
-        detectionVO.setLoudspeaker(30);
-        detectionVO.setSlagCar(33);
+        detectionVO.setVideo(iVideoPointService.count());
+        detectionVO.setIndividual(iHandheldTerminalService.count());
+        detectionVO.setLampblack(154L);
+        /// TODO: 2022/12/13 缂哄皯娌圭儫鏈虹洃鎺ц〃
+        detectionVO.setLoudspeaker(loudspeakerService.count());
+        detectionVO.setSlagCar(iCarSlagcarService.count());
         return CommonResult.success(detectionVO);
     }
 
@@ -57,27 +70,34 @@
     @GetMapping("/video")
     public CommonResult video(@Validated CockpitVO params) {
         checkApiUtil.cockpit(params);
-        return CommonResult.success(iVideoPointService.list().stream().map(item -> {
+        /// TODO: 2022/12/13  瑙嗛鐐逛綅璁惧涓虹┖ 娌℃暟鎹�
+        List<VideoPoint> list = iVideoPointService.list(new LambdaQueryWrapper<VideoPoint>()
+                .eq(params.getStreetId() != null, VideoPoint::getStreetId, params.getStreetId())
+                .isNotNull(VideoPoint::getPlatResourceId));
+
+        List<VideoVO> vos = list.stream().map(item -> {
             VideoVO videoVO = new VideoVO();
             videoVO.setName(item.getName());
             videoVO.setBrand(item.getEquipmentBrand());
             videoVO.setModel(item.getEquipmentModel());
             videoVO.setIp(item.getEquipmentIp());
-            videoVO.setLatitude(item.getLatitude().toString());
-            videoVO.setLongitude(item.getLongitude().toString());
+            videoVO.setLatitude(item.getLatitude() != null ? item.getLatitude().toString() : "");
+            videoVO.setLongitude(item.getLongitude() != null ? item.getLongitude().toString() : "");
             videoVO.setResourceId(item.getPlatResourceId());
             return videoVO;
-        }).collect(Collectors.toList()));
+        }).collect(Collectors.toList());
+
+        return CommonResult.success(vos);
+
     }
 
     @ApiOperation(value = "AI绠楁硶鏁堣兘")
     @GetMapping("/efficiency")
-    public CommonResult<List<AIIotVO.EfficiencyVO>> efficiency(@Validated CockpitVO params) {
+    public CommonResult efficiency(@Validated CockpitVO params) {
         checkApiUtil.cockpit(params);
-        List<AIIotVO.EfficiencyVO> efficiencyVOS = new ArrayList<>();
-        AIIotVO.EfficiencyVO a = null;
+        List<EfficiencyVO> efficiencyVOS = new ArrayList<>();
         for (int i = 0; i < 4; i++) {
-            a = new AIIotVO.EfficiencyVO();
+            EfficiencyVO a = new EfficiencyVO();
             a.setType("閬撹矾鐮存崯");
             a.setCount(12);
             a.setRatio(new BigDecimal("0.63").setScale(2, RoundingMode.HALF_UP));

--
Gitblit v1.8.0