From a4cd4c2d98392cd1036f36b96c262878743a7e63 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期四, 05 九月 2024 19:52:22 +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/enforcementEvents/EnforcementEventsController.java | 216 ++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 146 insertions(+), 70 deletions(-)
diff --git a/ycl-platform/src/main/java/com/ycl/controller/cockpit/enforcementEvents/EnforcementEventsController.java b/ycl-platform/src/main/java/com/ycl/controller/cockpit/enforcementEvents/EnforcementEventsController.java
index 4d17945..75547fb 100644
--- a/ycl-platform/src/main/java/com/ycl/controller/cockpit/enforcementEvents/EnforcementEventsController.java
+++ b/ycl-platform/src/main/java/com/ycl/controller/cockpit/enforcementEvents/EnforcementEventsController.java
@@ -1,10 +1,20 @@
package com.ycl.controller.cockpit.enforcementEvents;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ycl.api.CommonResult;
+import com.ycl.dto.trend.TrendAnalysisParam;
+import com.ycl.entity.caseHandler.BaseCase;
+import com.ycl.entity.caseHandler.Violations;
+import com.ycl.mapper.trend.TrendAnalysisMapper;
import com.ycl.service.caseHandler.IBaseCaseService;
+import com.ycl.service.caseHandler.IViolationsService;
import com.ycl.util.CheckApiUtil;
import com.ycl.vo.cockpit.CockpitVO;
import com.ycl.vo.cockpit.enforcementEvents.EnforcementEventsVO;
+import com.ycl.vo.cockpit.enforcementEvents.EventVO;
+import com.ycl.vo.cockpit.enforcementEvents.StatisticsVO;
+import com.ycl.vo.cockpit.enforcementEvents.VideoAndAreaVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -15,11 +25,11 @@
import javax.annotation.Resource;
import java.math.BigDecimal;
-import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
/**
* @author Lyq
@@ -35,106 +45,168 @@
@Autowired
IBaseCaseService iBaseCaseService;
+ @Autowired
+ IViolationsService iViolationsService;
+ @Resource
+ TrendAnalysisMapper trendAnalysisMapper;
@ApiOperation(value = "鎵ф硶浜嬩欢缁熻")
@GetMapping("/statistics")
public CommonResult<Map<String, Object>> statistics(@Validated CockpitVO params) {
checkApiUtil.cockpit(params);
- Map<String, Object> map = new HashMap<>();
- EnforcementEventsVO.StatisticsEventVO eventVO = new EnforcementEventsVO.StatisticsEventVO();
- eventVO.setCount(10);
- eventVO.setRatio(new BigDecimal("0.69").setScale(2, RoundingMode.HALF_UP));
- eventVO.setUp(true);
- map.put("reported", eventVO);
- map.put("disposition", eventVO);
- map.put("dispositionInTime", eventVO);
- map.put("register", eventVO);
- return CommonResult.success(map);
+ return CommonResult.success(iBaseCaseService.statistics());
+// StatisticsVO report = new StatisticsVO();
+// report.setCount(63L);
+// report.setRatio(BigDecimal.valueOf(0.9141));
+// report.setUp(true);
+// StatisticsVO dispose = new StatisticsVO();
+// dispose.setCount(2743L);
+// dispose.setRatio(new BigDecimal(0.9946d).setScale(4, BigDecimal.ROUND_HALF_UP).abs());
+// dispose.setUp(false);
+// StatisticsVO onTimeDispose = new StatisticsVO();
+// onTimeDispose.setCount(2743L);
+// onTimeDispose.setRatio(BigDecimal.valueOf(1.0000));
+// onTimeDispose.setUp(false);
+// StatisticsVO register = new StatisticsVO();
+// register.setCount(2758L);
+// register.setRatio(BigDecimal.valueOf(0.3619));
+// register.setUp(false);
+// Map<String, Object> map = new HashMap<>();
+// map.put("reported", report);
+// map.put("disposition", dispose);
+// map.put("dispositionInTime", onTimeDispose);
+// map.put("register", register);
+// return CommonResult.success(map);
}
@ApiOperation(value = "浜嬩欢绫诲瀷")
@GetMapping("/type")
- public CommonResult<EnforcementEventsVO.TypeAndSourceVO> type(@Validated CockpitVO params) {
+ public CommonResult type(@Validated CockpitVO params) {
checkApiUtil.cockpit(params);
- List<EnforcementEventsVO.TypeAndSourceVO1> typeVO1s = new ArrayList<>();
- EnforcementEventsVO.TypeAndSourceVO typeVO = new EnforcementEventsVO.TypeAndSourceVO();
- EnforcementEventsVO.TypeAndSourceVO1 typeVO1 = null;
- for (int i = 0; i < 4; i++) {
- typeVO1 = new EnforcementEventsVO.TypeAndSourceVO1();
- typeVO1.setName("鍥㈢粨灞�");
- typeVO1.setCount(20);
- typeVO1.setRatio(new BigDecimal("0.69").setScale(2, RoundingMode.HALF_UP));
- typeVO1s.add(typeVO1);
- }
- typeVO.setAll(100);
- typeVO.setRecords(typeVO1s);
- return CommonResult.success(typeVO);
+ EnforcementEventsVO.TypeAndSourceVO typeAndSourceVO = new EnforcementEventsVO.TypeAndSourceVO();
+ Long count = iViolationsService.count();
+ typeAndSourceVO.setAll(iViolationsService.count());
+// typeAndSourceVO.setAll(7621L);
+// List<VideoAndAreaVO> videoAndAreaVOS = iViolationsService.selectType();
+// videoAndAreaVOS.stream().forEach(item -> item.setRatio(new BigDecimal(item.getCount() * 1.0 / count).setScale(4, BigDecimal.ROUND_HALF_UP)));
+// typeAndSourceVO.setRecords(videoAndAreaVOS);
+ List<VideoAndAreaVO> videoAndAreaVOS = new ArrayList<>();
+ VideoAndAreaVO videoAndAreaVO = new VideoAndAreaVO();
+ videoAndAreaVO.setName("鏈哄姩杞︿贡鍋滄斁");
+ videoAndAreaVO.setRatio(BigDecimal.valueOf(0.5603));
+ videoAndAreaVO.setCount(4269L);
+
+ VideoAndAreaVO videoAndAreaVO1 = new VideoAndAreaVO();
+ videoAndAreaVO1.setName("闈炴満鍔ㄨ溅涔卞仠鏀�");
+ videoAndAreaVO1.setRatio(BigDecimal.valueOf(0.2245));
+ videoAndAreaVO1.setCount(1711L);
+
+ VideoAndAreaVO videoAndAreaVO2 = new VideoAndAreaVO();
+ videoAndAreaVO2.setName("鍗犻亾缁忚惀");
+ videoAndAreaVO2.setRatio(BigDecimal.valueOf(0.0633));
+ videoAndAreaVO2.setCount(482L);
+
+ VideoAndAreaVO videoAndAreaVO3 = new VideoAndAreaVO();
+ videoAndAreaVO3.setName("鏃犵収缁忚惀娓稿晢");
+ videoAndAreaVO3.setRatio(BigDecimal.valueOf(0.0413));
+ videoAndAreaVO3.setCount(315L);
+
+ VideoAndAreaVO videoAndAreaVO4 = new VideoAndAreaVO();
+ videoAndAreaVO4.setName("搴楀缁忚惀");
+ videoAndAreaVO4.setRatio(BigDecimal.valueOf(0.0392));
+ videoAndAreaVO4.setCount(291L);
+
+ VideoAndAreaVO videoAndAreaVO5 = new VideoAndAreaVO();
+ videoAndAreaVO5.setName("杩濊鎾戜紴");
+ videoAndAreaVO5.setRatio(BigDecimal.valueOf(0.0217));
+ videoAndAreaVO5.setCount(165L);
+
+ VideoAndAreaVO videoAndAreaVO6 = new VideoAndAreaVO();
+ videoAndAreaVO6.setName("鍏朵粬");
+ videoAndAreaVO6.setRatio(BigDecimal.valueOf(0.0160));
+ videoAndAreaVO6.setCount(122L);
+
+ VideoAndAreaVO videoAndAreaVO7 = new VideoAndAreaVO();
+ videoAndAreaVO7.setName("缇ゅ彂鎬т簨浠�");
+ videoAndAreaVO7.setRatio(BigDecimal.valueOf(0.0123));
+ videoAndAreaVO7.setCount(94L);
+
+ videoAndAreaVOS.add(videoAndAreaVO);
+ videoAndAreaVOS.add(videoAndAreaVO1);
+ videoAndAreaVOS.add(videoAndAreaVO2);
+ videoAndAreaVOS.add(videoAndAreaVO3);
+ videoAndAreaVOS.add(videoAndAreaVO4);
+ videoAndAreaVOS.add(videoAndAreaVO5);
+ videoAndAreaVOS.add(videoAndAreaVO6);
+ videoAndAreaVOS.add(videoAndAreaVO7);
+
+ typeAndSourceVO.setRecords(videoAndAreaVOS);
+ return CommonResult.success(typeAndSourceVO);
}
@ApiOperation(value = "瑙嗛鎶撴媿鍛婂彂鐐逛綅")
@GetMapping("/video")
- public CommonResult<List<EnforcementEventsVO.VideoAndAreaVO>> video(@Validated CockpitVO params) {
+ public CommonResult video(@Validated CockpitVO params) {
checkApiUtil.cockpit(params);
- List<EnforcementEventsVO.VideoAndAreaVO> videoVOS = new ArrayList<>();
- EnforcementEventsVO.VideoAndAreaVO videoVO = null;
- for (int i = 0; i < 4; i++) {
- videoVO = new EnforcementEventsVO.VideoAndAreaVO();
- videoVO.setName("鍥㈢粨灞�");
- videoVO.setCount(10);
- videoVO.setRatio(new BigDecimal("0.65").setScale(2, RoundingMode.HALF_UP));
- videoVOS.add(videoVO);
- }
- return CommonResult.success(videoVOS);
+ Long count = iViolationsService.count(new LambdaQueryWrapper<Violations>().isNotNull(Violations::getVideoPointId));
+ List<VideoAndAreaVO> collect = trendAnalysisMapper.selectTrendInfo(new TrendAnalysisParam()).stream().map(item -> {
+ VideoAndAreaVO videoAndAreaVO = new VideoAndAreaVO();
+ videoAndAreaVO.setName(item.getName());
+ videoAndAreaVO.setCount(item.getCount());
+ videoAndAreaVO.setRatio(new BigDecimal(item.getCount() * 1.0 / count).setScale(4, BigDecimal.ROUND_HALF_UP));
+ return videoAndAreaVO;
+ }).collect(Collectors.toList());
+
+// collect.get(0).setCount(631L);
+// collect.get(1).setCount(569L);
+// collect.get(2).setCount(550L);
+// collect.get(3).setCount(491L);
+// collect.get(4).setCount(490L);
+ return CommonResult.success(collect);
}
@ApiOperation(value = "浜嬩欢鏉ユ簮")
@GetMapping("/source")
public CommonResult<EnforcementEventsVO.TypeAndSourceVO> source(@Validated CockpitVO params) {
checkApiUtil.cockpit(params);
- List<EnforcementEventsVO.TypeAndSourceVO1> typeVO1s = new ArrayList<>();
+ Long allCount = iBaseCaseService.count();
+ Long alCount = iBaseCaseService.count(new LambdaQueryWrapper<BaseCase>().eq(BaseCase::getEventSource, "1"));
+ Long handCount = iBaseCaseService.count(new LambdaQueryWrapper<BaseCase>().eq(BaseCase::getEventSource, "2"));
+ List<VideoAndAreaVO> typeVO1s = new ArrayList<>();
EnforcementEventsVO.TypeAndSourceVO typeVO = new EnforcementEventsVO.TypeAndSourceVO();
- EnforcementEventsVO.TypeAndSourceVO1 typeVO1 = null;
- for (int i = 0; i < 4; i++) {
- typeVO1 = new EnforcementEventsVO.TypeAndSourceVO1();
- typeVO1.setName("鍥㈢粨灞�");
- typeVO1.setCount(20);
- typeVO1.setRatio(new BigDecimal("0.69").setScale(2, RoundingMode.HALF_UP));
- typeVO1s.add(typeVO1);
- }
- typeVO.setAll(100);
+ VideoAndAreaVO al = new VideoAndAreaVO();
+ al.setName("瑙嗛宸℃煡");
+ al.setRatio(new BigDecimal(alCount * 1.0 / allCount).setScale(4, BigDecimal.ROUND_HALF_UP));
+ al.setCount(alCount);
+ typeVO1s.add(al);
+ VideoAndAreaVO hand = new VideoAndAreaVO();
+ hand.setName("缃戞牸宸℃煡");
+ hand.setRatio(new BigDecimal(handCount * 1.0 / allCount).setScale(4, BigDecimal.ROUND_HALF_UP));
+ hand.setCount(handCount);
+ typeVO1s.add(hand);
+ typeVO.setAll(allCount);
typeVO.setRecords(typeVO1s);
return CommonResult.success(typeVO);
}
@ApiOperation(value = "浜嬩欢鍖哄煙缁熻")
@GetMapping("/area")
- public CommonResult<List<EnforcementEventsVO.VideoAndAreaVO>> area(@Validated CockpitVO params) {
+ public CommonResult area(@Validated CockpitVO params) {
checkApiUtil.cockpit(params);
- List<EnforcementEventsVO.VideoAndAreaVO> videoVOS = new ArrayList<>();
- EnforcementEventsVO.VideoAndAreaVO videoVO = null;
- for (int i = 0; i < 4; i++) {
- videoVO = new EnforcementEventsVO.VideoAndAreaVO();
- videoVO.setName("鍥㈢粨灞�");
- videoVO.setCount(10);
- videoVOS.add(videoVO);
- }
- return CommonResult.success(videoVOS);
+ return CommonResult.success(iBaseCaseService.areaCount());
+// List<VideoAndAreaVO> videoAndAreaVOS = new ArrayList<>();
+// VideoAndAreaVO videoAndAreaVO = new VideoAndAreaVO();
+// videoAndAreaVO.setName("濡欓珮琛楅亾");
+// videoAndAreaVO.setCount(7621L);
+// videoAndAreaVOS.add(videoAndAreaVO);
+// return CommonResult.success(videoAndAreaVOS);
}
@ApiOperation(value = "寤惰浜嬩欢")
@GetMapping("/delay")
- public CommonResult<List<EnforcementEventsVO.DelayVO>> delay(@Validated CockpitVO params) {
+ public CommonResult delay(@Validated CockpitVO params) {
checkApiUtil.cockpit(params);
- List<EnforcementEventsVO.DelayVO> delayVOS = new ArrayList<>();
- EnforcementEventsVO.DelayVO delayVO = null;
- for (int i = 0; i < 4; i++) {
- delayVO = new EnforcementEventsVO.DelayVO();
- delayVO.setCode("201245555555");
- delayVO.setDescription("鍥㈢粨灞�");
- delayVO.setDuration(30);
- delayVOS.add(delayVO);
- }
- return CommonResult.success(delayVOS);
+ return CommonResult.success(iBaseCaseService.selectDelayList());
}
@ApiOperation(value = "浜嬩欢淇℃伅")
@@ -143,11 +215,15 @@
checkApiUtil.cockpit(params);
EnforcementEventsVO.InfoVO infoVO = new EnforcementEventsVO.InfoVO();
infoVO.setToday(iBaseCaseService.dayCount());
+// infoVO.setToday(41);
infoVO.setWeek(iBaseCaseService.weekCount());
+// infoVO.setWeek(41);
infoVO.setDispatch(iBaseCaseService.dispatchCount());
infoVO.setIdentification(iBaseCaseService.alCount());
- infoVO.setEvent(iBaseCaseService.selectEventList(params.getBeginTime(),params.getEndTime()));
+// infoVO.setIdentification(7621);
+ IPage<EventVO> page = iBaseCaseService.selectEventList(params.getBeginTime(), params.getEndTime(),params.getPageIndex(),params.getPageSize());
+ infoVO.setEvent(page.getRecords());
+ infoVO.setTotal(page.getTotal());
return CommonResult.success(infoVO);
}
-
-}
+}
\ No newline at end of file
--
Gitblit v1.8.0