diff --git a/gather-app/src/main/java/com/ruoyi/business/controller/ApprovalProcessController.java b/gather-app/src/main/java/com/ruoyi/business/controller/ApprovalProcessController.java index a01c1c8..a8ca9d0 100644 --- a/gather-app/src/main/java/com/ruoyi/business/controller/ApprovalProcessController.java +++ b/gather-app/src/main/java/com/ruoyi/business/controller/ApprovalProcessController.java @@ -47,32 +47,79 @@ public class ApprovalProcessController extends BaseController { queryWrapper.orderByDesc("create_time"); if (approvalProcess.getTimeType() != null) { if (approvalProcess.getTimeType() == 1) { - queryWrapper.le("create_time", System.currentTimeMillis() - 3 * 24 * 60 * 60 * 1000); + queryWrapper.ge("create_time", System.currentTimeMillis() - 3 * 24 * 60 * 60 * 1000L); } else if (approvalProcess.getTimeType() == 2) { - queryWrapper.le("create_time", System.currentTimeMillis() - 7 * 24 * 60 * 60 * 1000); + queryWrapper.ge("create_time", System.currentTimeMillis() - 7 * 24 * 60 * 60 * 1000L); } else if (approvalProcess.getTimeType() == 3) { - queryWrapper.le("create_time", System.currentTimeMillis() - 30 * 24 * 60 * 60 * 1000); + queryWrapper.ge("create_time", System.currentTimeMillis() - 30 * 24 * 60 * 60 * 1000L); } } + if (approvalProcess.getProcessTitle() != null) { + queryWrapper.like("process_title", approvalProcess.getProcessTitle()) + .or().like("submitter_name", approvalProcess.getProcessTitle()); + } + if (approvalProcess.getSubmitterId() != null) { queryWrapper.eq("submitter_id", getLoginUser().getUserId()); } List list = approvalsProcessService.list(queryWrapper); - + List newList = new ArrayList<>(); for (ApprovalProcess process : list) { - - if (process.getMatterType() == 2){ + if (process.getMatterType() == 2) { gwglLog one = gwglLogService.lambdaQuery() .eq(gwglLog::getUuid, process.getUuid()) .orderByDesc(gwglLog::getCreateTime) .last("LIMIT 1") .one(); - if (one != null){ - if (one.getCheckState() == 0) { - process.setApprovalStatus(0); + if (one != null) { + if ((one.getCheckUserId() != null && one.getCheckUserId().equals(getUserId().toString())) + || (one.getChecker() != null && one.getChecker().equals(getNickname()))) { + if (one.getCheckState() == 0) { + process.setApprovalStatus(0); + } else { + process.setApprovalStatus(1); + } + } else { + continue; + } + } + } + if (process.getMatterType() == 3) { + gwglLog one = gwglLogService.lambdaQuery() + .eq(gwglLog::getApplyNo, process.getApprovalNo()) + .orderByDesc(gwglLog::getCreateTime) + .last("LIMIT 1") + .one(); + if (one != null) { + if ((one.getCheckUserId() != null && one.getCheckUserId().equals(getUserId().toString())) + || (one.getChecker() != null && one.getChecker().equals(getNickname()))) { + if (one.getCheckState() == 0) { + process.setApprovalStatus(0); + } else { + process.setApprovalStatus(1); + } }else { - process.setApprovalStatus(1); + continue; + } + } + } + if (process.getMatterType() == 4) { + gwglLog one = gwglLogService.lambdaQuery() + .eq(gwglLog::getApplyNo, process.getApprovalNo()) + .orderByDesc(gwglLog::getCreateTime) + .last("LIMIT 1") + .one(); + if (one != null) { + if ((one.getCheckUserId() != null && one.getCheckUserId().equals(getUserId().toString())) + || (one.getChecker() != null && one.getChecker().equals(getNickname()))) { + if (one.getCheckState() == 0) { + process.setApprovalStatus(0); + } else { + process.setApprovalStatus(1); + } + }else { + continue; } } } @@ -120,8 +167,9 @@ public class ApprovalProcessController extends BaseController { String formattedTime = localDateTime.format(formatter); process.setShowTime(formattedTime); } + newList.add(process); } - return getDataTable(list); + return getDataTable(newList); } public static void main(String[] args) { @@ -152,19 +200,25 @@ public class ApprovalProcessController extends BaseController { @ApiOperation("根据用户id查") @PostMapping("/getByuserId") - public TableDataInfo getByuserId(ApprovalProcess approvalProcess) { - List list = approvalsProcessService.lambdaQuery() - .eq(ApprovalProcess::getSubmitterId, approvalProcess.getSubmitterId()) - .eq(approvalProcess.getApprovalStatus() != null, ApprovalProcess::getApprovalStatus, approvalProcess.getApprovalStatus()) - .eq(approvalProcess.getCcName() != null, ApprovalProcess::getCcName, approvalProcess.getCcName()) - .eq(approvalProcess.getProcessTitle() != null, ApprovalProcess::getProcessTitle, approvalProcess.getProcessTitle()) - .eq(approvalProcess.getSubmitterName() != null, ApprovalProcess::getSubmitterName, approvalProcess.getSubmitterName()) - .eq(approvalProcess.getTimeType() != null, ApprovalProcess::getTimeType, approvalProcess.getTimeType()) - .orderByDesc(ApprovalProcess::getCreateTime) - .list(); - + public TableDataInfo getByuserId(@RequestBody ApprovalProcess approvalProcess) { + QueryWrapper queryWrapper = new QueryWrapper<>(approvalProcess); + queryWrapper.orderByDesc("create_time"); + if (approvalProcess.getTimeType() != null) { + if (approvalProcess.getTimeType() == 1) { + queryWrapper.ge("create_time", System.currentTimeMillis() - 3 * 24 * 60 * 60 * 1000L); + } else if (approvalProcess.getTimeType() == 2) { + queryWrapper.ge("create_time", System.currentTimeMillis() - 7 * 24 * 60 * 60 * 1000L); + } else if (approvalProcess.getTimeType() == 3) { + queryWrapper.ge("create_time", System.currentTimeMillis() - 30 * 24 * 60 * 60 * 1000L); + } + } + if (approvalProcess.getProcessTitle() != null) { + queryWrapper.like("process_title", approvalProcess.getProcessTitle()) + .or().like("submitter_name", approvalProcess.getProcessTitle()); + } + queryWrapper.eq("submitter_id", getLoginUser().getUserId()); + List list = approvalsProcessService.list(queryWrapper); for (ApprovalProcess process : list) { - // 如果创建时间为当天的时间 if (process.getCreateTime() > System.currentTimeMillis() - 24 * 60 * 60 * 1000) { // 一分钟之内,显示刚刚 @@ -231,7 +285,7 @@ public class ApprovalProcessController extends BaseController { String[] split = togUserIds.split(","); for (String s : split) { s = s.trim(); - System.out.println("拆分的字:"+s);// 移除首尾空格 + System.out.println("拆分的字:" + s);// 移除首尾空格 if (!s.isEmpty()) { SysUser user = sysUserService.selectUserById(Long.parseLong(s)); userList.add(user);