|
@@ -6,8 +6,6 @@ import com.skyversation.poiaddr.addquery.TransfromDataTool;
|
|
|
import com.skyversation.poiaddr.bean.AddressResult;
|
|
import com.skyversation.poiaddr.bean.AddressResult;
|
|
|
import com.skyversation.poiaddr.bean.GeoJsonBean;
|
|
import com.skyversation.poiaddr.bean.GeoJsonBean;
|
|
|
import com.skyversation.poiaddr.bean.YyskDmdzAddressStandardization;
|
|
import com.skyversation.poiaddr.bean.YyskDmdzAddressStandardization;
|
|
|
-import com.skyversation.poiaddr.config.DbConnection;
|
|
|
|
|
-import com.skyversation.poiaddr.entity.YyskAddressStandardization;
|
|
|
|
|
import com.skyversation.poiaddr.service.AreaService;
|
|
import com.skyversation.poiaddr.service.AreaService;
|
|
|
import com.skyversation.poiaddr.service.impl.YyskAddressStandardizationServiceImpl;
|
|
import com.skyversation.poiaddr.service.impl.YyskAddressStandardizationServiceImpl;
|
|
|
import com.skyversation.poiaddr.util.*;
|
|
import com.skyversation.poiaddr.util.*;
|
|
@@ -21,7 +19,6 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
-import java.io.IOException;
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -157,7 +154,7 @@ public class CorporateLibraryController {
|
|
|
if (StringUtils.hasText(district)) {
|
|
if (StringUtils.hasText(district)) {
|
|
|
splitAddress.setDistrict(district);
|
|
splitAddress.setDistrict(district);
|
|
|
}
|
|
}
|
|
|
- List<YyskDmdzAddressStandardization> list = AreaService.getInstance().getAddressPoiOnlyDB(splitAddress,3);
|
|
|
|
|
|
|
+ List<YyskDmdzAddressStandardization> list = AreaService.getInstance().getAddressPoiOnlyDB(splitAddress, 3);
|
|
|
AddressResult addressResult = null;
|
|
AddressResult addressResult = null;
|
|
|
if (list == null || list.size() < 1) {
|
|
if (list == null || list.size() < 1) {
|
|
|
// 写入回流表
|
|
// 写入回流表
|
|
@@ -184,7 +181,7 @@ public class CorporateLibraryController {
|
|
|
if (!StringUtils.hasText(address)) {
|
|
if (!StringUtils.hasText(address)) {
|
|
|
return MessageManage.getInstance().getResultContent(Constant.PARAM_ERROR, "参数错误", "参数错误");
|
|
return MessageManage.getInstance().getResultContent(Constant.PARAM_ERROR, "参数错误", "参数错误");
|
|
|
}
|
|
}
|
|
|
- AddressResult addressResult = AddressQueryEngine.getInstance().commonSearchByName_nw(address,1);
|
|
|
|
|
|
|
+ AddressResult addressResult = AddressQueryEngine.getInstance().commonSearchByName_nw(address, 1);
|
|
|
if (addressResult == null) {
|
|
if (addressResult == null) {
|
|
|
AreaService.getInstance().callBackErrorAddr(address);
|
|
AreaService.getInstance().callBackErrorAddr(address);
|
|
|
return MessageManage.getInstance().getResultContent(Constant.NO_DATA, "无数据", "无数据");
|
|
return MessageManage.getInstance().getResultContent(Constant.NO_DATA, "无数据", "无数据");
|
|
@@ -212,7 +209,7 @@ public class CorporateLibraryController {
|
|
|
int sl = 3;
|
|
int sl = 3;
|
|
|
String searchLevel = request.getParameter("searchLevel");
|
|
String searchLevel = request.getParameter("searchLevel");
|
|
|
try {
|
|
try {
|
|
|
- if(StringUtils.hasText(searchLevel)){
|
|
|
|
|
|
|
+ if (StringUtils.hasText(searchLevel)) {
|
|
|
sl = Integer.parseInt(searchLevel);
|
|
sl = Integer.parseInt(searchLevel);
|
|
|
if (sl < 1 || sl > 3) {
|
|
if (sl < 1 || sl > 3) {
|
|
|
return MessageManage.getInstance().getResultContent(Constant.PARAM_ERROR, "参数错误", "参数错误");
|
|
return MessageManage.getInstance().getResultContent(Constant.PARAM_ERROR, "参数错误", "参数错误");
|
|
@@ -221,7 +218,7 @@ public class CorporateLibraryController {
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
return MessageManage.getInstance().getResultContent(Constant.PARAM_ERROR, "参数错误", "参数错误");
|
|
return MessageManage.getInstance().getResultContent(Constant.PARAM_ERROR, "参数错误", "参数错误");
|
|
|
}
|
|
}
|
|
|
- AddressResult addressResult = AddressQueryEngine.getInstance().commonSearchByName_nw(address,sl);
|
|
|
|
|
|
|
+ AddressResult addressResult = AddressQueryEngine.getInstance().commonSearchByName_nw(address, sl);
|
|
|
if (addressResult == null || addressResult.getData() == null || addressResult.getData().get(0) == null) {
|
|
if (addressResult == null || addressResult.getData() == null || addressResult.getData().get(0) == null) {
|
|
|
AreaService.getInstance().callBackErrorAddr(address);
|
|
AreaService.getInstance().callBackErrorAddr(address);
|
|
|
return MessageManage.getInstance().getResultContent(Constant.NO_DATA, "无数据", "无数据");
|
|
return MessageManage.getInstance().getResultContent(Constant.NO_DATA, "无数据", "无数据");
|
|
@@ -234,6 +231,94 @@ public class CorporateLibraryController {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 只返回bean的接口,其中返回两个geojson结果
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param request
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/searchByNameOnly2")
|
|
|
|
|
+ public String searchByNameOnly2(HttpServletRequest request) {
|
|
|
|
|
+ String address = request.getParameter("address");
|
|
|
|
|
+ if (!StringUtils.hasText(address)) {
|
|
|
|
|
+ return MessageManage.getInstance().getResultContent(Constant.PARAM_ERROR, "参数错误", "参数错误");
|
|
|
|
|
+ }
|
|
|
|
|
+// 搜索等级:【1:路名、2:弄号、3:楼栋号】
|
|
|
|
|
+ int sl = 3;
|
|
|
|
|
+ String searchLevel = request.getParameter("searchLevel");
|
|
|
|
|
+ try {
|
|
|
|
|
+ if (StringUtils.hasText(searchLevel)) {
|
|
|
|
|
+ sl = Integer.parseInt(searchLevel);
|
|
|
|
|
+ if (sl < 1 || sl > 3) {
|
|
|
|
|
+ return MessageManage.getInstance().getResultContent(Constant.PARAM_ERROR, "参数错误", "参数错误");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ return MessageManage.getInstance().getResultContent(Constant.PARAM_ERROR, "参数错误", "参数错误");
|
|
|
|
|
+ }
|
|
|
|
|
+ AddressResult addressResult = AddressQueryEngine.getInstance().commonSearchByName_nwV2(address, sl);
|
|
|
|
|
+ if (addressResult == null || addressResult.getData() == null || addressResult.getData().get(0) == null) {
|
|
|
|
|
+ AreaService.getInstance().callBackErrorAddr(address);
|
|
|
|
|
+ return MessageManage.getInstance().getResultContent(Constant.NO_DATA, "无数据", "无数据");
|
|
|
|
|
+ } else {
|
|
|
|
|
+// TODO 添加逻辑,数据相对有效性判断,默认关闭
|
|
|
|
|
+ if (ScheduledTasks.ifOpenLonLatStatus) {
|
|
|
|
|
+ AddressTools.ifTrueAddressByBeans(addressResult.getData().get(0));
|
|
|
|
|
+ }
|
|
|
|
|
+ return MessageManage.getInstance().getResultContent(Constant.SUCCESS, addressResult.getData().get(0), "成功");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 手动添加或删除地址库和缓存中的地址
|
|
|
|
|
+ * 添加【address,lon,lat】添加比较快
|
|
|
|
|
+ * 删除【address,oid】删除比较慢
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param request
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/changeDMDZdatas")
|
|
|
|
|
+ public String changeDMDZdatas(HttpServletRequest request) {
|
|
|
|
|
+ String address = request.getParameter("address");
|
|
|
|
|
+ if (StringUtils.hasText(address)) {
|
|
|
|
|
+ String oid = request.getParameter("oid");
|
|
|
|
|
+ if (StringUtils.hasText(oid)) {
|
|
|
|
|
+// 删除操作,首先要删除缓存中的数据,然后执行del操作删除数据库中对应的数据
|
|
|
|
|
+ AreaService.getInstance().delDmdzAddressByRoadInfos(address, Long.parseLong(oid));
|
|
|
|
|
+ return MessageManage.getInstance().getResultContent(Constant.SUCCESS, "地址" + address + "删除成功!", "成功");
|
|
|
|
|
+ } else {
|
|
|
|
|
+// 添加操作
|
|
|
|
|
+ String lon = request.getParameter("lon");
|
|
|
|
|
+ String lat = request.getParameter("lat");
|
|
|
|
|
+ if (StringUtils.hasText(lon) && StringUtils.hasText(lat)) {
|
|
|
|
|
+ GeoJsonBean cjBean = AreaService.getInstance().isInResidentialCommitteePolygon(Double.parseDouble(lon), Double.parseDouble(lat));
|
|
|
|
|
+ if (cjBean != null && cjBean.getProperties() != null) {
|
|
|
|
|
+ YyskDmdzAddressStandardization yyskDmdzAddressStandardization = new YyskDmdzAddressStandardization();
|
|
|
|
|
+ yyskDmdzAddressStandardization.setSourceaddress(address);
|
|
|
|
|
+ yyskDmdzAddressStandardization.setCity("上海市");
|
|
|
|
|
+ yyskDmdzAddressStandardization.setCounty(cjBean.getProperties().getString("所属区"));
|
|
|
|
|
+ yyskDmdzAddressStandardization.setTown(cjBean.getProperties().getString("所属街"));
|
|
|
|
|
+ yyskDmdzAddressStandardization.setCommunity(cjBean.getProperties().getString("居委_1"));
|
|
|
|
|
+ yyskDmdzAddressStandardization.setCommunity_code(cjBean.getProperties().getString("居委会"));
|
|
|
|
|
+ yyskDmdzAddressStandardization.setCreatetime(new Date());
|
|
|
|
|
+ yyskDmdzAddressStandardization.setLon(Float.parseFloat(lon));
|
|
|
|
|
+ yyskDmdzAddressStandardization.setLat(Float.parseFloat(lat));
|
|
|
|
|
+ yyskDmdzAddressStandardization.setData_type("diyBack");
|
|
|
|
|
+ yyskDmdzAddressStandardization.setType("zl_v4");
|
|
|
|
|
+ yyskDmdzAddressStandardization = AreaService.getInstance().insertCallbackData(yyskDmdzAddressStandardization);
|
|
|
|
|
+ ScheduledTasks.yyskDmdzAddressStandardizationPutDmdz(yyskDmdzAddressStandardization);
|
|
|
|
|
+ }
|
|
|
|
|
+ return MessageManage.getInstance().getResultContent(Constant.SUCCESS, "地址" + address + "添加成功!", "成功");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return MessageManage.getInstance().getResultContent(Constant.PARAM_ERROR, "添加操作:lon或lat不能为空", "参数错误");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return MessageManage.getInstance().getResultContent(Constant.PARAM_ERROR, "删除操作:address不能为空", "参数错误");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 处理待处理表接口
|
|
* 处理待处理表接口
|
|
|
* 首先要使用JDBC写一个sql语句,验证同批次的地址不能重复,和null,重复或者为null的话直接返回(sql执行)
|
|
* 首先要使用JDBC写一个sql语句,验证同批次的地址不能重复,和null,重复或者为null的话直接返回(sql执行)
|