package com.ycl.controller.cockpit.aiIot; import com.ycl.api.CommonResult; import com.ycl.util.CheckApiUtil; import com.ycl.vo.cockpit.CockpitVO; import com.ycl.vo.cockpit.aiIot.AIIotVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; 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; 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 = "驾驶舱数据接口-AI物联") @RestController @RequestMapping("/api/lot") public class AIIotController { @Resource private CheckApiUtil checkApiUtil; @ApiOperation(value = "监测数据") @GetMapping("/detection") public CommonResult detection(@Validated CockpitVO.Params1VO params) { checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), null, null,null); AIIotVO.DetectionVO detectionVO = new AIIotVO.DetectionVO(); detectionVO.setVideo(121); detectionVO.setIndividual(20); detectionVO.setLampblack(154); detectionVO.setLoudspeaker(30); detectionVO.setSlagCar(33); return CommonResult.success(detectionVO); } @ApiOperation(value = "实时视频监控") @GetMapping("/video") @ApiImplicitParam(name = "regionId",value = "地区Id",required = true,dataType = "String") public CommonResult> video(@Validated CockpitVO.Params1VO params, @RequestParam(required = true)String regionId) { checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), null, null,regionId); List 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); } @ApiOperation(value = "AI算法效能") @GetMapping("/efficiency") public CommonResult> efficiency(@Validated CockpitVO.Params2VO params) { checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), params.getBeginTime(), params.getEndTime(),null); List efficiencyVOS = new ArrayList<>(); AIIotVO.EfficiencyVO a = null; for (int i = 0; i < 4; i++) { a = new AIIotVO.EfficiencyVO(); a.setType("道路破损"); a.setCount(12); a.setRatio(new BigDecimal("0.63").setScale(2, RoundingMode.HALF_UP)); efficiencyVOS.add(a); } return CommonResult.success(efficiencyVOS); } @ApiOperation(value = "渣土联动") @GetMapping("/slag_car") public CommonResult slagCar(@Validated CockpitVO.Params1VO params) { checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), null, null,null); AIIotVO.SlagCarVO slagCarVO = new AIIotVO.SlagCarVO(); slagCarVO.setCar(236); slagCarVO.setTeam(20); return CommonResult.success(slagCarVO); } @ApiOperation(value = "AI事件统计") @GetMapping("/event_statistics") public CommonResult> statistics(@Validated CockpitVO.Params2VO params) { checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), params.getBeginTime(), params.getEndTime(),null); List statisticsVOS = new ArrayList<>(); List statistics1VOS = new ArrayList<>(); AIIotVO.StatisticsVO a = null; AIIotVO.Statistics1VO a1 = null; for (int i = 0; i < 4; i++) { a = new AIIotVO.StatisticsVO(); a1 = new AIIotVO.Statistics1VO(); a.setType("道路破损"); a1.setCount(12); a1.setMonth("2022-10"); statistics1VOS.add(a1); a.setRecords(statistics1VOS); statisticsVOS.add(a); } return CommonResult.success(statisticsVOS); } }