|
@@ -134,7 +134,7 @@ public class ScheduledTasks {
|
|
|
* 如果返回了正确的数据,入到地址库表中,并更新state为2(同时添加到地址库中)
|
|
* 如果返回了正确的数据,入到地址库表中,并更新state为2(同时添加到地址库中)
|
|
|
* 否则更新状态为1
|
|
* 否则更新状态为1
|
|
|
*/
|
|
*/
|
|
|
- @Scheduled(cron = "0 15 2 * * ?")
|
|
|
|
|
|
|
+ @Scheduled(cron = "0 45 */2 * * ?")
|
|
|
public void dbdataCallBackTask() {
|
|
public void dbdataCallBackTask() {
|
|
|
try {
|
|
try {
|
|
|
long startTime = System.currentTimeMillis();
|
|
long startTime = System.currentTimeMillis();
|
|
@@ -171,6 +171,13 @@ public class ScheduledTasks {
|
|
|
}
|
|
}
|
|
|
if (addressResult != null && contentBean != null && contentBean.getLon() != null) {
|
|
if (addressResult != null && contentBean != null && contentBean.getLon() != null) {
|
|
|
SplitAddress splitAddress = ShanghaiAddressSplitUtil.splitBestAddress(addr);
|
|
SplitAddress splitAddress = ShanghaiAddressSplitUtil.splitBestAddress(addr);
|
|
|
|
|
+// TODO 因为市中心返回的居委部分是错误的,所以,都要进行一下落点才能入库
|
|
|
|
|
+ if(addressResult != null){
|
|
|
|
|
+ for (AddressResult.ContentBean content : addressResult.getData()) {
|
|
|
|
|
+ content.setCommunity(null);
|
|
|
|
|
+ content.setCommunityCode(null);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
AddressQueryEngine.getInstance().getCjWgWgwByLoc(addressResult, splitAddress);
|
|
AddressQueryEngine.getInstance().getCjWgWgwByLoc(addressResult, splitAddress);
|
|
|
item.setLat(contentBean.getLat().toString());
|
|
item.setLat(contentBean.getLat().toString());
|
|
|
item.setLon(contentBean.getLon().toString());
|
|
item.setLon(contentBean.getLon().toString());
|
|
@@ -271,6 +278,7 @@ public class ScheduledTasks {
|
|
|
yyskDmdzAddressStandardization.setTown(tAddressCallback.getStreetTownName());
|
|
yyskDmdzAddressStandardization.setTown(tAddressCallback.getStreetTownName());
|
|
|
yyskDmdzAddressStandardization.setCommunity(tAddressCallback.getCommunity());
|
|
yyskDmdzAddressStandardization.setCommunity(tAddressCallback.getCommunity());
|
|
|
yyskDmdzAddressStandardization.setData_type("callBack");
|
|
yyskDmdzAddressStandardization.setData_type("callBack");
|
|
|
|
|
+ yyskDmdzAddressStandardization.setCreatetime(new Date());
|
|
|
yyskDmdzAddressStandardization.setType("zl_v4");
|
|
yyskDmdzAddressStandardization.setType("zl_v4");
|
|
|
// 把请求到的数据放到缓存中
|
|
// 把请求到的数据放到缓存中
|
|
|
yyskDmdzAddressStandardizationPutDmdz(yyskDmdzAddressStandardization);
|
|
yyskDmdzAddressStandardizationPutDmdz(yyskDmdzAddressStandardization);
|
|
@@ -280,7 +288,6 @@ public class ScheduledTasks {
|
|
|
public static void yyskDmdzAddressStandardizationPutDmdz(YyskDmdzAddressStandardization yyskDmdzAddressStandardization) {
|
|
public static void yyskDmdzAddressStandardizationPutDmdz(YyskDmdzAddressStandardization yyskDmdzAddressStandardization) {
|
|
|
if (yyskDmdzAddressStandardization.getSourceaddress() != null && StringUtils.hasText(yyskDmdzAddressStandardization.getSourceaddress())) {
|
|
if (yyskDmdzAddressStandardization.getSourceaddress() != null && StringUtils.hasText(yyskDmdzAddressStandardization.getSourceaddress())) {
|
|
|
SplitAddress splitAddress = ShanghaiAddressSplitUtil.splitBestAddress(yyskDmdzAddressStandardization.getSourceaddress());
|
|
SplitAddress splitAddress = ShanghaiAddressSplitUtil.splitBestAddress(yyskDmdzAddressStandardization.getSourceaddress());
|
|
|
-// 如果再加入一个弄号的话,数据量可能会变大,但是搜索效率会变快。
|
|
|
|
|
if (splitAddress.getAddr().length() > 2) {
|
|
if (splitAddress.getAddr().length() > 2) {
|
|
|
putAllDmdzData(splitAddress.getAddr(), yyskDmdzAddressStandardization);
|
|
putAllDmdzData(splitAddress.getAddr(), yyskDmdzAddressStandardization);
|
|
|
} else {
|
|
} else {
|
|
@@ -300,92 +307,16 @@ public class ScheduledTasks {
|
|
|
public static void putAllDmdzData(String addr, YyskDmdzAddressStandardization item) {
|
|
public static void putAllDmdzData(String addr, YyskDmdzAddressStandardization item) {
|
|
|
Map<String, String> roadInfos = AddrSplitLmrMap.parseAddress(addr);
|
|
Map<String, String> roadInfos = AddrSplitLmrMap.parseAddress(addr);
|
|
|
if (roadInfos != null && StringUtils.hasText(roadInfos.get("路名"))) {
|
|
if (roadInfos != null && StringUtils.hasText(roadInfos.get("路名"))) {
|
|
|
- addr = roadInfos.get("路名") + (StringUtils.hasText(roadInfos.get("弄号")) ? roadInfos.get("弄号") : "");
|
|
|
|
|
|
|
+ addr = roadInfos.get("路名") + (StringUtils.hasText(roadInfos.get("弄号")) ? roadInfos.get("弄号") : "") + (StringUtils.hasText(roadInfos.get("楼栋号")) ? roadInfos.get("楼栋号") : "");
|
|
|
}
|
|
}
|
|
|
if (StringUtils.hasText(addr)) {
|
|
if (StringUtils.hasText(addr)) {
|
|
|
if (!ScheduledTasks.allDmdzData.containsKey(addr)) {
|
|
if (!ScheduledTasks.allDmdzData.containsKey(addr)) {
|
|
|
List<YyskDmdzAddressStandardization> datas = new ArrayList<>();
|
|
List<YyskDmdzAddressStandardization> datas = new ArrayList<>();
|
|
|
datas.add(item);
|
|
datas.add(item);
|
|
|
ScheduledTasks.allDmdzData.put(addr, datas);
|
|
ScheduledTasks.allDmdzData.put(addr, datas);
|
|
|
- } else if (ScheduledTasks.allDmdzData.get(addr).size() < 50) {
|
|
|
|
|
|
|
+ } else if (ScheduledTasks.allDmdzData.get(addr).size() < 20) {
|
|
|
ScheduledTasks.allDmdzData.get(addr).add(item);
|
|
ScheduledTasks.allDmdzData.get(addr).add(item);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 每天凌晨一点跑地址表没跑过的数据
|
|
|
|
|
- */
|
|
|
|
|
-// @Scheduled(cron = "0 0 */1 * * *")
|
|
|
|
|
- public void executeAtOneOClock() {
|
|
|
|
|
- System.out.println("定时开始执行,当前时间:" + new Date());
|
|
|
|
|
- if (!taskRunStatus) {
|
|
|
|
|
- taskRunStatus = true;
|
|
|
|
|
- taskServiceErr = false;
|
|
|
|
|
- yyskAddressStandardizationService.iterativeProcessing(10000, 0, "yysk_dmdz_address_standardization", "address is not null and data_tag = '法人库'", 0);
|
|
|
|
|
- taskRunStatus = false;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 每天凌晨30秒时得到前一天更新的数据并将数据插入到地址表中
|
|
|
|
|
- */
|
|
|
|
|
-// @Scheduled(cron = "30 0 0 * * *")
|
|
|
|
|
- public void insertIntoTask() {
|
|
|
|
|
- System.out.println("定时开始执行,当前时间:" + new Date());
|
|
|
|
|
- try {
|
|
|
|
|
- String previousDateStr = getPreviousDateStr();
|
|
|
|
|
- String insertIntoSql = "INSERT INTO yysk_dmdz_address_standardization (address) \n" +
|
|
|
|
|
- "select real_address FROM dws.fusion_nfrk_corp_info_partition_dsjzx_v1 where real_address is not NULL and task_dsjzx_date" +
|
|
|
|
|
- " like '" + previousDateStr + "%'\n" +
|
|
|
|
|
- "UNION\n" +
|
|
|
|
|
- "select addr_area_name_gb FROM dws.fusion_nfrk_corp_info_partition_dsjzx_v1 where addr_area_name_gb is not NULL and task_dsjzx_date" +
|
|
|
|
|
- " like '" + previousDateStr + "%'\n" +
|
|
|
|
|
- "UNION\n" +
|
|
|
|
|
- "select real_address FROM dws.fusion_nfrk_corp_info_partition_dsjzx where real_address is not NULL and task_dsjzx_date" +
|
|
|
|
|
- " like '" + previousDateStr + "%'\n" +
|
|
|
|
|
- "UNION\n" +
|
|
|
|
|
- "select addr_area_name_gb FROM dws.fusion_nfrk_corp_info_partition_dsjzx where addr_area_name_gb is not NULL and task_dsjzx_date" +
|
|
|
|
|
- " like '" + previousDateStr + "%'\n" +
|
|
|
|
|
- "UNION\n" +
|
|
|
|
|
- "select before_conten from dws.fusion_nfrk_corp_change_partition_dsjzx where reg_item_name IN ('住所变更','经营场所变更','驻在地址变更'" +
|
|
|
|
|
- ",'主要经营场所','经营场所','注册地址(住所)') and before_conten is not NULL and task_dsjzx_date like '" + previousDateStr + "%'\n" +
|
|
|
|
|
- "UNION\n" +
|
|
|
|
|
- "select after_content from dws.fusion_nfrk_corp_change_partition_dsjzx where reg_item_name IN ('住所变更','经营场所变更','驻在地址变更'" +
|
|
|
|
|
- ",'主要经营场所','经营场所','注册地址(住所)') and after_content is not NULL and task_dsjzx_date like '" + previousDateStr + "%'\n" +
|
|
|
|
|
- "UNION\n" +
|
|
|
|
|
- "select before_conten from dws.fusion_nfrk_corp_change_partition_dsjzx_v2 where reg_item_name IN ('住所变更','经营场所变更','驻在地址变更'" +
|
|
|
|
|
- ",'主要经营场所','经营场所','注册地址(住所)') and before_conten is not NULL and task_dsjzx_date like '" + previousDateStr + "%'\n" +
|
|
|
|
|
- "UNION\n" +
|
|
|
|
|
- "select after_content from dws.fusion_nfrk_corp_change_partition_dsjzx_v2 where reg_item_name IN ('住所变更','经营场所变更','驻在地址变更'" +
|
|
|
|
|
- ",'主要经营场所','经营场所','注册地址(住所)') and after_content is not NULL and task_dsjzx_date like '" + previousDateStr + "%'\n";
|
|
|
|
|
- System.out.println(">>>>>>>>------数据库连通性测试结果:" + DbConnection.getInstance().updateSql(insertIntoSql));
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- System.err.println(">>>>>>>>------数据库连通性测试结果:" + e);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public static String getPreviousDateStr() {
|
|
|
|
|
-// 获取当前日期
|
|
|
|
|
- LocalDate currentDate = LocalDate.now();
|
|
|
|
|
-// 获取前一天的日期
|
|
|
|
|
- LocalDate previousDate = currentDate.minusDays(1);
|
|
|
|
|
-// 定义日期格式
|
|
|
|
|
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
|
-// 返回前一天的日期字符串
|
|
|
|
|
- return previousDate.format(formatter);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 根据格式返回当前时间的字符串
|
|
|
|
|
- * 标准格式:yyyy-dd-MM hh:mm:ss
|
|
|
|
|
- *
|
|
|
|
|
- * @return
|
|
|
|
|
- */
|
|
|
|
|
- public static String getCurrentDateTimeByPatern(String pattern) {
|
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat(pattern);
|
|
|
|
|
- return sdf.format(new Date());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|