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