@@ -94,15 +94,15 @@ public abstract class AbstractMatterCacheHelper implements InitializingBean { | |||||
.refreshAfterWrite(7, TimeUnit.DAYS) | .refreshAfterWrite(7, TimeUnit.DAYS) | ||||
.maximumSize(1024 * 100) | .maximumSize(1024 * 100) | ||||
.build(key -> { | .build(key -> { | ||||
DscSxAdsShareItemQltQlsxCommonIDVKq matter = kqService.getOne(Wrappers.lambdaQuery(DscSxAdsShareItemQltQlsxCommonIDVKq.class) | |||||
.eq(DscSxAdsShareItemQltQlsxCommonIDVKq::getQlName, key) | |||||
NdKqZzsfwMattersDeduplicate dup = deduplicateService.getOne(Wrappers.lambdaQuery(NdKqZzsfwMattersDeduplicate.class) | |||||
.eq(NdKqZzsfwMattersDeduplicate::getQlName, key) | |||||
.last(BizConst.LIMIT_1) | .last(BizConst.LIMIT_1) | ||||
.isNotNull(DscSxAdsShareItemQltQlsxCommonIDVKq::getWebapplyurl)); | |||||
if (Objects.isNull(matter)) { | |||||
.isNotNull(NdKqZzsfwMattersDeduplicate::getWebapplyurl)); | |||||
if (Objects.isNull(dup)) { | |||||
//查不到直接返回null | //查不到直接返回null | ||||
return null; | return null; | ||||
} | } | ||||
return matter.getWebapplyurl(); | |||||
return dup.getWebapplyurl(); | |||||
}); | }); | ||||
mattersDupCache = Caffeine.newBuilder() | mattersDupCache = Caffeine.newBuilder() | ||||
.refreshAfterWrite(7, TimeUnit.DAYS) | .refreshAfterWrite(7, TimeUnit.DAYS) | ||||
@@ -58,4 +58,11 @@ public class TaskController { | |||||
synTask.synData(); | synTask.synData(); | ||||
return "同步成功"; | return "同步成功"; | ||||
} | } | ||||
@ApiOperation(value = "同步菜单链接数据", notes = "同步菜单链接数据") | |||||
@GetMapping("/syn-menu") | |||||
public String synMenuData() throws UnknownHostException { | |||||
synTask.synMenu(); | |||||
return "同步成功"; | |||||
} | |||||
} | } |
@@ -97,4 +97,24 @@ public class SynTask { | |||||
stopWatch.stop(); | stopWatch.stop(); | ||||
log.info("政务数据 ===================== 同步总共耗时 :{} s",stopWatch.getTotalTimeSeconds()); | log.info("政务数据 ===================== 同步总共耗时 :{} s",stopWatch.getTotalTimeSeconds()); | ||||
} | } | ||||
public void synMenu() { | |||||
//2. 事项 | |||||
List<NdKqZzsfwMenu> menus = menuService.list(); | |||||
for(NdKqZzsfwMenu menu : menus){ | |||||
String url = matterCacheHelper.getUrl(menu.getItemName()); | |||||
log.info("当前缓存的数据 : {},{}",menu.getItemName(),url); | |||||
if(StringUtils.isBlank(url)){ | |||||
menuService.update(Wrappers.lambdaUpdate(NdKqZzsfwMenu.class) | |||||
.eq(NdKqZzsfwMenu::getId,menu.getId()) | |||||
.set(NdKqZzsfwMenu::getWebapplyurl,null) | |||||
.set(NdKqZzsfwMenu::getHasUrl, CommonEnum.NO.getCode())); | |||||
}else{ | |||||
menuService.update(Wrappers.lambdaUpdate(NdKqZzsfwMenu.class) | |||||
.eq(NdKqZzsfwMenu::getId,menu.getId()) | |||||
.set(NdKqZzsfwMenu::getWebapplyurl,url) | |||||
.set(NdKqZzsfwMenu::getHasUrl,CommonEnum.YES.getCode())); | |||||
} | |||||
} | |||||
} | |||||
} | } |