From b14134cc5ab4233a3505dc772c912bc641e3358a Mon Sep 17 00:00:00 2001 From: yitonglei Date: Wed, 11 May 2022 15:59:53 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=B8=B8=E5=AE=A2=E6=95=B0=E9=87=8F=E6=8E=A5=E5=8F=A3=EF=BC=8C?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E7=9A=84=E6=95=B0=E6=8D=AE=E5=8C=85=E6=8B=AC?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=20=E5=A4=96=E5=9C=B0=E5=92=8C=E6=80=BB?= =?UTF-8?q?=E4=BA=BA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../monitormanage/controller/Controller.java | 4 ++-- .../service/PassengerFlowService.java | 19 ++++++++++++++----- .../service/RoadDataService.java | 2 +- 3 files changed, 17 insertions(+), 8 deletions(-) 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}";