|
@@ -400,6 +400,17 @@ public class PostServiceImpl implements PostService {
|
|
|
List<SysDictionaryItem> dicWorkYearDataList = dictionaryService.getDictionaryItemList("WorkYearType");
|
|
|
List<PostVo> resultList = new ArrayList<>();
|
|
|
|
|
|
+ // 获取二级的“其他”岗位
|
|
|
+ PcProfessionExample proEmp = new PcProfessionExample();
|
|
|
+ PcProfessionExample.Criteria proCia = proEmp.or();
|
|
|
+ proCia.andParentProfessionIDNotEqualTo("");
|
|
|
+ proCia.andProfessionNameEqualTo("其他");
|
|
|
+ PcProfession proOther = pcProfessionMapper.selectByExample(proEmp).stream().findFirst().orElse(null);
|
|
|
+ proEmp = new PcProfessionExample();
|
|
|
+ proEmp.or().andParentProfessionIDEqualTo(proOther.getProfessionID());
|
|
|
+ //查询已存在的三级“其他”岗位
|
|
|
+ List<PcProfession> proOtherSonList = pcProfessionMapper.selectByExample(proEmp);
|
|
|
+
|
|
|
dataList.forEach(item -> {
|
|
|
String errorInfo = "";
|
|
|
item.setPostID(UUID.randomUUID().toString());
|
|
@@ -417,8 +428,20 @@ public class PostServiceImpl implements PostService {
|
|
|
else {
|
|
|
item.professionID = thirdLevelProfessionList.stream().filter(it -> it.getName().equals(item.getProfessionName().trim()))
|
|
|
.findFirst().orElse(new SysDictionaryItem()).getCode();
|
|
|
- if (item.professionID == null || item.professionID == "")
|
|
|
- errorInfo += "岗位不存在!";
|
|
|
+ if (item.professionID == null || item.professionID == "") {
|
|
|
+ // 如果岗位不存在,则在“其他”下添加一个
|
|
|
+ if (proOther != null) {
|
|
|
+ item.setProfessionID(UUID.randomUUID().toString());
|
|
|
+ PcProfession proModel = new PcProfession();
|
|
|
+ proModel.setProfessionID(item.getProfessionID());
|
|
|
+ proModel.setParentProfessionID(proOther.getProfessionID());
|
|
|
+ proModel.setProfessionName(item.getProfessionName());
|
|
|
+ proModel.setStatus(Integer.parseInt("1"));
|
|
|
+ proModel.setOrderNo(proOtherSonList.size() + 1);
|
|
|
+
|
|
|
+ pcProfessionMapper.insert(proModel);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if (stringUtils.IsNullOrEmpty(item.getWorkCategoryName())) {
|
|
|
errorInfo += "请填写工种名称";
|