| | |
| | | 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)); |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * @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); |
| | | } |
| | |
| | | |
| | | /** |
| | | * @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); |
| | |
| | | public List<List<Coordinate>> selectRects(Double[] x, Double[] y); |
| | | |
| | | public SuYuan700 selectSuYuan700ById(String id, Date date); |
| | | |
| | | public String selectAddrByXY(double x, double y); |
| | | } |
| | |
| | | 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); |
| | | } |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | |
| | | @Resource |
| | | private QxshMapper qxshMapper; |
| | | |
| | | @Resource |
| | | private LocationMapper locationMapper; |
| | | |
| | | //@Transactional |
| | | //@Override |
| | |
| | | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | <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> |