This commit is contained in:
hanrenchun 2025-06-09 22:50:57 +08:00
parent 43129b0bca
commit 90b56cb553
1 changed files with 78 additions and 24 deletions

View File

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