Merge remote-tracking branch 'origin/master'

This commit is contained in:
wuweida 2022-05-16 15:16:20 +08:00
commit d4894d4767
4 changed files with 21 additions and 4 deletions

View File

@ -371,17 +371,19 @@ public class Controller {
}
@RequestMapping("passengerFlow")
//测试
//测试获取最新的客流列表从接口获取
public List<Map> passengerFlow(){
List<Map> list = passengerFlowService.passengerFlow();
return list;
}
//从提供方获取最新的实时客流列表
//获取最新的实时客流列表从表获取
@RequestMapping("listPassengerFlow")
public List<Map> listPassengerFlow(){
List<Map> list = passengerFlowService.passengerFlow();
public List<PassengerFlow> listPassengerFlow(){
List<PassengerFlow> list = passengerFlowService.listPassengerFlow();
return list;
}
//获取实时客流并保存到表t_passenger_flow
@RequestMapping("savePassengerFlow")
public Result savePassengerFlow(){

View File

@ -9,4 +9,5 @@ import java.util.Map;
public interface PassengerFlowlMapper extends BaseMapper<PassengerFlow> {
void batchSave(List<Map> list);
PassengerFlow getByMaxId();
}

View File

@ -104,6 +104,16 @@ public class PassengerFlowService {
}
return list;
}
//从表中获取最新的实时客流
public List<PassengerFlow> listPassengerFlow(){
PassengerFlow passengerFlow = passengerFlowMapper.getByMaxId();
String timeId = passengerFlow.getTimeId();
QueryWrapper<PassengerFlow> wrapper = new QueryWrapper<>();
wrapper.eq("time_id",timeId);
List<PassengerFlow> lists = passengerFlowMapper.selectList(wrapper);
return lists;
}
@Scheduled(cron = "0 31 10-22/1 * * ? ")
//提供的接口能查到当前时间2个小时之前的数据每隔15分钟一次我们只取整点从早8点到晚8点的整点数据
//10:31 到晚上1031每小时的31分执行一次

View File

@ -14,4 +14,8 @@
</foreach>
</insert>
<select id="getByMaxId" resultType="com.hisense.monitormanage.entity.PassengerFlow">
select * from t_passenger_flow ORDer by id desc limit 1
</select>
</mapper>