|
@@ -4,8 +4,17 @@ import java.util.List;
|
4
|
4
|
import javax.servlet.http.HttpServletResponse;
|
5
|
5
|
|
6
|
6
|
import com.baomidou.mybatisplus.annotation.TableField;
|
|
7
|
+import com.ruoyi.common.constant.HttpStatus;
|
|
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;
|
7
|
12
|
import com.ruoyi.postCheck.domain.PostPlanCheckUser;
|
8
|
13
|
import com.ruoyi.postCheck.domain.PostPlanInfo;
|
|
14
|
+import com.ruoyi.postCheck.domain.PostProgramme;
|
|
15
|
+import com.ruoyi.system.domain.SysPost;
|
|
16
|
+import com.ruoyi.system.service.ISysDeptService;
|
|
17
|
+import com.ruoyi.system.service.ISysPostService;
|
9
|
18
|
import io.swagger.annotations.*;
|
10
|
19
|
import org.springframework.security.access.prepost.PreAuthorize;
|
11
|
20
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -36,9 +45,16 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
36
|
45
|
@RestController
|
37
|
46
|
@RequestMapping("/postCheck/postPlan")
|
38
|
47
|
public class PostPlanController extends BaseController {
|
|
48
|
+
|
39
|
49
|
@Autowired
|
40
|
50
|
private IPostPlanService postPlanService;
|
41
|
51
|
|
|
52
|
+ @Autowired
|
|
53
|
+ private ISysDeptService sysDeptService;
|
|
54
|
+
|
|
55
|
+ @Autowired
|
|
56
|
+ private ISysPostService sysPostService;
|
|
57
|
+
|
42
|
58
|
/**
|
43
|
59
|
* 查询岗检计划列表
|
44
|
60
|
*/
|
|
@@ -202,6 +218,25 @@ public class PostPlanController extends BaseController {
|
202
|
218
|
@Log(title = "岗检计划审核-Icfa", businessType = BusinessType.UPDATE)
|
203
|
219
|
@PutMapping("/approveIcfa")
|
204
|
220
|
public AjaxResult approveIcfa(Long id, Integer statusIcfa, String reasonIcfa) {
|
|
221
|
+ // 判断当前状态
|
|
222
|
+ PostPlan postPlan = postPlanService.selectPostPlanById(id);
|
|
223
|
+ // 审核过得不在审核
|
|
224
|
+ if (postPlan.getStatusIcfa() == 3) {
|
|
225
|
+ return AjaxResult.error(HttpStatus.SUCCESS,"审核失败,请勿重复审核!");
|
|
226
|
+ }
|
|
227
|
+ // 判断审核的权限
|
|
228
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
229
|
+ // 当前登录用户的部门id 查询岗位id是否在内
|
|
230
|
+ SysDept sysDept = sysDeptService.selectDeptById(loginUser.getDeptId());
|
|
231
|
+ if (!sysDept.getDeptCode().equals(DeptCode.DEPT_ICFA.getCode())) {
|
|
232
|
+ return AjaxResult.error(HttpStatus.FORBIDDEN, "没有权限,请联系管理员授权");
|
|
233
|
+ }
|
|
234
|
+ // 判断岗位是否在权限范围内
|
|
235
|
+ SysPost sysPost = sysPostService.selectPostByDeptId(loginUser.getDeptId());
|
|
236
|
+ if (sysPost.getPostLevel() != 1) {
|
|
237
|
+ return AjaxResult.error(HttpStatus.FORBIDDEN, "没有权限,请联系管理员授权");
|
|
238
|
+ }
|
|
239
|
+
|
205
|
240
|
return toAjax(postPlanService.approveIcfa(id, statusIcfa, reasonIcfa));
|
206
|
241
|
}
|
207
|
242
|
|
|
@@ -217,6 +252,30 @@ public class PostPlanController extends BaseController {
|
217
|
252
|
@Log(title = "岗检计划审核-HR", businessType = BusinessType.UPDATE)
|
218
|
253
|
@PutMapping("/approveHr")
|
219
|
254
|
public AjaxResult approveHr(Long id, Integer statusHr, String reasonHr) {
|
|
255
|
+ // 判断当前状态
|
|
256
|
+ PostPlan postPlan = postPlanService.selectPostPlanById(id);
|
|
257
|
+ // 审核过得不在审核
|
|
258
|
+ if (postPlan.getStatusHr() == 3) {
|
|
259
|
+ return AjaxResult.error(HttpStatus.SUCCESS, "审核失败,请勿重复审核!");
|
|
260
|
+ }
|
|
261
|
+ // 判断顺序
|
|
262
|
+ if (postPlan.getStatusIcfa() != 3) {
|
|
263
|
+ return AjaxResult.error(HttpStatus.SUCCESS,"审核失败,审核流程有误!!");
|
|
264
|
+ }
|
|
265
|
+ // 判断审核的权限
|
|
266
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
267
|
+ // 当前登录用户的部门id 查询岗位id是否在内
|
|
268
|
+ SysDept sysDept = sysDeptService.selectDeptById(loginUser.getDeptId());
|
|
269
|
+ if (!sysDept.getDeptCode().equals(DeptCode.DEPT_HR.getCode())) {
|
|
270
|
+ return AjaxResult.error(HttpStatus.FORBIDDEN, "没有权限,请联系管理员授权");
|
|
271
|
+ }
|
|
272
|
+
|
|
273
|
+ // 判断岗位是否在权限范围内
|
|
274
|
+ SysPost sysPost = sysPostService.selectPostByDeptId(loginUser.getDeptId());
|
|
275
|
+ if (sysPost.getPostLevel() != 1) {
|
|
276
|
+ return AjaxResult.error(HttpStatus.FORBIDDEN, "没有权限,请联系管理员授权");
|
|
277
|
+ }
|
|
278
|
+
|
220
|
279
|
return toAjax(postPlanService.approveHr(id, statusHr, reasonHr));
|
221
|
280
|
}
|
222
|
281
|
|