From 3e46af38959a0bad1129f42b43183fe9ecf8ece1 Mon Sep 17 00:00:00 2001 From: lijiaqi Date: Wed, 10 Jan 2024 13:37:12 +0800 Subject: [PATCH] update --- .../workFlow/controller/WorkFlowController.java | 7 ++++--- .../ydool/oa/workFlow/data/dto/WorkFlowDto.java | 2 ++ .../oa/workFlow/service/WorkFlowService.java | 15 ++++++++++++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/ydool/oa/workFlow/controller/WorkFlowController.java b/src/main/java/com/ydool/oa/workFlow/controller/WorkFlowController.java index 9749280..563740a 100644 --- a/src/main/java/com/ydool/oa/workFlow/controller/WorkFlowController.java +++ b/src/main/java/com/ydool/oa/workFlow/controller/WorkFlowController.java @@ -244,7 +244,8 @@ public class WorkFlowController extends BaseController { @ApiImplicitParam(name = "userId", value = "发起人"), @ApiImplicitParam(name = "status", value = "状态"), @ApiImplicitParam(name = "startTime", value = "开始时间", dataType = "Date"), - @ApiImplicitParam(name = "endTime", value = "结束时间", dataType = "Date") + @ApiImplicitParam(name = "endTime", value = "结束时间", dataType = "Date"), + @ApiImplicitParam(name = "deptId", value = "部门id") }) @ApiOperationSupport( responses = @DynamicResponseParameters(properties = { @@ -257,9 +258,9 @@ public class WorkFlowController extends BaseController { "HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") LocalDateTime startTime, @DateTimeFormat(pattern = "yyyy-MM-dd " + "HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = - "GMT+8") LocalDateTime endTime) { + "GMT+8") LocalDateTime endTime,String deptId) { return workFlowService.getAllWorkFlowList(getPage(), value, column, orderBy, type, userId, status, startTime, - endTime); + endTime,deptId); } /** diff --git a/src/main/java/com/ydool/oa/workFlow/data/dto/WorkFlowDto.java b/src/main/java/com/ydool/oa/workFlow/data/dto/WorkFlowDto.java index 0de6ca2..899a562 100644 --- a/src/main/java/com/ydool/oa/workFlow/data/dto/WorkFlowDto.java +++ b/src/main/java/com/ydool/oa/workFlow/data/dto/WorkFlowDto.java @@ -48,4 +48,6 @@ public class WorkFlowDto extends WorkFlow { @ApiModelProperty(value = "是否能发起维修流程") private Boolean isRepair; + + } diff --git a/src/main/java/com/ydool/oa/workFlow/service/WorkFlowService.java b/src/main/java/com/ydool/oa/workFlow/service/WorkFlowService.java index 7f212ec..d56c2d2 100644 --- a/src/main/java/com/ydool/oa/workFlow/service/WorkFlowService.java +++ b/src/main/java/com/ydool/oa/workFlow/service/WorkFlowService.java @@ -454,11 +454,15 @@ public class WorkFlowService extends BaseService { * @return */ public AjaxResult getAllWorkFlowList(Page page, String value, String column, String orderBy, String type, - String userId, String status, LocalDateTime startTime, LocalDateTime endTime) { + String userId, String status, LocalDateTime startTime, LocalDateTime endTime, String deptId) { QueryWrapper qw = new QueryWrapper(); if (StrUtil.isNotBlank(value)) { qw.lambda().like(WorkFlow::getData, value); } + User user = userService.getOne(new QueryWrapper().lambda() + .eq(User::getId, StpUtil.getLoginIdAsString()) + .last("limit 1") + ); qw.lambda() .eq(StrUtil.isNotBlank(status), WorkFlow::getStatus, status) @@ -466,6 +470,15 @@ public class WorkFlowService extends BaseService { .eq(StrUtil.isNotBlank(userId), WorkFlow::getUserId, userId) .ge(ObjUtil.isNotNull(startTime), WorkFlow::getCreatedAt, startTime) .le(ObjUtil.isNotNull(endTime), WorkFlow::getCreatedAt, endTime); + if ("all".equals(user.getPermissions())) { + qw.lambda().inSql(StrUtil.isNotBlank(deptId), WorkFlow::getUserId, "select id from t_sys_user where dept = '" + deptId + "'"); + } else if ("dept".equals(user.getPermissions())) { + qw.lambda().inSql(WorkFlow::getUserId, "select id from t_sys_user where dept = '" + user.getDept() + "'"); + } else if ("my".equals(user.getPermissions())) { + qw.lambda().eq(WorkFlow::getUserId, StpUtil.getLoginIdAsString()); + } else { + return AjaxResult.fail("无权限"); + } if ("desc".equals(orderBy) && StrUtil.isNotBlank(column)) {