From 704e7207d74b6477c5f472c5aba92d484ab17f98 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期三, 29 十一月 2023 17:07:11 +0800
Subject: [PATCH] Merge branch 'master' of http://42.193.1.25:9521/r/sccg_server

---
 ycl-platform/src/main/java/com/ycl/controller/cockpit/aiIot/AIIotController.java |   44 ++++++++++++++++++++------------------------
 1 files changed, 20 insertions(+), 24 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 f1e4ead..d6ff0a3 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
@@ -12,6 +12,7 @@
 import com.ycl.util.CheckApiUtil;
 import com.ycl.util.VideoUtil;
 import com.ycl.vo.cockpit.CockpitVO;
+import com.ycl.vo.cockpit.aiIot.AIIotStatisticsVO;
 import com.ycl.vo.cockpit.aiIot.AIIotVO;
 import com.ycl.vo.cockpit.aiIot.EfficiencyVO;
 import com.ycl.vo.cockpit.aiIot.VideoVO;
@@ -58,6 +59,7 @@
     @Autowired
     IEfficiencyService iEfficiencyService;
 
+
     @ApiOperation(value = "鐩戞祴鏁版嵁")
     @GetMapping("/detection")
     public CommonResult<AIIotVO.DetectionVO> detection(@Validated CockpitVO params) {
@@ -65,9 +67,9 @@
         AIIotVO.DetectionVO detectionVO = new AIIotVO.DetectionVO();
         detectionVO.setVideo(iVideoPointService.count());
         detectionVO.setIndividual(iHandheldTerminalService.count());
-        detectionVO.setLampblack(154L);
-        /// TODO: 2022/12/13 缂哄皯娌圭儫鏈虹洃鎺ц〃
-        detectionVO.setLoudspeaker(loudspeakerService.count());
+        detectionVO.setLampblack(iEfficiencyService.getSmokeCustomer());
+
+        detectionVO.setLoudspeaker(34L);
         detectionVO.setSlagCar(iCarSlagcarService.count());
         return CommonResult.success(detectionVO);
     }
@@ -79,7 +81,7 @@
         /// TODO: 2022/12/13  瑙嗛鐐逛綅璁惧涓虹┖ 娌℃暟鎹�
         List<VideoPoint> list = iVideoPointService.list(new LambdaQueryWrapper<VideoPoint>()
                 .eq(params.getStreetId() != null, VideoPoint::getStreetId, params.getStreetId())
-                .isNotNull(VideoPoint::getPlatResourceId));
+                .isNotNull(VideoPoint::getPlatResourceId).orderByDesc(VideoPoint::getId));
 
         List<VideoVO> vos = list.stream().map(item -> {
             VideoVO videoVO = new VideoVO();
@@ -90,6 +92,7 @@
             videoVO.setLatitude(item.getLatitude() != null ? item.getLatitude().toString() : "");
             videoVO.setLongitude(item.getLongitude() != null ? item.getLongitude().toString() : "");
             videoVO.setResourceId(item.getPlatResourceId());
+            videoVO.setCode(item.getCode());
             return videoVO;
         }).collect(Collectors.toList());
 
@@ -102,14 +105,17 @@
     public CommonResult efficiency(@Validated CockpitVO params) {
         checkApiUtil.cockpit(params);
         List<EfficiencyDto> list = iEfficiencyService.list();
-        int sum = list.stream().mapToInt(EfficiencyDto::getNumber).sum();
         List<EfficiencyVO> efficiencyVOS = list.stream().map((Function<EfficiencyDto, EfficiencyVO>) efficiencyDto -> {
             EfficiencyVO a = new EfficiencyVO();
             a.setType(efficiencyDto.getName());
             a.setCount(efficiencyDto.getNumber());
-            a.setRatio(new BigDecimal((double)efficiencyDto.getNumber() / (double) sum).setScale(2, RoundingMode.HALF_UP));
+            a.setRatio(1.0 - ((double) efficiencyDto.getErrorNumber() / (double) efficiencyDto.getNumber()));
             return a;
         }).collect(Collectors.toList());
+        efficiencyVOS.add(new EfficiencyVO("搴楀缁忚惀", 0, 0.0));
+        efficiencyVOS.add(new EfficiencyVO("娌胯鏅炬檼", 0, 0.0));
+        efficiencyVOS.add(new EfficiencyVO("鏃犵収缁忚惀娓稿晢", 0, 0.0));
+        efficiencyVOS.add(new EfficiencyVO("杩濊鎾戜紴", 0, 0.0));
         return CommonResult.success(efficiencyVOS);
     }
 
@@ -117,31 +123,21 @@
     @GetMapping("/slag_car")
     public CommonResult<AIIotVO.SlagCarVO> slagCar(@Validated CockpitVO params) {
         checkApiUtil.cockpit(params);
+
         AIIotVO.SlagCarVO slagCarVO = new AIIotVO.SlagCarVO();
-        slagCarVO.setCar(236);
-        slagCarVO.setTeam(20);
+        slagCarVO.setCar(iCarSlagcarService.count());
+        slagCarVO.setTeam(0L);
+
         return CommonResult.success(slagCarVO);
     }
 
     @ApiOperation(value = "AI浜嬩欢缁熻")
     @GetMapping("/event_statistics")
-    public CommonResult<List<AIIotVO.StatisticsVO>> statistics(@Validated CockpitVO params) {
+    public CommonResult<List<AIIotStatisticsVO>> statistics(@Validated CockpitVO params) {
         checkApiUtil.cockpit(params);
-        List<AIIotVO.StatisticsVO> statisticsVOS = new ArrayList<>();
-        List<AIIotVO.Statistics1VO> statistics1VOS = new ArrayList<>();
-        AIIotVO.StatisticsVO a = null;
-        AIIotVO.Statistics1VO a1 = null;
-        for (int i = 0; i < 4; i++) {
-            a = new AIIotVO.StatisticsVO();
-            a1 = new AIIotVO.Statistics1VO();
-            a.setType("閬撹矾鐮存崯");
-            a1.setCount(12);
-            a1.setMonth("2022-10");
-            statistics1VOS.add(a1);
-            a.setRecords(statistics1VOS);
-            statisticsVOS.add(a);
-        }
-        return CommonResult.success(statisticsVOS);
+
+        List<AIIotStatisticsVO> list = iEfficiencyService.aiMonthList(params.getBeginTime(), params.getEndTime());
+        return CommonResult.success(list);
     }
 
 

--
Gitblit v1.8.0