Quellcode durchsuchen

去掉RecruitPlan临时中间类

java71- 张威豹 vor 3 Jahren
Ursprung
Commit
6465c2042b

+ 49 - 72
ruoyi-ahrs/src/main/java/com/ruoyi/ahrs/recruitplan/controller/RecruitPlanMainController.java

@@ -6,7 +6,6 @@ import java.util.List;
 import java.util.Map;
 
 import com.ruoyi.ahrs.recruitPersonnel.service.IRecruitPersonnelService;
-import com.ruoyi.ahrs.recruitplan.domian.RecruitPlan;
 import com.ruoyi.ahrs.recruitplan.domian.RecruitPlanChild;
 import com.ruoyi.ahrs.recruitplan.domian.RecruitPlanMain;
 import com.ruoyi.ahrs.recruitplan.service.impl.RecruitPlanChildServiceImpl;
@@ -59,7 +58,7 @@ public class RecruitPlanMainController extends BaseController
     }
 
     /**
-     * 查询recruitplan列表
+     * 查询RecruitPlanMain列表
      */
     @RequiresPermissions("recruitplan:recruit:list")
     @PostMapping("/list")
@@ -111,7 +110,7 @@ public class RecruitPlanMainController extends BaseController
     }
 
     /**
-     * 导出recruitplan列表
+     * 导出RecruitPlanMain列表
      */
     @RequiresPermissions("recruitplan:recruit:export")
     @Log(title = "recruitplan", businessType = BusinessType.EXPORT)
@@ -125,7 +124,7 @@ public class RecruitPlanMainController extends BaseController
     }
 
     /**
-     * 新增recruitplan
+     * 新增RecruitPlanMain
      */
     @GetMapping("/add")
     public String add(ModelMap mmap)
@@ -139,26 +138,6 @@ public class RecruitPlanMainController extends BaseController
         RecruitPlanMain  recruitPlanMain1 = new RecruitPlanMain();
         recruitPlanMain1.setDeptId(getDeptId());
         List<RecruitPlanMain> recruitPlanMainList = recruitPlanMainService.selectRecruitPlanMainList(recruitPlanMain1);
-        for (RecruitPlanMain recruitPlanMain :recruitPlanMainList){
-            if (recruitPlanMain!=null){
-              for (int i=0; i<yearsList.size();i++){
-                  Long a = yearsList.get(i).longValue();
-                  if (recruitPlanMain.getRecruitPlanYear().equals(a) && recruitPlanMain.getDeptName().equals(deptName)){
-                      yearsList.remove(i);
-                  }
-
-              }
-              if (yearsList.size()==1 && yearsList.get(0)==b){
-                  mmap.put("msg","该单位已有明年招聘计划,请修改原有计划或删除");
-                  return prefix + "/501";
-              }
-                }
-            }
-            if (yearsList.size()==0){
-                mmap.put("msg","该单位已有招聘计划,请修改原有计划或删除");
-                return prefix + "/501";
-            }
-
         //默认生成一个岗位代码
         String deptId1 =String.valueOf(getDeptId().intValue()) ;
         double number = Math.random()*1000000;
@@ -172,25 +151,33 @@ public class RecruitPlanMainController extends BaseController
         return prefix + "/add";
     }
 
+    /**
+     * 查询该单位有没有招聘计划
+     * @return
+     */
+    @PostMapping("/selectRecruitplanListBydeptId")
+    @ResponseBody
+    public AjaxResult selectRecruitplanmainidBydeptId(){
+        StringBuilder msg = new StringBuilder();
+        Long dept_id  = getDeptId();
+        Long Recruitplanmainid =recruitPlanMainService.selectRecruitPlanMainIdByDeptid(dept_id);
+        msg.append(Recruitplanmainid);
+        return AjaxResult.success(msg.toString());
+    }
+
 /*    *
-     * 新增保存recruitMan*/
+     * 新增保存RecruitPlanMain*/
     @RequiresPermissions("recruitPlan:recruit:add")
     @Log(title = "recruitMan", businessType = BusinessType.INSERT)
     @PostMapping("/add")
     @ResponseBody
-    public AjaxResult addSave(RecruitPlan recruitPlan )
+    public AjaxResult addSave(RecruitPlanMain recruitPM )
     {
      try {
-       RecruitPlanMain recruitPlanMain = new RecruitPlanMain();
-        recruitPlanMain.setDeptName(recruitPlan.getDeptName());
-        recruitPlanMain.setAttachment(recruitPlan.getAttachment());
-        recruitPlanMain.setDeptId(getDeptId());
-        recruitPlanMain.setDeclarationId(26L);
-        recruitPlanMain.setRecruitPlanYear(recruitPlan.getRecruitPlanYear());
-        recruitPlanMain.setRemark(recruitPlan.getRemark());
+         recruitPM.setDeptId(getDeptId());
         //给新增计划中的子计划delFlag赋值为"0''
-        List<RecruitPlanChild> recruitPlanChildList = recruitPlan.getColumns();
-        List<String> postNumIdList = recruitPlanMainService.selectRecruitPlanMainListForCheckPostNumId(recruitPlanMain);
+        List<RecruitPlanChild> recruitPlanChildList = recruitPM.getColumns();
+        List<String> postNumIdList = recruitPlanMainService.selectRecruitPlanMainListForCheckPostNumId(recruitPM);
         //再次校验子计划中的岗位代码是否与已有重复,概率为零
          for (RecruitPlanChild recruitPlanChild : recruitPlanChildList){
             if (postNumIdList.contains(recruitPlanChild.getPostNumId())){
@@ -198,11 +185,11 @@ public class RecruitPlanMainController extends BaseController
             }
          }
         recruitPlanChildList.forEach(recruitPlanChild -> recruitPlanChild.setDelFlag("0"));
-        recruitPlanMain.setAhrsRecruitPlanChildList(recruitPlanChildList);
-        recruitPlanMain.setCreateBy(ShiroUtils.getSysUser().getUserName());
-        recruitPlanMain.setCreateTime(DateUtils.getNowDate());
-        recruitPlanMain.setDelFlag("0");
-        int result = recruitPlanMainService.insertRecruitPlanMain(recruitPlanMain);
+         recruitPM.setAhrsRecruitPlanChildList(recruitPlanChildList);
+         recruitPM.setCreateBy(ShiroUtils.getSysUser().getUserName());
+         recruitPM.setCreateTime(DateUtils.getNowDate());
+         recruitPM.setDelFlag("0");
+        int result = recruitPlanMainService.insertRecruitPlanMain(recruitPM);
         if (result == 11){
              return AjaxResult.error("招聘计划中的岗位代码重复");
          }
@@ -214,12 +201,11 @@ public class RecruitPlanMainController extends BaseController
     }
 
     /**
-     * 修改recruitplan
+     * 修改RecruitPlanMain
      */
     @GetMapping("/edit/{recruitPlanMainId}")
     public String edit(@PathVariable("recruitPlanMainId") Long recruitPlanMainId, ModelMap mmap)
     {
-
         RecruitPlanMain recruitPlanMain = recruitPlanMainService.selectRecruitPlanMainById(recruitPlanMainId);
         //默认生成一个岗位代码
         String deptIdStr =String.valueOf(getDeptId().intValue()) ;
@@ -228,10 +214,8 @@ public class RecruitPlanMainController extends BaseController
         String postNumIdStr = deptIdStr+mathCode;
         int countNum = 0;
 
-        RecruitPlan recruitPlan = new RecruitPlan();
-        recruitPlan.setRecruitPlanYear(recruitPlanMain.getRecruitPlanYear());
-        recruitPlan.setRecruitPlanMainId(recruitPlanMainId);
-        recruitPlan.setDeptName(recruitPlanMain.getDeptName());
+        RecruitPlanMain recruitPM = new RecruitPlanMain();
+
         List<RecruitPlanChild> recruitPlanMainList = recruitPlanMain.getAhrsRecruitPlanChildList();
         for (RecruitPlanChild recruitPlanChild : recruitPlanMainList){
             countNum = (int)(Math.random()*10);
@@ -240,44 +224,37 @@ public class RecruitPlanMainController extends BaseController
                recruitPlanChild.setYprs(personnelCount);
                countNum++;
         }
-        recruitPlan.setRecruitPlanYear(recruitPlanMain.getRecruitPlanYear());
-        recruitPlan.setColumns(recruitPlanMain.getAhrsRecruitPlanChildList());
-        recruitPlan.setAttachment(recruitPlanMain.getAttachment());
-        recruitPlan.setRecruitPlanMainId(recruitPlanMainId);
-        recruitPlan.setRemark(recruitPlanMain.getRemark());
+        recruitPM.setRecruitPlanYear(recruitPlanMain.getRecruitPlanYear());
+        recruitPM.setRecruitPlanMainId(recruitPlanMainId);
+        recruitPM.setDeptName(recruitPlanMain.getDeptName());
+        recruitPM.setColumns(recruitPlanMain.getAhrsRecruitPlanChildList());
+        recruitPM.setAttachment(recruitPlanMain.getAttachment());
+        recruitPM.setRemark(recruitPlanMain.getRemark());
 
-        mmap.put("recruitPlan",recruitPlan);
-        mmap.put("recruitPlanYears",recruitPlan.getRecruitPlanYear());
+        mmap.put("RecruitPlanMain",recruitPM);
+        mmap.put("recruitPlanYears",recruitPM.getRecruitPlanYear());
         mmap.put("postNumIdStr",postNumIdStr);
-        mapNeed.put("recruitList",recruitPlan.getColumns());
+        mapNeed.put("recruitList",recruitPM.getColumns());
         return prefix + "/edit";
     }
 
     /**
-     * 修改保存recruitplan
+     * 修改保存RecruitPlanMain
      */
     @RequiresPermissions("recruitplan:recruit:edit")
-    @Log(title = "recruitplan", businessType = BusinessType.UPDATE)
+    @Log(title = "recruitplanMain", businessType = BusinessType.UPDATE)
     @PostMapping("/edit")
     @ResponseBody
-    public AjaxResult editSave(RecruitPlan recruitPlan)
+    public AjaxResult editSave(RecruitPlanMain recruitPM)
     {
         try {
-            RecruitPlanMain recruitPlanMain = new RecruitPlanMain();
-            recruitPlanMain.setRecruitPlanMainId(recruitPlan.getRecruitPlanMainId());
-            recruitPlanMain.setDeptName(recruitPlan.getDeptName());
-            recruitPlanMain.setAttachment(recruitPlan.getAttachment());
-            recruitPlanMain.setRecruitPlanYear(recruitPlan.getRecruitPlanYear());
-            recruitPlanMain.setDeptId(getDeptId());
-            recruitPlanMain.setRemark(recruitPlan.getRemark());
-
+            List<RecruitPlanChild> recruitPlanChildList = recruitPM.getColumns();
             //给修改招聘计划中的子计划delFlag赋值为"0''
-            List<RecruitPlanChild> recruitPlanChildList = recruitPlan.getColumns();
             recruitPlanChildList.forEach(recruitPlanChild -> recruitPlanChild.setDelFlag("0"));
-            recruitPlanMain.setAhrsRecruitPlanChildList(recruitPlanChildList);
-            recruitPlanMain.setUpdateBy(ShiroUtils.getSysUser().getUserName());
-            recruitPlanMain.setUpdateTime(DateUtils.getNowDate());
-            int result =  recruitPlanMainService.updateRecruitPlanMain(recruitPlanMain);
+            recruitPM.setAhrsRecruitPlanChildList(recruitPlanChildList);
+            recruitPM.setUpdateBy(ShiroUtils.getSysUser().getUserName());
+            recruitPM.setUpdateTime(DateUtils.getNowDate());
+            int result =  recruitPlanMainService.updateRecruitPlanMain(recruitPM);
             if (result == 11){
                 return  AjaxResult.error("招聘计划中的岗位代码重复");
             }
@@ -290,7 +267,7 @@ public class RecruitPlanMainController extends BaseController
 
     /**
      *
-     * 删除recruitplan
+     * 删除RecruitPlanMain
      *
      */
     @RequiresPermissions("recruitplan:recruit:remove")
@@ -310,7 +287,7 @@ public class RecruitPlanMainController extends BaseController
 
     /**
      *
-     * 校验recruitplan下是否有招聘人员
+     * 校验RecruitPlanMain下是否有招聘人员
      */
     @RequiresPermissions("recruitplan:recruit:remove")
     @Log(title = "recruitplan", businessType = BusinessType.DELETE)

+ 0 - 78
ruoyi-ahrs/src/main/java/com/ruoyi/ahrs/recruitplan/domian/RecruitPlan.java

@@ -1,78 +0,0 @@
-package com.ruoyi.ahrs.recruitplan.domian;
-
-import javax.validation.Valid;
-import java.util.List;
-
-/**
- * 1
- * 2 * @Author: dzy
- * 3 * @Date: 2021/1/11 14:31
- * 4
- */
-public class RecruitPlan {
-
-    @Valid
-    private List<RecruitPlanChild> columns;
-    private String deptName;
-    private Long recruitPlanYear;
-    private String remark;
-    private String attachment;
-    private Long recruitPlanMainId;
-    private Long deptId;
-
-    public List<RecruitPlanChild> getColumns() {
-        return columns;
-    }
-
-    public void setColumns(List<RecruitPlanChild> columns) {
-        this.columns = columns;
-    }
-
-    public String getDeptName() {
-        return deptName;
-    }
-
-    public void setDeptName(String deptName) {
-        this.deptName = deptName;
-    }
-
-    public Long getRecruitPlanYear() {
-        return recruitPlanYear;
-    }
-
-    public void setRecruitPlanYear(Long recruitPlanYear) {
-        this.recruitPlanYear = recruitPlanYear;
-    }
-
-    public String getAttachment() {
-        return attachment;
-    }
-
-    public void setAttachment(String attachment) {
-        this.attachment = attachment;
-    }
-
-    public String getRemark() {
-        return remark;
-    }
-
-    public void setRemark(String remark) {
-        this.remark = remark;
-    }
-
-    public Long getRecruitPlanMainId() {
-        return recruitPlanMainId;
-    }
-
-    public void setRecruitPlanMainId(Long recruitPlanMainId) {
-        this.recruitPlanMainId = recruitPlanMainId;
-    }
-
-    public Long getDeptId() {
-        return deptId;
-    }
-
-    public void setDeptId(Long deptId) {
-        this.deptId = deptId;
-    }
-}

+ 0 - 1
ruoyi-ahrs/src/main/java/com/ruoyi/ahrs/recruitplan/mapper/RecruitPlanMainMapper.java

@@ -1,6 +1,5 @@
 package com.ruoyi.ahrs.recruitplan.mapper;
 
-import com.ruoyi.ahrs.recruitplan.domian.RecruitPlan;
 import com.ruoyi.ahrs.recruitplan.domian.RecruitPlanChild;
 import com.ruoyi.ahrs.recruitplan.domian.RecruitPlanMain;
 import org.apache.ibatis.annotations.Param;

+ 0 - 55
ruoyi-ahrs/src/main/resources/templates/ahrs/recruitplan/501.html

@@ -1,55 +0,0 @@
-<!DOCTYPE html>
-<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
-<html lang="en">
-<head>
-
-    <meta charset="UTF-8" http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
-    <title>404-对不起!您访问的页面不存在</title>
-
-    <style type="text/css">
-
-        .txtbg404 .txtbox{ width:390px; position:relative; top:30px; left:60px;color:#eee; font-size:13px;}
-
-        .txtbg404 .txtbox p {margin:5px 0; line-height:18px;}
-
-        .txtbg404 .txtbox .paddingbox { padding-top:15px;}
-
-        .txtbg404 .txtbox p a { color:#eee; text-decoration:none;}
-
-        .txtbg404 .txtbox p a:hover { color:#FC9D1D; text-decoration:underline;}
-
-    </style>
-
-</head>
-
-
-
-<body bgcolor="#494949" onload="closeWindow()">
-
-<div class="head404"></div>
-
-<div class="txtbg404">
-
-    <div class="txtbox"  >
-        <h1 th:text="${msg}"></h1>
-    </div>
-</div>
-
-</body>
-<script>
-    var time=3;
-    function closeWindow(){
-        window.setTimeout('closeWindow()',1000);
-        if(time>0){
-            time--;
-        }
-        else{
-            window.opener=null; //关闭窗口时不出现提示窗口
-            window.close();
-        }
-    }
-</script>
-
-</html>
-</html>

+ 5 - 5
ruoyi-ahrs/src/main/resources/templates/ahrs/recruitplan/edit.html

@@ -6,7 +6,7 @@
     <th:block th:include="include :: datetimepicker-css"/>
 </head>
 <body>
-<div class="container-div" th:object="${recruitPlan}">
+<div class="container-div" th:object="${RecruitPlanMain}">
     <input name="attachment" type="hidden" id="attachment" th:field="*{attachment}">
     <input name="recruitPlanMainId" id="recruitPlanMainId" type="hidden" th:field="*{recruitPlanMainId}">
     <div class="row">
@@ -92,7 +92,7 @@
     var recruit_major = [[${@dict.getType('recruit_major')}]]; //专业科目
     var recruit_education = [[${@dict.getType('recruit_education')}]]; //学历
     var per_post_type = [[${@dict.getType('recruit_post_type')}]]; //岗位
-    var recruitPlan = [[${recruitPlan}]];
+    var RecruitPlanMain = [[${RecruitPlanMain}]];
     var deletNum = 0 ;
     var prefix = ctx + "recruitplan/recruit"; ///recruitplan/recruit
     var columnId;
@@ -131,7 +131,7 @@
                         if (value == null) {
                             value = ''
                         }
-                        var html = $.common.sprintf("<input class='form-control'   style='width: 40px;padding-left: 4px' type='text' onchange='changePostNumId(" + index + ",this);changeNumber(" + index + ",this.value)' onblur='changeData(" + index + ",this)'  name='columns[%s].postNumId'  value='%s'  >", index, value);
+                        var html = $.common.sprintf("<input class='form-control' readonly  style='width: 40px;padding-left: 4px' type='text' onchange='changePostNumId(" + index + ",this);changeNumber(" + index + ",this.value)' onblur='changeData(" + index + ",this)'  name='columns[%s].postNumId'  value='%s'  >", index, value);
                         return html;
                     }
                 },
@@ -451,7 +451,7 @@
     //校验该招聘计划是否有已招聘人员
     function changePostNumId(index,obj){
         try {
-            var rId = recruitPlan.columns[index].recruitPlanChildId;
+            var rId = RecruitPlanMain.columns[index].recruitPlanChildId;
         }catch (e) {
             console.log("未定义")
         }
@@ -491,7 +491,7 @@
             row = 0;
         } else {
             row = rows.length - 1;
-            var columns = recruitPlan.columns;
+            var columns = RecruitPlanMain.columns;
             var columnsLength = Object.keys(columns).length;
             columnsLength= columnsLength - deletNum;
         }

+ 45 - 1
ruoyi-ahrs/src/main/resources/templates/ahrs/recruitplan/recruit.html

@@ -33,7 +33,7 @@
             </div>
 
             <div class="btn-group-sm" id="toolbar" role="group">
-                <a class="btn btn-success" onclick="$.operate.addFull()" shiro:hasPermission="recruitplan:recruit:add">
+                <a class="btn btn-success" onclick="add()" shiro:hasPermission="recruitplan:recruit:add">
                     <i class="fa fa-plus"></i> 添加
                 </a>
                 <a class="btn btn-primary single disabled" onclick="$.operate.editFull()" shiro:hasPermission="recruitplan:recruit:edit">
@@ -67,6 +67,50 @@
             $.operate.detail(row.recruitPlanMainId);
         }
 
+        function add(){
+            //判断该单位是否有招聘计划
+            $.ajax({
+                // cache:true,
+                url: prefix + "/selectRecruitplanListBydeptId",
+                type: "POST",
+                contentType: "application/json;charset=UTF-8",
+                dataType: "JSON",
+                success: function (data) {
+                    if (data.msg != "null") {
+                        $.modal.alert("该单位已有招聘计划,无法新增招聘计划!");
+                    } else {
+
+                        var index = layer.open({
+                            type: 2,
+                            area: [$(window).width() + 'px', $(window).height() + 'px'],
+                            fix: false,
+                            //不固定
+                            maxmin: true,
+                            shade: 0.3,
+                            title: "添加招聘人员",
+                            content: prefix + "/add",
+                            btn: ['保存','关闭'],
+                            // 弹层外区域关闭
+                            shadeClose: false,
+                            yes:function(index,layero){
+                                var iframeWin = layero.find('iframe')[0];
+                                iframeWin.contentWindow.submitHandler(index);
+                                return false;
+                            },
+                            cancel: function(index) {
+                                return true;
+                            }
+                        });
+                        layer.full(index);
+
+                    }
+                }, error: function () {
+                    $.modal.msgError("获取数据失败!");
+                }
+            })
+
+        }
+
         $(function () {
             var options = {
                 url: prefix + "/list",