feat(REQ-4468) - 调整日志的查询逻辑

This commit is contained in:
wangli 2025-07-01 19:55:12 +08:00
parent 1a33e0ef8a
commit f398cfb0ba
2 changed files with 27 additions and 3 deletions

View File

@ -9,6 +9,9 @@ import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import static cn.axzo.workflow.common.enums.BpmnButtonEnum.BPMN_UPGRADE;
/**
* 流程定义中的按钮配置
@ -78,4 +81,11 @@ public class BpmnButtonConf implements Serializable {
this.carbonCopy = carbonCopy;
}
public void removeUpGradeButton() {
// 移除升级按钮
this.initiator.removeIf(button -> Objects.equals(BPMN_UPGRADE.getBtnKey(), button.getType()));
this.current.removeIf(button -> Objects.equals(BPMN_UPGRADE.getBtnKey(), button.getType()));
this.history.removeIf(button -> Objects.equals(BPMN_UPGRADE.getBtnKey(), button.getType()));
this.carbonCopy.removeIf(button -> Objects.equals(BPMN_UPGRADE.getBtnKey(), button.getType()));
}
}

View File

@ -149,6 +149,7 @@ import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -189,6 +190,7 @@ import static cn.axzo.workflow.common.constant.MetaInfoConstants.MODEL_TYPE_PROC
import static cn.axzo.workflow.common.enums.ApprovalMethodEnum.autoPassed;
import static cn.axzo.workflow.common.enums.ApprovalMethodEnum.autoRejection;
import static cn.axzo.workflow.common.enums.ApprovalMethodEnum.human;
import static cn.axzo.workflow.common.enums.BpmnButtonEnum.BPMN_UPGRADE;
import static cn.axzo.workflow.common.enums.BpmnFlowNodeMode.AND;
import static cn.axzo.workflow.common.enums.BpmnFlowNodeMode.EXCEPTIONAL;
import static cn.axzo.workflow.common.enums.BpmnFlowNodeMode.GENERAL;
@ -1367,6 +1369,7 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
authorizedButtons.addAll(logVO.getDefaultButtonConf().getCarbonCopy());
}
AtomicBoolean supportUpgrade = new AtomicBoolean(false);
if (Objects.nonNull(visitor)) {
String ge130Assignee = getGe130Assignee(visitor);
String le130Assignee = getLe130Assignee(visitor);
@ -1377,7 +1380,6 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
.findFirst()
.ifPresent(i -> logVO.setCalculatingButtonConf(i.getButtonConf()));
// 比对发起人
if (Objects.nonNull(logVO.getInitiator()) && Objects.equals(logVO.getResult(), PROCESSING) &&
(Objects.equals(logVO.getInitiator().buildAssigneeId_1_2_1(), le130Assignee)
@ -1405,7 +1407,10 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
.filter(Objects::nonNull)
.filter(i -> i.buildAssigneeId().contains(ge130Assignee) || Objects.equals(i.buildAssigneeId_1_2_1(), le130Assignee))
.findAny()
.ifPresent(i -> authorizedButtons.addAll(chooseButtons(logVO, CONFIG_BUTTON_TYPE_CURRENT)));
.ifPresent(i -> {
authorizedButtons.addAll(chooseButtons(logVO, CONFIG_BUTTON_TYPE_CURRENT));
supportUpgrade.set(i.getSupportUpgradeApproval());
});
// 比对历史审批人
@ -1428,6 +1433,12 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
.findAny()
.ifPresent(i -> authorizedButtons.addAll(chooseButtons(logVO, CONFIG_BUTTON_TYPE_CARBON_COPY)));
}
// 提级审批按钮特殊处理
if (!supportUpgrade.get()) {
authorizedButtons.removeIf(button -> Objects.equals(BPMN_UPGRADE.getBtnKey(), button.getBtnKey()));
}
logVO.setCurrentUserButtons(authorizedButtons);
// 有权限访问的自定义按钮
@ -1566,7 +1577,9 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
private static void getFutureTasks
(List<ProcessNodeDetailVO> forecasting, List<BpmnTaskInstanceLogVO> tasks) {
ListUtils.emptyIfNull(forecasting).forEach(e -> {
ListUtils.emptyIfNull(forecasting).stream()
.filter(i -> Objects.equals(Boolean.TRUE, i.getFutureNode()))
.forEach(e -> {
BpmnTaskInstanceLogVO build = BpmnTaskInstanceLogVO.builder()
.taskDefinitionKey(e.getId())
.name(e.getName())
@ -1583,6 +1596,7 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
break;
case autoPassed:
case autoRejection:
build.setOperationDesc("无需审批人,自动驳回");
break;
case human:
if (Objects.equals(e.getNodeMode(), EXCEPTIONAL)) {