Compare commits

..

2 Commits

  1. 27
      src/main/java/com/biutag/supervision/flow/action/ConfirmationCompletionAction.java
  2. 15
      src/main/java/com/biutag/supervision/flow/action/FirstApproveReturnAction.java
  3. 15
      src/main/java/com/biutag/supervision/flow/action/SecondApproveAction.java
  4. 15
      src/main/java/com/biutag/supervision/flow/action/SecondApproveReturnAction.java
  5. 19
      src/main/resources/mapper/ComplaintCollectionMapper.xml

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

@ -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);

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

@ -46,18 +46,23 @@ public class FirstApproveReturnAction implements Action {
public void updateNegative(String negativeId, String nextFlowKey) { public void updateNegative(String negativeId, String nextFlowKey) {
Negative negative = negativeService.getById(negativeId); Negative negative = negativeService.getById(negativeId);
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
Long firstApproveTime = negative.getFirstApproveTime();
// 覆盖制:每次重新计算,超时锁定则不更新 Long newFirstApproveTime = null;
if (TimeUtil.canUpdateApproveTime(firstApproveTime) && negative.getLatestProcessTime() != null) { // 只有超过24小时工作日才记录
firstApproveTime = TimeUtil.calculateWorkdayDuration(negative.getLatestProcessTime(), now); if (negative.getLatestProcessTime() != null) {
long newDuration = TimeUtil.calculateWorkdayDuration(negative.getLatestProcessTime(), now);
if (newDuration >= TimeUtil.SECONDS_OF_A_DAY) {
newFirstApproveTime = newDuration;
}
} }
negativeService.update(new LambdaUpdateWrapper<Negative>() negativeService.update(new LambdaUpdateWrapper<Negative>()
.set(Negative::getFlowKey, negative.getIsSecondHandle() ? FlowNodeEnum.VERIFY.getKey() : nextFlowKey) .set(Negative::getFlowKey, negative.getIsSecondHandle() ? FlowNodeEnum.VERIFY.getKey() : nextFlowKey)
.set(Negative::getUpdTime, LocalDateTime.now()) .set(Negative::getUpdTime, LocalDateTime.now())
// 当前处理对象 // 当前处理对象
.set(Negative::getCurrentProcessingObject, String.format("%s专班", negative.getHandleSecondDepartName())) .set(Negative::getCurrentProcessingObject, String.format("%s专班", negative.getHandleSecondDepartName()))
.eq(Negative::getId, negativeId) .eq(Negative::getId, negativeId)
.set(TimeUtil.canUpdateApproveTime(firstApproveTime), Negative::getFirstApproveTime, firstApproveTime) .set(newFirstApproveTime != null, Negative::getFirstApproveTime, newFirstApproveTime)
.set(Negative::getLatestProcessTime, now)); .set(Negative::getLatestProcessTime, now));
} }

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

@ -53,20 +53,17 @@ public class SecondApproveAction implements Action {
public void updateNegative(String negativeId, String nextFlowKey) { public void updateNegative(String negativeId, String nextFlowKey) {
Negative negative = negativeService.getById(negativeId); Negative negative = negativeService.getById(negativeId);
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.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>()
.set(Negative::getFlowKey, nextFlowKey) .set(Negative::getFlowKey, nextFlowKey)
.set(Negative::getUpdTime, LocalDateTime.now()) .set(Negative::getUpdTime, LocalDateTime.now())
.eq(Negative::getId, negativeId); .eq(Negative::getId, negativeId);
// 超时锁定时,不更新审批时长字段 // 只有超过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);
}
} }
// Negative negative = negativeService.getById(negativeId);
if (ApprovalFlowEnum.SECOND_APPROVAL.getValue().equals(negative.getApprovalFlow())) { if (ApprovalFlowEnum.SECOND_APPROVAL.getValue().equals(negative.getApprovalFlow())) {
updateWrapper.set(Negative::getFlowKey, FlowNodeEnum.COMPLETED.getKey()) updateWrapper.set(Negative::getFlowKey, FlowNodeEnum.COMPLETED.getKey())
.set(Negative::getProcessingStatus, ProcessingStatusEnum.completed.name()) .set(Negative::getProcessingStatus, ProcessingStatusEnum.completed.name())

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

@ -47,18 +47,23 @@ public class SecondApproveReturnAction implements Action {
public void updateNegative(String negativeId, String nextFlowKey) { public void updateNegative(String negativeId, String nextFlowKey) {
Negative negative = negativeService.getById(negativeId); Negative negative = negativeService.getById(negativeId);
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
Long secondApprovalTime = negative.getSecondApprovalTime();
// 覆盖制:每次重新计算,超时锁定则不更新 Long newSecondApprovalTime = null;
if (TimeUtil.canUpdateApproveTime(secondApprovalTime) && negative.getLatestProcessTime() != null) { // 只有超过24小时工作日才记录
secondApprovalTime = TimeUtil.calculateWorkdayDuration(negative.getLatestProcessTime(), now); if (negative.getLatestProcessTime() != null) {
long newDuration = TimeUtil.calculateWorkdayDuration(negative.getLatestProcessTime(), now);
if (newDuration >= TimeUtil.SECONDS_OF_A_DAY) {
newSecondApprovalTime = newDuration;
}
} }
negativeService.update(new LambdaUpdateWrapper<Negative>() negativeService.update(new LambdaUpdateWrapper<Negative>()
.set(Negative::getFlowKey, nextFlowKey) .set(Negative::getFlowKey, nextFlowKey)
.set(Negative::getUpdTime, LocalDateTime.now()) .set(Negative::getUpdTime, LocalDateTime.now())
.set(Negative::getProcessingStatus, ProcessingStatusEnum.processing.name()) .set(Negative::getProcessingStatus, ProcessingStatusEnum.processing.name())
// 当前处理对象 // 当前处理对象
.set(Negative::getCurrentProcessingObject, String.format("%s专班", negative.getHandleThreeDepartName())) .set(Negative::getCurrentProcessingObject, String.format("%s专班", negative.getHandleThreeDepartName()))
.set(TimeUtil.canUpdateApproveTime(secondApprovalTime), Negative::getSecondApprovalTime, secondApprovalTime) .set(newSecondApprovalTime != null, Negative::getSecondApprovalTime, newSecondApprovalTime)
.eq(Negative::getId, negativeId)); .eq(Negative::getId, negativeId));
} }

19
src/main/resources/mapper/ComplaintCollectionMapper.xml

@ -363,9 +363,11 @@
FROM complaint_collection cc FROM complaint_collection cc
LEFT JOIN negative n ON n.id = cc.negative_id LEFT JOIN negative n ON n.id = cc.negative_id
<where> <where>
<choose> <!-- 至少有一个参数非空时,生成括号包裹的 OR 条件 -->
<when test="(param.responderIdCode != null and param.responderIdCode != '') or (param.responderName != null and param.responderName != '') or (param.responderPhone != null and param.responderPhone != '')"> <if test="(param.responderIdCode != null and param.responderIdCode != '')
1=1 or (param.responderName != null and param.responderName != '')
or (param.responderPhone != null and param.responderPhone != '')">
<trim prefix="(" suffix=")" prefixOverrides="OR">
<if test="param.responderIdCode != null and param.responderIdCode != ''"> <if test="param.responderIdCode != null and param.responderIdCode != ''">
OR cc.responder_id_code = #{param.responderIdCode} OR cc.responder_id_code = #{param.responderIdCode}
</if> </if>
@ -375,11 +377,14 @@
<if test="param.responderPhone != null and param.responderPhone != ''"> <if test="param.responderPhone != null and param.responderPhone != ''">
OR n.contactPhone = #{param.responderPhone} OR n.contactPhone = #{param.responderPhone}
</if> </if>
</when> </trim>
<otherwise> </if>
<!-- 三个参数全为空时,强制无结果 -->
<if test="(param.responderIdCode == null or param.responderIdCode == '')
and (param.responderName == null or param.responderName == '')
and (param.responderPhone == null or param.responderPhone == '')">
1=0 1=0
</otherwise> </if>
</choose>
</where> </where>
ORDER BY cc.create_time DESC ORDER BY cc.create_time DESC
LIMIT 100 LIMIT 100

Loading…
Cancel
Save