1、修改listPassengerFlow方法,增加参数timeId,前端可以传入参数查询,也可以默认查询最新的

This commit is contained in:
yitonglei 2022-05-19 10:59:37 +08:00
parent 3e39169a30
commit 661b02bdad
2 changed files with 12 additions and 7 deletions

View File

@ -389,8 +389,9 @@ public class Controller {
//获取最新的实时客流列表从表获取
@GetMapping("listPassengerFlow")
@ApiOperation("获取最新的实时客流列表,从表获取,热力图")
public List<PassengerFlow> listPassengerFlow(){
List<PassengerFlow> list = passengerFlowService.listPassengerFlow();
@ApiImplicitParam(name="timeId",value = "时间点",required = false,paramType = "query",dataType = "string")
public List<PassengerFlow> listPassengerFlow(@RequestParam(value="timeId",required = false,defaultValue = "1970000000") String timeId){
List<PassengerFlow> list = passengerFlowService.listPassengerFlow(timeId);
return list;
}

View File

@ -106,13 +106,17 @@ public class PassengerFlowService {
return list;
}
//从表中获取最新的实时客流
public List<PassengerFlow> listPassengerFlow(){
PassengerFlow passengerFlow = passengerFlowMapper.getByMaxId();
String timeId = passengerFlow.getTimeId();
public List<PassengerFlow> listPassengerFlow(String timeId){
List<PassengerFlow> lists = new ArrayList<>();
long longTimeId = Long.valueOf(timeId);
if(longTimeId == 1970000000){
PassengerFlow passengerFlow = passengerFlowMapper.getByMaxId();
timeId = passengerFlow.getTimeId();
}
QueryWrapper<PassengerFlow> wrapper = new QueryWrapper<>();
wrapper.eq("time_id",timeId);
List<PassengerFlow> lists = passengerFlowMapper.selectList(wrapper);
lists = passengerFlowMapper.selectList(wrapper);
return lists;
}
@Scheduled(cron = "0 31 10-22/1 * * ? ")