1.增加查询工地信息接口
This commit is contained in:
parent
bd038a0c22
commit
ae96948655
|
@ -5,17 +5,13 @@ import com.hisense.monitormanage.entity.*;
|
|||
import com.hisense.monitormanage.mapper.*;
|
||||
import com.hisense.monitormanage.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.sql.Array;
|
||||
import java.time.Clock;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -57,6 +53,10 @@ public class Controller {
|
|||
@Autowired
|
||||
private CameraChannelService cameraChannelService;
|
||||
|
||||
@Autowired
|
||||
private BuildingSiteService buildingSitrService;
|
||||
|
||||
|
||||
@RequestMapping("all")
|
||||
public Object all(){
|
||||
List<Project> projects = projectMapper.selectList(null);
|
||||
|
@ -394,4 +394,13 @@ public class Controller {
|
|||
List<RoadData> list = roadDataService.listRoadData(dt);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
//查询工地信息,根据经纬度和半径查询
|
||||
@RequestMapping(value = "listBuildingSiteByPoints")
|
||||
public Result listBuildingSiteByPoints(double longitude,double latitude,Integer raidus){
|
||||
List<BuildingSite> list = new ArrayList<>();
|
||||
|
||||
list = buildingSitrService.listBuildingSiteByPoints(longitude,latitude,raidus);
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package com.hisense.monitormanage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @version 1.0.0
|
||||
* @ClassName BuildingSite.java
|
||||
* @Description TODO
|
||||
* @createTime 2022年05月12日 14:00:00
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("t_building_site")
|
||||
public class BuildingSite {
|
||||
@TableId
|
||||
private Integer id;
|
||||
private String gdmc;
|
||||
private String sgwz;
|
||||
private double jd;
|
||||
private double wd;
|
||||
private String ssdq;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.hisense.monitormanage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.hisense.monitormanage.entity.BuildingSite;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @version 1.0.0
|
||||
* @ClassName BuildingSiteMapper.java
|
||||
* @Description TODO
|
||||
* @createTime 2022年05月12日 13:59:00
|
||||
*/
|
||||
public interface BuildingSiteMapper extends BaseMapper<BuildingSite> {
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package com.hisense.monitormanage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.hisense.monitormanage.entity.BuildingSite;
|
||||
import com.hisense.monitormanage.mapper.BuildingSiteMapper;
|
||||
import com.hisense.monitormanage.utils.LongLatUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @version 1.0.0
|
||||
* @ClassName BuildingSitrService.java
|
||||
* @Description TODO
|
||||
* @createTime 2022年05月12日 13:58:00
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BuildingSiteService {
|
||||
@Autowired
|
||||
private BuildingSiteMapper buildingSiteMapper;
|
||||
|
||||
public List<BuildingSite> listBuildingSiteByPoints(double longitude,double latitude,Integer raidus){
|
||||
List<BuildingSite> list = new ArrayList<>();
|
||||
try{
|
||||
double[] points = LongLatUtil.getAround(longitude,latitude,raidus);
|
||||
QueryWrapper<BuildingSite> wrapper = new QueryWrapper();
|
||||
wrapper.between("jd",points[0],points[2]).between("wd",points[1],points[3]);
|
||||
list = buildingSiteMapper.selectList(wrapper);
|
||||
}catch (Exception e){
|
||||
log.error("[listBuildingSiteByPoints] Exception:"+e.getMessage());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue