From 661b02bdad729a2d5cd7fb765cf9c920e0860737 Mon Sep 17 00:00:00 2001 From: yitonglei Date: Thu, 19 May 2022 10:59:37 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E6=94=B9listPassengerFlow?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=8F=82=E6=95=B0?= =?UTF-8?q?timeId=EF=BC=8C=E5=89=8D=E7=AB=AF=E5=8F=AF=E4=BB=A5=E4=BC=A0?= =?UTF-8?q?=E5=85=A5=E5=8F=82=E6=95=B0=E6=9F=A5=E8=AF=A2=EF=BC=8C=E4=B9=9F?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E9=BB=98=E8=AE=A4=E6=9F=A5=E8=AF=A2=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../monitormanage/controller/Controller.java | 5 +++-- .../service/PassengerFlowService.java | 14 +++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/hisense/monitormanage/controller/Controller.java b/src/main/java/com/hisense/monitormanage/controller/Controller.java index 29f38af..29bdc66 100644 --- a/src/main/java/com/hisense/monitormanage/controller/Controller.java +++ b/src/main/java/com/hisense/monitormanage/controller/Controller.java @@ -389,8 +389,9 @@ public class Controller { //获取最新的实时客流列表,从表获取 @GetMapping("listPassengerFlow") @ApiOperation("获取最新的实时客流列表,从表获取,热力图") - public List listPassengerFlow(){ - List list = passengerFlowService.listPassengerFlow(); + @ApiImplicitParam(name="timeId",value = "时间点",required = false,paramType = "query",dataType = "string") + public List listPassengerFlow(@RequestParam(value="timeId",required = false,defaultValue = "1970000000") String timeId){ + List list = passengerFlowService.listPassengerFlow(timeId); return list; } diff --git a/src/main/java/com/hisense/monitormanage/service/PassengerFlowService.java b/src/main/java/com/hisense/monitormanage/service/PassengerFlowService.java index 5298a68..7780429 100644 --- a/src/main/java/com/hisense/monitormanage/service/PassengerFlowService.java +++ b/src/main/java/com/hisense/monitormanage/service/PassengerFlowService.java @@ -106,13 +106,17 @@ public class PassengerFlowService { return list; } //从表中获取最新的实时客流 - public List listPassengerFlow(){ - PassengerFlow passengerFlow = passengerFlowMapper.getByMaxId(); - String timeId = passengerFlow.getTimeId(); - + public List listPassengerFlow(String timeId){ + List lists = new ArrayList<>(); + long longTimeId = Long.valueOf(timeId); + if(longTimeId == 1970000000){ + PassengerFlow passengerFlow = passengerFlowMapper.getByMaxId(); + timeId = passengerFlow.getTimeId(); + } QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("time_id",timeId); - List lists = passengerFlowMapper.selectList(wrapper); + lists = passengerFlowMapper.selectList(wrapper); + return lists; } @Scheduled(cron = "0 31 10-22/1 * * ? ")