Bläddra i källkod

web-岗位招聘日期控制状态、求职意向岗位ID赋值错误调整

liao-sea 11 månader sedan
förälder
incheckning
7add66193d

+ 7 - 0
src/main/java/com/hz/employmentsite/controller/companyService/PostController.java

@@ -63,6 +63,7 @@ public class PostController {
 
     @PostMapping("/saveCommendPostList")
     public BaseResponse saveCommendPostList(@RequestBody List<RecommendPostVo> data) {
+
         var result = 0;
         for (RecommendPostVo curData: data) {
              result += postService.saveCommendPost(curData, accountService.getLoginUserID());
@@ -70,6 +71,12 @@ public class PostController {
         return RespGenerstor.success(result);
     }
 
+    @ResponseBody
+    @GetMapping("/updatePostStatus")
+    public BaseResponse<Map<String, Object>> updatePostStatus(String postID, Integer status) {
+        return RespGenerstor.success(postService.updatePostStatus(postID, status));
+    }
+
     @PostMapping("/save")
     public BaseResponse<Integer> save(@RequestBody PostVo data) {
         String loginUserID = data.loginUserID;

+ 14 - 0
src/main/java/com/hz/employmentsite/services/impl/companyService/PostServiceImpl.java

@@ -84,6 +84,9 @@ public class PostServiceImpl implements PostService {
         if(list != null && list.size()>0){
             for(PostVo curPost : list){
                 curPost.listLabel = labelCQuery.getPostLabelList(curPost.getPostID());
+                if(curPost.endTime.before(new Date())){
+                    curPost.setRecordStatus(0);
+                }
             }
         }
         PageInfo<PostVo> result = new PageInfo(list);
@@ -132,6 +135,16 @@ public class PostServiceImpl implements PostService {
         return result;
     }
 
+    @Override
+    public int updatePostStatus(String postID, Integer status) {
+        PcPost post = pcPostMapper.selectByPrimaryKey(postID);
+        if(status.equals(1)&&post.getEndTime().before(new Date())){
+            throw new BaseException("","该岗位招聘日期已结束,不能启用!");
+        }
+        post.setRecordStatus(status);
+        return pcPostMapper.updateByPrimaryKey(post);
+    }
+
 
     @Override
     public int save(PostVo data, String userId) {
@@ -317,6 +330,7 @@ public class PostServiceImpl implements PostService {
         return data;
     }
 
+
     @Override
     public List<PostVo> getDataListByCompanyID(String companyId) {
         List<PostVo> resultList = new ArrayList<>();

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

@@ -19,6 +19,7 @@ public interface PostService {
     Integer saveCommendPost(RecommendPostVo data, String userId);
 
     int save(PostVo data, String userId);
+    int updatePostStatus(String postID, Integer status);
 
     int delete(List<String> ids);
 

+ 14 - 0
vue/src/api/companyService/post.ts

@@ -62,3 +62,17 @@ export function del(ids: any) {
     },
   );
 }
+
+export function updatePostStatus(query: { postID: String, status: number }) {
+  return request(
+    {
+      url: 'companyService/post/updatePostStatus',
+      method: 'get',
+      params: query,
+    },
+    {
+      isNew: true,
+      successMsg: '操作成功',
+    },
+  );
+}

+ 24 - 53
vue/src/views/companyService/post/index.vue

@@ -124,7 +124,8 @@
               <a-button type="link" size="small" @click='onDetail(record)' functioncode="T01020201">查看</a-button>
               <a-button type="link" size="small" @click='onEdit(record)' functioncode="T01020203">编辑</a-button>
               <a-button type="link" size="small" @click="onDel(record)" functioncode="T01020204">删除</a-button>
-              <a-button type="link" size="small"  @click="onRecommendJob(record)" functioncode="T01030207">推荐求职人员</a-button>
+              <a-button type="link" size="small" @click="onRecommendJob(record)" functioncode="T01030207">推荐求职人员</a-button>
+              <a-button type="link" size="small" @click="onChangeStatus(record.postID,record.recordStatus==1?0:1)"   >{{ record.recordStatus==1?"禁用":"启用" }}</a-button>
             </div>
           </template>
         </template>
@@ -151,6 +152,7 @@ import {get} from "@/api/common";
 import Recommend from "@/views/companyService/post/recommend.vue";
 import {getSiteList} from "@/api/baseSettings/siteInfo";
 import ColumnsSetting from "@/components/common/ColumnsSetting.vue";
+import {updatePostStatus} from "@/api/companyService/post";
 
 export default defineComponent({
   name: "PostList",
@@ -214,77 +216,40 @@ export default defineComponent({
     });
     // 原始表格定义数据
     const originalColumns = [
-      {
-        title: '序号',
-        align: "center",
-        key: 'postID',
-        width: 50,
-        customRender: item => `${searchParams.pageSize * (searchParams.pageIndex - 1) + item.index + 1}`,
+      {title: '序号', align: "center", key: 'postID', width: 50,
+        customRender: (item) => `${searchParams.pageSize * (searchParams.pageIndex - 1) + item.index + 1}`,
         isDisabled: true
       },
       {title: '岗位名称', dataIndex: 'professionName', key: 'professionName', align: "center"},
       {title: '招聘人数', dataIndex: 'recruitCount', key: 'recruitCount', width: 120, align: "center"},
-      {
-        title: '开始日期', dataIndex: 'startTime', key: 'startTime', align: "center", customRender: (item) => {
+      {title: '开始日期', dataIndex: 'startTime', key: 'startTime', width: 120, align: "center",
+        customRender: (item) => {
           return item.record.startTime == null ? "" : (dayjs(item.record.startTime).format('YYYY-MM-DD'))
         }
       },
-      {title: '结束日期', dataIndex: 'endTime', key: 'endTime', align: "center",customRender: (item) => {
+      {title: '结束日期', dataIndex: 'endTime', key: 'endTime', width: 120, align: "center",
+        customRender: (item) => {
           return item.record.endTime == null ? "" : (dayjs(item.record.endTime).format('YYYY-MM-DD'))
         }
       },
-      {title: '招聘企业', dataIndex: 'companyName', key: 'companyName', width: 200, align: "center"},
-      {title: '所属驿站', dataIndex: 'siteName', key: 'siteName', width: 200, align: "center"},
-      {
-        title: '岗位状态', dataIndex: 'recordStatus', key: 'recordStatus', align: "center",
+      {title: '招聘企业', dataIndex: 'companyName', key: 'companyName',align: "center"},
+      {title: '所属驿站', dataIndex: 'siteName', key: 'siteName', align: "center"},
+      {title: '岗位状态', dataIndex: 'recordStatus', key: 'recordStatus', width: 100, align: "center",
         customRender: (item) => {
           return item.record.recordStatus == 1 ? "启用" : "停用";
         }
       },
-      {
-        title: '学历要求',
-        dataIndex: 'cultureLevelName',
-        key: 'cultureLevelName',
-        width: 150,
-        align: "center",
-        isDefaultClose: true
-      },
-      {
-        title: '薪酬',
-        dataIndex: 'postSalary',
-        key: 'postSalary',
-        width: 150,
-        align: "center",
+      {title: '学历要求', dataIndex: 'cultureLevelName', key: 'cultureLevelName', width: 150, align: "center", isDefaultClose: true},
+      {title: '薪酬', dataIndex: 'postSalary', key: 'postSalary', width: 150, align: "center",
         customRender: (item) => {
           return showSalary(item.record.minSalary, item.record.maxSalary);
         },
         isDefaultClose: true
       },
-      {
-        title: '联系人',
-        dataIndex: 'contactName',
-        key: 'contactName',
-        width: 150,
-        align: "center",
-        isDefaultClose: true
-      },
-      {
-        title: '联系电话',
-        dataIndex: 'contactMobile',
-        key: 'contactMobile',
-        width: 200,
-        align: "center",
-        isDefaultClose: true
-      },
-      {
-        title: '推荐数量',
-        dataIndex: 'recommendNum',
-        key: 'recommendNum',
-        width: 100,
-        align: "center",
-        isDefaultClose: true
-      },
-      {title: '操作', key: 'operation', fixed: 'right', width: 240, align: "center", isDisabled: true},
+      {title: '联系人', dataIndex: 'contactName', key: 'contactName', width: 150, align: "center", isDefaultClose: true},
+      {title: '联系电话', dataIndex: 'contactMobile', key: 'contactMobile', width: 200, align: "center", isDefaultClose: true},
+      {title: '推荐数量', dataIndex: 'recommendNum', key: 'recommendNum', width: 100, align: "center", isDefaultClose: true},
+      {title: '操作', key: 'operation', fixed: 'right', width: 290, align: "center", isDisabled: true},
     ];
     // 响应式表格定义
     const columns = ref<Array<any>>(originalColumns.filter(item => !item.isDefaultClose));
@@ -331,6 +296,11 @@ export default defineComponent({
       recommendRef.value.show(item.professionID,item.parentProfessionID,item.professionName,item.postID,item.companyName,0,'推荐求职人员');
     }
 
+    const onChangeStatus = (curPostID: any,statusValue:any) => {
+      updatePostStatus({ postID: curPostID,status:statusValue });
+      loadData();
+    };
+
     const onRecommendInfo = (item) =>{
       recommendRef.value.show('','',item.professionName,item.postID,item.companyName,1,'求职人员信息');
     }
@@ -427,6 +397,7 @@ export default defineComponent({
       onAdd,
       onEdit,
       onRecommendJob,
+      onChangeStatus,
       onRecommendInfo,
       expand,
       postStatusList,

+ 13 - 11
vue/src/views/jobUserManager/jobhunt/edit.vue

@@ -111,7 +111,7 @@
   </div>
 </template>
 <script lang="ts">
-import {defineComponent, reactive, ref, toRefs, watch} from "vue";
+import {defineComponent, reactive, ref, toRefs} from "vue";
 import {useTabsViewStore} from "@/store/modules/tabsView";
 import {getJobHuntByID, saveJobHuntCopy} from "@/api/jobUserManager/jobhunt"
 import {getJobUserDataList} from "@/api/jobUserManager/jobuser";
@@ -119,7 +119,6 @@ import {getSysDictionaryList} from '@/api/system/dictionary';
 import BUploadFile from "@/components/file/uploadFile.vue";
 import {CascaderProps, message, SelectProps} from "ant-design-vue";
 import {get} from "@/api/common";
-import {debounce} from "lodash-es";
 import {getProfessionLikeList} from "@/api/jobUserManager/recommendMgt";
 
 interface jobHuntModel {
@@ -202,12 +201,8 @@ export default defineComponent({
         }
       }
     };
-    watch(() => formData.dataModel.professionName, (selectedValues) => {
-      if (selectedValues && selectedValues.length == 3) {
-        formData.dataModel.professionID = selectedValues[2];
-        formData.dataModel.hasProfession = true;
-      }
-    });
+
+
     const getJobUserList = async function() {
       const jobUserResult :any = await getJobUserDataList();
       jobUserList.value = jobUserResult;
@@ -273,7 +268,7 @@ export default defineComponent({
     };
 
     // 查询岗位
-    const selectProfessionList = debounce((professionName: string) => {
+    const selectProfessionList = (professionName: string) => {
       if (professionName) {
         getProfessionLikeList({
           pageIndex: 1,
@@ -281,19 +276,26 @@ export default defineComponent({
           professionName,
         }).then(data => {
           professionList.value = data.list;
+          setProfessionId(professionName);
+          console.log("list",professionList.value);
         })
       }
-    }, 200)
+    }
 
     // 岗位名称变更
     function professionChange(value: any) {
-      formData.dataModel.professionName = value
+      formData.dataModel.professionName = value;
+      setProfessionId(value);
+    }
+
+    function setProfessionId(value:any){
       const profession = professionList.value.find(prof => prof.professionName === value);
       if (profession) {
         formData.dataModel.professionID = profession.professionID;
       } else {
         formData.dataModel.professionID = "";
       }
+      formData.dataModel.hasProfession = true;
     }
 
     // 名称搜索关键字高亮