1、修改查询游客数量接口,返回的数据包括本地 外地和总人数
This commit is contained in:
parent
aafe76b886
commit
b14134cc5a
|
@ -344,7 +344,7 @@ public class Controller {
|
||||||
@RequestParam(value="raidus") Integer raidus,
|
@RequestParam(value="raidus") Integer raidus,
|
||||||
@RequestParam(value="timeId") String timeId
|
@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
|
//查询并保存环卫车轨迹到表t_trail_sanitation
|
||||||
|
@ -374,7 +374,7 @@ public class Controller {
|
||||||
|
|
||||||
//查询道路污染数据
|
//查询道路污染数据
|
||||||
@RequestMapping(value="listRoadData")
|
@RequestMapping(value="listRoadData")
|
||||||
//2022-05-10 00:00:00
|
//输入参考:2022-05-10 00:00:00,只能查询当前日期前一天及以前的
|
||||||
public Result listRoadData(@RequestParam(value="dt") String dt){
|
public Result listRoadData(@RequestParam(value="dt") String dt){
|
||||||
List<RoadData> list = roadDataService.listRoadData(dt);
|
List<RoadData> list = roadDataService.listRoadData(dt);
|
||||||
return Result.success(list);
|
return Result.success(list);
|
||||||
|
|
|
@ -168,23 +168,32 @@ public class PassengerFlowService {
|
||||||
}
|
}
|
||||||
|
|
||||||
//根据半径,一个经纬度和hour_id查询游客总数
|
//根据半径,一个经纬度和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);
|
double[] points = LongLatUtil.getAround(longitude,latitude,raidus);
|
||||||
QueryWrapper<PassengerFlow> wrapper = new QueryWrapper<>();
|
QueryWrapper<PassengerFlow> wrapper = new QueryWrapper<>();
|
||||||
|
|
||||||
|
|
||||||
wrapper.eq("time_id",timeId).between("longitude",points[0],points[2]).between("latitude",points[1],points[3]);
|
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{
|
try{
|
||||||
List<PassengerFlow> list = passengerFlowMapper.selectList(wrapper);
|
List<PassengerFlow> list = passengerFlowMapper.selectList(wrapper);
|
||||||
for(PassengerFlow p:list){
|
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){
|
}catch (Exception e){
|
||||||
log.error("[passengerNums] Exception:"+e.getMessage());
|
log.error("[passengerNums] Exception:"+e.getMessage());
|
||||||
return count;
|
return result;
|
||||||
}
|
}
|
||||||
return count;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class RoadDataService {
|
||||||
private RoadDataMapper roadDataMapper;
|
private RoadDataMapper roadDataMapper;
|
||||||
|
|
||||||
//道路统计数据与排名(道路污染),调用公开接口并保存到表t_road_data
|
//道路统计数据与排名(道路污染),调用公开接口并保存到表t_road_data
|
||||||
//@Scheduled(cron="0 0 8 * * ?")
|
@Scheduled(cron="0 0 8 * * ?")
|
||||||
public void saveRoadData(){
|
public void saveRoadData(){
|
||||||
String url = "http://outerdata.novaecs.com/api/qingdaoData/roadData?groupId={groupId}&timeType={timeType}&dt={dt}";
|
String url = "http://outerdata.novaecs.com/api/qingdaoData/roadData?groupId={groupId}&timeType={timeType}&dt={dt}";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue