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