Browse Source

增加特色场景文件信息

master
WendyYang 3 weeks ago
parent
commit
b2cc45b337
3 changed files with 62 additions and 26 deletions
  1. +13
    -13
      kq-vas-api/src/main/java/com/ningdatech/kqapi/common/helper/basic/AbstractMatterCacheHelper.java
  2. +40
    -8
      kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/manage/MatterManage.java
  3. +9
    -5
      kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/model/vo/TreeVO.java

+ 13
- 13
kq-vas-api/src/main/java/com/ningdatech/kqapi/common/helper/basic/AbstractMatterCacheHelper.java View File

@@ -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;


+ 40
- 8
kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/manage/MatterManage.java View File

@@ -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<Long, Integer> fileIdMap = new HashMap<>();
zones.forEach(zone -> {
Map<Long, Integer> iconFileIdMap = new HashMap<>();
Map<Long, Integer> specialFeatureFileIdMap = new HashMap<>();
for (Zone zone : zones) {
if (StrUtil.isNotBlank(zone.getZoneIcon())) {
List<AttachFileVo> 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<AttachFileVo> files = JSONUtil.toList(zone.getSpecialFeature(), AttachFileVo.class);
if (CollUtil.isNotEmpty(files)) {
for (AttachFileVo file : files) {
specialFeatureFileIdMap.put(file.getFileId(), zone.getId());
}
}
}
}
Map<Integer, String> iconUrlMap = new HashMap<>();
if (!fileIdMap.isEmpty()) {
for (File file : fileService.listByIds(fileIdMap.keySet())) {
Map<Integer, List<FileResultVO>> specialFeatureUrlMap = new HashMap<>();
if (!iconFileIdMap.isEmpty() || !specialFeatureFileIdMap.isEmpty()) {
List<Long> 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());
}


+ 9
- 5
kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/model/vo/TreeVO.java View File

@@ -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<FileResultVO> specialFeatureFiles;

}

Loading…
Cancel
Save