Browse Source

修改网上办理地址webapplyurl规则

master
wangrenkang 10 months ago
parent
commit
7b698dbc16
1 changed files with 17 additions and 9 deletions
  1. +17
    -9
      kqapi/src/main/java/com/ningdatech/kqapi/common/helper/basic/AbstractMatterCacheHelper.java

+ 17
- 9
kqapi/src/main/java/com/ningdatech/kqapi/common/helper/basic/AbstractMatterCacheHelper.java View File

@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.LoadingCache;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.ningdatech.kqapi.common.constant.BizConst;
import com.ningdatech.kqapi.zzsfw.entity.entity.DscSxAdsShareItemQltQlsxCommonIDVKq;
import com.ningdatech.kqapi.zzsfw.entity.entity.MatterKey;
@@ -18,9 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

/**
* <p>
@@ -43,11 +40,15 @@ public abstract class AbstractMatterCacheHelper implements InitializingBean {

protected LoadingCache<String, String> mattersUrlCache;

private final String KQ_ZZS_BASE_URL = "https://www.zjzwfw.gov.cn/zjservice-fe/#/workguide?localInnerCode=&siteCode=330000000000";

private Boolean initMatterCache() {
List<DscSxAdsShareItemQltQlsxCommonIDVKq> allMatters = kqService
.list(Wrappers.lambdaQuery(DscSxAdsShareItemQltQlsxCommonIDVKq.class)
.select(DscSxAdsShareItemQltQlsxCommonIDVKq::getRowguid,DscSxAdsShareItemQltQlsxCommonIDVKq::getQlName,
DscSxAdsShareItemQltQlsxCommonIDVKq::getWebapplyurl)
.eq(DscSxAdsShareItemQltQlsxCommonIDVKq::getQlState, "1")
.isNotNull(DscSxAdsShareItemQltQlsxCommonIDVKq::getQlInnerCodeItem)
.isNotNull(DscSxAdsShareItemQltQlsxCommonIDVKq::getWebapplyurl)
.orderByDesc(DscSxAdsShareItemQltQlsxCommonIDVKq::getUpdateDate));
if (allMatters.isEmpty()) {
@@ -55,12 +56,14 @@ public abstract class AbstractMatterCacheHelper implements InitializingBean {
return Boolean.FALSE;
}
allMatters.forEach(m -> {
MatterKey key = MatterKey.of(m.getQlName(),m.getWebapplyurl());
// 1-11日修改新的url匹配规则,取事项状态为1且qlInnerCodeItem不为空的进行拼接,新的url规则如下
String kq_url = KQ_ZZS_BASE_URL.replace("localInnerCode=", "localInnerCode=" + m.getQlInnerCodeItem());
MatterKey key = MatterKey.of(m.getQlName(),kq_url);
if(!mattersUrlCache.asMap().containsKey(m.getQlName())){
mattersUrlCache.put(m.getQlName(),m.getWebapplyurl());
mattersUrlCache.put(m.getQlName(),kq_url);
}else{
String url = mattersUrlCache.get(m.getQlName());
if(StringUtils.isNotBlank(url) && !url.equals(m.getWebapplyurl())){
if(StringUtils.isNotBlank(url) && !url.equals(kq_url)){
return;
}
}
@@ -69,7 +72,7 @@ public abstract class AbstractMatterCacheHelper implements InitializingBean {
dup.setCountNum(dup.getCountNum() + 1);
mattersDupCache.put(key,dup);
}else{
mattersDupCache.put(key,NdKqZzsfwMattersDeduplicate.of(m.getQlName(),m.getWebapplyurl()));
mattersDupCache.put(key,NdKqZzsfwMattersDeduplicate.of(m.getQlName(),kq_url));
}
});
return Boolean.TRUE;
@@ -129,13 +132,18 @@ public abstract class AbstractMatterCacheHelper implements InitializingBean {
.build(key -> {
DscSxAdsShareItemQltQlsxCommonIDVKq matter = kqService.getOne(Wrappers.lambdaQuery(DscSxAdsShareItemQltQlsxCommonIDVKq.class)
.eq(DscSxAdsShareItemQltQlsxCommonIDVKq::getQlName, key)
.eq(DscSxAdsShareItemQltQlsxCommonIDVKq::getQlState, "1")
.isNotNull(DscSxAdsShareItemQltQlsxCommonIDVKq::getWebapplyurl)
.isNotNull(DscSxAdsShareItemQltQlsxCommonIDVKq::getQlInnerCodeItem)
.orderByDesc(DscSxAdsShareItemQltQlsxCommonIDVKq::getUpdateDate)
.last(BizConst.LIMIT_1)
.isNotNull(DscSxAdsShareItemQltQlsxCommonIDVKq::getWebapplyurl));
);
if (Objects.isNull(matter)) {
//查不到直接返回null
return null;
}
return matter.getWebapplyurl();
// return matter.getWebapplyurl();
return "https://www.zjzwfw.gov.cn/zjservice-fe/#/workguide?localInnerCode="+ matter.getQlInnerCodeItem() +"&siteCode=330000000000";
});
mattersDupCache = Caffeine.newBuilder()
.refreshAfterWrite(7, TimeUnit.DAYS)


Loading…
Cancel
Save