Browse Source

fix: 岗位导入fix

zhangying 9 months ago
parent
commit
621bf5a961

+ 44 - 5
src/main/java/com/hz/employmentsite/services/impl/companyService/PostServiceImpl.java

@@ -58,6 +58,9 @@ public class PostServiceImpl implements PostService {
     @Autowired
     private RecommendMgtCQuery recommendMgtCQuery;
 
+    @Autowired
+    private PcWorkcategoryMapper pcWorkcategoryMapper;
+
     @Override
     public PageInfo<PostVo> getList(Integer page, Integer rows, List<String> postIDList,
                                     String professionName, Integer minCount, Integer maxCount,
@@ -361,19 +364,46 @@ public class PostServiceImpl implements PostService {
                 for (PcProfession curItem : thirdLevelData) {
                     SysDictionaryItem item = new SysDictionaryItem();
                     item.setCode(curItem.getProfessionID());
-                    item.setCode(curItem.getProfessionName());
+                    item.setName(curItem.getProfessionName());
                     thirdLevelProfessionList.add(item);
                 }
             }
         }
+        // 工种信息
+        List<SysDictionaryItem> WorkCategoryList = new ArrayList<>();
+        // 获取第一级工种
+        PcWorkcategoryExample workCategoryExample = new PcWorkcategoryExample();
+        workCategoryExample.or().andParentWorkCategoryIDEqualTo("").andStatusEqualTo(1);
+        List<PcWorkcategory> firstLevelWorkCategoryList = pcWorkcategoryMapper.selectByExample(workCategoryExample);
+        for (PcWorkcategory pcWorkcategory : firstLevelWorkCategoryList) {
+            // 获取第二级工种
+            workCategoryExample = new PcWorkcategoryExample();
+            workCategoryExample.or().andParentWorkCategoryIDEqualTo(pcWorkcategory.getWorkCategoryID()).andStatusEqualTo(1);
+            List<PcWorkcategory> secondLevelWorkCategoryList = pcWorkcategoryMapper.selectByExample(workCategoryExample);
+            for (PcWorkcategory workCategory : secondLevelWorkCategoryList) {
+                // 获取第三级工种
+                workCategoryExample = new PcWorkcategoryExample();
+                workCategoryExample.or().andParentWorkCategoryIDEqualTo(workCategory.getWorkCategoryID()).andStatusEqualTo(1);
+                List<PcWorkcategory> thirdLevelWorkCategoryList = pcWorkcategoryMapper.selectByExample(workCategoryExample);
+                for (PcWorkcategory pcWorkCategory1 : thirdLevelWorkCategoryList) {
+                    SysDictionaryItem item = new SysDictionaryItem();
+                    item.setCode(pcWorkCategory1.getWorkCategoryID());
+                    item.setName(pcWorkCategory1.getWorkCategoryName());
+                    WorkCategoryList.add(item);
+                }
+            }
+        }
 
         //文化程度
         List<SysDictionaryItem> dicCultureDataList = dictionaryService.getDictionaryItemList("CultureLevel");
+        // 工作年限
         List<SysDictionaryItem> dicWorkYearDataList = dictionaryService.getDictionaryItemList("WorkYearType");
         List<PostVo> resultList = new ArrayList<>();
 
         dataList.forEach(item -> {
             String errorInfo = "";
+            item.setPostID(UUID.randomUUID().toString());
+            item.setRecordStatus(1);
             if (stringUtils.IsNullOrEmpty(item.companyName))
                 errorInfo += "请填写企业名称!";
             else {
@@ -390,6 +420,15 @@ public class PostServiceImpl implements PostService {
                 if (item.professionID == null || item.professionID == "")
                     errorInfo += "岗位不存在!";
             }
+            if (stringUtils.IsNullOrEmpty(item.getWorkCategoryName())) {
+                errorInfo += "请填写工种名称";
+            } else {
+                item.workCode = WorkCategoryList.stream().filter(it -> it.getName().equals(item.getWorkCategoryName().trim()))
+                        .findFirst().orElse(new SysDictionaryItem()).getCode();
+                if (item.workCode == null || item.workCode == "") {
+                    errorInfo += "工种不存在!";
+                }
+            }
 
             if (stringUtils.IsNullOrEmpty(String.valueOf(item.recruitCount)) || item.recruitCount == null)
                 errorInfo += "请填写招聘人数!";
@@ -401,11 +440,11 @@ public class PostServiceImpl implements PostService {
             if (stringUtils.IsNullOrEmpty(item.jobPlace))
                 errorInfo += "请填写工作地点!";
 
-            if (stringUtils.IsNullOrEmpty(item.workYearStr)) {
-                item.workYear = dicWorkYearDataList.stream().filter(it -> it.getName().equals(item.workYearStr.trim()))
+            if (!stringUtils.IsNullOrEmpty(item.getWorkYearName())) {
+                item.workYear = dicWorkYearDataList.stream().filter(it -> it.getName().equals(item.getWorkYearName().trim()))
                         .findFirst().orElse(new SysDictionaryItem()).getValue();
-                if (item.workYear == null || item.workYear == 0)
-                    errorInfo += "输入的工作年限不存在!";
+                if (item.workYear == null)
+                    errorInfo += "工作年限不存在!";
             }
 
             if (item.isTrailName.trim().equals("是")) item.isTrail = true;

BIN
src/main/resources/static/doc/template/岗位信息导入模板.xlsx


+ 2 - 1
vue/src/views/companyService/post/index.vue

@@ -185,11 +185,12 @@ export default defineComponent({
       columns: [
         {cnName: '企业名称', enName: 'companyName', width: 100},
         {cnName: '岗位名称', enName: 'professionName', width: 100},
+        {cnName: '工种名称', enName: 'workCategoryName', width: 100},
         {cnName: '招聘人数', enName: 'recruitCount', width: 100},
         {cnName: '开始日期', enName: 'startTime', width: 100},
         {cnName: '结束日期', enName: 'endTime', width: 100},
         {cnName: '工作地点', enName: 'jobPlace', width: 100},
-        {cnName: '工作年限', enName: 'workYear', width: 100},
+        {cnName: '工作年限', enName: 'workYearName', width: 100},
         {cnName: '学历要求', enName: 'cultureLevelName', width: 100},
         {cnName: '岗位最高月薪', enName: 'maxSalary', width: 100},
         {cnName: '岗位最低月薪', enName: 'minSalary', width: 100},