部分接口优化

This commit is contained in:
wuweida 2022-05-23 10:27:57 +08:00
parent 89f92797fb
commit 7a4e4b14fe
6 changed files with 30 additions and 26 deletions

View File

@ -211,18 +211,18 @@ public class Controller {
* 根据经纬度查询半径内所有的摄像头 * 根据经纬度查询半径内所有的摄像头
* @param gpsX * @param gpsX
* @param gpsY * @param gpsY
* @param raidus * @param radius
* @return * @return
*/ */
@GetMapping ("selectAllByGps") @GetMapping ("selectAllByGps")
@ApiOperation("根据经纬度查询半径内所有的摄像头") @ApiOperation("根据经纬度查询半径内所有的摄像头")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "gpsX", value = "经度", paramType = "query",required = true,dataType ="double"), @ApiImplicitParam(name = "gpsX", value = "经度",required = true,dataType ="Double"),
@ApiImplicitParam(name = "gpsY", value = "纬度", paramType = "query",required = true,dataType ="double"), @ApiImplicitParam(name = "gpsY", value = "纬度",required = true,dataType ="Double"),
@ApiImplicitParam(name = "raidus", value = "半径,米", paramType = "query",required = true,dataType ="Integer"),} @ApiImplicitParam(name = "radius", value = "半径,米",required = true,dataType ="Integer"),}
) )
public Result selectAllByGps(Double gpsX,Double gpsY,Integer raidus){ public Result selectAllByGps(Double gpsX,Double gpsY,Integer radius){
double[] around = LongLatUtil.getAround(gpsX, gpsY, raidus); double[] around = LongLatUtil.getAround(gpsX, gpsY, radius);
List<CameraChannel> c = cameraChannelMapper.selectAllByGps(around[0], around[2], around[1], around[3]); List<CameraChannel> c = cameraChannelMapper.selectAllByGps(around[0], around[2], around[1], around[3]);
Result success = Result.success(c); Result success = Result.success(c);
return success; return success;
@ -376,18 +376,18 @@ public class Controller {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "longitude", value = "经度", paramType = "query",required = true,dataType ="double"), @ApiImplicitParam(name = "longitude", value = "经度", paramType = "query",required = true,dataType ="double"),
@ApiImplicitParam(name = "latitude", 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 = "radius", value = "半径,米", paramType = "query",required = true,dataType ="Integer"),
@ApiImplicitParam(name = "start", value = "开始时间2021-08-03 10:17:23", paramType = "query",required = true,dataType ="string"), @ApiImplicitParam(name = "start", value = "开始时间2021-08-03 10:17:23", paramType = "query",required = true,dataType ="string"),
@ApiImplicitParam(name = "end", value = "结束时间2021-08-03 12:17:23", paramType = "query",required = true,dataType ="string") @ApiImplicitParam(name = "end", value = "结束时间2021-08-03 12:17:23", paramType = "query",required = true,dataType ="string")
}) })
public Result listSedimentTrailByPoints( public Result listSedimentTrailByPoints(
@RequestParam(value="longitude") double longitude, @RequestParam(value="longitude") double longitude,
@RequestParam(value="latitude") double latitude, @RequestParam(value="latitude") double latitude,
@RequestParam(value="raidus") Integer raidus, @RequestParam(value="radius") Integer radius,
@RequestParam(value="start") String start, @RequestParam(value="start") String start,
@RequestParam(value = "end") String end @RequestParam(value = "end") String end
){ ){
Map<String,List<SedimentTrail>> map = sedimentTrailService.listSedimentTrailByPoints(longitude,latitude,raidus,start,end); Map<String,List<SedimentTrail>> map = sedimentTrailService.listSedimentTrailByPoints(longitude,latitude,radius,start,end);
return Result.success(map); return Result.success(map);
} }
@ -427,16 +427,16 @@ public class Controller {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "longitude", value = "经度", paramType = "query",required = false,dataType ="double"), @ApiImplicitParam(name = "longitude", value = "经度", paramType = "query",required = false,dataType ="double"),
@ApiImplicitParam(name = "latitude", 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 = "radius", value = "半径,米", paramType = "query",required = false,dataType ="Integer"),
@ApiImplicitParam(name = "timeId", value = "时间点202205101600", paramType = "query",required = true,dataType ="string"), @ApiImplicitParam(name = "timeId", value = "时间点202205101600", paramType = "query",required = true,dataType ="string"),
}) })
public Result getPassengerNum( public Result getPassengerNum(
@RequestParam(value="longitude",required = false,defaultValue = "0.00") double longitude, @RequestParam(value="longitude",required = false,defaultValue = "0.00") double longitude,
@RequestParam(value="latitude",required = false,defaultValue = "0.00") double latitude, @RequestParam(value="latitude",required = false,defaultValue = "0.00") double latitude,
@RequestParam(value="raidus",required = false,defaultValue = "0") Integer raidus, @RequestParam(value="radius",required = false,defaultValue = "0") Integer radius,
@RequestParam(value="timeId",required = true) String timeId @RequestParam(value="timeId",required = true) String timeId
){ ){
return Result.success(passengerFlowService.passengerNums(longitude,latitude,raidus,timeId)); return Result.success(passengerFlowService.passengerNums(longitude,latitude,radius,timeId));
} }
//查询并保存环卫车轨迹到表t_trail_sanitation //查询并保存环卫车轨迹到表t_trail_sanitation
@ -457,18 +457,18 @@ public class Controller {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "longitude", value = "经度", paramType = "query",required = true,dataType ="double"), @ApiImplicitParam(name = "longitude", value = "经度", paramType = "query",required = true,dataType ="double"),
@ApiImplicitParam(name = "latitude", 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 = "radius", value = "半径,米", paramType = "query",required = true,dataType ="Integer"),
@ApiImplicitParam(name = "start", value = "开始时间2021-03-17 00:00:00", paramType = "query",required = true,dataType ="string"), @ApiImplicitParam(name = "start", value = "开始时间2021-03-17 00:00:00", paramType = "query",required = true,dataType ="string"),
@ApiImplicitParam(name = "end", value = "结束时间2021-03-22 00:00:00", paramType = "query",required = true,dataType ="string"), @ApiImplicitParam(name = "end", value = "结束时间2021-03-22 00:00:00", paramType = "query",required = true,dataType ="string"),
}) })
public Result listTrailSanitationByPoints( public Result listTrailSanitationByPoints(
@RequestParam(value="longitude") double longitude, @RequestParam(value="longitude") double longitude,
@RequestParam(value="latitude") double latitude, @RequestParam(value="latitude") double latitude,
@RequestParam(value="raidus") Integer raidus, @RequestParam(value="radius") Integer radius,
@RequestParam(value="start") String start, @RequestParam(value="start") String start,
@RequestParam(value = "end") String end @RequestParam(value = "end") String end
){ ){
List<TrailSanitation> list = trailSanitationService.listSedimentTrailByPoints(longitude,latitude,raidus,start,end); List<TrailSanitation> list = trailSanitationService.listSedimentTrailByPoints(longitude,latitude,radius,start,end);
return Result.success(list); return Result.success(list);
} }
@ -489,9 +489,9 @@ public class Controller {
@ApiImplicitParam(name="longitude",value = "经度",paramType = "query",required = true,dataType = "double"), @ApiImplicitParam(name="longitude",value = "经度",paramType = "query",required = true,dataType = "double"),
@ApiImplicitParam(name="longitude",value = "经度",paramType = "query",required = true,dataType = "double") @ApiImplicitParam(name="longitude",value = "经度",paramType = "query",required = true,dataType = "double")
}) })
public Result listBuildingSiteByPoints(double longitude,double latitude,Integer raidus){ public Result listBuildingSiteByPoints(double longitude,double latitude,Integer radius){
List<BuildingSite> list = new ArrayList<>(); List<BuildingSite> list = new ArrayList<>();
list = buildingSitrService.listBuildingSiteByPoints(longitude,latitude,raidus); list = buildingSitrService.listBuildingSiteByPoints(longitude,latitude,radius);
return Result.success(list); return Result.success(list);
} }
} }

View File

@ -1,5 +1,7 @@
package com.hisense.monitormanage.controller; package com.hisense.monitormanage.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -11,9 +13,11 @@ import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
@Controller @Controller
@Api(tags = "转发")
public class FordController { public class FordController {
@GetMapping("components/**") @GetMapping("components/**")
@ApiOperation("前端访问图片请求转发")
public void ford(HttpServletRequest request, HttpServletResponse response){ public void ford(HttpServletRequest request, HttpServletResponse response){
String imageDomain = "http://10.132.191.48:30080"; String imageDomain = "http://10.132.191.48:30080";

View File

@ -24,10 +24,10 @@ public class BuildingSiteService {
@Autowired @Autowired
private BuildingSiteMapper buildingSiteMapper; private BuildingSiteMapper buildingSiteMapper;
public List<BuildingSite> listBuildingSiteByPoints(double longitude,double latitude,Integer raidus){ public List<BuildingSite> listBuildingSiteByPoints(double longitude,double latitude,Integer radius){
List<BuildingSite> list = new ArrayList<>(); List<BuildingSite> list = new ArrayList<>();
try{ try{
double[] points = LongLatUtil.getAround(longitude,latitude,raidus); double[] points = LongLatUtil.getAround(longitude,latitude,radius);
QueryWrapper<BuildingSite> wrapper = new QueryWrapper(); QueryWrapper<BuildingSite> wrapper = new QueryWrapper();
wrapper.between("jd",points[0],points[2]).between("wd",points[1],points[3]); wrapper.between("jd",points[0],points[2]).between("wd",points[1],points[3]);
list = buildingSiteMapper.selectList(wrapper); list = buildingSiteMapper.selectList(wrapper);

View File

@ -185,12 +185,12 @@ public class PassengerFlowService {
} }
//根据半径一个经纬度和timeId查询游客总数 //根据半径一个经纬度和timeId查询游客总数
public JSONObject passengerNums(double longitude, double latitude, Integer raidus,String timeId){ public JSONObject passengerNums(double longitude, double latitude, Integer radius,String timeId){
QueryWrapper<PassengerFlow> wrapper = new QueryWrapper<>(); QueryWrapper<PassengerFlow> wrapper = new QueryWrapper<>();
if(Double.doubleToLongBits(longitude) == Double.doubleToLongBits(0.00) || Double.doubleToLongBits(latitude) == Double.doubleToLongBits(0.00)){ if(Double.doubleToLongBits(longitude) == Double.doubleToLongBits(0.00) || Double.doubleToLongBits(latitude) == Double.doubleToLongBits(0.00)){
wrapper.eq("time_id",timeId); wrapper.eq("time_id",timeId);
}else{ }else{
double[] points = LongLatUtil.getAround(longitude,latitude,raidus); double[] points = LongLatUtil.getAround(longitude,latitude,radius);
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]);
} }

View File

@ -52,11 +52,11 @@ public class SedimentTrailService {
/** /**
* 根据输入的经纬度和查询的半径查询范围内的渣土车轨迹信息 * 根据输入的经纬度和查询的半径查询范围内的渣土车轨迹信息
* @param longitude经度 latitude纬度 raidus() start(时间) end(时间) * @param longitude经度 latitude纬度 radius() start(时间) end(时间)
* *
*/ */
public Map<String,List<SedimentTrail>> listSedimentTrailByPoints(double longitude, double latitude, Integer raidus,String start,String end){ public Map<String,List<SedimentTrail>> listSedimentTrailByPoints(double longitude, double latitude, Integer radius,String start,String end){
double[] points = LongLatUtil.getAround(longitude,latitude,raidus); double[] points = LongLatUtil.getAround(longitude,latitude,radius);
QueryWrapper<SedimentTrail> wrapper = new QueryWrapper<>(); QueryWrapper<SedimentTrail> wrapper = new QueryWrapper<>();
wrapper.between("update_time",start,end).between("longitude",points[0],points[2]).between("latitude",points[1],points[3]) wrapper.between("update_time",start,end).between("longitude",points[0],points[2]).between("latitude",points[1],points[3])
.orderByAsc("sim_card_num","record_time"); .orderByAsc("sim_card_num","record_time");

View File

@ -39,8 +39,8 @@ public class TrailSanitationService {
* @param longitude经度 latitude纬度 raidus() start(时间) end(时间) * @param longitude经度 latitude纬度 raidus() start(时间) end(时间)
* *
*/ */
public List<TrailSanitation> listSedimentTrailByPoints(double longitude, double latitude, Integer raidus, String start, String end){ public List<TrailSanitation> listSedimentTrailByPoints(double longitude, double latitude, Integer radius, String start, String end){
double[] points = LongLatUtil.getAround(longitude,latitude,raidus); double[] points = LongLatUtil.getAround(longitude,latitude,radius);
QueryWrapper<TrailSanitation> wrapper = new QueryWrapper<>(); QueryWrapper<TrailSanitation> wrapper = new QueryWrapper<>();
wrapper.between("fssj",start,end).between("jd",points[0],points[2]).between("wd",points[1],points[3]); wrapper.between("fssj",start,end).between("jd",points[0],points[2]).between("wd",points[1],points[3]);
return trailSanitationMapper.selectList(wrapper); return trailSanitationMapper.selectList(wrapper);