浏览代码

岗位方案审核

zwj 10 月之前
父节点
当前提交
b02de00dd1

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

@@ -17,6 +17,12 @@ public enum PostProgrammeEnum {
17 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 26
     //status_icfa 2-内控法务部审批-状态:1-待审核;3-通过;4-驳回;
21 27
     STATUS_ICFA_WAIT("待审核", 1),
22 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 30
             <artifactId>ruoyi-common</artifactId>
31 31
         </dependency>
32 32
 
33
+        <!-- system系统模块 -->
34
+        <dependency>
35
+            <groupId>com.ruoyi</groupId>
36
+            <artifactId>ruoyi-system</artifactId>
37
+        </dependency>
33 38
     </dependencies>
34 39
 
35 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 3
 import java.util.Date;
4 4
 import java.util.List;
5
+import java.util.Optional;
5 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 16
 import org.springframework.security.access.prepost.PreAuthorize;
8 17
 import org.springframework.beans.factory.annotation.Autowired;
9 18
 import org.springframework.web.bind.annotation.GetMapping;
@@ -37,9 +46,16 @@ import io.swagger.annotations.ApiImplicitParam;
37 46
 @RestController
38 47
 @RequestMapping("/postCheck/programme")
39 48
 public class PostProgrammeController extends BaseController {
49
+
40 50
     @Autowired
41 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 204
     @Log(title = "岗检方案审核-HR", businessType = BusinessType.UPDATE)
189 205
     @PutMapping("/approveHr")
190 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 227
         return toAjax(postProgrammeService.approveHr(id, statusHr, reasonHr));
192 228
     }
193 229
 
@@ -201,6 +237,29 @@ public class PostProgrammeController extends BaseController {
201 237
     @Log(title = "岗检方案审核-Icfa", businessType = BusinessType.UPDATE)
202 238
     @PutMapping("/approveIcfa")
203 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 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 116
     @TableField(value = "dept_name")
117 117
     @Excel(name = "提交部门名称")
118 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 8
 import com.ruoyi.common.constant.PostPlanEnum;
9 9
 import com.ruoyi.common.constant.PostProgrammeEnum;
10 10
 import com.ruoyi.common.utils.DateUtils;
11
+import com.ruoyi.common.utils.SecurityUtils;
11 12
 import org.apache.commons.lang3.StringUtils;
12 13
 import org.springframework.beans.factory.annotation.Autowired;
13 14
 import org.springframework.stereotype.Service;
@@ -24,6 +25,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
24 25
  */
25 26
 @Service
26 27
 public class PostProgrammeServiceImpl extends ServiceImpl<PostProgrammeMapper, PostProgramme> implements IPostProgrammeService {
28
+
27 29
     @Autowired
28 30
     private PostProgrammeMapper postProgrammeMapper;
29 31
 
@@ -116,7 +118,6 @@ public class PostProgrammeServiceImpl extends ServiceImpl<PostProgrammeMapper, P
116 118
         if (id == null || statusHr == null) {
117 119
             return 0;
118 120
         }
119
-
120 121
         //状态错误
121 122
         if (statusHr != PostProgrammeEnum.STATUS_HR_PASS.getValue() && statusHr != PostProgrammeEnum.STATUS_HR_BACK.getValue()) {
122 123
             return 0;
@@ -127,45 +128,26 @@ public class PostProgrammeServiceImpl extends ServiceImpl<PostProgrammeMapper, P
127 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 131
         PostProgramme data = new PostProgramme();
132
+
151 133
         data.setId(id);
152 134
         data.setStatusHr(statusHr);
153 135
         data.setReasonHr(reasonHr);
154
-
136
+        data.setDateHr(DateUtils.getNowDate());
137
+        data.setStatusHrUserId(SecurityUtils.getUserId());
155 138
         if (statusHr == PostPlanEnum.STATUS_HR_PASS.getValue()) {
156 139
             data.setStatus(PostProgrammeEnum.STATUS_ING.getValue());//审核中
140
+            data.setStep(PostProgrammeEnum.STEP_HR.getValue());
157 141
         } else {
158 142
             data.setStatus(PostPlanEnum.STATUS_BACK.getValue());//驳回
159 143
         }
160
-
161
-
162 144
         return postProgrammeMapper.updatePostProgramme(data);
163 145
     }
164 146
 
165 147
     /**
166 148
      * 审核2:岗检方案审核-Icfa
167 149
      *
168
-     * @param id         主键ID
150
+     * @param id       主键ID
169 151
      * @param statusIcfa 2-内控法务部审批-状态:1-待审核;3-通过;4-驳回;
170 152
      * @param reasonIcfa 2-内控法务部审批-未通过理由
171 153
      * @return
@@ -176,30 +158,26 @@ public class PostProgrammeServiceImpl extends ServiceImpl<PostProgrammeMapper, P
176 158
         if (id == null || statusIcfa == null) {
177 159
             return 0;
178 160
         }
179
-
180 161
         //状态错误
181 162
         if (statusIcfa != PostProgrammeEnum.STATUS_ICFA_PASS.getValue() && statusIcfa != PostProgrammeEnum.STATUS_ICFA_BACK.getValue()) {
182 163
             return 0;
183 164
         }
184
-
185 165
         //未写理由
186 166
         if (statusIcfa == PostProgrammeEnum.STATUS_ICFA_BACK.getValue() && StringUtils.isBlank(reasonIcfa)) {
187 167
             return 0;
188 168
         }
189 169
 
190
-        //TODO 待开发:权限、顺序 判断
191
-        //TODO 待开发:权限、顺序 判断
192
-        //TODO 待开发:权限、顺序 判断
193
-        //TODO 待开发:权限、顺序 判断
194
-        //TODO 待开发:权限、顺序 判断
195
-
196
-
197
-
198 170
         PostProgramme data = new PostProgramme();
171
+
199 172
         data.setId(id);
200 173
         data.setStatusIcfa(statusIcfa);
201 174
         data.setReasonIcfa(reasonIcfa);
202 175
         data.setStatus(statusIcfa);//最终审核结果
176
+        data.setStep(PostProgrammeEnum.STEP_ICFA.getValue());
177
+        data.setStatusIcfaUserId(SecurityUtils.getUserId());
178
+        data.setDateIcfa(DateUtils.getNowDate());
203 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 29
         <result property="statusUserId"    column="status_user_id"    />
30 30
         <result property="statusIcfaUserId"    column="status_icfa_user_id"    />
31 31
         <result property="statusHrUserId"    column="status_hr_user_id"    />
32
+        <result property="step" column="step" />
32 33
     </resultMap>
33 34
 
34 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 37
     </sql>
37 38
 
38 39
     <select id="selectPostProgrammeList" parameterType="PostProgramme" resultMap="PostProgrammeResult">
@@ -90,6 +91,7 @@
90 91
             <if test="statusUserId != null">status_user_id,</if>
91 92
             <if test="statusIcfaUserId != null">status_icfa_user_id,</if>
92 93
             <if test="statusHrUserId != null">status_hr_user_id,</if>
94
+            <if test="step != null">step,</if>
93 95
         </trim>
94 96
         <trim prefix="values (" suffix=")" suffixOverrides=",">
95 97
             <if test="id != null">#{id},</if>
@@ -116,6 +118,7 @@
116 118
             <if test="statusUserId != null">#{statusUserId},</if>
117 119
             <if test="statusIcfaUserId != null">#{statusIcfaUserId},</if>
118 120
             <if test="statusHrUserId != null">#{statusHrUserId},</if>
121
+            <if test="step != null">#{step},</if>
119 122
         </trim>
120 123
     </insert>
121 124
 
@@ -145,6 +148,7 @@
145 148
             <if test="statusUserId != null">status_user_id = #{statusUserId},</if>
146 149
             <if test="statusIcfaUserId != null">status_icfa_user_id = #{statusIcfaUserId},</if>
147 150
             <if test="statusHrUserId != null">status_hr_user_id = #{statusHrUserId},</if>
151
+            <if test="step != null">step = #{step},</if>
148 152
         </trim>
149 153
         where id = #{id}
150 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 61
 	</select>
62 62
 
63 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 65
 			(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
66 66
 		from sys_dept d
67 67
 		where d.dept_id = #{deptId}