|
@@ -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
|
}
|