Bläddra i källkod

专家审核信息修改改正

master
niohe·erbao 1 år sedan
förälder
incheckning
f891f4e049
4 ändrade filer med 44 tillägg och 4 borttagningar
  1. +10
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionCacheHelper.java
  2. +6
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionCacheHelper.java
  3. +25
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java
  4. +3
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertUserInfoAssembler.java

+ 10
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionCacheHelper.java Visa fil

@@ -99,4 +99,14 @@ public interface RegionCacheHelper {
**/
String getDisplayName(String regionCode, Integer regionLevel);


/**
* 获取用于前端回显示使用的unionList 仅用于返回前端的时候使用
*
* @param code 区域编码
* @param level 区域层级
* @return
*/
String getUnionPathStr(String code, Integer level);

}

+ 6
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionCacheHelper.java Visa fil

@@ -1,6 +1,5 @@
package com.ningdatech.pmapi.common.helper.basic;

import cn.hutool.core.lang.Assert;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.LoadingCache;
import com.ningdatech.pmapi.common.model.RegionMapKey;
@@ -28,10 +27,12 @@ import java.util.concurrent.TimeUnit;
@Slf4j
public abstract class AbstractRegionCacheHelper implements InitializingBean {

private static final String PARENT_CODE_ROOT = "-1";

@Autowired
private IRegionService regionService;

private LoadingCache<RegionMapKey, RegionDTO> regionsCache;
protected LoadingCache<RegionMapKey, RegionDTO> regionsCache;

private void initRegionCache() {
List<RegionDTO> allRegions = regionService.all();
@@ -71,4 +72,7 @@ public abstract class AbstractRegionCacheHelper implements InitializingBean {
initRegionCache();
}

public String getParentCodeRoot() {
return PARENT_CODE_ROOT;
}
}

+ 25
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java Visa fil

@@ -185,4 +185,29 @@ public class RegionsCacheHelperImpl extends AbstractRegionCacheHelper implements
.collect(Collectors.toList());
}


@Override
public String getUnionPathStr(String code, Integer level) {
if (StringUtils.isBlank(code) || Objects.isNull(level)) {
return null;
}
List<String> unionPathStrList = new ArrayList<>();
buildUnionPathStrList(code, level, unionPathStrList);
Collections.reverse(unionPathStrList);
if (CollectionUtils.isEmpty(unionPathStrList)) {
return null;
}
return String.join("@@", unionPathStrList);
}

protected void buildUnionPathStrList(String code, Integer level, List<String> unionPathStrList) {
if (level <= 0 || super.getParentCodeRoot().equals(code)) {
return;
}
RegionDTO regionDTO = getByCodeAndLevel(code, level);
unionPathStrList.add(regionDTO.getRegionCode() + "##" + regionDTO.getRegionName() + "##" + regionDTO.getRegionLevel());
if (!super.getParentCodeRoot().equals(regionDTO.getParentCode())) {
buildUnionPathStrList(regionDTO.getParentCode(), level - 1, unionPathStrList);
}
}
}

+ 3
- 2
pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertUserInfoAssembler.java Visa fil

@@ -4,6 +4,7 @@ package com.ningdatech.pmapi.expert.assembler;
import com.alibaba.fastjson.JSONObject;
import com.ningdatech.file.entity.vo.result.AttachFileVo;
import com.ningdatech.pmapi.common.enumeration.BoolDisplayEnum;
import com.ningdatech.pmapi.common.helper.RegionCacheHelper;
import com.ningdatech.pmapi.common.model.FileBasicInfo;
import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeEnum;
import com.ningdatech.pmapi.expert.entity.ExpertAvoidCompany;
@@ -41,7 +42,7 @@ public class ExpertUserInfoAssembler {

private final TagCache tagCache;
private final DictionaryCache dictionaryCache;
// private final RegionCache regionCache;
private final RegionCacheHelper regionCacheHelper;

public ExpertFullInfoVO buildExpertFullInfoVO(List<AttachFileVo> attachFiles
, ExpertFullInfoAllDTO expertUserFullInfoAll) {
@@ -83,7 +84,7 @@ public class ExpertUserInfoAssembler {
ExpertRegionInfo expertApplyIntentionWorkRegion = new ExpertRegionInfo();
expertApplyIntentionWorkRegion.setRegionLevel(r.getRegionLevel());
expertApplyIntentionWorkRegion.setRegionCode(r.getRegionCode());
// expertApplyIntentionWorkRegion.setRegionName(regionCache.getUnionPathStr(r.getRegionCode(), r.getRegionLevel()));
expertApplyIntentionWorkRegion.setRegionName(regionCacheHelper.getUnionPathStr(r.getRegionCode(), r.getRegionLevel()));
return expertApplyIntentionWorkRegion;
}).collect(Collectors.toList());



Laddar…
Avbryt
Spara