From b2cc45b3373ed859262675e6d96d870a582eda07 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 28 May 2024 10:55:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=89=B9=E8=89=B2=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E6=96=87=E4=BB=B6=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../helper/basic/AbstractMatterCacheHelper.java | 26 ++++++------ .../kqapi/zzsfw/manage/MatterManage.java | 48 ++++++++++++++++++---- .../ningdatech/kqapi/zzsfw/model/vo/TreeVO.java | 14 ++++--- 3 files changed, 62 insertions(+), 26 deletions(-) diff --git a/kq-vas-api/src/main/java/com/ningdatech/kqapi/common/helper/basic/AbstractMatterCacheHelper.java b/kq-vas-api/src/main/java/com/ningdatech/kqapi/common/helper/basic/AbstractMatterCacheHelper.java index fc73643..4cdde46 100644 --- a/kq-vas-api/src/main/java/com/ningdatech/kqapi/common/helper/basic/AbstractMatterCacheHelper.java +++ b/kq-vas-api/src/main/java/com/ningdatech/kqapi/common/helper/basic/AbstractMatterCacheHelper.java @@ -46,7 +46,7 @@ public abstract class AbstractMatterCacheHelper implements InitializingBean { @Autowired private ComponentsMatterEliminateService componentsMatterEliminateService; - private final String KQ_ZZS_BASE_URL = "https://www.zjzwfw.gov.cn/zjservice-fe/#/workguide?localInnerCode=&siteCode=330000000000"; + private static final String KQ_ZZS_BASE_URL = "https://www.zjzwfw.gov.cn/zjservice-fe/#/workguide?localInnerCode=&siteCode=330000000000"; private Boolean initMatterCache() { // 首先,查询ComponentsMatterEliminateEntity中isDelete不为1的qlName列表, 未被剔除 @@ -64,11 +64,11 @@ public abstract class AbstractMatterCacheHelper implements InitializingBean { DscSxAdsShareItemQltQlsxCommonIDVKq::getQlState, DscSxAdsShareItemQltQlsxCommonIDVKq::getQlInnerCode, DscSxAdsShareItemQltQlsxCommonIDVKq::getWebapplyurl) -// .eq(DscSxAdsShareItemQltQlsxCommonIDVKq::getQlState, "1") .isNotNull(DscSxAdsShareItemQltQlsxCommonIDVKq::getWebapplyurl) .isNotNull(DscSxAdsShareItemQltQlsxCommonIDVKq::getQlInnerCode) .ne(DscSxAdsShareItemQltQlsxCommonIDVKq::getQlInnerCode, "") - .notIn(!eliminatedQlNames.isEmpty(), DscSxAdsShareItemQltQlsxCommonIDVKq::getQlName, eliminatedQlNames) // 过滤掉那些在eliminatedQlNames中的记录 + .notIn(!eliminatedQlNames.isEmpty(), DscSxAdsShareItemQltQlsxCommonIDVKq::getQlName, eliminatedQlNames) + // 过滤掉那些在eliminatedQlNames中的记录 .orderByDesc(DscSxAdsShareItemQltQlsxCommonIDVKq::getUpdateDate)); if (allMatters.isEmpty()) { log.warn("事项数据未初始化"); @@ -76,22 +76,22 @@ public abstract class AbstractMatterCacheHelper implements InitializingBean { } allMatters.forEach(m -> { // 3-14日修改新的url匹配规则,取事项状态为1且qlInnerCode不为空的进行拼接,新的url规则如下 - String kq_url = KQ_ZZS_BASE_URL.replace("localInnerCode=", "localInnerCode=" + m.getQlInnerCode()); - MatterKey key = MatterKey.of(m.getQlName(),kq_url); - if(!mattersUrlCache.asMap().containsKey(m.getQlName())){ - mattersUrlCache.put(m.getQlName(),kq_url); - }else{ + String kqUrl = KQ_ZZS_BASE_URL.replace("localInnerCode=", "localInnerCode=" + m.getQlInnerCode()); + MatterKey key = MatterKey.of(m.getQlName(), kqUrl); + if (!mattersUrlCache.asMap().containsKey(m.getQlName())) { + mattersUrlCache.put(m.getQlName(), kqUrl); + } else { String url = mattersUrlCache.get(m.getQlName()); - if(StringUtils.isNotBlank(url) && !url.equals(kq_url)){ + if (StringUtils.isNotBlank(url) && !url.equals(kqUrl)) { return; } } - if(mattersDupCache.asMap().containsKey(key)){ + if (mattersDupCache.asMap().containsKey(key)) { KqZzsfwMattersDeduplicate dup = mattersDupCache.get(key); dup.setCountNum(dup.getCountNum() + 1); - mattersDupCache.put(key,dup); - }else{ - mattersDupCache.put(key, KqZzsfwMattersDeduplicate.of(m.getQlName(),kq_url)); + mattersDupCache.put(key, dup); + } else { + mattersDupCache.put(key, KqZzsfwMattersDeduplicate.of(m.getQlName(), kqUrl)); } }); return Boolean.TRUE; diff --git a/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/manage/MatterManage.java b/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/manage/MatterManage.java index a95a15b..96cd8c8 100644 --- a/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/manage/MatterManage.java +++ b/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/manage/MatterManage.java @@ -30,6 +30,7 @@ import com.ningdatech.kqapi.zzsfw.service.IKqZzsfwMatterDeduplicateService; import com.ningdatech.kqapi.zzsfw.service.IKqZzsfwMenuService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.compress.utils.Lists; import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.Row; @@ -113,20 +114,50 @@ public class MatterManage { if (zones.isEmpty()) { return Collections.emptyList(); } - Map fileIdMap = new HashMap<>(); - zones.forEach(zone -> { + Map iconFileIdMap = new HashMap<>(); + Map specialFeatureFileIdMap = new HashMap<>(); + for (Zone zone : zones) { if (StrUtil.isNotBlank(zone.getZoneIcon())) { List files = JSONUtil.toList(zone.getZoneIcon(), AttachFileVo.class); - if (files != null && !files.isEmpty()) { - fileIdMap.put(files.get(0).getFileId(), zone.getId()); + if (CollUtil.isNotEmpty(files)) { + iconFileIdMap.put(files.get(0).getFileId(), zone.getId()); } } - }); + if (StrUtil.isNotBlank(zone.getSpecialFeature())) { + List files = JSONUtil.toList(zone.getSpecialFeature(), AttachFileVo.class); + if (CollUtil.isNotEmpty(files)) { + for (AttachFileVo file : files) { + specialFeatureFileIdMap.put(file.getFileId(), zone.getId()); + } + } + } + } Map iconUrlMap = new HashMap<>(); - if (!fileIdMap.isEmpty()) { - for (File file : fileService.listByIds(fileIdMap.keySet())) { + Map> specialFeatureUrlMap = new HashMap<>(); + if (!iconFileIdMap.isEmpty() || !specialFeatureFileIdMap.isEmpty()) { + List tmpFileIds = new ArrayList<>(); + tmpFileIds.addAll(iconFileIdMap.keySet()); + tmpFileIds.addAll(specialFeatureFileIdMap.keySet()); + for (File file : fileService.listByIds(tmpFileIds)) { String fileUrl = fileService.findUrlByFile(file, Duration.ofDays(30)); - iconUrlMap.put(fileIdMap.get(file.getId()), fileUrl); + if (iconFileIdMap.containsKey(file.getId())) { + iconUrlMap.put(iconFileIdMap.get(file.getId()), fileUrl); + } else if (specialFeatureFileIdMap.containsKey(file.getId())) { + FileResultVO retFile = FileResultVO.builder() + .id(file.getId()) + .url(fileUrl) + .contentType(file.getContentType()) + .fileType(file.getFileType()) + .originalFileName(file.getOriginalFileName()) + .size(file.getSize()) + .suffix(file.getSuffix()) + .build(); + specialFeatureUrlMap.merge(specialFeatureFileIdMap.get(file.getId()), + CollUtil.newArrayList(retFile), (v1, v2) -> { + v1.addAll(v2); + return v1; + }); + } } } @@ -134,6 +165,7 @@ public class MatterManage { .name(w.getZoneName()) .zoneIcon(iconUrlMap.get(w.getId())) .specialFeature(w.getSpecialFeature()) + .specialFeatureFiles(specialFeatureUrlMap.get(w.getId())) .type(ZzsfwMenuConstant.MENU_TYPE_ZONE) .build()); } diff --git a/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/model/vo/TreeVO.java b/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/model/vo/TreeVO.java index f1997cf..98685db 100644 --- a/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/model/vo/TreeVO.java +++ b/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/model/vo/TreeVO.java @@ -1,5 +1,6 @@ package com.ningdatech.kqapi.zzsfw.model.vo; +import com.ningdatech.file.entity.vo.result.FileResultVO; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Builder; @@ -21,7 +22,12 @@ import java.util.List; @ApiModel(value = "TreeVO", description = "树结构") public class TreeVO { - @ApiModelProperty("rowid") + @Tolerate + public TreeVO() { + // 无参构造 + } + + @ApiModelProperty("rowId") private String id; @ApiModelProperty("名称") @@ -62,9 +68,7 @@ public class TreeVO { @ApiModelProperty("特色场景") private String specialFeature; - @Tolerate - public TreeVO() { - // 无参构造 - } + @ApiModelProperty("特色场景文件信息") + private List specialFeatureFiles; }