燕山石化溯源三维电子沙盘-【后端】-服务
1
13693261870
2023-07-05 2b8df9f5452218cad1f012a008acea724de81fff
1
已修改7个文件
66 ■■■■ 文件已修改
src/main/java/com/yssh/controller/SuYuanController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/dao/LocationMapper.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/ILocationService.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/ISuYuanService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/impl/LocationServiceImpl.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/impl/SuYuanServiceImpl.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapping/LocationMapper.xml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/controller/SuYuanController.java
@@ -174,4 +174,11 @@
    public Result selectSuYuan700ById(@RequestParam(value = "id", required = true) String id, @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) {
        return Result.OK(suYuanService.selectSuYuan700ById(id, date));
    }
    @ApiOperation(value = "根据经纬度查询地名", notes = "根据经纬度查询地名")
    @ApiOperationSupport(order = 15)
    @GetMapping("/selectAddrByXY")
    public Result selectAddrByXY(@RequestParam(value = "x", required = true) double x, @RequestParam(value = "y", required = true) double y) {
        return Result.OK(suYuanService.selectAddrByXY(x, y));
    }
}
src/main/java/com/yssh/dao/LocationMapper.java
@@ -8,16 +8,18 @@
/**
 * @author wMeng
 * @ClassName YsshLocationMapper
 * @Description TODO
 * @date 2022/10/30 13:37
 * @Version 1.0
 * @version 1.0
 */
@Mapper
public interface LocationMapper {
    List<Location> query(@Param("name") String name, @Param("type") String type);
    List<Location> getAll();
    int insertLocation(Location ysshLocation);
    int deleteLocation(String id);
    List<Location> selectByXY(@Param("x") double x, @Param("y") double y);
}
src/main/java/com/yssh/service/ILocationService.java
@@ -6,14 +6,14 @@
/**
 * @author wMeng
 * @ClassName YsshLocationService
 * @Description TODO
 * @date 2022/10/30 13:25
 * @Version 1.0
 * @version 1.0
 */
public interface ILocationService {
    List<Location> query(String name, String type);
    List<Location> getAll();
    int insertLocation(Location ysshLocation);
    int deleteLocation(String id);
src/main/java/com/yssh/service/ISuYuanService.java
@@ -36,4 +36,6 @@
    public List<List<Coordinate>> selectRects(Double[] x, Double[] y);
    public SuYuan700 selectSuYuan700ById(String id, Date date);
    public String selectAddrByXY(double x, double y);
}
src/main/java/com/yssh/service/impl/LocationServiceImpl.java
@@ -3,37 +3,38 @@
import com.yssh.dao.LocationMapper;
import com.yssh.entity.Location;
import com.yssh.service.ILocationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
 * @author wMeng
 * @ClassName YsshLocationServiceImpl
 * @Description TODO
 * @date 2022/10/30 13:25
 * @Version 1.0
 * @version 1.0
 */
@Service
public class LocationServiceImpl implements ILocationService {
    @Autowired
    @Resource
    private LocationMapper mapper;
    @Override
    public List<Location> query(String name, String type) {
        return mapper.query(name, type);
    }
    @Override
    public List<Location> getAll() {
        return mapper.getAll();
    }
    @Override
    public int insertLocation(Location location) {
        return mapper.insertLocation(location);
    }
    @Override
    public int deleteLocation(String id) {
        return mapper.deleteLocation(id);
    }
}
src/main/java/com/yssh/service/impl/SuYuanServiceImpl.java
@@ -4,7 +4,7 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
import com.yssh.dao.QxshMapper;
import com.yssh.dao.*;
import com.yssh.entity.*;
import com.yssh.utils.*;
import org.slf4j.Logger;
@@ -13,9 +13,6 @@
import org.springframework.stereotype.Service;
import com.google.common.collect.Lists;
import com.yssh.dao.DictRecordMapper;
import com.yssh.dao.FeedbackMapper;
import com.yssh.dao.SuYuanMapper;
import com.yssh.service.IAsyncService;
import com.yssh.service.ICommonService;
import com.yssh.service.ISuYuanService;
@@ -43,6 +40,9 @@
    @Resource
    private QxshMapper qxshMapper;
    @Resource
    private LocationMapper locationMapper;
    //@Transactional
    //@Override
@@ -301,4 +301,15 @@
        return suYuanMapper.selectSuYuan700ById(id, time);
    }
    @Override
    public String selectAddrByXY(double x, double y) {
        List<Location> locations = locationMapper.selectByXY(x, y);
        if (null != locations && locations.size() > 0) {
            return locations.get(0).getName();
        }
        return null;
    }
}
src/main/resources/mapping/LocationMapper.xml
@@ -12,6 +12,15 @@
    <sql id="locationSql">
        SELECT id, name, type, format(lon, 6) lon, format(lat, 6) lat FROM location
    </sql>
    <select id="selectByXY" resultMap="locationResult">
        <include refid="locationSql"></include>
        <where>
            lon between (#{x} - 0.000027) and (#{x} + 0.000027)
            and
            lat between (#{y} - 0.000027) and (#{y} + 0.000027)
        </where>
    </select>
    
    <select id="query" resultMap="locationResult">
        <include refid="locationSql"></include>