|
@@ -580,49 +580,52 @@ public class YyskAddressStandardizationServiceImpl {
|
|
|
public void tyaToServer(Integer startOidIndex, Integer page, Integer pageSize) {
|
|
|
System.out.println("page:" + page + ",pageSize:" + pageSize);
|
|
|
long startTime = System.currentTimeMillis();
|
|
|
- Page<YyszAddressV3> sqlDatas = AreaService.getInstance().getTyaData2ByPage(page, pageSize);
|
|
|
- List<YyszAddressV3> tYyszAddressList = sqlDatas.getContent();
|
|
|
+ Page<YyszAddressV3All> sqlDatas = AreaService.getInstance().getTyaData3ByPage(page, pageSize);
|
|
|
+ List<YyszAddressV3All> tYyszAddressList = sqlDatas.getContent();
|
|
|
JSONObject dataList = new JSONObject();
|
|
|
// 操作类型 1:新增,2:更新3:删除
|
|
|
dataList.put("optFlag", 1);
|
|
|
JSONArray datas = new JSONArray();
|
|
|
- for (YyszAddressV3 tYyszAddress : tYyszAddressList) {
|
|
|
+ for (YyszAddressV3All tYyszAddress : tYyszAddressList) {
|
|
|
JSONObject dataItem = new JSONObject();
|
|
|
dataItem.put("oid", Long.valueOf(startOidIndex));
|
|
|
startOidIndex++;
|
|
|
- dataItem.put("address", initAddrMap.outAddrMapInAddr(tYyszAddress.getSourceaddress()).getAddress());
|
|
|
- dataItem.put("sourceaddress", tYyszAddress.getSourceaddress());
|
|
|
- dataItem.put("city", tYyszAddress.getCity());
|
|
|
- dataItem.put("county", tYyszAddress.getCounty());
|
|
|
- dataItem.put("town", tYyszAddress.getTown());
|
|
|
- dataItem.put("community", tYyszAddress.getCommunity());
|
|
|
- dataItem.put("lon", tYyszAddress.getX());
|
|
|
- dataItem.put("lat", tYyszAddress.getY());
|
|
|
- dataItem.put("address_type", tYyszAddress.getAddressType());
|
|
|
+ dataItem.put("address", tYyszAddress.getName());
|
|
|
+// dataItem.put("address", initAddrMap.outAddrMapInAddr(tYyszAddress.getAddress()).getAddress());
|
|
|
+ dataItem.put("sourceaddress", tYyszAddress.getAddress());
|
|
|
+ dataItem.put("city", tYyszAddress.getCityname());
|
|
|
+ dataItem.put("county", tYyszAddress.getAdname());
|
|
|
+ dataItem.put("town", tYyszAddress.getStreetTown());
|
|
|
+ dataItem.put("community", tYyszAddress.getResidentialCommittee());
|
|
|
+ dataItem.put("lon", tYyszAddress.getLocation().split(",")[0]);
|
|
|
+ dataItem.put("lat", tYyszAddress.getLocation().split(",")[1]);
|
|
|
+ dataItem.put("x",tYyszAddress.getLon());
|
|
|
+ dataItem.put("y",tYyszAddress.getLat());
|
|
|
+ dataItem.put("address_type", tYyszAddress.getType());
|
|
|
dataItem.put("createtime", getCurrentDateTime());
|
|
|
dataItem.put("updatetime", getCurrentDateTime());
|
|
|
- dataItem.put("match_level", tYyszAddress.getMatchLevel());
|
|
|
+// dataItem.put("match_level", tYyszAddress.getMatchLevel());
|
|
|
datas.add(dataItem);
|
|
|
}
|
|
|
dataList.put("data", datas);
|
|
|
// TODO 发送远程请求
|
|
|
- Map<String,Object> logItem = new HashMap<>();
|
|
|
- logItem.put("page",page);
|
|
|
- logItem.put("pageSize",pageSize);
|
|
|
+ Map<String, Object> logItem = new HashMap<>();
|
|
|
+ logItem.put("page", page);
|
|
|
+ logItem.put("pageSize", pageSize);
|
|
|
entityManager.clear();
|
|
|
try {
|
|
|
String resStr = AddressQueryEngine.getInstance().putDataToSJ_Big_Data_kafka_server(dataList).toString();
|
|
|
- logItem.put("res",resStr);
|
|
|
+ logItem.put("res", resStr);
|
|
|
System.out.println(resStr);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
String resStr = e.toString();
|
|
|
- logItem.put("res",resStr);
|
|
|
+ logItem.put("res", resStr);
|
|
|
System.err.println(page + "页数据入湖异常" + e);
|
|
|
}
|
|
|
long endTime = System.currentTimeMillis();
|
|
|
- logItem.put("startTime",timestampToDateTime(startTime));
|
|
|
- logItem.put("endTime",timestampToDateTime(endTime));
|
|
|
+ logItem.put("startTime", timestampToDateTime(startTime));
|
|
|
+ logItem.put("endTime", timestampToDateTime(endTime));
|
|
|
ScheduledTasks.LogInfos.add(logItem);
|
|
|
System.out.println("单批数据处理完成,用时:" + (endTime - startTime) / 1000 + "秒!");
|
|
|
if (sqlDatas.getTotalPages() > page && !ScheduledTasks.pauseTag) {
|
|
@@ -630,6 +633,7 @@ public class YyskAddressStandardizationServiceImpl {
|
|
|
tyaToServer(startOidIndex, page, pageSize);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
public static String timestampToDateTime(long timestamp) {
|
|
|
// 将时间戳转换为LocalDateTime对象
|
|
|
LocalDateTime dateTime = Instant.ofEpochMilli(timestamp)
|
|
@@ -818,7 +822,16 @@ public class YyskAddressStandardizationServiceImpl {
|
|
|
yyskAddressStandardization.setResidentialCommittee(item.getOrDefault("residentialCommittee", "").toString());
|
|
|
yyskAddressStandardization.setLon(item.getOrDefault("lon", "").toString());
|
|
|
yyskAddressStandardization.setLat(item.getOrDefault("lat", "").toString());
|
|
|
- listData.add(yyskAddressStandardization);
|
|
|
+ if (yyskAddressStandardization.getStandardAddress() != null && !yyskAddressStandardization.getStandardAddress().isEmpty()) {
|
|
|
+ AddrBean addrBean = initAddrMap.outAddrMapInAddr(yyskAddressStandardization.getStandardAddress());
|
|
|
+ if (addrBean.getMarket().contains("上海")) {
|
|
|
+ yyskAddressStandardization.setStandardAddress(addrBean.getStandardAddress());
|
|
|
+ yyskAddressStandardization.setDistinguish(addrBean.getDistinguish());
|
|
|
+ yyskAddressStandardization.setResidentialCommittee(addrBean.getResidentialCommittee());
|
|
|
+ yyskAddressStandardization.setStreetTown(addrBean.getStreetTown());
|
|
|
+ listData.add(yyskAddressStandardization);
|
|
|
+ }
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -829,17 +842,17 @@ public class YyskAddressStandardizationServiceImpl {
|
|
|
}
|
|
|
if (listData != null && listData.size() > 0) {
|
|
|
// 批量更新处理后的数据
|
|
|
- List<YyskDmdzAddressStandardization> resultDataList = runExecutorService(listData);
|
|
|
+ /*List<YyskDmdzAddressStandardization> resultDataList = runExecutorService(listData);
|
|
|
if (resultDataList.size() > 0) {
|
|
|
ExcelReaderUtils.convertYYListToMapList(resultDataList, outPath);
|
|
|
- }
|
|
|
+ }*/
|
|
|
// TODO 数据转换
|
|
|
-// List<FusionKjdlTydzWf> returnDatas = YyskDmdzAddressStandardizationToFusionKjdlTydzWf(listData);
|
|
|
-// try {
|
|
|
-// AreaService.getInstance().saveFktws(returnDatas);
|
|
|
-// } catch (Exception e) {
|
|
|
-// System.err.println("第" + startFileIndex + "个文件入库异常:" + e);
|
|
|
-// }
|
|
|
+ List<FusionKjdlTydzWf> returnDatas = YyskDmdzAddressStandardizationToFusionKjdlTydzWf(listData);
|
|
|
+ try {
|
|
|
+ AreaService.getInstance().saveFktws(returnDatas);
|
|
|
+ } catch (Exception e) {
|
|
|
+ System.err.println("第" + startFileIndex + "个文件入库异常:" + e);
|
|
|
+ }
|
|
|
long endTime = System.currentTimeMillis();
|
|
|
System.out.println("处理单批次用时" + (endTime - startTime) / 1000 + "秒!");
|
|
|
} else {
|