|
|
|
|
@ -15,6 +15,7 @@ import com.biutag.supervision.pojo.model.UserAuth;
|
|
|
|
|
import com.biutag.supervision.service.NegativeApproveService; |
|
|
|
|
import com.biutag.supervision.service.NegativeService; |
|
|
|
|
import com.biutag.supervision.service.NegativeWorkService; |
|
|
|
|
import com.biutag.supervision.util.TimeUtil; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
|
|
@ -50,18 +51,42 @@ public class SecondApproveAction implements Action {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void updateNegative(String negativeId, String nextFlowKey) { |
|
|
|
|
Negative negative = negativeService.getById(negativeId); |
|
|
|
|
LocalDateTime now = LocalDateTime.now(); |
|
|
|
|
|
|
|
|
|
// 【审批时长统计】计算2级审批时长并累加
|
|
|
|
|
// 计算范围:secondApproveStartTime(3级提交时设置)到 now(当前审批时间)
|
|
|
|
|
// 触发时机:2级点击【审批通过】或【退回整改】时
|
|
|
|
|
// 累加规则:duration += (当前时间 - 开始时间),退回后再审批会继续累加
|
|
|
|
|
// 注意事项:本级办理(isSecondHandle=true)时,secondApproveStartTime 为null,不会进入此逻辑
|
|
|
|
|
if (negative.getSecondApproveStartTime() != null) { |
|
|
|
|
long duration = TimeUtil.calculateWorkdayDuration(negative.getSecondApproveStartTime(), now); |
|
|
|
|
Long totalDuration = negative.getSecondApproveDuration() == null ? duration : negative.getSecondApproveDuration() + duration; |
|
|
|
|
negativeService.update(new LambdaUpdateWrapper<Negative>() |
|
|
|
|
.eq(Negative::getId, negativeId) |
|
|
|
|
.set(Negative::getSecondApproveDuration, totalDuration) |
|
|
|
|
.set(Negative::getSecondApproveStartTime, null)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
LambdaUpdateWrapper<Negative> updateWrapper = new LambdaUpdateWrapper<Negative>() |
|
|
|
|
.set(Negative::getFlowKey, nextFlowKey) |
|
|
|
|
.set(Negative::getUpdTime, LocalDateTime.now()) |
|
|
|
|
.eq(Negative::getId, negativeId); |
|
|
|
|
Negative negative = negativeService.getById(negativeId); |
|
|
|
|
// Negative negative = negativeService.getById(negativeId);
|
|
|
|
|
if (ApprovalFlowEnum.SECOND_APPROVAL.getValue().equals(negative.getApprovalFlow())) { |
|
|
|
|
// 二级审批流程,直接办结(无需市局审批,不设置firstApproveStartTime)
|
|
|
|
|
updateWrapper.set(Negative::getFlowKey, FlowNodeEnum.COMPLETED.getKey()) |
|
|
|
|
.set(Negative::getProcessingStatus, ProcessingStatusEnum.completed.name()) |
|
|
|
|
.set(Negative::getCompleteDate, LocalDateTime.now()); |
|
|
|
|
} else { |
|
|
|
|
// 【审批时长统计】三级审批流程,设置市局审批开始时间
|
|
|
|
|
// 触发条件:approvalFlow="3"(三级审批),且2级审批通过
|
|
|
|
|
// 设置时机:2级提交到市局时(市局待审批任务创建时)
|
|
|
|
|
// 业务含义:市局开始审批的计时起点
|
|
|
|
|
// 后续使用:ConfirmationCompletionAction 计算市局审批时长,FirstApproveReturnAction 退回时也计算时长
|
|
|
|
|
updateWrapper.set(Negative::getFlowKey, nextFlowKey) |
|
|
|
|
.set(Negative::getCurrentProcessingObject, "市局专班"); |
|
|
|
|
.set(Negative::getCurrentProcessingObject, "市局专班") |
|
|
|
|
.set(Negative::getFirstApproveStartTime, now); |
|
|
|
|
} |
|
|
|
|
negativeService.update(updateWrapper); |
|
|
|
|
} |
|
|
|
|
|