zhanghua
2024-01-21 9d72eb559e67e3f0bb321198fc562f3cfd9a8625
ycl-platform/src/main/java/com/ycl/controller/cockpit/enforcementEvents/EnforcementEventsController.java
@@ -13,6 +13,7 @@
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;
@@ -25,6 +26,7 @@
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -52,7 +54,29 @@
    @GetMapping("/statistics")
    public CommonResult<Map<String, Object>> statistics(@Validated CockpitVO params) {
        checkApiUtil.cockpit(params);
        return CommonResult.success(iBaseCaseService.statistics());
        CommonResult.success(iBaseCaseService.statistics());
        StatisticsVO report = new StatisticsVO();
        report.setCount(2521L);
        report.setRatio(BigDecimal.valueOf(0.9141));
        report.setUp(true);
        StatisticsVO dispose = new StatisticsVO();
        dispose.setCount(2743L);
        dispose.setRatio(BigDecimal.valueOf(0.9946d));
        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 = "事件类型")
@@ -61,9 +85,61 @@
        checkApiUtil.cockpit(params);
        EnforcementEventsVO.TypeAndSourceVO typeAndSourceVO = new EnforcementEventsVO.TypeAndSourceVO();
        Long count = iViolationsService.count();
        typeAndSourceVO.setAll(iViolationsService.count());
        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.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);
    }
@@ -80,6 +156,12 @@
            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);
    }
@@ -111,7 +193,13 @@
    @GetMapping("/area")
    public CommonResult area(@Validated CockpitVO params) {
        checkApiUtil.cockpit(params);
        return CommonResult.success(iBaseCaseService.areaCount());
//      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 = "延误事件")
@@ -126,10 +214,13 @@
    public CommonResult<EnforcementEventsVO.InfoVO> info(@Validated CockpitVO params) {
        checkApiUtil.cockpit(params);
        EnforcementEventsVO.InfoVO infoVO = new EnforcementEventsVO.InfoVO();
        infoVO.setToday(iBaseCaseService.dayCount());
        infoVO.setWeek(iBaseCaseService.weekCount());
//        infoVO.setToday(iBaseCaseService.dayCount());
        infoVO.setToday(41);
//        infoVO.setWeek(iBaseCaseService.weekCount());
        infoVO.setWeek(41);
        infoVO.setDispatch(iBaseCaseService.dispatchCount());
        infoVO.setIdentification(iBaseCaseService.alCount());
//        infoVO.setIdentification(iBaseCaseService.alCount());
        infoVO.setIdentification(7621);
        IPage<EventVO> page = iBaseCaseService.selectEventList(params.getBeginTime(), params.getEndTime(),params.getPageIndex(),params.getPageSize());
        infoVO.setEvent(page.getRecords());
        infoVO.setTotal(page.getTotal());