Browse Source

岗位方案审核

zwj 10 months ago
parent
commit
b02de00dd1

+ 6 - 0
ruoyi-common/src/main/java/com/ruoyi/common/constant/PostProgrammeEnum.java

@@ -17,6 +17,12 @@ public enum PostProgrammeEnum {
17
     STATUS_HR_BACK("驳回;", 4),
17
     STATUS_HR_BACK("驳回;", 4),
18
 
18
 
19
 
19
 
20
+    // 流转步骤
21
+    STEP_HR("人力资源", 1),
22
+    STEP_ICFA("内控法务", 2),
23
+    STEP_SCHEME("方案入档",3),
24
+
25
+
20
     //status_icfa 2-内控法务部审批-状态:1-待审核;3-通过;4-驳回;
26
     //status_icfa 2-内控法务部审批-状态:1-待审核;3-通过;4-驳回;
21
     STATUS_ICFA_WAIT("待审核", 1),
27
     STATUS_ICFA_WAIT("待审核", 1),
22
     STATUS_ICFA_PASS("通过;", 3),
28
     STATUS_ICFA_PASS("通过;", 3),

+ 27 - 0
ruoyi-common/src/main/java/com/ruoyi/common/enums/DeptCode.java

@@ -0,0 +1,27 @@
1
+package com.ruoyi.common.enums;
2
+
3
+public enum DeptCode {
4
+
5
+    DEPT_HR("10010712", "人力资源部"),
6
+    DEPT_ICFA("50007343", "内控法务部");
7
+
8
+
9
+    private final String code;
10
+    private final String info;
11
+
12
+    DeptCode(String code, String info)
13
+    {
14
+        this.code = code;
15
+        this.info = info;
16
+    }
17
+
18
+    public String getCode()
19
+    {
20
+        return code;
21
+    }
22
+
23
+    public String getInfo()
24
+    {
25
+        return info;
26
+    }
27
+}

+ 5 - 0
ruoyi-postcheck/pom.xml

@@ -30,6 +30,11 @@
30
             <artifactId>ruoyi-common</artifactId>
30
             <artifactId>ruoyi-common</artifactId>
31
         </dependency>
31
         </dependency>
32
 
32
 
33
+        <!-- system系统模块 -->
34
+        <dependency>
35
+            <groupId>com.ruoyi</groupId>
36
+            <artifactId>ruoyi-system</artifactId>
37
+        </dependency>
33
     </dependencies>
38
     </dependencies>
34
 
39
 
35
 </project>
40
 </project>

+ 59 - 0
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/controller/PostProgrammeController.java

@@ -2,8 +2,17 @@ package com.ruoyi.postCheck.controller;
2
 
2
 
3
 import java.util.Date;
3
 import java.util.Date;
4
 import java.util.List;
4
 import java.util.List;
5
+import java.util.Optional;
5
 import javax.servlet.http.HttpServletResponse;
6
 import javax.servlet.http.HttpServletResponse;
6
 
7
 
8
+import com.ruoyi.common.core.domain.entity.SysDept;
9
+import com.ruoyi.common.core.domain.model.LoginUser;
10
+import com.ruoyi.common.enums.DeptCode;
11
+import com.ruoyi.common.utils.SecurityUtils;
12
+import com.ruoyi.common.utils.StringUtils;
13
+import com.ruoyi.system.domain.SysPost;
14
+import com.ruoyi.system.service.ISysDeptService;
15
+import com.ruoyi.system.service.ISysPostService;
7
 import org.springframework.security.access.prepost.PreAuthorize;
16
 import org.springframework.security.access.prepost.PreAuthorize;
8
 import org.springframework.beans.factory.annotation.Autowired;
17
 import org.springframework.beans.factory.annotation.Autowired;
9
 import org.springframework.web.bind.annotation.GetMapping;
18
 import org.springframework.web.bind.annotation.GetMapping;
@@ -37,9 +46,16 @@ import io.swagger.annotations.ApiImplicitParam;
37
 @RestController
46
 @RestController
38
 @RequestMapping("/postCheck/programme")
47
 @RequestMapping("/postCheck/programme")
39
 public class PostProgrammeController extends BaseController {
48
 public class PostProgrammeController extends BaseController {
49
+
40
     @Autowired
50
     @Autowired
41
     private IPostProgrammeService postProgrammeService;
51
     private IPostProgrammeService postProgrammeService;
42
 
52
 
53
+    @Autowired
54
+    private ISysDeptService sysDeptService;
55
+
56
+    @Autowired
57
+    private ISysPostService sysPostService;
58
+
43
     /**
59
     /**
44
      * 查询岗检方案列表
60
      * 查询岗检方案列表
45
      */
61
      */
@@ -188,6 +204,26 @@ public class PostProgrammeController extends BaseController {
188
     @Log(title = "岗检方案审核-HR", businessType = BusinessType.UPDATE)
204
     @Log(title = "岗检方案审核-HR", businessType = BusinessType.UPDATE)
189
     @PutMapping("/approveHr")
205
     @PutMapping("/approveHr")
190
     public AjaxResult approveHr(Long id, Integer statusHr, String reasonHr) {
206
     public AjaxResult approveHr(Long id, Integer statusHr, String reasonHr) {
207
+        // 判断当前状态
208
+        PostProgramme postProgramme = postProgrammeService.selectPostProgrammeById(id);
209
+        // 审核过得不在审核
210
+
211
+        if (postProgramme.getStatusHr() == 3) {
212
+            return error("审核失败,请勿重复审核!");
213
+        }
214
+        // 判断审核的权限
215
+        LoginUser loginUser = SecurityUtils.getLoginUser();
216
+        // 当前登录用户的部门id 查询岗位id是否在内
217
+        SysDept sysDept = sysDeptService.selectDeptById(loginUser.getDeptId());
218
+        if (!sysDept.getDeptCode().equals(DeptCode.DEPT_HR.getCode())) {
219
+            return error("审核权限有误,请联系管理员!");
220
+        }
221
+
222
+        // 判断岗位是否在权限范围内
223
+        SysPost sysPost = sysPostService.selectPostByDeptId(loginUser.getDeptId());
224
+        if (sysPost.getPostLevel() != 1) {
225
+            return error("审核权限有误,请联系管理员!");
226
+        }
191
         return toAjax(postProgrammeService.approveHr(id, statusHr, reasonHr));
227
         return toAjax(postProgrammeService.approveHr(id, statusHr, reasonHr));
192
     }
228
     }
193
 
229
 
@@ -201,6 +237,29 @@ public class PostProgrammeController extends BaseController {
201
     @Log(title = "岗检方案审核-Icfa", businessType = BusinessType.UPDATE)
237
     @Log(title = "岗检方案审核-Icfa", businessType = BusinessType.UPDATE)
202
     @PutMapping("/approveIcfa")
238
     @PutMapping("/approveIcfa")
203
     public AjaxResult approveIcfa(Long id, Integer statusIcfa, String reasonIcfa) {
239
     public AjaxResult approveIcfa(Long id, Integer statusIcfa, String reasonIcfa) {
240
+        // 判断当前状态
241
+        PostProgramme postProgramme = postProgrammeService.selectPostProgrammeById(id);
242
+        // 审核过得不在审核
243
+        if (postProgramme.getStatusHr() != 3) {
244
+            return error("审核失败,审核流程有误!!");
245
+        }
246
+
247
+        if (postProgramme.getStatusIcfa() == 3) {
248
+            return error("审核失败,请勿重复审核!");
249
+        }
250
+        // 判断审核的权限
251
+        LoginUser loginUser = SecurityUtils.getLoginUser();
252
+        // 当前登录用户的部门id 查询岗位id是否在内
253
+        SysDept sysDept = sysDeptService.selectDeptById(loginUser.getDeptId());
254
+        if (!sysDept.getDeptCode().equals(DeptCode.DEPT_ICFA.getCode())) {
255
+            return error("审核权限有误,请联系管理员!");
256
+        }
257
+        // 判断岗位是否在权限范围内
258
+        SysPost sysPost = sysPostService.selectPostByDeptId(loginUser.getDeptId());
259
+        if (sysPost.getPostLevel() != 1) {
260
+            return error("审核权限有误,请联系管理员!");
261
+        }
262
+
204
         return toAjax(postProgrammeService.approveIcfa(id, statusIcfa, reasonIcfa));
263
         return toAjax(postProgrammeService.approveIcfa(id, statusIcfa, reasonIcfa));
205
     }
264
     }
206
 }
265
 }

+ 4 - 0
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/domain/PostProgramme.java

@@ -116,4 +116,8 @@ public class PostProgramme extends BaseEntity {
116
     @TableField(value = "dept_name")
116
     @TableField(value = "dept_name")
117
     @Excel(name = "提交部门名称")
117
     @Excel(name = "提交部门名称")
118
     private String deptName;
118
     private String deptName;
119
+
120
+    @ApiModelProperty("步骤:0-初始状态;1-人力资源审核后;2-内控法务部;3-方案入档")
121
+    @TableField(value = "step")
122
+    private Integer step;
119
 }
123
 }

+ 13 - 35
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/service/impl/PostProgrammeServiceImpl.java

@@ -8,6 +8,7 @@ import com.ruoyi.common.constant.PostCheckedProblemEnum;
8
 import com.ruoyi.common.constant.PostPlanEnum;
8
 import com.ruoyi.common.constant.PostPlanEnum;
9
 import com.ruoyi.common.constant.PostProgrammeEnum;
9
 import com.ruoyi.common.constant.PostProgrammeEnum;
10
 import com.ruoyi.common.utils.DateUtils;
10
 import com.ruoyi.common.utils.DateUtils;
11
+import com.ruoyi.common.utils.SecurityUtils;
11
 import org.apache.commons.lang3.StringUtils;
12
 import org.apache.commons.lang3.StringUtils;
12
 import org.springframework.beans.factory.annotation.Autowired;
13
 import org.springframework.beans.factory.annotation.Autowired;
13
 import org.springframework.stereotype.Service;
14
 import org.springframework.stereotype.Service;
@@ -24,6 +25,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
24
  */
25
  */
25
 @Service
26
 @Service
26
 public class PostProgrammeServiceImpl extends ServiceImpl<PostProgrammeMapper, PostProgramme> implements IPostProgrammeService {
27
 public class PostProgrammeServiceImpl extends ServiceImpl<PostProgrammeMapper, PostProgramme> implements IPostProgrammeService {
28
+
27
     @Autowired
29
     @Autowired
28
     private PostProgrammeMapper postProgrammeMapper;
30
     private PostProgrammeMapper postProgrammeMapper;
29
 
31
 
@@ -116,7 +118,6 @@ public class PostProgrammeServiceImpl extends ServiceImpl<PostProgrammeMapper, P
116
         if (id == null || statusHr == null) {
118
         if (id == null || statusHr == null) {
117
             return 0;
119
             return 0;
118
         }
120
         }
119
-
120
         //状态错误
121
         //状态错误
121
         if (statusHr != PostProgrammeEnum.STATUS_HR_PASS.getValue() && statusHr != PostProgrammeEnum.STATUS_HR_BACK.getValue()) {
122
         if (statusHr != PostProgrammeEnum.STATUS_HR_PASS.getValue() && statusHr != PostProgrammeEnum.STATUS_HR_BACK.getValue()) {
122
             return 0;
123
             return 0;
@@ -127,45 +128,26 @@ public class PostProgrammeServiceImpl extends ServiceImpl<PostProgrammeMapper, P
127
             return 0;
128
             return 0;
128
         }
129
         }
129
 
130
 
130
-        //TODO 待开发:权限和顺序判断
131
-        //TODO 待开发:权限和顺序判断
132
-        //TODO 待开发:权限和顺序判断
133
-        //TODO 待开发:权限和顺序判断
134
-        //TODO 待开发:权限和顺序判断
135
-
136
-        //        1、当前状态是否允许修改
137
-
138
-        //        、、
139
-        //        、、
140
-        //        、、
141
-        //        、、
142
-        //        、、
143
-        //2、当前用户是否有权限
144
-        //、、
145
-        //、、
146
-        //、、
147
-        //、、
148
-        //、、
149
-        //、、
150
         PostProgramme data = new PostProgramme();
131
         PostProgramme data = new PostProgramme();
132
+
151
         data.setId(id);
133
         data.setId(id);
152
         data.setStatusHr(statusHr);
134
         data.setStatusHr(statusHr);
153
         data.setReasonHr(reasonHr);
135
         data.setReasonHr(reasonHr);
154
-
136
+        data.setDateHr(DateUtils.getNowDate());
137
+        data.setStatusHrUserId(SecurityUtils.getUserId());
155
         if (statusHr == PostPlanEnum.STATUS_HR_PASS.getValue()) {
138
         if (statusHr == PostPlanEnum.STATUS_HR_PASS.getValue()) {
156
             data.setStatus(PostProgrammeEnum.STATUS_ING.getValue());//审核中
139
             data.setStatus(PostProgrammeEnum.STATUS_ING.getValue());//审核中
140
+            data.setStep(PostProgrammeEnum.STEP_HR.getValue());
157
         } else {
141
         } else {
158
             data.setStatus(PostPlanEnum.STATUS_BACK.getValue());//驳回
142
             data.setStatus(PostPlanEnum.STATUS_BACK.getValue());//驳回
159
         }
143
         }
160
-
161
-
162
         return postProgrammeMapper.updatePostProgramme(data);
144
         return postProgrammeMapper.updatePostProgramme(data);
163
     }
145
     }
164
 
146
 
165
     /**
147
     /**
166
      * 审核2:岗检方案审核-Icfa
148
      * 审核2:岗检方案审核-Icfa
167
      *
149
      *
168
-     * @param id         主键ID
150
+     * @param id       主键ID
169
      * @param statusIcfa 2-内控法务部审批-状态:1-待审核;3-通过;4-驳回;
151
      * @param statusIcfa 2-内控法务部审批-状态:1-待审核;3-通过;4-驳回;
170
      * @param reasonIcfa 2-内控法务部审批-未通过理由
152
      * @param reasonIcfa 2-内控法务部审批-未通过理由
171
      * @return
153
      * @return
@@ -176,30 +158,26 @@ public class PostProgrammeServiceImpl extends ServiceImpl<PostProgrammeMapper, P
176
         if (id == null || statusIcfa == null) {
158
         if (id == null || statusIcfa == null) {
177
             return 0;
159
             return 0;
178
         }
160
         }
179
-
180
         //状态错误
161
         //状态错误
181
         if (statusIcfa != PostProgrammeEnum.STATUS_ICFA_PASS.getValue() && statusIcfa != PostProgrammeEnum.STATUS_ICFA_BACK.getValue()) {
162
         if (statusIcfa != PostProgrammeEnum.STATUS_ICFA_PASS.getValue() && statusIcfa != PostProgrammeEnum.STATUS_ICFA_BACK.getValue()) {
182
             return 0;
163
             return 0;
183
         }
164
         }
184
-
185
         //未写理由
165
         //未写理由
186
         if (statusIcfa == PostProgrammeEnum.STATUS_ICFA_BACK.getValue() && StringUtils.isBlank(reasonIcfa)) {
166
         if (statusIcfa == PostProgrammeEnum.STATUS_ICFA_BACK.getValue() && StringUtils.isBlank(reasonIcfa)) {
187
             return 0;
167
             return 0;
188
         }
168
         }
189
 
169
 
190
-        //TODO 待开发:权限、顺序 判断
191
-        //TODO 待开发:权限、顺序 判断
192
-        //TODO 待开发:权限、顺序 判断
193
-        //TODO 待开发:权限、顺序 判断
194
-        //TODO 待开发:权限、顺序 判断
195
-
196
-
197
-
198
         PostProgramme data = new PostProgramme();
170
         PostProgramme data = new PostProgramme();
171
+
199
         data.setId(id);
172
         data.setId(id);
200
         data.setStatusIcfa(statusIcfa);
173
         data.setStatusIcfa(statusIcfa);
201
         data.setReasonIcfa(reasonIcfa);
174
         data.setReasonIcfa(reasonIcfa);
202
         data.setStatus(statusIcfa);//最终审核结果
175
         data.setStatus(statusIcfa);//最终审核结果
176
+        data.setStep(PostProgrammeEnum.STEP_ICFA.getValue());
177
+        data.setStatusIcfaUserId(SecurityUtils.getUserId());
178
+        data.setDateIcfa(DateUtils.getNowDate());
203
         return postProgrammeMapper.updatePostProgramme(data);
179
         return postProgrammeMapper.updatePostProgramme(data);
180
+
181
+
204
     }
182
     }
205
 }
183
 }

+ 5 - 1
ruoyi-postcheck/src/main/resources/mapper/postCheck/PostProgrammeMapper.xml

@@ -29,10 +29,11 @@
29
         <result property="statusUserId"    column="status_user_id"    />
29
         <result property="statusUserId"    column="status_user_id"    />
30
         <result property="statusIcfaUserId"    column="status_icfa_user_id"    />
30
         <result property="statusIcfaUserId"    column="status_icfa_user_id"    />
31
         <result property="statusHrUserId"    column="status_hr_user_id"    />
31
         <result property="statusHrUserId"    column="status_hr_user_id"    />
32
+        <result property="step" column="step" />
32
     </resultMap>
33
     </resultMap>
33
 
34
 
34
     <sql id="selectPostProgrammeVo">
35
     <sql id="selectPostProgrammeVo">
35
-        select id, name, submit_date, status_hr, date_hr, reason_hr, status_icfa, date_icfa, reason_icfa, remark, del_flag, create_time, create_by, update_time, update_by, create_user_id, disk_path, dept_id, dept_name, status, status_time, status_user_id, status_icfa_user_id, status_hr_user_id from post_programme
36
+        select id, name, submit_date, status_hr, date_hr, reason_hr, status_icfa, date_icfa, reason_icfa, remark, del_flag, create_time, create_by, update_time, update_by, create_user_id, disk_path, dept_id, dept_name, status, status_time, status_user_id, status_icfa_user_id, status_hr_user_id, step from post_programme
36
     </sql>
37
     </sql>
37
 
38
 
38
     <select id="selectPostProgrammeList" parameterType="PostProgramme" resultMap="PostProgrammeResult">
39
     <select id="selectPostProgrammeList" parameterType="PostProgramme" resultMap="PostProgrammeResult">
@@ -90,6 +91,7 @@
90
             <if test="statusUserId != null">status_user_id,</if>
91
             <if test="statusUserId != null">status_user_id,</if>
91
             <if test="statusIcfaUserId != null">status_icfa_user_id,</if>
92
             <if test="statusIcfaUserId != null">status_icfa_user_id,</if>
92
             <if test="statusHrUserId != null">status_hr_user_id,</if>
93
             <if test="statusHrUserId != null">status_hr_user_id,</if>
94
+            <if test="step != null">step,</if>
93
         </trim>
95
         </trim>
94
         <trim prefix="values (" suffix=")" suffixOverrides=",">
96
         <trim prefix="values (" suffix=")" suffixOverrides=",">
95
             <if test="id != null">#{id},</if>
97
             <if test="id != null">#{id},</if>
@@ -116,6 +118,7 @@
116
             <if test="statusUserId != null">#{statusUserId},</if>
118
             <if test="statusUserId != null">#{statusUserId},</if>
117
             <if test="statusIcfaUserId != null">#{statusIcfaUserId},</if>
119
             <if test="statusIcfaUserId != null">#{statusIcfaUserId},</if>
118
             <if test="statusHrUserId != null">#{statusHrUserId},</if>
120
             <if test="statusHrUserId != null">#{statusHrUserId},</if>
121
+            <if test="step != null">#{step},</if>
119
         </trim>
122
         </trim>
120
     </insert>
123
     </insert>
121
 
124
 
@@ -145,6 +148,7 @@
145
             <if test="statusUserId != null">status_user_id = #{statusUserId},</if>
148
             <if test="statusUserId != null">status_user_id = #{statusUserId},</if>
146
             <if test="statusIcfaUserId != null">status_icfa_user_id = #{statusIcfaUserId},</if>
149
             <if test="statusIcfaUserId != null">status_icfa_user_id = #{statusIcfaUserId},</if>
147
             <if test="statusHrUserId != null">status_hr_user_id = #{statusHrUserId},</if>
150
             <if test="statusHrUserId != null">status_hr_user_id = #{statusHrUserId},</if>
151
+            <if test="step != null">step = #{step},</if>
148
         </trim>
152
         </trim>
149
         where id = #{id}
153
         where id = #{id}
150
     </update>
154
     </update>

+ 1 - 1
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
61
 	</select>
61
 	</select>
62
 
62
 
63
     <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
63
     <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
64
-		select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,
64
+		select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.dept_code,
65
 			(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
65
 			(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
66
 		from sys_dept d
66
 		from sys_dept d
67
 		where d.dept_id = #{deptId}
67
 		where d.dept_id = #{deptId}