feature (工行押品):添加工行询价功能
1. 小区百度坐标转高德坐标
This commit is contained in:
parent
c0cc060384
commit
ec398fc8c9
@ -48,6 +48,14 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot 拦截器 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@ -0,0 +1,37 @@
|
||||
package com.ruoyi.project.data.basis.domain;
|
||||
|
||||
/**
|
||||
* 高德坐标系
|
||||
*
|
||||
* @author lihe
|
||||
*/
|
||||
public class GDConvertCordinateResult {
|
||||
|
||||
private Integer status;
|
||||
private String info;
|
||||
private String locations;
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
public void setInfo(String info) {
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public String getLocations() {
|
||||
return locations;
|
||||
}
|
||||
|
||||
public void setLocations(String locations) {
|
||||
this.locations = locations;
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package com.ruoyi.project.data.basis.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 小区坐标
|
||||
*
|
||||
* @author lihe
|
||||
*/
|
||||
public class UvCommunityGeo {
|
||||
|
||||
private String communityId;
|
||||
private BigDecimal baiduLng;
|
||||
private BigDecimal baiduLat;
|
||||
private BigDecimal gaodeLng;
|
||||
private BigDecimal gaodeLat;
|
||||
|
||||
|
||||
public String getCommunityId() {
|
||||
return communityId;
|
||||
}
|
||||
|
||||
public void setCommunityId(String communityId) {
|
||||
this.communityId = communityId;
|
||||
}
|
||||
|
||||
public BigDecimal getBaiduLng() {
|
||||
return baiduLng;
|
||||
}
|
||||
|
||||
public void setBaiduLng(BigDecimal baiduLng) {
|
||||
this.baiduLng = baiduLng;
|
||||
}
|
||||
|
||||
public BigDecimal getBaiduLat() {
|
||||
return baiduLat;
|
||||
}
|
||||
|
||||
public void setBaiduLat(BigDecimal baiduLat) {
|
||||
this.baiduLat = baiduLat;
|
||||
}
|
||||
|
||||
public BigDecimal getGaodeLng() {
|
||||
return gaodeLng;
|
||||
}
|
||||
|
||||
public void setGaodeLng(BigDecimal gaodeLng) {
|
||||
this.gaodeLng = gaodeLng;
|
||||
}
|
||||
|
||||
public BigDecimal getGaodeLat() {
|
||||
return gaodeLat;
|
||||
}
|
||||
|
||||
public void setGaodeLat(BigDecimal gaodeLat) {
|
||||
this.gaodeLat = gaodeLat;
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.ruoyi.project.data.basis.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.ruoyi.project.data.basis.domain.UVBasePrice;
|
||||
import com.ruoyi.project.data.basis.domain.UVBasePriceQueryModel;
|
||||
import com.ruoyi.project.data.basis.domain.UvCommunityGeo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 小区坐标Mapper
|
||||
*
|
||||
* @author lihe
|
||||
*/
|
||||
@DS("teemlink")
|
||||
public interface UvCommunityGeoMapper {
|
||||
|
||||
/**
|
||||
* 获取所有
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<UvCommunityGeo> all();
|
||||
|
||||
/**
|
||||
* 更新高德坐标
|
||||
*
|
||||
* @param uvCommunityGeo
|
||||
* @return
|
||||
*/
|
||||
int updateGaoDeCoordinate(UvCommunityGeo uvCommunityGeo);
|
||||
|
||||
}
|
80
ruoyi/src/main/resources/application-routine.yml
Normal file
80
ruoyi/src/main/resources/application-routine.yml
Normal file
@ -0,0 +1,80 @@
|
||||
ruoyi:
|
||||
# 名称
|
||||
name: RuoYi
|
||||
# 版本
|
||||
version: 2.2.0
|
||||
# 版权年份
|
||||
copyrightYear: 2019
|
||||
# 实例演示开关
|
||||
demoEnabled: true
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: D:/ruoyi/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
|
||||
# web服务器配置
|
||||
server:
|
||||
port: 9700
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
# tomcat最大线程数,默认为200
|
||||
max-threads: 800
|
||||
# Tomcat启动初始化的线程数,默认值25
|
||||
min-spare-threads: 30
|
||||
|
||||
spring:
|
||||
datasource:
|
||||
dynamic:
|
||||
primary: master
|
||||
hikari:
|
||||
connection-timeout: 30000
|
||||
validation-timeout: 30000
|
||||
idle-timeout: 30000
|
||||
max-lifetime: 30000
|
||||
max-pool-size: 30
|
||||
min-idle: 10
|
||||
initialization-fail-timeout: 30000
|
||||
connection-init-sql: select 1
|
||||
connection-test-query: select 1
|
||||
is-auto-commit: true
|
||||
is-read-only: false
|
||||
datasource:
|
||||
master:
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
url: jdbc:mysql://172.16.30.243:6060/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: LOLm2dI2UQF#RxOf
|
||||
teemlink:
|
||||
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=obpm_LianCheng_Data
|
||||
username: sa
|
||||
password: Lcdatacenter_888
|
||||
oldProd:
|
||||
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
url: jdbc:sqlserver://139.196.201.83:8433;DatabaseName=LC_DataCenter
|
||||
username: sa
|
||||
password: lc1234
|
||||
compute:
|
||||
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_calc
|
||||
username: sa
|
||||
password: Lcdatacenter_888
|
||||
clean:
|
||||
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_clean
|
||||
username: sa
|
||||
password: Lcdatacenter_888
|
||||
calc:
|
||||
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
url: jdbc:sqlserver://139.196.201.83:1433;DatabaseName=CALC
|
||||
username: purple
|
||||
password: liancheng
|
||||
spider:
|
||||
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
url: jdbc:sqlserver://139.196.201.83:1433;DatabaseName=TEST
|
||||
username: purple
|
||||
password: liancheng
|
@ -0,0 +1,14 @@
|
||||
<?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.ruoyi.project.data.basis.mapper.UvCommunityGeoMapper">
|
||||
<select id="all" resultType="com.ruoyi.project.data.basis.domain.UvCommunityGeo">
|
||||
select community_id as communityId, baidu_lng as baiduLng, baidu_lat as baiduLat from gis_community where
|
||||
gaode_lng is null
|
||||
</select>
|
||||
<update id="updateGaoDeCoordinate" parameterType="com.ruoyi.project.data.basis.domain.UvCommunityGeo">
|
||||
update gis_community set gaode_lng=#{gaodeLng},gaode_lat=#{gaodeLat},update_time=getdate() where
|
||||
community_id=#{communityId}
|
||||
</update>
|
||||
</mapper>
|
83
ruoyi/src/test/java/com/ruoyi/routine/GeoTests.java
Normal file
83
ruoyi/src/test/java/com/ruoyi/routine/GeoTests.java
Normal file
@ -0,0 +1,83 @@
|
||||
package com.ruoyi.routine;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.ruoyi.RuoYiApplication;
|
||||
import com.ruoyi.project.data.basis.domain.GDConvertCordinateResult;
|
||||
import com.ruoyi.project.data.basis.domain.UvCommunityGeo;
|
||||
import com.ruoyi.project.data.basis.mapper.UvCommunityGeoMapper;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.security.web.PortResolverImpl;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = RuoYiApplication.class)
|
||||
@ActiveProfiles("uat")
|
||||
public class GeoTests {
|
||||
|
||||
@Autowired
|
||||
private UvCommunityGeoMapper uvCommunityGeoMapper;
|
||||
|
||||
/**
|
||||
* 小区坐标,百度转高德
|
||||
*/
|
||||
@Test
|
||||
@DS("teemlink")
|
||||
public void convertBd2Gd() {
|
||||
List<UvCommunityGeo> communityGeoList = uvCommunityGeoMapper.all();
|
||||
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
String baseUrl = "https://restapi.amap.com/v3/assistant/coordinate/convert?key" +
|
||||
"=4b331b88b71252b7db756603a2562737";
|
||||
|
||||
//
|
||||
communityGeoList.parallelStream().forEach(communityGeo -> {
|
||||
|
||||
StringBuilder sb = new StringBuilder(baseUrl);
|
||||
sb.append(String.format("&locations=%s,%s&coordsys=baidu", communityGeo.getBaiduLng(),
|
||||
communityGeo.getBaiduLat()));
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url(sb.toString())
|
||||
.build();
|
||||
try (Response response = client.newCall(request).execute()) {
|
||||
String content = response.body().string();
|
||||
// System.out.println(content);
|
||||
GDConvertCordinateResult priceApiResult = JSON.parseObject(content,
|
||||
GDConvertCordinateResult.class);
|
||||
if (Objects.equals(1, priceApiResult.getStatus())) {
|
||||
String[] coordinates = priceApiResult.getLocations().split(",");
|
||||
communityGeo.setGaodeLng(new BigDecimal(coordinates[0]));
|
||||
communityGeo.setGaodeLat(new BigDecimal(coordinates[1]));
|
||||
uvCommunityGeoMapper.updateGaoDeCoordinate(communityGeo);
|
||||
}
|
||||
|
||||
// System.out.println(priceApiResult);
|
||||
// if (null != priceApiResult && priceApiResult.getStatus()) {
|
||||
// jdbcTemplate.update("update collateral set total_price=? where id=?",
|
||||
// new Object[]{priceApiResult.getUeasPrice(), x.getId()});
|
||||
// }
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user