package com.ycl.controller.cockpit.statisticsEvents; import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.ycl.api.CommonResult; import com.ycl.entity.cockpitManage.TeamConstruction; import com.ycl.entity.cockpitManage.TeamIndex; import com.ycl.service.cockpitManage.ITeamConstructionService; import com.ycl.service.video.impl.IVideoPointService; import com.ycl.util.CheckApiUtil; import com.ycl.vo.cockpit.CockpitVO; import com.ycl.vo.cockpit.statisticsEvents.StatisticsEventsVO; import com.ycl.vo.equipment.VideoPointVo; 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; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.ArrayList; import java.util.List; /** * @author Lyq * @version 1.0 * @date 2022/10/26 */ @Api(tags = "驾驶舱数据接口-综合决策") @RestController @RequestMapping("/api/data") public class StatisticsEventsController { @Resource private CheckApiUtil checkApiUtil; private IVideoPointService videoPointService; private ITeamConstructionService teamConstructionService; @Autowired public void setTeamConstructionService(ITeamConstructionService teamConstructionService) { this.teamConstructionService = teamConstructionService; } @Autowired public void setVideoPointService(IVideoPointService videoPointService) { this.videoPointService = videoPointService; } @ApiOperation(value = "执法事件") @GetMapping("/law_enforcement_event") public CommonResult> detection(@Validated CockpitVO params) { checkApiUtil.cockpit(params); List lawEnforcementEventVOS = new ArrayList<>(); StatisticsEventsVO.LawEnforcementEventVO a = null; for (int i = 0; i < 4; i++) { a = new StatisticsEventsVO.LawEnforcementEventVO(); a.setName("团结屯"); a.setMonth("10"); a.setCityManagementCount(10); a.setEnforcementEventCount(10); lawEnforcementEventVOS.add(a); } return CommonResult.success(lawEnforcementEventVOS); } @ApiOperation(value = "物联感知") @GetMapping("/lot") public CommonResult> lot(@Validated CockpitVO params) { checkApiUtil.cockpit(params); List lotVOS = new ArrayList<>(); StatisticsEventsVO.LotVO a = null; for (int i = 0; i < 4; i++) { a = new StatisticsEventsVO.LotVO(); a.setName("团结屯"); a.setType("摄像头"); a.setCount(10); a.setRatio(new BigDecimal("-0.3").setScale(2, RoundingMode.HALF_UP)); lotVOS.add(a); } return CommonResult.success(lotVOS); } @ApiOperation(value = "执法队伍") @GetMapping("/team") public CommonResult team(@Validated CockpitVO params) { checkApiUtil.cockpit(params); StatisticsEventsVO.TeamVO teamVO = new StatisticsEventsVO.TeamVO(); teamVO.setAll(30); teamVO.setAssistant(10); teamVO.setOfficer(10); teamVO.setSecondOfficer(1); teamVO.setOffline(10); teamVO.setOnline(20); return CommonResult.success(teamVO); } @ApiOperation(value = "网格员") @GetMapping("/grid_member") public CommonResult> gridMember(@Validated CockpitVO params) { checkApiUtil.cockpit(params); List gridMemberVOS = new ArrayList<>(); StatisticsEventsVO.GridMemberVO a = null; for (int i = 0; i < 4; i++) { a = new StatisticsEventsVO.GridMemberVO(); a.setRatio(new BigDecimal("0.20").setScale(2, RoundingMode.HALF_UP)); a.setName("团结屯"); a.setCount(10); gridMemberVOS.add(a); } return CommonResult.success(gridMemberVOS); } @ApiOperation(value = "指数体征") @GetMapping("/index_signs") public CommonResult indexSigns(@Validated CockpitVO params) { checkApiUtil.cockpit(params); StatisticsEventsVO.IndexSignsVO indexSignsVO = new StatisticsEventsVO.IndexSignsVO(); indexSignsVO.setEvent(1); indexSignsVO.setGridMember(20); indexSignsVO.setCompletePercentage(new BigDecimal("0.60").setScale(2, RoundingMode.HALF_UP)); indexSignsVO.setEquipment(30); indexSignsVO.setAccuracy(new BigDecimal("0.80").setScale(2, RoundingMode.HALF_UP)); indexSignsVO.setTrigger(10); indexSignsVO.setLot(30); indexSignsVO.setLotOnline(10); indexSignsVO.setCityData(10); indexSignsVO.setEvaluationData(10); return CommonResult.success(indexSignsVO); } @ApiOperation(value = "top10") @GetMapping("/top10") public CommonResult> top10(@Validated CockpitVO params) { checkApiUtil.cockpit(params); List ls = new ArrayList<>(); ls.add(new StatisticsEventsVO.Top10VO("xx中队", 100.0)); ls.add(new StatisticsEventsVO.Top10VO("xx中队", 90.0)); ls.add(new StatisticsEventsVO.Top10VO("xx中队", 80.0)); ls.add(new StatisticsEventsVO.Top10VO("xx中队", 70.0)); return CommonResult.success(ls); } @ApiOperation(value = "AI算法") @GetMapping("/arithmetic_event") public CommonResult> arithmeticEvent(@Validated CockpitVO params) { checkApiUtil.cockpit(params); List ls = new ArrayList<>(); ls.add(new StatisticsEventsVO.ArithmeticVO("xx中队", 10, 0.1)); ls.add(new StatisticsEventsVO.ArithmeticVO("xx中队", 20, 0.2)); ls.add(new StatisticsEventsVO.ArithmeticVO("xx中队", 30, 0.3)); ls.add(new StatisticsEventsVO.ArithmeticVO("xx中队", 40, 0.4)); return CommonResult.success(ls); } @ApiOperation(value = "城市体征看板") @GetMapping("/city_panel") public CommonResult cityPanel(@Validated CockpitVO params) { checkApiUtil.cockpit(params); StatisticsEventsVO.CityPanelVo vo = new StatisticsEventsVO.CityPanelVo(92, true, 22, false, 12, true, 22, false, 34, true, 99, false, 9, true, 34, false, 6, true); return CommonResult.success(vo); } @ApiOperation(value = "点位") @GetMapping("/video_point") public CommonResult> videoPoint(@Validated CockpitVO params) { checkApiUtil.cockpit(params); IPage page = videoPointService.getList(null, null, 1, 500); return CommonResult.success(page.getRecords()); } @ApiOperation(value = "队伍建设") @GetMapping("/team_construction") public CommonResult> teamConstruction(@Validated CockpitVO params) { checkApiUtil.cockpit(params); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().eq(TeamConstruction::getStatus, 1).eq(TeamConstruction::getIsDelete, 0); List list = teamConstructionService.list(queryWrapper); return CommonResult.success(list); } @ApiOperation(value = "中队指数体征") @GetMapping("/team_index") public CommonResult> teamIndex(@Validated CockpitVO params) { checkApiUtil.cockpit(params); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().eq(TeamConstruction::getStatus, 1).eq(TeamConstruction::getIsDelete, 0); List list = teamConstructionService.list(queryWrapper); List teamIndexList = BeanUtil.copyToList(list, TeamIndex.class); teamIndexList.forEach(o -> { o.setStepTimely(0.6); o.setStepDelayed(0.3); o.setStepOvertime(0.1); o.setHandleTimely(0.6); o.setHandleDelayed(0.2); o.setHandleOvertime(0.1); o.setNoHandle(0.1); }); return CommonResult.success(teamIndexList); } }