From 02e1cc1309f499cbb32a381f98b0daff09c4d9d2 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Fri, 5 Jan 2024 09:34:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E5=90=8C=E6=AD=A5=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=BB=BB=E5=8A=A1=20=E5=AE=9A=E6=97=B6=E5=BC=80?= =?UTF-8?q?=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../helper/basic/AbstractMatterCacheHelper.java | 10 +++++----- .../kqapi/scheduler/controller/TaskController.java | 7 +++++++ .../com/ningdatech/kqapi/scheduler/task/SynTask.java | 20 ++++++++++++++++++++ 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/helper/basic/AbstractMatterCacheHelper.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/helper/basic/AbstractMatterCacheHelper.java index a0b89ba..f5c6fe2 100644 --- a/kqapi/src/main/java/com/ningdatech/kqapi/common/helper/basic/AbstractMatterCacheHelper.java +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/helper/basic/AbstractMatterCacheHelper.java @@ -94,15 +94,15 @@ public abstract class AbstractMatterCacheHelper implements InitializingBean { .refreshAfterWrite(7, TimeUnit.DAYS) .maximumSize(1024 * 100) .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) - .isNotNull(DscSxAdsShareItemQltQlsxCommonIDVKq::getWebapplyurl)); - if (Objects.isNull(matter)) { + .isNotNull(NdKqZzsfwMattersDeduplicate::getWebapplyurl)); + if (Objects.isNull(dup)) { //查不到直接返回null return null; } - return matter.getWebapplyurl(); + return dup.getWebapplyurl(); }); mattersDupCache = Caffeine.newBuilder() .refreshAfterWrite(7, TimeUnit.DAYS) diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/scheduler/controller/TaskController.java b/kqapi/src/main/java/com/ningdatech/kqapi/scheduler/controller/TaskController.java index 3d86ed3..40d0137 100644 --- a/kqapi/src/main/java/com/ningdatech/kqapi/scheduler/controller/TaskController.java +++ b/kqapi/src/main/java/com/ningdatech/kqapi/scheduler/controller/TaskController.java @@ -58,4 +58,11 @@ public class TaskController { synTask.synData(); return "同步成功"; } + + @ApiOperation(value = "同步菜单链接数据", notes = "同步菜单链接数据") + @GetMapping("/syn-menu") + public String synMenuData() throws UnknownHostException { + synTask.synMenu(); + return "同步成功"; + } } diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/scheduler/task/SynTask.java b/kqapi/src/main/java/com/ningdatech/kqapi/scheduler/task/SynTask.java index 20f983b..9d8d277 100644 --- a/kqapi/src/main/java/com/ningdatech/kqapi/scheduler/task/SynTask.java +++ b/kqapi/src/main/java/com/ningdatech/kqapi/scheduler/task/SynTask.java @@ -97,4 +97,24 @@ public class SynTask { stopWatch.stop(); log.info("政务数据 ===================== 同步总共耗时 :{} s",stopWatch.getTotalTimeSeconds()); } + + public void synMenu() { + //2. 事项 + List 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())); + } + } + } }