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

View File

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