update - 修复实例创建过程中人员分配问题
This commit is contained in:
parent
b68c6a6ace
commit
a162860391
@ -9,6 +9,7 @@ import org.flowable.engine.RepositoryService;
|
||||
import org.flowable.engine.delegate.DelegateExecution;
|
||||
import org.flowable.engine.delegate.ExecutionListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
@ -42,11 +43,13 @@ public class EngineExecutionStartListener implements ExecutionListener {
|
||||
calculateDTO.setTaskDefinitionKey(currentActivityId);
|
||||
|
||||
List<BpmTaskDelegateAssigner> assigners = bpmTaskDelegate.calculateAssignerAtExecution(calculateDTO);
|
||||
List<String> assigneeIdList= new ArrayList<>();
|
||||
for (BpmTaskDelegateAssigner user : assigners) {
|
||||
assigneeIdList.add(user.getAssignerId());
|
||||
List<String> assigneeIdList = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(assigners)) {
|
||||
for (BpmTaskDelegateAssigner user : assigners) {
|
||||
assigneeIdList.add(user.getAssignerId());
|
||||
}
|
||||
}
|
||||
execution.setVariable(variable,assigneeIdList);
|
||||
execution.setVariable(variable, assigneeIdList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@ import org.flowable.engine.repository.Model;
|
||||
import org.flowable.engine.repository.ProcessDefinition;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -103,6 +104,7 @@ public class BpmModelServiceImpl implements BpmModelService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String deployBpmModelById(String modelId) {
|
||||
Model model = this.repositoryService.getModel(modelId);
|
||||
if (ObjectUtils.isEmpty(model)) {
|
||||
|
||||
@ -3,13 +3,16 @@ package cn.axzo.server.controller.delegate;
|
||||
import cn.axzo.workflow.core.deletage.BpmTaskCalculateDTO;
|
||||
import cn.axzo.workflow.core.deletage.BpmTaskDelegate;
|
||||
import cn.axzo.workflow.core.deletage.BpmTaskDelegateAssigner;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Profile("local")
|
||||
@Service
|
||||
public class BpmTaskDelegateImpl implements BpmTaskDelegate {
|
||||
private static final Logger log = LoggerFactory.getLogger(BpmTaskDelegateImpl.class);
|
||||
@ -17,10 +20,32 @@ public class BpmTaskDelegateImpl implements BpmTaskDelegate {
|
||||
@Override
|
||||
public List<BpmTaskDelegateAssigner> calculateAssignerAtExecution(BpmTaskCalculateDTO delegateTask) {
|
||||
log.info("计算审核人,当前的审批任务 DefinitionKey 为: {}", delegateTask.getTaskDefinitionKey());
|
||||
List<BpmTaskDelegateAssigner> assigners = new ArrayList<>();
|
||||
if (Objects.equals("NODE1687954452526_0.3121942479568347_1", delegateTask.getTaskDefinitionKey())) {
|
||||
BpmTaskDelegateAssigner user1 = new BpmTaskDelegateAssigner();
|
||||
user1.setAssignerId("65654");
|
||||
user1.setAssignerName("王军");
|
||||
assigners.add(user1);
|
||||
|
||||
BpmTaskDelegateAssigner assigner = new BpmTaskDelegateAssigner();
|
||||
assigner.setAssignerId("323");
|
||||
assigner.setAssignerName("张三");
|
||||
return Lists.newArrayList(assigner);
|
||||
BpmTaskDelegateAssigner user2 = new BpmTaskDelegateAssigner();
|
||||
user2.setAssignerId("66647");
|
||||
user2.setAssignerName("王粒");
|
||||
assigners.add(user2);
|
||||
}
|
||||
|
||||
if (Objects.equals("NODE1688636856136_0.05991425774293391_1", delegateTask.getTaskDefinitionKey())) {
|
||||
BpmTaskDelegateAssigner user1 = new BpmTaskDelegateAssigner();
|
||||
user1.setAssignerId("65712");
|
||||
user1.setAssignerName("王汪");
|
||||
assigners.add(user1);
|
||||
|
||||
BpmTaskDelegateAssigner user2 = new BpmTaskDelegateAssigner();
|
||||
user2.setAssignerId("66624");
|
||||
user2.setAssignerName("王颖");
|
||||
assigners.add(user2);
|
||||
}
|
||||
|
||||
|
||||
return assigners;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package cn.axzo.workflow.core.listener.custom;
|
||||
package cn.axzo.server.controller.listener;
|
||||
|
||||
import cn.axzo.workflow.core.listener.BpmProcessEventListener;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
@ -9,6 +10,7 @@ import org.springframework.stereotype.Component;
|
||||
* @author wangli
|
||||
* @since 2023/7/10 18:22
|
||||
*/
|
||||
@Profile("local")
|
||||
@Component
|
||||
public class CustomBpmProcessEventListener implements BpmProcessEventListener {
|
||||
}
|
||||
@ -1,7 +1,8 @@
|
||||
package cn.axzo.workflow.core.listener.custom;
|
||||
package cn.axzo.server.controller.listener;
|
||||
|
||||
import cn.axzo.workflow.core.listener.BpmTaskEventListener;
|
||||
import org.flowable.task.service.delegate.DelegateTask;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
@ -10,6 +11,7 @@ import org.springframework.stereotype.Component;
|
||||
* @author wangli
|
||||
* @since 2023/7/10 18:22
|
||||
*/
|
||||
@Profile("local")
|
||||
@Component
|
||||
public class CustomBpmTaskEventListener implements BpmTaskEventListener {
|
||||
@Override
|
||||
@ -2,6 +2,8 @@ server:
|
||||
port: 8080
|
||||
|
||||
spring:
|
||||
profiles:
|
||||
default: local
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
cloud:
|
||||
@ -55,7 +57,9 @@ mybatis-plus:
|
||||
|
||||
|
||||
debug: true
|
||||
|
||||
logging:
|
||||
level:
|
||||
root: debug
|
||||
--- #################### 数据库相关配置 ####################
|
||||
|
||||
spring:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user