提交 20226086 authored 作者: 000516's avatar 000516

根据经纬度,逆地理解析,得到地位

上级 f0adfe34
......@@ -115,11 +115,11 @@ public class LsDisStore implements Serializable {
* 区
*/
private String reArea;
//
// /**
// * 百度地址
// */
// private String reAddress;
/**
* 百度地址
*/
private String reAddress;
//
// /**
// * [销售金额_元___Sell_Out_Value__Yuan_]
......
......@@ -33,8 +33,8 @@ public class LsDisStoreDaoImpl {
updateanhui(lsDisStores,ldsId);
}
// OI4hMr7tEUoDBhSYxcrOGslnnBfZmD2b
// 1ZKO0CGs6nm9HuZWR6ucRiu4p9kM8f3i
// 东旭:OI4hMr7tEUoDBhSYxcrOGslnnBfZmD2b
// 秋林:1ZKO0CGs6nm9HuZWR6ucRiu4p9kM8f3i
private void updateanhui(List<LsDisStore> lsDisStores,Long ldsId){
for (LsDisStore lsDisStore : lsDisStores) {
String outlet = lsDisStore.getOutletName()+lsDisStore.getOutletAddress();
......@@ -72,8 +72,8 @@ public class LsDisStoreDaoImpl {
updateGuangzhou(lsDisStores,ldsId);
}
// sJFYkogPGt8kI3xkkSPwQQ9T61b4GVQV
// 8ptRbXOnQNX2TTqGVVYv5AUw3vJZ77gZ
// 光浩:sJFYkogPGt8kI3xkkSPwQQ9T61b4GVQV
// 黄总:8ptRbXOnQNX2TTqGVVYv5AUw3vJZ77gZ
private void updateGuangzhou(List<LsDisStore> lsDisStores,Long ldsId){
for (LsDisStore lsDisStore : lsDisStores) {
String outlet = lsDisStore.getOutletName()+lsDisStore.getOutletAddress();
......@@ -111,8 +111,8 @@ public class LsDisStoreDaoImpl {
updateanhuisp(lsDisStores,ldsId);
}
// StY6BS8Bw50TrclA4Zd52MfEjsL1zUXI
// anjhOkUMuRyTb3DZO6dMGRUCY2l0vAql
// 欣雨:StY6BS8Bw50TrclA4Zd52MfEjsL1zUXI
// 本才:anjhOkUMuRyTb3DZO6dMGRUCY2l0vAql
private void updateanhuisp(List<LsDisStore> lsDisStores,Long ldsId){
for (LsDisStore lsDisStore : lsDisStores) {
String outlet = lsDisStore.getOutletName()+lsDisStore.getOutletAddress();
......@@ -140,4 +140,209 @@ public class LsDisStoreDaoImpl {
baiduAddressAnHuisp(ldsId);
}
public void nAddreasAnHui(long ldsId) {
List<LsDisStore> lsDisStores = lsDisStoreMapper.selectBaseLO(ldsId);
if (lsDisStores.isEmpty()){
return;
}
ldsId = lsDisStores.get(lsDisStores.size() - 1).getLdsIf();
nUanhuisp(lsDisStores,ldsId);
}
private void nUanhuisp(List<LsDisStore> lsDisStores,Long ldsId){
for (LsDisStore lsDisStore : lsDisStores) {
String lng = lsDisStore.getLng();
String s = HttpUtil.get("https://api.map.baidu.com/reverse_geocoding/v3/?location="+lng+"&output=json&ak=anjhOkUMuRyTb3DZO6dMGRUCY2l0vAql");
JSONObject bd = JSONObject.parseObject(s);
Integer status = bd.getInteger("status");
if (status.intValue() >= 300 && status.intValue() <= 399){
log.info(s);
return;
}
if (status.intValue() != 0){
continue;
}
JSONObject jo = bd.getJSONObject("result");
String formattedAddress = jo.getString("formatted_address");
JSONObject ac = jo.getJSONObject("addressComponent");
String district = ac.getString("district");
lsDisStore.setReAddress(formattedAddress);
lsDisStore.setReArea(district);
}
lsDisStoreMapper.updateListNO(lsDisStores);
nAddreasAnHui(ldsId);
}
public void lsStoreNXY(long ldsId) {
List<LsDisStore> lsDisStores = lsDisStoreMapper.selectBaseLT(ldsId);
if (lsDisStores.isEmpty()){
return;
}
ldsId = lsDisStores.get(lsDisStores.size() - 1).getLdsIf();
nUXY(lsDisStores,ldsId);
}
private void nUXY(List<LsDisStore> lsDisStores,Long ldsId){
for (LsDisStore lsDisStore : lsDisStores) {
String lng = lsDisStore.getLng();
String s = HttpUtil.get("https://api.map.baidu.com/reverse_geocoding/v3/?location="+lng+"&output=json&ak=StY6BS8Bw50TrclA4Zd52MfEjsL1zUXI");
JSONObject bd = JSONObject.parseObject(s);
Integer status = bd.getInteger("status");
if (status.intValue() >= 300 && status.intValue() <= 399){
log.info(s);
return;
}
if (status.intValue() != 0){
continue;
}
JSONObject jo = bd.getJSONObject("result");
String formattedAddress = jo.getString("formatted_address");
JSONObject ac = jo.getJSONObject("addressComponent");
String district = ac.getString("district");
lsDisStore.setReAddress(formattedAddress);
lsDisStore.setReArea(district);
}
lsDisStoreMapper.updateListNO(lsDisStores);
lsStoreNXY(ldsId);
}
public void lsStoreNGH(long ldsId) {
List<LsDisStore> lsDisStores = lsDisStoreMapper.selectBaseLS(ldsId);
if (lsDisStores.isEmpty()){
return;
}
ldsId = lsDisStores.get(lsDisStores.size() - 1).getLdsIf();
nUGH(lsDisStores,ldsId);
}
private void nUGH(List<LsDisStore> lsDisStores, long ldsId) {
for (LsDisStore lsDisStore : lsDisStores) {
String lng = lsDisStore.getLng();
String s = HttpUtil.get("https://api.map.baidu.com/reverse_geocoding/v3/?location="+lng+"&output=json&ak=sJFYkogPGt8kI3xkkSPwQQ9T61b4GVQV");
JSONObject bd = JSONObject.parseObject(s);
Integer status = bd.getInteger("status");
if (status.intValue() >= 300 && status.intValue() <= 399){
log.info(s);
return;
}
if (status.intValue() != 0){
continue;
}
JSONObject jo = bd.getJSONObject("result");
String formattedAddress = jo.getString("formatted_address");
JSONObject ac = jo.getJSONObject("addressComponent");
String district = ac.getString("district");
lsDisStore.setReAddress(formattedAddress);
lsDisStore.setReArea(district);
}
lsDisStoreMapper.updateListNO(lsDisStores);
lsStoreNGH(ldsId);
}
public void lsStoreNHS(long ldsId) {
List<LsDisStore> lsDisStores = lsDisStoreMapper.selectBaseLF(ldsId);
if (lsDisStores.isEmpty()){
return;
}
ldsId = lsDisStores.get(lsDisStores.size() - 1).getLdsIf();
nUHS(lsDisStores,ldsId);
}
private void nUHS(List<LsDisStore> lsDisStores, long ldsId) {
for (LsDisStore lsDisStore : lsDisStores) {
String lng = lsDisStore.getLng();
String s = HttpUtil.get("https://api.map.baidu.com/reverse_geocoding/v3/?location="+lng+"&output=json&ak=8ptRbXOnQNX2TTqGVVYv5AUw3vJZ77gZ");
JSONObject bd = JSONObject.parseObject(s);
Integer status = bd.getInteger("status");
if (status.intValue() >= 300 && status.intValue() <= 399){
log.info(s);
return;
}
if (status.intValue() != 0){
continue;
}
JSONObject jo = bd.getJSONObject("result");
String formattedAddress = jo.getString("formatted_address");
JSONObject ac = jo.getJSONObject("addressComponent");
String district = ac.getString("district");
lsDisStore.setReAddress(formattedAddress);
lsDisStore.setReArea(district);
}
lsDisStoreMapper.updateListNO(lsDisStores);
lsStoreNHS(ldsId);
}
public void lsStoreNDX(long ldsId) {
List<LsDisStore> lsDisStores = lsDisStoreMapper.selectBaseLV(ldsId);
if (lsDisStores.isEmpty()){
return;
}
ldsId = lsDisStores.get(lsDisStores.size() - 1).getLdsIf();
nUDX(lsDisStores,ldsId);
}
private void nUDX(List<LsDisStore> lsDisStores, long ldsId) {
for (LsDisStore lsDisStore : lsDisStores) {
String lng = lsDisStore.getLng();
String s = HttpUtil.get("https://api.map.baidu.com/reverse_geocoding/v3/?location="+lng+"&output=json&ak=OI4hMr7tEUoDBhSYxcrOGslnnBfZmD2b");
JSONObject bd = JSONObject.parseObject(s);
Integer status = bd.getInteger("status");
if (status.intValue() >= 300 && status.intValue() <= 399){
log.info(s);
return;
}
if (status.intValue() != 0){
continue;
}
JSONObject jo = bd.getJSONObject("result");
String formattedAddress = jo.getString("formatted_address");
JSONObject ac = jo.getJSONObject("addressComponent");
String district = ac.getString("district");
lsDisStore.setReAddress(formattedAddress);
lsDisStore.setReArea(district);
}
lsDisStoreMapper.updateListNO(lsDisStores);
lsStoreNDX(ldsId);
}
public void lsStoreNQL(long ldsId) {
List<LsDisStore> lsDisStores = lsDisStoreMapper.selectBaseLX(ldsId);
if (lsDisStores.isEmpty()){
return;
}
ldsId = lsDisStores.get(lsDisStores.size() - 1).getLdsIf();
nUQL(lsDisStores,ldsId);
}
private void nUQL(List<LsDisStore> lsDisStores, long ldsId) {
for (LsDisStore lsDisStore : lsDisStores) {
String lng = lsDisStore.getLng();
String s = HttpUtil.get("https://api.map.baidu.com/reverse_geocoding/v3/?location="+lng+"&output=json&ak=1ZKO0CGs6nm9HuZWR6ucRiu4p9kM8f3i");
JSONObject bd = JSONObject.parseObject(s);
Integer status = bd.getInteger("status");
if (status.intValue() >= 300 && status.intValue() <= 399){
log.info(s);
return;
}
if (status.intValue() != 0){
continue;
}
JSONObject jo = bd.getJSONObject("result");
String formattedAddress = jo.getString("formatted_address");
JSONObject ac = jo.getJSONObject("addressComponent");
String district = ac.getString("district");
lsDisStore.setReAddress(formattedAddress);
lsDisStore.setReArea(district);
}
lsDisStoreMapper.updateListNO(lsDisStores);
lsStoreNQL(ldsId);
}
}
......@@ -27,6 +27,18 @@ public interface LsDisStoreMapper extends BaseMapper<LsDisStore> {
List<LsDisStore> selectBaseS(Long lastId);
void updateListS(@Param("lsDisStores") List<LsDisStore> lsDisStores);
/**
* 逆地理编码
*/
List<LsDisStore> selectBaseLO(long ldsId);
List<LsDisStore> selectBaseLT(long ldsId);
List<LsDisStore> selectBaseLS(long ldsId);
List<LsDisStore> selectBaseLF(long ldsId);
List<LsDisStore> selectBaseLV(long ldsId);
List<LsDisStore> selectBaseLX(long ldsId);
void updateListNO(@Param("lsDisStores") List<LsDisStore> lsDisStores);
}
......
......@@ -34,4 +34,35 @@ public class TestTask {
lsDisStoreDaoImpl.baiduAddressAnHuisp(1000000L);
}
/**
* 逆地理编码
*/
@XxlJob("ls_store_n_anhui")
public void lsStoreNAnHui() {
lsDisStoreDaoImpl.nAddreasAnHui(0L);
}
@XxlJob("ls_store_n_xy")
public void lsStoreNXY() {
lsDisStoreDaoImpl.lsStoreNXY(250000L);
}
@XxlJob("ls_store_n_gh")
public void lsStoreNGH() {
lsDisStoreDaoImpl.lsStoreNGH(500000L);
}
@XxlJob("ls_store_n_hs")
public void lsStoreNHS() {
lsDisStoreDaoImpl.lsStoreNHS(750000L);
}
@XxlJob("ls_store_n_dx")
public void lsStoreNDX() {
lsDisStoreDaoImpl.lsStoreNDX(1000000L);
}
@XxlJob("ls_store_n_ql")
public void lsStoreNQL() {
lsDisStoreDaoImpl.lsStoreNQL(1250000L);
}
}
......@@ -70,4 +70,41 @@
</update>
<select id="selectBaseLO" resultMap="LsDisStoreBase">
select lds_if,lng
from ls_dis_store where lng is not null and lds_if &gt; #{lastId} and lds_if &lt;= 250000
</select>
<select id="selectBaseLT" resultMap="LsDisStoreBase">
select lds_if,lng
from ls_dis_store where lng is not null and lds_if &gt; #{lastId} and lds_if &lt;= 500000
</select>
<select id="selectBaseLS" resultMap="LsDisStoreBase">
select lds_if,lng
from ls_dis_store where lng is not null and lds_if &gt; #{lastId} and lds_if &lt;= 750000
</select>
<select id="selectBaseLF" resultMap="LsDisStoreBase">
select lds_if,lng
from ls_dis_store where lng is not null and lds_if &gt; #{lastId} and lds_if &lt;= 1000000
</select>
<select id="selectBaseLV" resultMap="LsDisStoreBase">
select lds_if,lng
from ls_dis_store where lng is not null and lds_if &gt; #{lastId} and lds_if &lt;= 1250000
</select>
<select id="selectBaseLX" resultMap="LsDisStoreBase">
select lds_if,lng
from ls_dis_store where lng is not null and lds_if &gt; #{lastId} and lds_if &lt;= 1537130
</select>
<update id="updateListNO" parameterType="java.util.List">
<foreach collection="lsDisStores" item="item" separator=";">
update ls_dis_store set re_address = #{item.reAddress},re_area = #{item.reArea} where lds_if = #{item.ldsIf}
</foreach>
</update>
</mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论