From 6c56f35bef519265b4e7ae98fda6ca87855daf9f Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期四, 15 十二月 2022 11:29:08 +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 | 82 ++++++++++++++++++++++++---------------- 1 files changed, 49 insertions(+), 33 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 178c339..bb5c16d 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 @@ -1,16 +1,23 @@ package com.ycl.controller.cockpit.aiIot; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ycl.api.CommonResult; +import com.ycl.entity.video.VideoPoint; +import com.ycl.service.carManage.ICarSlagcarService; +import com.ycl.service.equipment.IHandheldTerminalService; +import com.ycl.service.equipment.ILoudspeakerService; +import com.ycl.service.video.impl.IVideoPointService; import com.ycl.util.CheckApiUtil; +import com.ycl.util.VideoUtil; import com.ycl.vo.cockpit.CockpitVO; import com.ycl.vo.cockpit.aiIot.AIIotVO; +import com.ycl.vo.cockpit.aiIot.VideoVO; import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; 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.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @@ -18,6 +25,7 @@ import java.math.RoundingMode; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; /** * @author Lyq @@ -32,45 +40,53 @@ @Resource private CheckApiUtil checkApiUtil; + @Autowired + private IVideoPointService iVideoPointService; + @Autowired + private VideoUtil videoUtil; + @Autowired + IHandheldTerminalService iHandheldTerminalService; + @Autowired + ILoudspeakerService loudspeakerService; + @Autowired + ICarSlagcarService iCarSlagcarService; + @ApiOperation(value = "鐩戞祴鏁版嵁") @GetMapping("/detection") - public CommonResult<AIIotVO.DetectionVO> detection(@Validated CockpitVO.Params1VO params) { - checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), null, null,null); + public CommonResult<AIIotVO.DetectionVO> detection(@Validated CockpitVO params) { + checkApiUtil.cockpit(params); AIIotVO.DetectionVO detectionVO = new AIIotVO.DetectionVO(); - detectionVO.setVideo(121); - detectionVO.setIndividual(20); - detectionVO.setLampblack(154); - detectionVO.setLoudspeaker(30); - detectionVO.setSlagCar(33); + detectionVO.setVideo(iVideoPointService.count()); + detectionVO.setIndividual(iHandheldTerminalService.count()); + detectionVO.setLampblack(154L); + /// TODO: 2022/12/13 缂哄皯娌圭儫鏈虹洃鎺ц〃 + detectionVO.setLoudspeaker(loudspeakerService.count()); + detectionVO.setSlagCar(iCarSlagcarService.count()); return CommonResult.success(detectionVO); } @ApiOperation(value = "瀹炴椂瑙嗛鐩戞帶") @GetMapping("/video") - @ApiImplicitParam(name = "regionId",value = "鍦板尯Id",required = true,dataType = "String") - public CommonResult<List<AIIotVO.VideoVO>> video(@Validated CockpitVO.Params1VO params, @RequestParam(required = true)String regionId) { - checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), null, null,regionId); - List<AIIotVO.VideoVO> videoVOS = new ArrayList<>(); - AIIotVO.VideoVO a = null; - for (int i = 0; i < 4; i++) { - a = new AIIotVO.VideoVO(); - a.setLongitude("32.11"); - a.setLatitude("106.111"); - a.setName("璁惧涓�"); - a.setResourceId("012"); - a.setBrand("澶у崕"); - a.setModel("鐞冩満"); - a.setIp("10.23.14.2"); - a.setUrl("http://10.23.14.2:12001"); - videoVOS.add(a); - } - return CommonResult.success(videoVOS); + public CommonResult video(@Validated CockpitVO params) { + checkApiUtil.cockpit(params); + /// TODO: 2022/12/13 瑙嗛鐐逛綅璁惧涓虹┖ 娌℃暟鎹� + return CommonResult.success(iVideoPointService.list(new LambdaQueryWrapper<VideoPoint>().eq(params.getStreetId() != null, VideoPoint::getStreetId, params.getStreetId()).isNotNull(VideoPoint::getPlatResourceId)).stream().map(item -> { + VideoVO videoVO = new VideoVO(); + videoVO.setName(item.getName()); + videoVO.setBrand(item.getEquipmentBrand()); + videoVO.setModel(item.getEquipmentModel()); + videoVO.setIp(item.getEquipmentIp()); + videoVO.setLatitude(item.getLatitude().toString()); + videoVO.setLongitude(item.getLongitude().toString()); + videoVO.setResourceId(item.getPlatResourceId()); + return videoVO; + }).collect(Collectors.toList())); } @ApiOperation(value = "AI绠楁硶鏁堣兘") @GetMapping("/efficiency") - public CommonResult<List<AIIotVO.EfficiencyVO>> efficiency(@Validated CockpitVO.Params2VO params) { - checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), params.getBeginTime(), params.getEndTime(),null); + public CommonResult<List<AIIotVO.EfficiencyVO>> efficiency(@Validated CockpitVO params) { + checkApiUtil.cockpit(params); List<AIIotVO.EfficiencyVO> efficiencyVOS = new ArrayList<>(); AIIotVO.EfficiencyVO a = null; for (int i = 0; i < 4; i++) { @@ -85,8 +101,8 @@ @ApiOperation(value = "娓e湡鑱斿姩") @GetMapping("/slag_car") - public CommonResult<AIIotVO.SlagCarVO> slagCar(@Validated CockpitVO.Params1VO params) { - checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), null, null,null); + public CommonResult<AIIotVO.SlagCarVO> slagCar(@Validated CockpitVO params) { + checkApiUtil.cockpit(params); AIIotVO.SlagCarVO slagCarVO = new AIIotVO.SlagCarVO(); slagCarVO.setCar(236); slagCarVO.setTeam(20); @@ -95,8 +111,8 @@ @ApiOperation(value = "AI浜嬩欢缁熻") @GetMapping("/event_statistics") - public CommonResult<List<AIIotVO.StatisticsVO>> statistics(@Validated CockpitVO.Params2VO params) { - checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), params.getBeginTime(), params.getEndTime(),null); + public CommonResult<List<AIIotVO.StatisticsVO>> statistics(@Validated CockpitVO params) { + checkApiUtil.cockpit(params); List<AIIotVO.StatisticsVO> statisticsVOS = new ArrayList<>(); List<AIIotVO.Statistics1VO> statistics1VOS = new ArrayList<>(); AIIotVO.StatisticsVO a = null; -- Gitblit v1.8.0