Compare commits

...

5 Commits

  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. 8
      src/main/java/com/biutag/supervision/pojo/entity/NegativeHistory.java
  6. 6
      src/main/java/com/biutag/supervision/service/MailBoxCaptureService.java
  7. 10
      src/main/java/com/biutag/supervision/service/NegativeQueryService.java
  8. 10
      src/main/java/com/biutag/supervision/service/NegativeService.java
  9. 4
      src/main/java/com/biutag/supervision/service/NegativeTaskService.java
  10. 72
      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;
} }
} }

8
src/main/java/com/biutag/supervision/pojo/entity/NegativeHistory.java

@ -51,4 +51,12 @@ public class NegativeHistory {
// 节点耗时(剔除节假日的秒数) // 节点耗时(剔除节假日的秒数)
private Long duration; private Long duration;
@TableField(exist = false)
private String departId;
@TableField(exist = false)
// 部门level
private Integer departLevel;
} }

6
src/main/java/com/biutag/supervision/service/MailBoxCaptureService.java

@ -618,9 +618,9 @@ public class MailBoxCaptureService {
dto.setCrtTime(mail.getMailTime()); dto.setCrtTime(mail.getMailTime());
dto.setProblemSourcesCode(ProblemSourcesEnum.JZXX.getValue()); dto.setProblemSourcesCode(ProblemSourcesEnum.JZXX.getValue());
dto.setProblemSources(ProblemSourcesEnum.JZXX.getLabel()); dto.setProblemSources(ProblemSourcesEnum.JZXX.getLabel());
// 业务类型(其他 // 业务类型(执法办案
dto.setBusinessTypeCode(BusinessTypeEnum.QT.getValue()); dto.setBusinessTypeCode(BusinessTypeEnum.ZFBA.getValue());
dto.setBusinessTypeName(BusinessTypeEnum.QT.getLabel()); dto.setBusinessTypeName(BusinessTypeEnum.ZFBA.getLabel());
// 追责对象(涉及个人) // 追责对象(涉及个人)
dto.setAccountabilityTarget(AccountabilityTargetEnum.PERSONAL.getValue()); dto.setAccountabilityTarget(AccountabilityTargetEnum.PERSONAL.getValue());
// 反映人信息 // 反映人信息

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;
} }
} }

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

@ -134,11 +134,19 @@ public class NegativeService extends ServiceImpl<NegativeMapper, Negative> {
if (StrUtil.isNotBlank(vo.getProblemSourcesCode())) { if (StrUtil.isNotBlank(vo.getProblemSourcesCode())) {
vo.setFileClasses(fileClassService.list(vo.getProblemSourcesCode())); vo.setFileClasses(fileClassService.list(vo.getProblemSourcesCode()));
} }
// 计算每个节点的用时(剔除节假日) // 计算每个节点的用时(剔除节假日),并回填部门ID 最多十几条记录 对性能影响不大,直接查
for (int i = 0; i < flows.size(); i++) { for (int i = 0; i < flows.size(); i++) {
LocalDateTime currentTime = flows.get(i).getCrtTime(); LocalDateTime currentTime = flows.get(i).getCrtTime();
LocalDateTime previousTime = i == 0 ? negative.getCrtTime() : flows.get(i - 1).getCrtTime(); LocalDateTime previousTime = i == 0 ? negative.getCrtTime() : flows.get(i - 1).getCrtTime();
flows.get(i).setDuration(TimeUtil.calculateWorkdayDuration(previousTime, currentTime)); flows.get(i).setDuration(TimeUtil.calculateWorkdayDuration(previousTime, currentTime));
if (StrUtil.isNotBlank(flows.get(i).getDepartName())) {
String departName = flows.get(i).getDepartName();
SupDepart depart = departService.getOne(new LambdaQueryWrapper<SupDepart>().and(wrapper -> wrapper.eq(SupDepart::getName, departName).or().eq(SupDepart::getShortName, departName)).last("LIMIT 1"));
if (Objects.nonNull(depart)) {
flows.get(i).setDepartId(depart.getId());
flows.get(i).setDepartLevel(depart.getLevel());
}
}
} }
NegativeDetail detail = new NegativeDetail() NegativeDetail detail = new NegativeDetail()
.setNegative(vo) .setNegative(vo)

4
src/main/java/com/biutag/supervision/service/NegativeTaskService.java

@ -225,8 +225,8 @@ public class NegativeTaskService extends ServiceImpl<NegativeTaskMapper, Negativ
fillBlameAndLeaderAges(blameVo); fillBlameAndLeaderAges(blameVo);
blameVoList.add(blameVo); blameVoList.add(blameVo);
} }
vo.setFirstApproveTime(TimeUtil.getTimeoutStatus(NumberUtil.nullToZero(item.getFirstApproveTime()))); vo.setFirstApproveTime(TimeUtil.getTimeoutStatus(NumberUtil.nullToZero(item.getFirstApproveTime()), "city", true));
vo.setSecondApprovalTime(TimeUtil.getTimeoutStatus(NumberUtil.nullToZero(item.getSecondApprovalTime()))); vo.setSecondApprovalTime(TimeUtil.getTimeoutStatus(NumberUtil.nullToZero(item.getSecondApprovalTime()), "branch", true));
return vo; return vo;
}).toList(); }).toList();
} }

72
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("spscTime", 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;
} }
/** /**
@ -218,4 +259,33 @@ public class TimeUtil {
} }
} }
/**
* 判断指定审批时长是否超时按审批层级阈值
* @param usedSeconds 已用审批时长
* @param dictValue 审批超时字典值branch=分局审批city=市局审批
* @return 未超时/已超时
*/
public static String getTimeoutStatus(long usedSeconds, String dictValue) {
return getTimeoutStatus(usedSeconds, dictValue, false);
}
/**
* 判断指定审批时长是否超时按审批层级阈值
* @param usedSeconds 已用审批时长
* @param dictValue 审批超时字典值branch=分局审批city=市局审批
* @param detail 是否展示超时明细
* @return 未超时 已超时/超时xx天xx时xx分
*/
public static String getTimeoutStatus(long usedSeconds, String dictValue, boolean detail) {
Long threshold = getApprovalLockThreshold(dictValue);
long diff = threshold - usedSeconds;
if (diff >= 0) {
return "未超时";
}
if (detail) {
return "已超时/超时" + formatDuration(-diff);
}
return "已超时";
}
} }

Loading…
Cancel
Save