Browse Source

fix:超时审批时长变为2天和3天

master
parent
commit
b415ae6bf7
  1. 4
      src/main/java/com/biutag/supervision/flow/action/ConfirmationCompletionAction.java
  2. 2
      src/main/java/com/biutag/supervision/flow/action/FirstApproveReturnAction.java
  3. 2
      src/main/java/com/biutag/supervision/flow/action/SecondApproveAction.java
  4. 2
      src/main/java/com/biutag/supervision/flow/action/SecondApproveReturnAction.java
  5. 10
      src/main/java/com/biutag/supervision/service/NegativeQueryService.java
  6. 43
      src/main/java/com/biutag/supervision/util/TimeUtil.java

4
src/main/java/com/biutag/supervision/flow/action/ConfirmationCompletionAction.java

@ -121,7 +121,7 @@ public class ConfirmationCompletionAction implements Action {
// 只有超过24小时工作日才记录 // 只有超过24小时工作日才记录
if (negative.getLatestProcessTime() != null) { if (negative.getLatestProcessTime() != null) {
long newDuration = TimeUtil.calculateWorkdayDuration(negative.getLatestProcessTime(), now); long newDuration = TimeUtil.calculateWorkdayDuration(negative.getLatestProcessTime(), now);
if (newDuration >= TimeUtil.SECONDS_OF_A_DAY) { if (newDuration >= TimeUtil.getApprovalLockThreshold("branch")) {
updateWrapper.set(Negative::getSecondApprovalTime, newDuration); updateWrapper.set(Negative::getSecondApprovalTime, newDuration);
} }
} }
@ -130,7 +130,7 @@ public class ConfirmationCompletionAction implements Action {
// 只有超过24小时工作日才记录 // 只有超过24小时工作日才记录
if (negative.getLatestProcessTime() != null) { if (negative.getLatestProcessTime() != null) {
long newDuration = TimeUtil.calculateWorkdayDuration(negative.getLatestProcessTime(), now); long newDuration = TimeUtil.calculateWorkdayDuration(negative.getLatestProcessTime(), now);
if (newDuration >= TimeUtil.SECONDS_OF_A_DAY) { if (newDuration >= TimeUtil.getApprovalLockThreshold("city")) {
updateWrapper.set(Negative::getFirstApproveTime, newDuration); updateWrapper.set(Negative::getFirstApproveTime, newDuration);
} }
} }

2
src/main/java/com/biutag/supervision/flow/action/FirstApproveReturnAction.java

@ -51,7 +51,7 @@ public class FirstApproveReturnAction implements Action {
// 只有超过24小时工作日才记录 // 只有超过24小时工作日才记录
if (negative.getLatestProcessTime() != null) { if (negative.getLatestProcessTime() != null) {
long newDuration = TimeUtil.calculateWorkdayDuration(negative.getLatestProcessTime(), now); long newDuration = TimeUtil.calculateWorkdayDuration(negative.getLatestProcessTime(), now);
if (newDuration >= TimeUtil.SECONDS_OF_A_DAY) { if (newDuration >= TimeUtil.getApprovalLockThreshold("city")) {
newFirstApproveTime = newDuration; newFirstApproveTime = newDuration;
} }
} }

2
src/main/java/com/biutag/supervision/flow/action/SecondApproveAction.java

@ -60,7 +60,7 @@ public class SecondApproveAction implements Action {
// 只有超过24小时工作日才记录 // 只有超过24小时工作日才记录
if (negative.getLatestProcessTime() != null) { if (negative.getLatestProcessTime() != null) {
long newDuration = TimeUtil.calculateWorkdayDuration(negative.getLatestProcessTime(), now); long newDuration = TimeUtil.calculateWorkdayDuration(negative.getLatestProcessTime(), now);
if (newDuration >= TimeUtil.SECONDS_OF_A_DAY) { if (newDuration >= TimeUtil.getApprovalLockThreshold("branch")) {
updateWrapper.set(Negative::getSecondApprovalTime, newDuration); updateWrapper.set(Negative::getSecondApprovalTime, newDuration);
} }
} }

2
src/main/java/com/biutag/supervision/flow/action/SecondApproveReturnAction.java

@ -52,7 +52,7 @@ public class SecondApproveReturnAction implements Action {
// 只有超过24小时工作日才记录 // 只有超过24小时工作日才记录
if (negative.getLatestProcessTime() != null) { if (negative.getLatestProcessTime() != null) {
long newDuration = TimeUtil.calculateWorkdayDuration(negative.getLatestProcessTime(), now); long newDuration = TimeUtil.calculateWorkdayDuration(negative.getLatestProcessTime(), now);
if (newDuration >= TimeUtil.SECONDS_OF_A_DAY) { if (newDuration >= TimeUtil.getApprovalLockThreshold("branch")) {
newSecondApprovalTime = newDuration; newSecondApprovalTime = newDuration;
} }
} }

10
src/main/java/com/biutag/supervision/service/NegativeQueryService.java

@ -259,18 +259,20 @@ public class NegativeQueryService {
} }
private void buildTimeoutCondition(LambdaQueryWrapper<Negative> queryWrapper, String status) { private void buildTimeoutCondition(LambdaQueryWrapper<Negative> queryWrapper, String status) {
Long cityThreshold = TimeUtil.getApprovalLockThreshold("city");
Long branchThreshold = TimeUtil.getApprovalLockThreshold("branch");
switch (status) { switch (status) {
case "city_timeout": case "city_timeout":
queryWrapper.gt(Negative::getFirstApproveTime, TimeUtil.SECONDS_OF_A_DAY); queryWrapper.gt(Negative::getFirstApproveTime, cityThreshold);
break; break;
case "city_normal": case "city_normal":
queryWrapper.le(Negative::getFirstApproveTime, TimeUtil.SECONDS_OF_A_DAY).or().isNull(Negative::getFirstApproveTime); queryWrapper.le(Negative::getFirstApproveTime, cityThreshold).or().isNull(Negative::getFirstApproveTime);
break; break;
case "branch_timeout": case "branch_timeout":
queryWrapper.gt(Negative::getSecondApprovalTime, TimeUtil.SECONDS_OF_A_DAY); queryWrapper.gt(Negative::getSecondApprovalTime, branchThreshold);
break; break;
case "branch_normal": case "branch_normal":
queryWrapper.le(Negative::getSecondApprovalTime, TimeUtil.SECONDS_OF_A_DAY).or().isNull(Negative::getSecondApprovalTime); queryWrapper.le(Negative::getSecondApprovalTime, branchThreshold).or().isNull(Negative::getSecondApprovalTime);
break; break;
} }
} }

43
src/main/java/com/biutag/supervision/util/TimeUtil.java

@ -4,7 +4,9 @@ import cn.hutool.core.date.DatePattern;
import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.biutag.supervision.constants.enums.FlowNodeEnum; import com.biutag.supervision.constants.enums.FlowNodeEnum;
import com.biutag.supervision.pojo.entity.SupDictData;
import com.biutag.supervision.service.HolidayService; import com.biutag.supervision.service.HolidayService;
import com.biutag.supervision.service.SupDictDataService;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate; import java.time.LocalDate;
@ -51,7 +53,46 @@ public class TimeUtil {
* @return true=可以更新false=已锁定不可更新>=86400秒 * @return true=可以更新false=已锁定不可更新>=86400秒
*/ */
public static boolean canUpdateApproveTime(Long currentDuration) { public static boolean canUpdateApproveTime(Long currentDuration) {
return currentDuration == null || currentDuration < APPROVAL_LOCK_THRESHOLD; return canUpdateApproveTime(currentDuration, null);
}
/**
* 判断审批时长是否可以更新
* @param currentDuration 当前审批时长null表示尚未开始计时
* @param dictValue 审批超时字典值branch=分局审批city=市局审批
* @return true=可以更新false=已锁定不可更新
*/
public static boolean canUpdateApproveTime(Long currentDuration, String dictValue) {
Long threshold = getApprovalLockThreshold(dictValue);
return currentDuration == null || currentDuration < threshold;
}
/**
* 读取审批超时锁定阈值
* @param dictValue 字典值branch=分局审批city=市局审批
* @return 阈值秒数读取失败时按默认值返回
*/
public static Long getApprovalLockThreshold(String dictValue) {
if (StrUtil.isBlank(dictValue)) {
return APPROVAL_LOCK_THRESHOLD;
}
try {
SupDictData dictData = SpringUtil.getBean(SupDictDataService.class)
.get("approvalTimeout", dictValue);
if (dictData != null && StrUtil.isNotBlank(dictData.getDictValue())) {
long days = Long.parseLong(dictData.getDictValue());
return days * SECONDS_OF_A_DAY;
}
} catch (Exception e) {
// 字典读取失败时使用默认值,不影响流程
}
if ("city".equals(dictValue)) {
return 3L * SECONDS_OF_A_DAY;
}
if ("branch".equals(dictValue)) {
return 2L * SECONDS_OF_A_DAY;
}
return APPROVAL_LOCK_THRESHOLD;
} }
/** /**

Loading…
Cancel
Save