瀏覽代碼

Merge remote-tracking branch 'origin/master'

liao-sea 10 月之前
父節點
當前提交
a45c094b74

+ 12 - 2
src/main/java/com/hz/employmentsite/controller/companyService/PostController.java

@@ -197,7 +197,7 @@ public class PostController {
     }
 
     @PostMapping("/importPost")
-    public BaseResponse<Object> importPost(@RequestBody List<PostVo> dataList){
+    public BaseResponse<Object> importPost(@RequestBody List<PostVo> dataList) {
         List<PostVo> result = postService.importPost(dataList, accountService.getLoginUserID());
         if (result != null && result.size() > 0) {
             return RespGenerstor.importFail(BaseErrorEnum.IMPORT_DATA_ERROR, result);
@@ -206,5 +206,15 @@ public class PostController {
         }
     }
 
-
+    /**
+     * 企业数据可视化地图获取岗位
+     *
+     * @param companyID 企业ID
+     * @return 岗位信息
+     */
+    @GetMapping("/companyMapGet")
+    public BaseResponse getCompanyMapPostList(@RequestParam int pageIndex, @RequestParam int pageSize, @RequestParam String companyID) {
+        PageInfo<PostVo> result = postService.selectCompanyMapPostList(pageIndex, pageSize, companyID);
+        return RespGenerstor.success(result);
+    }
 }

+ 8 - 0
src/main/java/com/hz/employmentsite/mapper/cquery/PostCQuery.java

@@ -19,4 +19,12 @@ public interface PostCQuery {
     List<RecommendPostVo> selectRecommendPostList(@Param("jobUserID") String jobUserID);
 
     int insert(PcPost post);
+
+    /**
+     * 企业数据可视化地图页面获取岗位
+     *
+     * @param companyID 企业ID
+     * @return 岗位信息
+     */
+    List<PostVo> selectCompanyMapPostList(@Param("companyID") String companyID);
 }

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

@@ -373,7 +373,7 @@ public class PostServiceImpl implements PostService {
             var secondLevelData = pcProfessionMapper.selectByExample(professionExp);
             for (PcProfession curParentProfession : secondLevelData) {
                 professionExp = new PcProfessionExample();
-                professionExp.or().andParentProfessionIDEqualTo(curParentProfession.getProfessionID()).andStatusEqualTo(1);
+                professionExp.or().andParentProfessionIDEqualTo(curParentProfession.getProfessionID()).andStatusEqualTo(1).andProfessionNameIsNotNull();
                 var thirdLevelData = pcProfessionMapper.selectByExample(professionExp);
                 for (PcProfession curItem : thirdLevelData) {
                     SysDictionaryItem item = new SysDictionaryItem();
@@ -443,7 +443,7 @@ public class PostServiceImpl implements PostService {
             if (stringUtils.IsNullOrEmpty(item.professionName))
                 errorInfo += "请填写岗位名称!";
             else {
-                item.professionID = thirdLevelProfessionList.stream().filter(it -> it.getName().equals(item.getProfessionName().trim()))
+                item.professionID = thirdLevelProfessionList.stream().filter(it -> it.getName() != null && it.getName().equals(item.getProfessionName().trim()))
                         .findFirst().orElse(new SysDictionaryItem()).getCode();
                 if (item.professionID == null || item.professionID == "") {
                     // 如果岗位不存在,则在“其他”下添加一个
@@ -456,13 +456,18 @@ public class PostServiceImpl implements PostService {
                         proModel.setStatus(Integer.parseInt("1"));
                         proModel.setOrderNo(proOtherSonList.size() + 1);
                         pcProfessionList.add(proModel);
+                        // 先将该岗位临时存储在第三级数据中,防止在最终添加之前,向pcProfessionList生成多个相同名称的岗位字典数据
+                        SysDictionaryItem dictionaryItem = new SysDictionaryItem();
+                        dictionaryItem.setCode(item.getProfessionID());
+                        dictionaryItem.setName(item.getProfessionName());
+                        thirdLevelProfessionList.add(dictionaryItem);
                     }
                 }
             }
             if (stringUtils.IsNullOrEmpty(item.getWorkCategoryName())) {
                 errorInfo += "请填写工种名称";
             } else {
-                item.workCode = WorkCategoryList.stream().filter(it -> it.getName().equals(item.getWorkCategoryName().trim()))
+                item.workCode = WorkCategoryList.stream().filter(it -> it.getName() != null && it.getName().equals(item.getWorkCategoryName().trim()))
                         .findFirst().orElse(new SysDictionaryItem()).getCode();
                 if (item.workCode == null || item.workCode == "") {
                     errorInfo += "工种不存在!";
@@ -480,7 +485,7 @@ public class PostServiceImpl implements PostService {
                 errorInfo += "请填写工作地点!";
 
             if (!stringUtils.IsNullOrEmpty(item.getWorkYearName())) {
-                item.workYear = dicWorkYearDataList.stream().filter(it -> it.getName().equals(item.getWorkYearName().trim()))
+                item.workYear = dicWorkYearDataList.stream().filter(it -> it.getName() != null && it.getName().equals(item.getWorkYearName().trim()))
                         .findFirst().orElse(new SysDictionaryItem()).getValue();
                 if (item.workYear == null)
                     errorInfo += "工作年限不存在!";
@@ -490,7 +495,7 @@ public class PostServiceImpl implements PostService {
             else if (item.isTrailName.trim().equals("否")) item.isTrail = false;
 
             if (!stringUtils.IsNullOrEmpty(item.cultureLevelName)) {
-                item.cultureRank = dicCultureDataList.stream().filter(it -> it.getName().equals(item.cultureLevelName.trim()))
+                item.cultureRank = dicCultureDataList.stream().filter(it -> it.getName() != null && it.getName().equals(item.cultureLevelName.trim()))
                         .findFirst().orElse(new SysDictionaryItem()).getValue();
                 if (item.cultureRank == null || item.cultureRank == 0)
                     errorInfo += "输入的学历要求不存在!";
@@ -514,4 +519,18 @@ public class PostServiceImpl implements PostService {
         });
         return null;
     }
+
+    /**
+     * 企业数据可视化地图页面获取岗位
+     *
+     * @param companyID 企业ID
+     * @return 岗位信息
+     */
+    @Override
+    public PageInfo<PostVo> selectCompanyMapPostList(int pageIndex, int pageSize, String companyID) {
+        PageHelper.startPage(pageIndex, pageSize);
+        List<PostVo> postVos = postCQuery.selectCompanyMapPostList(companyID);
+        PageInfo<PostVo> result = new PageInfo(postVos);
+        return result;
+    }
 }

+ 1 - 1
src/main/java/com/hz/employmentsite/services/impl/jobUserManager/JobHuntServiceImpl.java

@@ -226,7 +226,7 @@ public class JobHuntServiceImpl implements JobHuntService {
             var secondLevelData = pcProfessionMapper.selectByExample(professionExp);
             for (PcProfession curParentProfession : secondLevelData) {
                 professionExp = new PcProfessionExample();
-                professionExp.or().andParentProfessionIDEqualTo(curParentProfession.getProfessionID()).andStatusEqualTo(1);
+                professionExp.or().andParentProfessionIDEqualTo(curParentProfession.getProfessionID()).andStatusEqualTo(1).andProfessionNameIsNotNull();
                 var thirdLevelData = pcProfessionMapper.selectByExample(professionExp);
                 for (PcProfession curItem : thirdLevelData) {
                     SysDictionaryItem item = new SysDictionaryItem();

+ 8 - 0
src/main/java/com/hz/employmentsite/services/service/companyService/PostService.java

@@ -30,4 +30,12 @@ public interface PostService {
     List<PostVo> importPost(List<PostVo> dataList, String userID);
 
     int deletePostAndRecommendMgt(String id);
+
+    /**
+     * 企业数据可视化地图页面获取岗位
+     *
+     * @param companyID 企业ID
+     * @return 岗位信息
+     */
+    PageInfo<PostVo> selectCompanyMapPostList(int pageIndex, int pageSize, String companyID);
 }

+ 3 - 1
src/main/java/com/hz/employmentsite/vo/companyService/PostVo.java

@@ -6,7 +6,6 @@ import com.hz.employmentsite.util.datarange.annotations.RegionID;
 import com.hz.employmentsite.util.datarange.annotations.SiteID;
 import com.hz.employmentsite.vo.baseSettings.LabelVo;
 import lombok.Data;
-import org.apache.catalina.LifecycleState;
 
 import java.math.BigDecimal;
 import java.util.Date;
@@ -131,4 +130,7 @@ public class PostVo {
     public String loginUserID;
 
     public List<LabelVo> listLabel;
+
+    // JSON格式的标签列表
+    public String labelList;
 }

+ 24 - 0
src/main/resources/mapping/cquery/PostCQuery.xml

@@ -90,4 +90,28 @@
         where jobhunt.JobUserID = #{jobUserID}
         order by post.CreateTime desc
     </select>
+
+    <select id="selectCompanyMapPostList" resultType="com.hz.employmentsite.vo.companyService.PostVo">
+        SELECT post.PostID,
+               prof.ProfessionName,
+               post.MinSalary,
+               post.MaxSalary,
+               post.RecruitCount,
+               post.StartTime,
+               post.EndTime,
+               post.PostDesc,
+               (
+                   SELECT JSON_ARRAYAGG(JSON_OBJECT('labelID', labelTemp.LabelID, 'labelName', labelTemp.LabelName))
+                   FROM (
+                            SELECT label.LabelID,
+                                   label.LabelName
+                            FROM pc_label label
+                                     LEFT JOIN pc_label_post label_post ON label.LabelID = label_post.LabelID
+                            WHERE label_post.PostID = post.PostID
+                        ) AS labelTemp
+               ) AS labelList
+        FROM pc_post post
+                 LEFT JOIN pc_profession prof ON post.ProfessionID = prof.ProfessionID
+        WHERE post.CompanyID = #{companyID}
+    </select>
 </mapper>