|
|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.biutag.supervision.job; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.NumberUtil; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
|
import com.biutag.supervision.constants.enums.ProcessingStatusEnum; |
|
|
|
|
@ -17,6 +18,8 @@ import java.util.ArrayList;
|
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
import static com.biutag.supervision.util.TimeUtil.SECONDS_OF_A_DAY; |
|
|
|
|
|
|
|
|
|
@RequiredArgsConstructor |
|
|
|
|
@Component |
|
|
|
|
public class Job { |
|
|
|
|
@ -63,19 +66,20 @@ public class Job {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 更新办理超时
|
|
|
|
|
// @Scheduled(fixedRate = 600000)
|
|
|
|
|
@Scheduled(fixedRate = 600000) |
|
|
|
|
public void updateHandleTimeout() { |
|
|
|
|
List<Negative> list = negativeService.list(new LambdaQueryWrapper<Negative>() |
|
|
|
|
.isNotNull(Negative::getCompleteDate) |
|
|
|
|
.isNotNull(Negative::getCrtTime) |
|
|
|
|
.isNull(Negative::getFlowKey)); |
|
|
|
|
.isNotNull(Negative::getMaxHandleDuration) |
|
|
|
|
.isNotNull(Negative::getMaxExtensionDuration) |
|
|
|
|
.eq(Negative::getProcessingStatus, ProcessingStatusEnum.completed.name()) |
|
|
|
|
.isNull(Negative::getHandleTimeout)); |
|
|
|
|
list.forEach(item -> { |
|
|
|
|
long remainingDuration = TimeUtil.getRemainingDuration(item.getCrtTime(), item.getCompleteDate(), 3 * 24 * 60 * 60L); |
|
|
|
|
if (remainingDuration < 0) { |
|
|
|
|
negativeService.update(new LambdaUpdateWrapper<Negative>() |
|
|
|
|
.set(Negative::getHandleTimeout, -remainingDuration) |
|
|
|
|
.eq(Negative::getId, item.getId())); |
|
|
|
|
} |
|
|
|
|
long remainingDuration = TimeUtil.getRemainingDuration(item.getCrtTime(), item.getCompleteDate(), NumberUtil.mul(item.getMaxHandleDuration(), SECONDS_OF_A_DAY).longValue()) + NumberUtil.mul(item.getMaxExtensionDuration(), SECONDS_OF_A_DAY).longValue(); |
|
|
|
|
negativeService.update(new LambdaUpdateWrapper<Negative>() |
|
|
|
|
.set(Negative::getHandleTimeout, remainingDuration >= 0 ? 0: -remainingDuration) |
|
|
|
|
.eq(Negative::getId, item.getId())); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|