From 8ea3443791fc6f9c4fd8acba0a0ec6be2617b76c Mon Sep 17 00:00:00 2001 From: yitonglei Date: Mon, 16 May 2022 13:30:27 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=96=B0=E5=A2=9E=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=9C=80=E6=96=B0=E5=AE=A2=E6=B5=81=E5=88=97=E8=A1=A8--?= =?UTF-8?q?=E4=BB=8E=E8=A1=A8=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hisense/monitormanage/controller/Controller.java | 10 ++++++---- .../monitormanage/mapper/PassengerFlowlMapper.java | 1 + .../monitormanage/service/PassengerFlowService.java | 10 ++++++++++ src/main/resources/mapper/PassengerFlowlMapper.xml | 4 ++++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/hisense/monitormanage/controller/Controller.java b/src/main/java/com/hisense/monitormanage/controller/Controller.java index 6a9d856..a888afa 100644 --- a/src/main/java/com/hisense/monitormanage/controller/Controller.java +++ b/src/main/java/com/hisense/monitormanage/controller/Controller.java @@ -350,17 +350,19 @@ public class Controller { } @RequestMapping("passengerFlow") - //测试 + //测试获取最新的客流列表,从接口获取 public List passengerFlow(){ List list = passengerFlowService.passengerFlow(); return list; } - //从提供方获取最新的实时客流列表 + //获取最新的实时客流列表,从表获取 @RequestMapping("listPassengerFlow") - public List listPassengerFlow(){ - List list = passengerFlowService.passengerFlow(); + public List listPassengerFlow(){ + List list = passengerFlowService.listPassengerFlow(); return list; } + + //获取实时客流并保存到表t_passenger_flow @RequestMapping("savePassengerFlow") public Result savePassengerFlow(){ diff --git a/src/main/java/com/hisense/monitormanage/mapper/PassengerFlowlMapper.java b/src/main/java/com/hisense/monitormanage/mapper/PassengerFlowlMapper.java index 9daa332..f272f44 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/PassengerFlowlMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/PassengerFlowlMapper.java @@ -9,4 +9,5 @@ import java.util.Map; public interface PassengerFlowlMapper extends BaseMapper { void batchSave(List list); + PassengerFlow getByMaxId(); } diff --git a/src/main/java/com/hisense/monitormanage/service/PassengerFlowService.java b/src/main/java/com/hisense/monitormanage/service/PassengerFlowService.java index fc4a10c..e870503 100644 --- a/src/main/java/com/hisense/monitormanage/service/PassengerFlowService.java +++ b/src/main/java/com/hisense/monitormanage/service/PassengerFlowService.java @@ -104,6 +104,16 @@ public class PassengerFlowService { } return list; } + //从表中获取最新的实时客流 + public List listPassengerFlow(){ + PassengerFlow passengerFlow = passengerFlowMapper.getByMaxId(); + String timeId = passengerFlow.getTimeId(); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("time_id",timeId); + List lists = passengerFlowMapper.selectList(wrapper); + return lists; + } @Scheduled(cron = "0 31 10-22/1 * * ? ") //提供的接口能查到当前时间2个小时之前的数据,每隔15分钟一次,我们只取整点从早8点到晚8点的整点数据 //10:31 到晚上10:31,每小时的31分执行一次 diff --git a/src/main/resources/mapper/PassengerFlowlMapper.xml b/src/main/resources/mapper/PassengerFlowlMapper.xml index dfe3d36..c798073 100644 --- a/src/main/resources/mapper/PassengerFlowlMapper.xml +++ b/src/main/resources/mapper/PassengerFlowlMapper.xml @@ -14,4 +14,8 @@ + + \ No newline at end of file