1、修改查询游客数量接口,返回的数据包括本地 外地和总人数

This commit is contained in:
yitonglei 2022-05-11 15:59:53 +08:00
parent aafe76b886
commit b14134cc5a
3 changed files with 17 additions and 8 deletions

View File

@ -344,7 +344,7 @@ public class Controller {
@RequestParam(value="raidus") Integer raidus,
@RequestParam(value="timeId") String timeId
){
return Result.success(String.valueOf(passengerFlowService.passengerNums(longitude,latitude,raidus,timeId)));
return Result.success(passengerFlowService.passengerNums(longitude,latitude,raidus,timeId));
}
//查询并保存环卫车轨迹到表t_trail_sanitation
@ -374,7 +374,7 @@ public class Controller {
//查询道路污染数据
@RequestMapping(value="listRoadData")
//2022-05-10 00:00:00
//输入参考2022-05-10 00:00:00只能查询当前日期前一天及以前的
public Result listRoadData(@RequestParam(value="dt") String dt){
List<RoadData> list = roadDataService.listRoadData(dt);
return Result.success(list);

View File

@ -168,23 +168,32 @@ public class PassengerFlowService {
}
//根据半径一个经纬度和hour_id查询游客总数
public Integer passengerNums(double longitude, double latitude, Integer raidus,String timeId){
public JSONObject passengerNums(double longitude, double latitude, Integer raidus,String timeId){
double[] points = LongLatUtil.getAround(longitude,latitude,raidus);
QueryWrapper<PassengerFlow> wrapper = new QueryWrapper<>();
wrapper.eq("time_id",timeId).between("longitude",points[0],points[2]).between("latitude",points[1],points[3]);
int count = 0;
int allCount = 0;
int localCount = 0;
int nonLocalCount = 0;
JSONObject result = new JSONObject();
try{
List<PassengerFlow> list = passengerFlowMapper.selectList(wrapper);
for(PassengerFlow p:list){
count+=p.getAllNums();
allCount+=p.getAllNums();
localCount+=p.getLocalNums();
nonLocalCount+=p.getNonlocalNums();
}
result.put("local_nums",localCount);
result.put("nonlocal_nums",nonLocalCount);
result.put("all_nums",allCount);
}catch (Exception e){
log.error("[passengerNums] Exception:"+e.getMessage());
return count;
return result;
}
return count;
return result;
}

View File

@ -40,7 +40,7 @@ public class RoadDataService {
private RoadDataMapper roadDataMapper;
//道路统计数据与排名(道路污染)调用公开接口并保存到表t_road_data
//@Scheduled(cron="0 0 8 * * ?")
@Scheduled(cron="0 0 8 * * ?")
public void saveRoadData(){
String url = "http://outerdata.novaecs.com/api/qingdaoData/roadData?groupId={groupId}&timeType={timeType}&dt={dt}";