Browse Source

区位状况信息接口

wucl 7 months ago
parent
commit
72f2bb6025

+ 45 - 0
biz-base/src/main/java/com/dayou/controller/HouseGuarantyAreaController.java

@@ -0,0 +1,45 @@
+package com.dayou.controller;
+
+import com.dayou.entity.HouseGuarantyArea;
+import com.dayou.result.Result;
+import com.dayou.service.HouseGuarantyAreaService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+
+
+/**
+ * 房地产估价对象标的物区位状况
+ */
+@RestController
+@RequestMapping("houseGuarantyArea")
+@Slf4j
+public class HouseGuarantyAreaController {
+
+    @Autowired
+    private HouseGuarantyAreaService houseGuarantyAreaService;
+
+    /**
+     * 更新和保存区位信息
+     * @param houseGuarantyArea
+     * @return
+     */
+    @PostMapping("")
+    public Result<Long> save(@RequestBody HouseGuarantyArea houseGuarantyArea) {
+        houseGuarantyAreaService.saveOrUpdate(houseGuarantyArea);
+        return Result.build(houseGuarantyArea.getId());
+    }
+
+    /**
+     * 根据经纬度查询附近
+     * @param lngLat
+     * @return
+     */
+    @GetMapping("/lngLat")
+    public Result<HouseGuarantyArea> getByLngLat(String lngLat) {
+        HouseGuarantyArea area = houseGuarantyAreaService.getByLngLat(lngLat);
+        return Result.build(area);
+    }
+
+}

+ 13 - 0
dao/src/main/java/com/dayou/mapper/HouseGuarantyAreaMapper.java

@@ -0,0 +1,13 @@
+package com.dayou.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.dayou.entity.HouseGuarantyArea;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+public interface HouseGuarantyAreaMapper extends BaseMapper<HouseGuarantyArea> {
+
+    HouseGuarantyArea getByLngLat(@Param("lng") BigDecimal lng, @Param("lat") BigDecimal lat);
+}

dao/src/main/resources/mapper/HouseGuarantyAim.xml → dao/src/main/resources/mapper/HouseGuarantyAimMapper.xml


+ 13 - 0
dao/src/main/resources/mapper/HouseGuarantyAreaMapper.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.dayou.mapper.HouseGuarantyAreaMapper">
+
+
+    <select id="getByLngLat" resultType="com.dayou.entity.HouseGuarantyArea">
+        SELECT * FROM house_guaranty_area
+                 WHERE ( lng &lt;=( #{lng}+0.01 ) and lng &gt;=( #{lng}-0.01 ))
+                   AND ( lat &gt;=( #{lat}-0.01 ) and lat &lt;=( #{lat}+0.01 ))
+                    and delete_status=0
+            order by id desc limit 1
+    </select>
+</mapper>

dao/src/main/resources/mapper/HouseGuarantyBase.xml → dao/src/main/resources/mapper/HouseGuarantyBaseMapper.xml


+ 42 - 0
domain/src/main/java/com/dayou/entity/HouseGuarantyArea.java

@@ -0,0 +1,42 @@
+package com.dayou.entity;
+
+import com.dayou.common.BaseEntity;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class HouseGuarantyArea extends BaseEntity {
+
+    private Long docId;
+
+    private String tid;
+
+    private String tno;
+
+    private BigDecimal lng;
+
+    private BigDecimal lat;
+
+    private String location;
+
+    private String road;
+
+    private String publicTransport;
+
+    private String park;
+
+    private String business;
+
+    private String community;
+
+    private String education;
+
+    private String hospital;
+
+    private String bank;
+
+    private String hotel;
+
+    private String spot;
+}

+ 9 - 0
service/src/main/java/com/dayou/service/HouseGuarantyAreaService.java

@@ -0,0 +1,9 @@
+package com.dayou.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.dayou.entity.HouseGuarantyArea;
+
+public interface HouseGuarantyAreaService extends IService<HouseGuarantyArea> {
+
+    HouseGuarantyArea getByLngLat(String lngLat);
+}

+ 29 - 0
service/src/main/java/com/dayou/service/impl/HouseGuarantyAreaServiceImpl.java

@@ -0,0 +1,29 @@
+package com.dayou.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.dayou.entity.HouseGuarantyArea;
+import com.dayou.mapper.HouseGuarantyAreaMapper;
+import com.dayou.service.HouseGuarantyAreaService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+public class HouseGuarantyAreaServiceImpl extends ServiceImpl<HouseGuarantyAreaMapper, HouseGuarantyArea> implements HouseGuarantyAreaService {
+
+    @Autowired
+    private HouseGuarantyAreaMapper houseGuarantyAreaMapper;
+
+    @Override
+    public HouseGuarantyArea getByLngLat(String lngLat) {
+        List<BigDecimal> lngLats = Arrays.stream(lngLat.split(","))
+                .map(BigDecimal::new).collect(Collectors.toList());
+        BigDecimal lng = lngLats.get(0);
+        BigDecimal lat = lngLats.get(1);
+        return houseGuarantyAreaMapper.getByLngLat(lng,lat);
+    }
+}

+ 2 - 1
service/src/main/java/com/dayou/service/HouseGuarantyBaseServiceImpl.java

@@ -1,8 +1,9 @@
-package com.dayou.service;
+package com.dayou.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.dayou.entity.HouseGuarantyBase;
 import com.dayou.mapper.HouseGuarantyBaseMapper;
+import com.dayou.service.HouseGuarantyBaseService;
 import org.springframework.stereotype.Service;
 
 @Service