| | |
| | | package com.ycl.controller.cockpit.enforcementEvents; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ycl.api.CommonResult; |
| | | import com.ycl.entity.caseHandler.BaseCase; |
| | | import com.ycl.service.caseHandler.IBaseCaseService; |
| | | import com.ycl.util.CheckApiUtil; |
| | | import com.ycl.vo.cockpit.CockpitVO; |
| | | import com.ycl.vo.cockpit.enforcementEvents.EnforcementEventsVO; |
| | | import com.ycl.vo.cockpit.enforcementEvents.VideoAndAreaVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | @Resource |
| | | private CheckApiUtil checkApiUtil; |
| | | |
| | | @Autowired |
| | | IBaseCaseService iBaseCaseService; |
| | | |
| | | @ApiOperation(value = "执法事件统计") |
| | | @GetMapping("/statistics") |
| | | public CommonResult<Map<String, Object>> statistics(@Validated CockpitVO.Params2VO params) { |
| | | checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), params.getBeginTime(), params.getEndTime(),null); |
| | | 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); |
| | |
| | | |
| | | @ApiOperation(value = "事件类型") |
| | | @GetMapping("/type") |
| | | public CommonResult<EnforcementEventsVO.TypeAndSourceVO> type(@Validated CockpitVO.Params2VO params) { |
| | | checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), params.getBeginTime(), params.getEndTime(),null); |
| | | 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); |
| | | public CommonResult type(@Validated CockpitVO params) { |
| | | checkApiUtil.cockpit(params); |
| | | EnforcementEventsVO.TypeAndSourceVO typeAndSourceVO = new EnforcementEventsVO.TypeAndSourceVO(); |
| | | Long allCount = iBaseCaseService.count(); |
| | | Long violationCount = iBaseCaseService.count(new LambdaQueryWrapper<BaseCase>().eq(BaseCase::getCategory, "1")); |
| | | Long illegalBuildingCount = iBaseCaseService.count(new LambdaQueryWrapper<BaseCase>().eq(BaseCase::getCategory, "2")); |
| | | |
| | | ArrayList<VideoAndAreaVO> typeAndSourceVO1s = new ArrayList<>(); |
| | | VideoAndAreaVO violationVO1 = new VideoAndAreaVO(); |
| | | violationVO1.setName("违规"); |
| | | violationVO1.setCount(violationCount); |
| | | violationVO1.setRatio(new BigDecimal(violationCount * 1.0 / allCount).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | VideoAndAreaVO illegalBuildingVO1 = new VideoAndAreaVO(); |
| | | illegalBuildingVO1.setName("违建"); |
| | | illegalBuildingVO1.setCount(illegalBuildingCount); |
| | | illegalBuildingVO1.setRatio(new BigDecimal(illegalBuildingCount * 1.0 / allCount).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | typeAndSourceVO1s.add(violationVO1); |
| | | typeAndSourceVO1s.add(illegalBuildingVO1); |
| | | typeAndSourceVO.setRecords(typeAndSourceVO1s); |
| | | typeAndSourceVO.setAll(allCount); |
| | | System.out.println(illegalBuildingCount / allCount); |
| | | return CommonResult.success(typeAndSourceVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "视频抓拍告发点位") |
| | | @GetMapping("/video") |
| | | public CommonResult<List<EnforcementEventsVO.VideoAndAreaVO>> video(@Validated CockpitVO.Params2VO params) { |
| | | checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), params.getBeginTime(), params.getEndTime(),null); |
| | | List<EnforcementEventsVO.VideoAndAreaVO> videoVOS = new ArrayList<>(); |
| | | EnforcementEventsVO.VideoAndAreaVO videoVO = null; |
| | | public CommonResult video(@Validated CockpitVO params) { |
| | | checkApiUtil.cockpit(params); |
| | | List<VideoAndAreaVO> videoVOS = new ArrayList<>(); |
| | | VideoAndAreaVO videoVO = null; |
| | | for (int i = 0; i < 4; i++) { |
| | | videoVO = new EnforcementEventsVO.VideoAndAreaVO(); |
| | | videoVO = new VideoAndAreaVO(); |
| | | videoVO.setName("团结屯"); |
| | | videoVO.setCount(10); |
| | | videoVO.setCount(10L); |
| | | videoVO.setRatio(new BigDecimal("0.65").setScale(2, RoundingMode.HALF_UP)); |
| | | videoVOS.add(videoVO); |
| | | } |
| | |
| | | |
| | | @ApiOperation(value = "事件来源") |
| | | @GetMapping("/source") |
| | | public CommonResult<EnforcementEventsVO.TypeAndSourceVO> source(@Validated CockpitVO.Params2VO params) { |
| | | checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), params.getBeginTime(), params.getEndTime(),null); |
| | | List<EnforcementEventsVO.TypeAndSourceVO1> typeVO1s = new ArrayList<>(); |
| | | public CommonResult<EnforcementEventsVO.TypeAndSourceVO> source(@Validated CockpitVO params) { |
| | | checkApiUtil.cockpit(params); |
| | | 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(2, 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(2, 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.Params2VO params) { |
| | | checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), params.getBeginTime(), params.getEndTime(),null); |
| | | 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); |
| | | public CommonResult area(@Validated CockpitVO params) { |
| | | checkApiUtil.cockpit(params); |
| | | return CommonResult.success(iBaseCaseService.areaCount()); |
| | | } |
| | | |
| | | @ApiOperation(value = "延误事件") |
| | | @GetMapping("/delay") |
| | | public CommonResult<List<EnforcementEventsVO.DelayVO>> delay(@Validated CockpitVO.Params2VO params) { |
| | | checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), params.getBeginTime(), params.getEndTime(),null); |
| | | 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); |
| | | public CommonResult delay(@Validated CockpitVO params) { |
| | | checkApiUtil.cockpit(params); |
| | | return CommonResult.success(iBaseCaseService.selectDelayList()); |
| | | } |
| | | |
| | | @ApiOperation(value = "事件信息") |
| | | @GetMapping("/info") |
| | | public CommonResult<EnforcementEventsVO.InfoVO> info(@Validated CockpitVO.Params2VO params) { |
| | | checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), params.getBeginTime(), params.getEndTime(),null); |
| | | public CommonResult<EnforcementEventsVO.InfoVO> info(@Validated CockpitVO params) { |
| | | checkApiUtil.cockpit(params); |
| | | EnforcementEventsVO.InfoVO infoVO = new EnforcementEventsVO.InfoVO(); |
| | | EnforcementEventsVO.EventVO eventVO = new EnforcementEventsVO.EventVO(); |
| | | infoVO.setToday(5); |
| | | infoVO.setWeek(10); |
| | | infoVO.setDispatch(20); |
| | | infoVO.setIdentification(20); |
| | | eventVO.setDescription("事件描述"); |
| | | eventVO.setAddress("事发地址"); |
| | | eventVO.setAlarmTime("2022-10-15 16:12:13"); |
| | | eventVO.setPoint("1号点位"); |
| | | eventVO.setPicture("http://12.2.23.4/xx.png"); |
| | | eventVO.setSource("AI识别"); |
| | | infoVO.setEvent(eventVO); |
| | | infoVO.setToday(iBaseCaseService.dayCount()); |
| | | infoVO.setWeek(iBaseCaseService.weekCount()); |
| | | infoVO.setDispatch(iBaseCaseService.dispatchCount()); |
| | | infoVO.setIdentification(iBaseCaseService.alCount()); |
| | | infoVO.setEvent(iBaseCaseService.selectEventList(params.getBeginTime(), params.getEndTime())); |
| | | return CommonResult.success(infoVO); |
| | | } |
| | | |
| | | } |
| | | } |