This commit is contained in:
lijiaqi 2024-01-10 13:37:12 +08:00
parent a4780b39b0
commit 3e46af3895
3 changed files with 20 additions and 4 deletions

View File

@ -244,7 +244,8 @@ public class WorkFlowController extends BaseController {
@ApiImplicitParam(name = "userId", value = "发起人"), @ApiImplicitParam(name = "userId", value = "发起人"),
@ApiImplicitParam(name = "status", value = "状态"), @ApiImplicitParam(name = "status", value = "状态"),
@ApiImplicitParam(name = "startTime", value = "开始时间", dataType = "Date"), @ApiImplicitParam(name = "startTime", value = "开始时间", dataType = "Date"),
@ApiImplicitParam(name = "endTime", value = "结束时间", dataType = "Date") @ApiImplicitParam(name = "endTime", value = "结束时间", dataType = "Date"),
@ApiImplicitParam(name = "deptId", value = "部门id")
}) })
@ApiOperationSupport( @ApiOperationSupport(
responses = @DynamicResponseParameters(properties = { 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, "HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") LocalDateTime startTime,
@DateTimeFormat(pattern = "yyyy-MM-dd " + @DateTimeFormat(pattern = "yyyy-MM-dd " +
"HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "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, return workFlowService.getAllWorkFlowList(getPage(), value, column, orderBy, type, userId, status, startTime,
endTime); endTime,deptId);
} }
/** /**

View File

@ -48,4 +48,6 @@ public class WorkFlowDto extends WorkFlow {
@ApiModelProperty(value = "是否能发起维修流程") @ApiModelProperty(value = "是否能发起维修流程")
private Boolean isRepair; private Boolean isRepair;
} }

View File

@ -454,11 +454,15 @@ public class WorkFlowService extends BaseService<WorkFlowMapper, WorkFlow> {
* @return * @return
*/ */
public AjaxResult getAllWorkFlowList(Page page, String value, String column, String orderBy, String type, 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<WorkFlow> qw = new QueryWrapper<WorkFlow>(); QueryWrapper<WorkFlow> qw = new QueryWrapper<WorkFlow>();
if (StrUtil.isNotBlank(value)) { if (StrUtil.isNotBlank(value)) {
qw.lambda().like(WorkFlow::getData, value); qw.lambda().like(WorkFlow::getData, value);
} }
User user = userService.getOne(new QueryWrapper<User>().lambda()
.eq(User::getId, StpUtil.getLoginIdAsString())
.last("limit 1")
);
qw.lambda() qw.lambda()
.eq(StrUtil.isNotBlank(status), WorkFlow::getStatus, status) .eq(StrUtil.isNotBlank(status), WorkFlow::getStatus, status)
@ -466,6 +470,15 @@ public class WorkFlowService extends BaseService<WorkFlowMapper, WorkFlow> {
.eq(StrUtil.isNotBlank(userId), WorkFlow::getUserId, userId) .eq(StrUtil.isNotBlank(userId), WorkFlow::getUserId, userId)
.ge(ObjUtil.isNotNull(startTime), WorkFlow::getCreatedAt, startTime) .ge(ObjUtil.isNotNull(startTime), WorkFlow::getCreatedAt, startTime)
.le(ObjUtil.isNotNull(endTime), WorkFlow::getCreatedAt, endTime); .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)) { if ("desc".equals(orderBy) && StrUtil.isNotBlank(column)) {