From ae9694865579706b056d2d4f50b5f466a11d39f8 Mon Sep 17 00:00:00 2001 From: yitonglei Date: Thu, 12 May 2022 14:08:41 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E6=9F=A5=E8=AF=A2=E5=B7=A5?= =?UTF-8?q?=E5=9C=B0=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../monitormanage/controller/Controller.java | 19 ++++++--- .../monitormanage/entity/BuildingSite.java | 28 +++++++++++++ .../mapper/BuildingSiteMapper.java | 14 +++++++ .../service/BuildingSiteService.java | 39 +++++++++++++++++++ 4 files changed, 95 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/hisense/monitormanage/entity/BuildingSite.java create mode 100644 src/main/java/com/hisense/monitormanage/mapper/BuildingSiteMapper.java create mode 100644 src/main/java/com/hisense/monitormanage/service/BuildingSiteService.java 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; + } +}