|
@@ -37,22 +37,21 @@ import java.util.Map; |
|
|
*/ |
|
|
*/ |
|
|
public class ExpertRegisterUtil { |
|
|
public class ExpertRegisterUtil { |
|
|
|
|
|
|
|
|
|
|
|
private ExpertRegisterUtil() { |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static final String SEPARATOR = ",|,|\\n"; |
|
|
|
|
|
|
|
|
public static RegionCacheHelper regionCacheHelper; |
|
|
public static RegionCacheHelper regionCacheHelper; |
|
|
public static DictionaryCache dictionaryCache; |
|
|
public static DictionaryCache dictionaryCache; |
|
|
public static IDingOrganizationService organizationService; |
|
|
public static IDingOrganizationService organizationService; |
|
|
public static TagCache tagCache; |
|
|
public static TagCache tagCache; |
|
|
public static ExpertController expertController; |
|
|
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(); |
|
|
List<Map<String, Object>> experts = reader.readAll(); |
|
|
experts.forEach(w -> { |
|
|
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(); |
|
|
ExpertRegistrationRequest request = new ExpertRegistrationRequest(); |
|
|
ExpertBasicInfo basic = new ExpertBasicInfo(); |
|
|
ExpertBasicInfo basic = new ExpertBasicInfo(); |
|
|
basic.setBank(MapUtil.getStr(w, "开户行")); |
|
|
basic.setBank(MapUtil.getStr(w, "开户行")); |
|
@@ -111,15 +110,15 @@ public class ExpertRegisterUtil { |
|
|
} |
|
|
} |
|
|
request.setEduInfo(eduInfo); |
|
|
request.setEduInfo(eduInfo); |
|
|
// 专家层级 |
|
|
// 专家层级 |
|
|
String expertRegionStr = MapUtil.getStr(w, "*专家层级"); |
|
|
|
|
|
|
|
|
String expertRegionStr = MapUtil.getStr(w, "*专家层级").replace("景宁县", "景宁畲族自治县"); |
|
|
RegionDTO expertRegion = regionCacheHelper.getByRegionName(expertRegionStr); |
|
|
RegionDTO expertRegion = regionCacheHelper.getByRegionName(expertRegionStr); |
|
|
if (expertRegion != null) { |
|
|
if (expertRegion != null) { |
|
|
basic.setExpertRegionInfo(BeanUtil.copyProperties(expertRegion, ExpertRegionInfo.class)); |
|
|
basic.setExpertRegionInfo(BeanUtil.copyProperties(expertRegion, ExpertRegionInfo.class)); |
|
|
} |
|
|
} |
|
|
// 履职意向 |
|
|
// 履职意向 |
|
|
String intentionRegions = MapUtil.getStr(w, "*履职意向"); |
|
|
|
|
|
|
|
|
String intentionRegions = MapUtil.getStr(w, "*履职意向").replace("景宁县", "景宁畲族自治县"); |
|
|
basic.setExpertIntentionWorkRegions(new ArrayList<>()); |
|
|
basic.setExpertIntentionWorkRegions(new ArrayList<>()); |
|
|
for (String intentionRegionStr : intentionRegions.split("\\n|,")) { |
|
|
|
|
|
|
|
|
for (String intentionRegionStr : intentionRegions.split("")) { |
|
|
RegionDTO currRegion = regionCacheHelper.getByRegionName(intentionRegionStr); |
|
|
RegionDTO currRegion = regionCacheHelper.getByRegionName(intentionRegionStr); |
|
|
if (currRegion != null) { |
|
|
if (currRegion != null) { |
|
|
basic.getExpertIntentionWorkRegions().add(BeanUtil.copyProperties(currRegion, ExpertRegionInfo.class)); |
|
|
basic.getExpertIntentionWorkRegions().add(BeanUtil.copyProperties(currRegion, ExpertRegionInfo.class)); |
|
@@ -170,26 +169,28 @@ public class ExpertRegisterUtil { |
|
|
ExpertProfessionalInfo professionalInfo = new ExpertProfessionalInfo(); |
|
|
ExpertProfessionalInfo professionalInfo = new ExpertProfessionalInfo(); |
|
|
professionalInfo.setAwards("暂无"); |
|
|
professionalInfo.setAwards("暂无"); |
|
|
professionalInfo.setIndustrySector(new ArrayList<>()); |
|
|
professionalInfo.setIndustrySector(new ArrayList<>()); |
|
|
String otherTagStr = MapUtil.getStr(w, "其他标签"); |
|
|
|
|
|
professionalInfo.setOther(new ArrayList<>()); |
|
|
professionalInfo.setOther(new ArrayList<>()); |
|
|
Map<String, TagDTO> tagMap = tagCache.getNameTagDtoMap(); |
|
|
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, "*回避单位"); |
|
|
String avoidCompanyStr = MapUtil.getStr(w, "*回避单位"); |
|
|
professionalInfo.setAvoidCompanyList(new ArrayList<>()); |
|
|
professionalInfo.setAvoidCompanyList(new ArrayList<>()); |
|
|
List<DingOrganization> avoidOrges = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) |
|
|
List<DingOrganization> avoidOrges = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) |
|
|
.in(DingOrganization::getOrganizationName, avoidCompanyStr.split(","))); |
|
|
|
|
|
|
|
|
.in(DingOrganization::getOrganizationName, avoidCompanyStr.split(SEPARATOR))); |
|
|
if (!avoidOrges.isEmpty()) { |
|
|
if (!avoidOrges.isEmpty()) { |
|
|
avoidOrges.forEach(org -> { |
|
|
avoidOrges.forEach(org -> { |
|
|
ExpertAvoidCompanyInfo companyInfo = new ExpertAvoidCompanyInfo(); |
|
|
ExpertAvoidCompanyInfo companyInfo = new ExpertAvoidCompanyInfo(); |
|
@@ -201,7 +202,7 @@ public class ExpertRegisterUtil { |
|
|
|
|
|
|
|
|
professionalInfo.setGoodAt(new ArrayList<>()); |
|
|
professionalInfo.setGoodAt(new ArrayList<>()); |
|
|
String goodAtStr = MapUtil.getStr(w, "*擅长方向"); |
|
|
String goodAtStr = MapUtil.getStr(w, "*擅长方向"); |
|
|
for (String othTag : goodAtStr.split(",")) { |
|
|
|
|
|
|
|
|
for (String othTag : goodAtStr.split(SEPARATOR)) { |
|
|
tagMap.entrySet().stream() |
|
|
tagMap.entrySet().stream() |
|
|
.filter(tag -> tag.getValue().getTagName().equals(othTag)) |
|
|
.filter(tag -> tag.getValue().getTagName().equals(othTag)) |
|
|
.forEach(tag -> { |
|
|
.forEach(tag -> { |
|
@@ -212,9 +213,21 @@ public class ExpertRegisterUtil { |
|
|
professionalInfo.getGoodAt().add(expertTag); |
|
|
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<>()); |
|
|
professionalInfo.setTechnicalExpertise(new ArrayList<>()); |
|
|
String techStr = MapUtil.getStr(w, "技术专长"); |
|
|
String techStr = MapUtil.getStr(w, "技术专长"); |
|
|
for (String othTag : techStr.split(",|、")) { |
|
|
|
|
|
|
|
|
for (String othTag : techStr.split(SEPARATOR)) { |
|
|
tagMap.entrySet().stream() |
|
|
tagMap.entrySet().stream() |
|
|
.filter(tag -> tag.getValue().getTagName().equals(othTag)) |
|
|
.filter(tag -> tag.getValue().getTagName().equals(othTag)) |
|
|
.forEach(tag -> { |
|
|
.forEach(tag -> { |
|
@@ -245,8 +258,11 @@ public class ExpertRegisterUtil { |
|
|
recommendInfo.setRecommendedWay(new ArrayList<>()); |
|
|
recommendInfo.setRecommendedWay(new ArrayList<>()); |
|
|
recommendInfo.setRecommendationProofFile(new ArrayList<>()); |
|
|
recommendInfo.setRecommendationProofFile(new ArrayList<>()); |
|
|
request.setRecommendInfo(recommendInfo); |
|
|
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)); |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|