From e31d4d2d3cecab2fb56508c0f5b82d821719e7bb Mon Sep 17 00:00:00 2001 From: zhangzeli <123456> Date: 星期二, 25 一月 2022 14:39:14 +0800 Subject: [PATCH] bug --- xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 107 insertions(+), 2 deletions(-) diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java index ab3b00c..3f3936e 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java @@ -8,7 +8,11 @@ import cn.exrick.xboot.your.entity.*; import cn.exrick.xboot.your.service.*; import cn.exrick.xboot.your.util.HaiKangPost; +import cn.exrick.xboot.your.vo.AlarmVo; +import cn.exrick.xboot.your.vo.PreviewURLsVo; +import cn.exrick.xboot.your.vo.TalkURLsVo; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -52,6 +56,12 @@ @Autowired private IAreaSectionService iAreaSectionService; + @Autowired + private IEquipmentService iEquipmentService; + + @Autowired + private IAlarmService iAlarmService; + @RequestMapping(value = "/getIndex1", method = RequestMethod.GET) @ApiOperation(value = "鑾峰彇棣栭〉鏁版嵁") public Result<Object> getIndex1() { @@ -91,10 +101,17 @@ @ApiOperation(value = "鑾峰彇杞﹁締瀹氫綅淇℃伅") public Result<Object> getCars() { List<Car> list = iCarService.list(); - String codes[] = new String[list.size()]; + List<String> list2 = new ArrayList<>(); for(int i=0;i<list.size();i++){ - codes[i] = list.get(i).getCode(); + if(!StrUtil.isEmpty(list.get(i).getCode())){ + list2.add(list.get(i).getCode()); + } + } + + String codes[] = new String[list2.size()]; + for(int i=0;i<list2.size();i++){ + codes[i] = list2.get(i); } String latestGps = haiKangPost.findLatestGps(codes); return new ResultUtil<Object>().setData(JSONUtil.parseObj(latestGps)); @@ -153,6 +170,94 @@ return new ResultUtil<Object>().setData(map); } + @RequestMapping(value = "/getOrderStatus", method = RequestMethod.GET) + @ApiOperation(value = "鑾峰彇鏌愯締杞︾殑閰嶉�佹儏鍐�") + public Result<Object> getOrderStatus(String carNo) { + + QueryWrapper<Car> wrapper = new QueryWrapper<>(); + wrapper.eq("car_no",carNo); + Car car = iCarService.getOne(wrapper); + + if(car==null){ + return ResultUtil.error("杞﹁締涓嶅瓨鍦�,璇峰厛娣诲姞杞﹁締淇℃伅"); + } + + QueryWrapper<OrderTask> wrapper2 = new QueryWrapper<OrderTask>(); + String format = DateUtil.format(new Date(), "yyyy-MM-dd"); + wrapper2.eq("a.send_date",format); + wrapper2.eq("a.car_id",car.getId()); + List<OrderTask> list = iOrderTaskService.list4(wrapper2); + + return new ResultUtil<Object>().setData(list); + } + + @RequestMapping(value = "/getVideoByCarId", method = RequestMethod.GET) + @ApiOperation(value = "鑾峰彇瑙嗛淇℃伅 1锛氬墠缃� 4锛氳溅鍐�") + public Result<Object> getVideoByCarId(String carCode,int type) { + QueryWrapper<Car> wrapper = new QueryWrapper<Car>(); + wrapper.eq("code",carCode); + Car car = iCarService.getOne(wrapper); + if(car==null){ + return ResultUtil.error("杞﹁締缂栧彿閿欒"); + } + + QueryWrapper<Equipment> wrapper1 = new QueryWrapper<>(); + wrapper1.eq("car_id",car.getId()); + wrapper1.eq("type",type); + Equipment one = iEquipmentService.getOne(wrapper1); + if(one==null){ + return ResultUtil.error("璁惧鏈壘鍒�"); + } + + PreviewURLsVo previewURLsVo = new PreviewURLsVo(); + previewURLsVo.setCameraIndexCode(one.getCode()); + String s = haiKangPost.previewURLs(previewURLsVo); + return new ResultUtil<Object>().setData(JSONUtil.parseObj(s)); + } + + @RequestMapping(value = "/getYuYinByCarId", method = RequestMethod.GET) + @ApiOperation(value = "鑾峰彇瀵硅淇℃伅") + public Result<Object> getYuYinByCarId(String carCode,int type,int transmode) { + QueryWrapper<Car> wrapper = new QueryWrapper<Car>(); + wrapper.eq("code",carCode); + Car car = iCarService.getOne(wrapper); + if(car==null){ + return ResultUtil.error("杞﹁締缂栧彿閿欒"); + } + + QueryWrapper<Equipment> wrapper1 = new QueryWrapper<>(); + wrapper1.eq("car_id",car.getId()); + wrapper1.eq("type",type); + Equipment one = iEquipmentService.getOne(wrapper1); + if(one==null){ + return ResultUtil.error("璁惧鏈壘鍒�"); + } + + TalkURLsVo talkURLsVo =new TalkURLsVo(); + talkURLsVo.setCameraIndexCode(one.getCode()); + talkURLsVo.setTransmode(transmode); + String s = haiKangPost.talkURLs(talkURLsVo); + return new ResultUtil<Object>().setData(JSONUtil.parseObj(s)); + } + + @RequestMapping(value = "/getAlarmByCarId", method = RequestMethod.GET) + @ApiOperation(value = "鑾峰彇鎶ヨ鍥剧墖") + public Result<Object> getAlarmByCarId(String alarmId) { + QueryWrapper<Alarm> wrapper = new QueryWrapper<Alarm>(); + wrapper.eq("alarm_id",alarmId); + Alarm alarm = iAlarmService.getOne(wrapper); + if(alarm==null){ + return ResultUtil.error("鎶ヨid閿欒"); + } + + AlarmVo alarmVo = new AlarmVo(); + alarmVo.setAlarmId(alarm.getAlarmId()); + String[] s1 = alarm.getAlarmTime().split(" "); + alarmVo.setAlarmTime(s1[0]+"T"+s1[1]+".000+08:00"); + String s = haiKangPost.findPicturesByAlarmId(alarmVo); + return new ResultUtil<Object>().setData(JSONUtil.parseObj(s)); + } + public double trans2(double v2){ return (double) Math.round(v2 * 100) / 100; } -- Gitblit v1.9.1