diff --git a/src/main/java/com/hisense/monitormanage/controller/Controller.java b/src/main/java/com/hisense/monitormanage/controller/Controller.java index 8c0c70e..29f38af 100644 --- a/src/main/java/com/hisense/monitormanage/controller/Controller.java +++ b/src/main/java/com/hisense/monitormanage/controller/Controller.java @@ -411,16 +411,16 @@ public class Controller { @GetMapping("getPassengerNum") @ApiOperation("查询游客总数,根据经纬度和半径米、timeId从表中查询") @ApiImplicitParams({ - @ApiImplicitParam(name = "longitude", value = "经度", paramType = "query",required = true,dataType ="double"), - @ApiImplicitParam(name = "latitude", value = "纬度", paramType = "query",required = true,dataType ="double"), - @ApiImplicitParam(name = "raidus", value = "半径,米", paramType = "query",required = true,dataType ="Integer"), + @ApiImplicitParam(name = "longitude", value = "经度", paramType = "query",required = false,dataType ="double"), + @ApiImplicitParam(name = "latitude", value = "纬度", paramType = "query",required = false,dataType ="double"), + @ApiImplicitParam(name = "raidus", value = "半径,米", paramType = "query",required = false,dataType ="Integer"), @ApiImplicitParam(name = "timeId", value = "时间点,202205101600", paramType = "query",required = true,dataType ="string"), }) public Result getPassengerNum( - @RequestParam(value="longitude") double longitude, - @RequestParam(value="latitude") double latitude, - @RequestParam(value="raidus") Integer raidus, - @RequestParam(value="timeId") String timeId + @RequestParam(value="longitude",required = false,defaultValue = "0.00") double longitude, + @RequestParam(value="latitude",required = false,defaultValue = "0.00") double latitude, + @RequestParam(value="raidus",required = false,defaultValue = "0") Integer raidus, + @RequestParam(value="timeId",required = true) String timeId ){ return Result.success(passengerFlowService.passengerNums(longitude,latitude,raidus,timeId)); } diff --git a/src/main/java/com/hisense/monitormanage/controller/SJZTController.java b/src/main/java/com/hisense/monitormanage/controller/SJZTController.java index 81e967b..a0707ee 100644 --- a/src/main/java/com/hisense/monitormanage/controller/SJZTController.java +++ b/src/main/java/com/hisense/monitormanage/controller/SJZTController.java @@ -46,7 +46,7 @@ public class SJZTController { } @PostMapping("upStream") - @ApiOperation("案件上报,调用接口上报") + @ApiOperation("案件上报,调用接口上报,暂时未测试") public Result upStream(@ApiParam(value="data,直接以json字符串的形式传递",required = true) @RequestBody String data){ System.out.println("案件上报,调用接口上报"); return sjztService.upStream(JSONObject.parseObject(data)); diff --git a/src/main/java/com/hisense/monitormanage/service/PassengerFlowService.java b/src/main/java/com/hisense/monitormanage/service/PassengerFlowService.java index e870503..5298a68 100644 --- a/src/main/java/com/hisense/monitormanage/service/PassengerFlowService.java +++ b/src/main/java/com/hisense/monitormanage/service/PassengerFlowService.java @@ -15,6 +15,7 @@ import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.DigestUtils; +import org.springframework.util.StringUtils; import org.springframework.web.client.RestTemplate; import java.nio.charset.StandardCharsets; @@ -179,13 +180,16 @@ public class PassengerFlowService { } } - //根据半径,一个经纬度和hour_id查询游客总数 + //根据半径,一个经纬度和timeId查询游客总数 public JSONObject passengerNums(double longitude, double latitude, Integer raidus,String timeId){ - double[] points = LongLatUtil.getAround(longitude,latitude,raidus); QueryWrapper wrapper = new QueryWrapper<>(); + if(Double.doubleToLongBits(longitude) == Double.doubleToLongBits(0.00) || Double.doubleToLongBits(latitude) == Double.doubleToLongBits(0.00)){ + wrapper.eq("time_id",timeId); + }else{ + double[] points = LongLatUtil.getAround(longitude,latitude,raidus); + 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 allCount = 0; int localCount = 0; int nonLocalCount = 0;