diff --git a/src/main/java/com/hisense/monitormanage/controller/Controller.java b/src/main/java/com/hisense/monitormanage/controller/Controller.java index 1b58036..fe50795 100644 --- a/src/main/java/com/hisense/monitormanage/controller/Controller.java +++ b/src/main/java/com/hisense/monitormanage/controller/Controller.java @@ -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 projects = projectMapper.selectList(null); @@ -394,4 +394,13 @@ public class Controller { List list = roadDataService.listRoadData(dt); return Result.success(list); } + + //查询工地信息,根据经纬度和半径查询 + @RequestMapping(value = "listBuildingSiteByPoints") + public Result listBuildingSiteByPoints(double longitude,double latitude,Integer raidus){ + List list = new ArrayList<>(); + + list = buildingSitrService.listBuildingSiteByPoints(longitude,latitude,raidus); + return Result.success(list); + } } diff --git a/src/main/java/com/hisense/monitormanage/entity/BuildingSite.java b/src/main/java/com/hisense/monitormanage/entity/BuildingSite.java new file mode 100644 index 0000000..e3a3b1b --- /dev/null +++ b/src/main/java/com/hisense/monitormanage/entity/BuildingSite.java @@ -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; +} diff --git a/src/main/java/com/hisense/monitormanage/mapper/BuildingSiteMapper.java b/src/main/java/com/hisense/monitormanage/mapper/BuildingSiteMapper.java new file mode 100644 index 0000000..a88f9e9 --- /dev/null +++ b/src/main/java/com/hisense/monitormanage/mapper/BuildingSiteMapper.java @@ -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 { +} diff --git a/src/main/java/com/hisense/monitormanage/service/BuildingSiteService.java b/src/main/java/com/hisense/monitormanage/service/BuildingSiteService.java new file mode 100644 index 0000000..563fae3 --- /dev/null +++ b/src/main/java/com/hisense/monitormanage/service/BuildingSiteService.java @@ -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 listBuildingSiteByPoints(double longitude,double latitude,Integer raidus){ + List list = new ArrayList<>(); + try{ + double[] points = LongLatUtil.getAround(longitude,latitude,raidus); + QueryWrapper 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; + } +}