|
|
@@ -37,22 +37,21 @@ import java.util.Map; |
|
|
|
*/ |
|
|
|
public class ExpertRegisterUtil { |
|
|
|
|
|
|
|
private ExpertRegisterUtil() { |
|
|
|
} |
|
|
|
|
|
|
|
private static final String SEPARATOR = ",|,|\\n"; |
|
|
|
|
|
|
|
public static RegionCacheHelper regionCacheHelper; |
|
|
|
public static DictionaryCache dictionaryCache; |
|
|
|
public static IDingOrganizationService organizationService; |
|
|
|
public static TagCache tagCache; |
|
|
|
public static ExpertController expertController; |
|
|
|
|
|
|
|
private static final String FILE_PATH = "/Users/wendy/Desktop/丽水市市本级专家导入用(1).xlsx"; |
|
|
|
|
|
|
|
public static void registerExpertBatch() { |
|
|
|
ExcelReader reader = ExcelUtil.getReader(new File(FILE_PATH)); |
|
|
|
public static void registerExpertBatch(String path) { |
|
|
|
ExcelReader reader = ExcelUtil.getReader(new File(path)); |
|
|
|
List<Map<String, Object>> experts = reader.readAll(); |
|
|
|
experts.forEach(w -> { |
|
|
|
String rowNum = MapUtil.getStr(w, "序号"); |
|
|
|
if (!StrUtils.isNumeric(rowNum) || Integer.parseInt(rowNum) <= 41 || Integer.parseInt(rowNum) >= 108) { |
|
|
|
return; |
|
|
|
} |
|
|
|
ExpertRegistrationRequest request = new ExpertRegistrationRequest(); |
|
|
|
ExpertBasicInfo basic = new ExpertBasicInfo(); |
|
|
|
basic.setBank(MapUtil.getStr(w, "开户行")); |
|
|
@@ -111,15 +110,15 @@ public class ExpertRegisterUtil { |
|
|
|
} |
|
|
|
request.setEduInfo(eduInfo); |
|
|
|
// 专家层级 |
|
|
|
String expertRegionStr = MapUtil.getStr(w, "*专家层级"); |
|
|
|
String expertRegionStr = MapUtil.getStr(w, "*专家层级").replace("景宁县", "景宁畲族自治县"); |
|
|
|
RegionDTO expertRegion = regionCacheHelper.getByRegionName(expertRegionStr); |
|
|
|
if (expertRegion != null) { |
|
|
|
basic.setExpertRegionInfo(BeanUtil.copyProperties(expertRegion, ExpertRegionInfo.class)); |
|
|
|
} |
|
|
|
// 履职意向 |
|
|
|
String intentionRegions = MapUtil.getStr(w, "*履职意向"); |
|
|
|
String intentionRegions = MapUtil.getStr(w, "*履职意向").replace("景宁县", "景宁畲族自治县"); |
|
|
|
basic.setExpertIntentionWorkRegions(new ArrayList<>()); |
|
|
|
for (String intentionRegionStr : intentionRegions.split("\\n|,")) { |
|
|
|
for (String intentionRegionStr : intentionRegions.split("")) { |
|
|
|
RegionDTO currRegion = regionCacheHelper.getByRegionName(intentionRegionStr); |
|
|
|
if (currRegion != null) { |
|
|
|
basic.getExpertIntentionWorkRegions().add(BeanUtil.copyProperties(currRegion, ExpertRegionInfo.class)); |
|
|
@@ -170,26 +169,28 @@ public class ExpertRegisterUtil { |
|
|
|
ExpertProfessionalInfo professionalInfo = new ExpertProfessionalInfo(); |
|
|
|
professionalInfo.setAwards("暂无"); |
|
|
|
professionalInfo.setIndustrySector(new ArrayList<>()); |
|
|
|
String otherTagStr = MapUtil.getStr(w, "其他标签"); |
|
|
|
professionalInfo.setOther(new ArrayList<>()); |
|
|
|
Map<String, TagDTO> tagMap = tagCache.getNameTagDtoMap(); |
|
|
|
for (String othTag : otherTagStr.split(",")) { |
|
|
|
tagMap.entrySet().stream() |
|
|
|
.filter(tag -> tag.getValue().getParentCode().equals(ExpertTagEnum.OTHER.getKey()) |
|
|
|
&& tag.getValue().getTagName().equals(othTag)) |
|
|
|
.forEach(tag -> { |
|
|
|
TagFieldInfo expertTag = new TagFieldInfo(); |
|
|
|
expertTag.setTagCode(tag.getValue().getTagCode()); |
|
|
|
expertTag.setTagFieldName(tag.getValue().getParentCode()); |
|
|
|
expertTag.setTagName(tag.getValue().getTagName()); |
|
|
|
professionalInfo.getOther().add(expertTag); |
|
|
|
}); |
|
|
|
String otherTagStr = MapUtil.getStr(w, "其他标签"); |
|
|
|
if (StrUtils.isNotBlank(otherTagStr)) { |
|
|
|
for (String othTag : otherTagStr.split(SEPARATOR)) { |
|
|
|
tagMap.entrySet().stream() |
|
|
|
.filter(tag -> tag.getValue().getParentCode().equals(ExpertTagEnum.OTHER.getKey()) |
|
|
|
&& tag.getValue().getTagName().equals(othTag)) |
|
|
|
.forEach(tag -> { |
|
|
|
TagFieldInfo expertTag = new TagFieldInfo(); |
|
|
|
expertTag.setTagCode(tag.getValue().getTagCode()); |
|
|
|
expertTag.setTagFieldName(tag.getValue().getParentCode()); |
|
|
|
expertTag.setTagName(tag.getValue().getTagName()); |
|
|
|
professionalInfo.getOther().add(expertTag); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
String avoidCompanyStr = MapUtil.getStr(w, "*回避单位"); |
|
|
|
professionalInfo.setAvoidCompanyList(new ArrayList<>()); |
|
|
|
List<DingOrganization> avoidOrges = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) |
|
|
|
.in(DingOrganization::getOrganizationName, avoidCompanyStr.split(","))); |
|
|
|
.in(DingOrganization::getOrganizationName, avoidCompanyStr.split(SEPARATOR))); |
|
|
|
if (!avoidOrges.isEmpty()) { |
|
|
|
avoidOrges.forEach(org -> { |
|
|
|
ExpertAvoidCompanyInfo companyInfo = new ExpertAvoidCompanyInfo(); |
|
|
@@ -201,7 +202,7 @@ public class ExpertRegisterUtil { |
|
|
|
|
|
|
|
professionalInfo.setGoodAt(new ArrayList<>()); |
|
|
|
String goodAtStr = MapUtil.getStr(w, "*擅长方向"); |
|
|
|
for (String othTag : goodAtStr.split(",")) { |
|
|
|
for (String othTag : goodAtStr.split(SEPARATOR)) { |
|
|
|
tagMap.entrySet().stream() |
|
|
|
.filter(tag -> tag.getValue().getTagName().equals(othTag)) |
|
|
|
.forEach(tag -> { |
|
|
@@ -212,9 +213,21 @@ public class ExpertRegisterUtil { |
|
|
|
professionalInfo.getGoodAt().add(expertTag); |
|
|
|
}); |
|
|
|
} |
|
|
|
String industrySectorStr = MapUtil.getStr(w, "行业领域"); |
|
|
|
for (String othTag : industrySectorStr.split(SEPARATOR)) { |
|
|
|
tagMap.entrySet().stream() |
|
|
|
.filter(tag -> tag.getValue().getTagName().equals(othTag)) |
|
|
|
.forEach(tag -> { |
|
|
|
TagFieldInfo expertTag = new TagFieldInfo(); |
|
|
|
expertTag.setTagCode(tag.getValue().getTagCode()); |
|
|
|
expertTag.setTagFieldName(ExpertTagEnum.INDUSTRY_SECTOR.getKey()); |
|
|
|
expertTag.setTagName(tag.getValue().getTagName()); |
|
|
|
professionalInfo.getIndustrySector().add(expertTag); |
|
|
|
}); |
|
|
|
} |
|
|
|
professionalInfo.setTechnicalExpertise(new ArrayList<>()); |
|
|
|
String techStr = MapUtil.getStr(w, "技术专长"); |
|
|
|
for (String othTag : techStr.split(",|、")) { |
|
|
|
for (String othTag : techStr.split(SEPARATOR)) { |
|
|
|
tagMap.entrySet().stream() |
|
|
|
.filter(tag -> tag.getValue().getTagName().equals(othTag)) |
|
|
|
.forEach(tag -> { |
|
|
@@ -245,8 +258,11 @@ public class ExpertRegisterUtil { |
|
|
|
recommendInfo.setRecommendedWay(new ArrayList<>()); |
|
|
|
recommendInfo.setRecommendationProofFile(new ArrayList<>()); |
|
|
|
request.setRecommendInfo(recommendInfo); |
|
|
|
System.out.println(JSONUtil.toJsonStr(request)); |
|
|
|
expertController.expertBasicInfoSubmit(request); |
|
|
|
try { |
|
|
|
expertController.expertBasicInfoSubmit(request); |
|
|
|
} catch (Exception e) { |
|
|
|
System.out.println(JSONUtil.toJsonStr(request)); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|