|
|
|
@ -107,15 +107,6 @@ public class ConfirmationCompletionAction implements Action { |
|
|
|
public void updateNegative(String negativeId, ConfirmationCompletionData completionData) { |
|
|
|
public void updateNegative(String negativeId, ConfirmationCompletionData completionData) { |
|
|
|
Negative negative = negativeService.getById(negativeId); |
|
|
|
Negative negative = negativeService.getById(negativeId); |
|
|
|
LocalDateTime now = LocalDateTime.now(); |
|
|
|
LocalDateTime now = LocalDateTime.now(); |
|
|
|
Long firstApproveTime = negative.getFirstApproveTime(); |
|
|
|
|
|
|
|
// 覆盖制:每次重新计算,超时锁定则不更新
|
|
|
|
|
|
|
|
if (TimeUtil.canUpdateApproveTime(firstApproveTime) && negative.getLatestProcessTime() != null) { |
|
|
|
|
|
|
|
firstApproveTime = TimeUtil.calculateWorkdayDuration(negative.getLatestProcessTime(), now); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Long secondApprovalTime = negative.getSecondApprovalTime(); |
|
|
|
|
|
|
|
if (TimeUtil.canUpdateApproveTime(secondApprovalTime) && negative.getLatestProcessTime() != null) { |
|
|
|
|
|
|
|
secondApprovalTime = TimeUtil.calculateWorkdayDuration(negative.getLatestProcessTime(), now); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
LambdaUpdateWrapper<Negative> updateWrapper = new LambdaUpdateWrapper<Negative>() |
|
|
|
LambdaUpdateWrapper<Negative> updateWrapper = new LambdaUpdateWrapper<Negative>() |
|
|
|
.eq(Negative::getId, negativeId) |
|
|
|
.eq(Negative::getId, negativeId) |
|
|
|
.set(Negative::getProcessingStatus, ProcessingStatusEnum.completed.name()) |
|
|
|
.set(Negative::getProcessingStatus, ProcessingStatusEnum.completed.name()) |
|
|
|
@ -127,15 +118,21 @@ public class ConfirmationCompletionAction implements Action { |
|
|
|
.set(Negative::getFlowKey, FlowNodeEnum.COMPLETED.getKey()) |
|
|
|
.set(Negative::getFlowKey, FlowNodeEnum.COMPLETED.getKey()) |
|
|
|
.set(Negative::getUpdTime, LocalDateTime.now()); |
|
|
|
.set(Negative::getUpdTime, LocalDateTime.now()); |
|
|
|
if ("2".equals(negative.getApprovalFlow())){ |
|
|
|
if ("2".equals(negative.getApprovalFlow())){ |
|
|
|
// 超时锁定时,不更新审批时长字段
|
|
|
|
// 只有超过24小时工作日才记录
|
|
|
|
if (TimeUtil.canUpdateApproveTime(secondApprovalTime)) { |
|
|
|
if (negative.getLatestProcessTime() != null) { |
|
|
|
updateWrapper.set(Negative::getSecondApprovalTime, secondApprovalTime); |
|
|
|
long newDuration = TimeUtil.calculateWorkdayDuration(negative.getLatestProcessTime(), now); |
|
|
|
|
|
|
|
if (newDuration >= TimeUtil.SECONDS_OF_A_DAY) { |
|
|
|
|
|
|
|
updateWrapper.set(Negative::getSecondApprovalTime, newDuration); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if ("3".equals(negative.getApprovalFlow())){ |
|
|
|
if ("3".equals(negative.getApprovalFlow())){ |
|
|
|
// 超时锁定时,不更新审批时长字段
|
|
|
|
// 只有超过24小时工作日才记录
|
|
|
|
if (TimeUtil.canUpdateApproveTime(firstApproveTime)) { |
|
|
|
if (negative.getLatestProcessTime() != null) { |
|
|
|
updateWrapper.set(Negative::getFirstApproveTime, firstApproveTime); |
|
|
|
long newDuration = TimeUtil.calculateWorkdayDuration(negative.getLatestProcessTime(), now); |
|
|
|
|
|
|
|
if (newDuration >= TimeUtil.SECONDS_OF_A_DAY) { |
|
|
|
|
|
|
|
updateWrapper.set(Negative::getFirstApproveTime, newDuration); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
negativeService.update(updateWrapper); |
|
|
|
negativeService.update(updateWrapper); |
|
|
|
|