Преглед на файлове

Merge remote-tracking branch 'origin/master'

tags/24080901
PoffyZhang преди 1 година
родител
ревизия
b8a7e70440
променени са 5 файла, в които са добавени 62 реда и са изтрити 37 реда
  1. +8
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionCacheHelper.java
  2. +19
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java
  3. +14
    -35
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExpertRegisterUtil.java
  4. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/entity/CockpitApplication.java
  5. +18
    -2
      pmapi/src/test/java/com/ningdatech/pmapi/region/RegionTest.java

+ 8
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionCacheHelper.java Целия файл

@@ -109,4 +109,12 @@ public interface RegionCacheHelper {
*/
String getUnionPath(String code, Integer level);

/**
* 根据区域名称获取区域信息(参数格式:浙江省-杭州市-滨江区)
*
* @param regionName 地区名称
* @return \
**/
RegionDTO getByRegionName(String regionName);

}

+ 19
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java Целия файл

@@ -211,6 +211,25 @@ public class RegionsCacheHelperImpl extends AbstractRegionCacheHelper implements
return String.join("@@", unionPathStrList);
}

@Override
public RegionDTO getByRegionName(String regionName) {
if (StrUtils.isBlank(regionName)) {
return null;
}
String[] regionArray = regionName.split("-");
int length = regionArray.length;
return all().stream()
.filter(w -> {
boolean lastEq = w.getRegionLevel().equals(length)
&& w.getRegionName().equals(regionArray[length - 1]);
if (lastEq && length > 1) {
RegionDTO parent = getByCodeAndLevel(w.getParentCode(), w.getRegionLevel() - 1);
return parent.getRegionName().equals(regionArray[length - 2]);
}
return false;
}).findFirst().orElse(null);
}

protected void buildUnionPathStrList(String code, Integer level, List<String> unionPathStrList) {
if (level <= 0 || super.getParentCodeRoot().equals(code)) {
return;


+ 14
- 35
pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExpertRegisterUtil.java Целия файл

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

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.json.JSONUtil;
import cn.hutool.poi.excel.ExcelReader;
@@ -25,7 +26,6 @@ import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;

/**
* <p>
@@ -60,7 +60,6 @@ public class ExpertRegisterUtil {
basic.setName(MapUtil.getStr(w, "*姓名"));
basic.setPhoneNo(MapUtil.getStr(w, "*手机"));
basic.setGender("男".equals(MapUtil.getStr(w, "性别")) ? "1" : "0");
String expertRegion = MapUtil.getStr(w, "*专家层级");
// 政治面貌
basic.setPolitical(new ArrayList<>());
String political = MapUtil.getStr(w, "政治面貌");
@@ -112,36 +111,18 @@ public class ExpertRegisterUtil {
}
request.setEduInfo(eduInfo);
// 专家层级
String lastRegionName = expertRegion.substring(expertRegion.lastIndexOf("-") + 1);
List<RegionDTO> regions = regionCacheHelper.all();
Optional<RegionDTO> firstExpertRegion = regions.stream()
.filter(region -> region.getRegionLevel().equals(3)
&& region.getRegionName().equals(lastRegionName))
.findFirst();
if (firstExpertRegion.isPresent()) {
RegionDTO dto = firstExpertRegion.get();
ExpertRegionInfo regionInfo = new ExpertRegionInfo();
regionInfo.setRegionCode(dto.getRegionCode());
regionInfo.setRegionLevel(dto.getRegionLevel());
regionInfo.setRegionName(dto.getRegionName());
basic.setExpertRegionInfo(regionInfo);
String expertRegionStr = MapUtil.getStr(w, "*专家层级");
RegionDTO expertRegion = regionCacheHelper.getByRegionName(expertRegionStr);
if (expertRegion != null) {
basic.setExpertRegionInfo(BeanUtil.copyProperties(expertRegion, ExpertRegionInfo.class));
}
// 履职意向
String intentionRegionStr = MapUtil.getStr(w, "*履职意向");
String intentionRegions = MapUtil.getStr(w, "*履职意向");
basic.setExpertIntentionWorkRegions(new ArrayList<>());
for (String intentionRegion : intentionRegionStr.split("\\n")) {
String[] split = intentionRegion.split("-");
Optional<RegionDTO> first = regions.stream()
.filter(region -> region.getRegionName().equals(split[split.length - 1])
&& region.getRegionLevel().equals(split.length))
.findFirst();
if (first.isPresent()) {
RegionDTO dto = first.get();
ExpertRegionInfo regionInfo = new ExpertRegionInfo();
regionInfo.setRegionCode(dto.getRegionCode());
regionInfo.setRegionLevel(dto.getRegionLevel());
regionInfo.setRegionName(dto.getRegionName());
basic.getExpertIntentionWorkRegions().add(regionInfo);
for (String intentionRegionStr : intentionRegions.split("\\n|,")) {
RegionDTO currRegion = regionCacheHelper.getByRegionName(intentionRegionStr);
if (currRegion != null) {
basic.getExpertIntentionWorkRegions().add(BeanUtil.copyProperties(currRegion, ExpertRegionInfo.class));
}
}
request.setBasicInfo(basic);
@@ -222,12 +203,11 @@ public class ExpertRegisterUtil {
String goodAtStr = MapUtil.getStr(w, "*擅长方向");
for (String othTag : goodAtStr.split(",")) {
tagMap.entrySet().stream()
.filter(tag -> tag.getValue().getParentCode().equals(ExpertTagEnum.GOOD_AT.getKey())
&& tag.getValue().getTagName().equals(othTag))
.filter(tag -> tag.getValue().getTagName().equals(othTag))
.forEach(tag -> {
TagFieldInfo expertTag = new TagFieldInfo();
expertTag.setTagCode(tag.getValue().getTagCode());
expertTag.setTagFieldName(tag.getValue().getParentCode());
expertTag.setTagFieldName(ExpertTagEnum.GOOD_AT.getKey());
expertTag.setTagName(tag.getValue().getTagName());
professionalInfo.getGoodAt().add(expertTag);
});
@@ -236,12 +216,11 @@ public class ExpertRegisterUtil {
String techStr = MapUtil.getStr(w, "技术专长");
for (String othTag : techStr.split(",|、")) {
tagMap.entrySet().stream()
.filter(tag -> tag.getValue().getParentCode().equals(ExpertTagEnum.TECHNICAL_EXPERTISE.getKey())
&& tag.getValue().getTagName().equals(othTag))
.filter(tag -> tag.getValue().getTagName().equals(othTag))
.forEach(tag -> {
TagFieldInfo expertTag = new TagFieldInfo();
expertTag.setTagCode(tag.getValue().getTagCode());
expertTag.setTagFieldName(tag.getValue().getParentCode());
expertTag.setTagFieldName(ExpertTagEnum.TECHNICAL_EXPERTISE.getKey());
expertTag.setTagName(tag.getValue().getTagName());
professionalInfo.getTechnicalExpertise().add(expertTag);
});


+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/entity/CockpitApplication.java Целия файл

@@ -24,6 +24,9 @@ public class CockpitApplication implements Serializable {
@ApiModelProperty("应用名称")
private String applicationName;

@ApiModelProperty("项目编码")
private String projectCode;

@ApiModelProperty("介绍")
private String introduce;



+ 18
- 2
pmapi/src/test/java/com/ningdatech/pmapi/region/RegionTest.java Целия файл

@@ -1,9 +1,17 @@
package com.ningdatech.pmapi.region;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.pmapi.AppTests;
import com.ningdatech.pmapi.common.helper.RegionCacheHelper;
import com.ningdatech.pmapi.common.util.ExpertRegisterUtil;
import com.ningdatech.pmapi.expert.constant.ExpertApplyStatusEnum;
import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeEnum;
import com.ningdatech.pmapi.expert.controller.ExpertController;
import com.ningdatech.pmapi.expert.entity.ExpertIntentionWorkRegion;
import com.ningdatech.pmapi.expert.entity.ExpertMetaApply;
import com.ningdatech.pmapi.expert.service.IExpertIntentionWorkRegionService;
import com.ningdatech.pmapi.expert.service.IExpertMetaApplyService;
import com.ningdatech.pmapi.meta.helper.DictionaryCache;
import com.ningdatech.pmapi.meta.helper.TagCache;
import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
@@ -12,7 +20,10 @@ import com.ningdatech.pmapi.sys.service.IRegionService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;

@@ -28,7 +39,7 @@ public class RegionTest extends AppTests {
private IRegionService regionService;

@Test
public void test(){
public void test() {
Set<Region> set = regionService.list().stream().collect(Collectors.toSet());

Set<Long> ids = set.stream().map(Region::getId).collect(Collectors.toSet());
@@ -50,7 +61,12 @@ public class RegionTest extends AppTests {
private ExpertController expertController;

@Test
public void test1(){
public void test1() {
System.out.println(regionCacheHelper.getByRegionName("浙江省-杭州市-滨江区"));
}

@Test
public void test2() {
ExpertRegisterUtil.regionCacheHelper = regionCacheHelper;
ExpertRegisterUtil.tagCache = tagCache;
ExpertRegisterUtil.dictionaryCache = dictionaryCache;


Loading…
Отказ
Запис