diff --git a/src/main/java/com/hisense/monitormanage/controller/Controller.java b/src/main/java/com/hisense/monitormanage/controller/Controller.java index 8a75c36..3d3bf47 100644 --- a/src/main/java/com/hisense/monitormanage/controller/Controller.java +++ b/src/main/java/com/hisense/monitormanage/controller/Controller.java @@ -344,7 +344,7 @@ public class Controller { @RequestParam(value="raidus") Integer raidus, @RequestParam(value="timeId") String timeId ){ - return Result.success(String.valueOf(passengerFlowService.passengerNums(longitude,latitude,raidus,timeId))); + return Result.success(passengerFlowService.passengerNums(longitude,latitude,raidus,timeId)); } //查询并保存环卫车轨迹到表t_trail_sanitation @@ -374,7 +374,7 @@ public class Controller { //查询道路污染数据 @RequestMapping(value="listRoadData") - //2022-05-10 00:00:00 + //输入参考:2022-05-10 00:00:00,只能查询当前日期前一天及以前的 public Result listRoadData(@RequestParam(value="dt") String dt){ List list = roadDataService.listRoadData(dt); return Result.success(list); diff --git a/src/main/java/com/hisense/monitormanage/service/PassengerFlowService.java b/src/main/java/com/hisense/monitormanage/service/PassengerFlowService.java index fd9da20..d2d5e7b 100644 --- a/src/main/java/com/hisense/monitormanage/service/PassengerFlowService.java +++ b/src/main/java/com/hisense/monitormanage/service/PassengerFlowService.java @@ -168,23 +168,32 @@ public class PassengerFlowService { } //根据半径,一个经纬度和hour_id查询游客总数 - public Integer passengerNums(double longitude, double latitude, Integer raidus,String timeId){ + public JSONObject passengerNums(double longitude, double latitude, Integer raidus,String timeId){ double[] points = LongLatUtil.getAround(longitude,latitude,raidus); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("time_id",timeId).between("longitude",points[0],points[2]).between("latitude",points[1],points[3]); - int count = 0; + int allCount = 0; + int localCount = 0; + int nonLocalCount = 0; + JSONObject result = new JSONObject(); + try{ List list = passengerFlowMapper.selectList(wrapper); for(PassengerFlow p:list){ - count+=p.getAllNums(); + allCount+=p.getAllNums(); + localCount+=p.getLocalNums(); + nonLocalCount+=p.getNonlocalNums(); } + result.put("local_nums",localCount); + result.put("nonlocal_nums",nonLocalCount); + result.put("all_nums",allCount); }catch (Exception e){ log.error("[passengerNums] Exception:"+e.getMessage()); - return count; + return result; } - return count; + return result; } diff --git a/src/main/java/com/hisense/monitormanage/service/RoadDataService.java b/src/main/java/com/hisense/monitormanage/service/RoadDataService.java index f62f51a..91f3f30 100644 --- a/src/main/java/com/hisense/monitormanage/service/RoadDataService.java +++ b/src/main/java/com/hisense/monitormanage/service/RoadDataService.java @@ -40,7 +40,7 @@ public class RoadDataService { private RoadDataMapper roadDataMapper; //道路统计数据与排名(道路污染),调用公开接口并保存到表t_road_data - //@Scheduled(cron="0 0 8 * * ?") + @Scheduled(cron="0 0 8 * * ?") public void saveRoadData(){ String url = "http://outerdata.novaecs.com/api/qingdaoData/roadData?groupId={groupId}&timeType={timeType}&dt={dt}";