增加下一个用户任务获取方法
This commit is contained in:
parent
537c764dda
commit
8c8b8b8037
@ -37,13 +37,9 @@ public class OaUserTaskCompleteListener implements TaskListener, JavaDelegate {
|
||||
@Override
|
||||
public void notify(DelegateTask delegateTask) {
|
||||
LOG.debug(">>>> userTask complete");
|
||||
Map<String, Object> variables = runtimeService.getVariables(delegateTask.getProcessInstanceId());
|
||||
String reportUid = variables.get(IOaFormReportService.KEY_REPORT_UID).toString();
|
||||
String formCode = variables.get(IOaFormReportService.KEY_FORM_CODE).toString();
|
||||
Integer formVersion = Integer.parseInt(variables.get(IOaFormReportService.KEY_FORM_VERSION).toString());
|
||||
LOG.debug("查询表单数据:formCode: {}, formVersion: {}, reportUid: {}", formCode, formVersion, reportUid);
|
||||
Map<String, Object> reportForm = oaFormReportService.get(formCode, formVersion, reportUid);
|
||||
UserTask nextUserTask = activitiModelService.getNextUserTaskByTaskDefinitionKeyAndProcessDefinitionIdAndReportForm(delegateTask.getTaskDefinitionKey(), delegateTask.getProcessDefinitionId(), reportForm);
|
||||
Map<String, Object> variables = delegateTask.getVariables();
|
||||
LOG.debug("查询表单数据:variables: {}", variables);
|
||||
UserTask nextUserTask = activitiModelService.getNextUserTask(delegateTask.getTaskDefinitionKey(), delegateTask.getProcessDefinitionId(), variables);
|
||||
if (nextUserTask != null) {
|
||||
nextUserTask.setAssignee("1");
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public interface IActivitiModelService {
|
||||
* @param currentUserTask 当前用户任务
|
||||
* @return
|
||||
*/
|
||||
UserTask getNextUserTaskByCurrentUserTask(UserTask currentUserTask);
|
||||
UserTask getNextUserTask(UserTask currentUserTask);
|
||||
|
||||
/**
|
||||
* 获取下一个用户任务
|
||||
@ -76,7 +76,7 @@ public interface IActivitiModelService {
|
||||
* @param reportForm 上报表单
|
||||
* @return
|
||||
*/
|
||||
UserTask getNextUserTaskByExclusiveGatewayAndReportForm(ExclusiveGateway exclusiveGateway, Map<String, Object> reportForm);
|
||||
UserTask getNextUserTask(ExclusiveGateway exclusiveGateway, Map<String, Object> reportForm);
|
||||
|
||||
/**
|
||||
* 获取下一个用户任务
|
||||
@ -86,7 +86,7 @@ public interface IActivitiModelService {
|
||||
* @param reportForm 上报表单
|
||||
* @return
|
||||
*/
|
||||
UserTask getNextUserTaskByTaskDefinitionKeyAndProcessDefinitionIdAndReportForm(String currentTaskDefinitionKey, String processDefinitionId, Map<String, Object> reportForm);
|
||||
UserTask getNextUserTask(String currentTaskDefinitionKey, String processDefinitionId, Map<String, Object> reportForm);
|
||||
|
||||
/**
|
||||
* 获得开始节点
|
||||
|
@ -96,7 +96,7 @@ public class ActivitiModelServiceImpl extends DefaultBaseService implements IAct
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserTask getNextUserTaskByCurrentUserTask(UserTask currentUserTask) {
|
||||
public UserTask getNextUserTask(UserTask currentUserTask) {
|
||||
List<SequenceFlow> outgoingFlows = currentUserTask.getOutgoingFlows();
|
||||
if (outgoingFlows.size() > 1 || outgoingFlows.size() == 0) {
|
||||
throw new SystemException("流程错误,下个用户任务节点数只能有1个");
|
||||
@ -109,7 +109,7 @@ public class ActivitiModelServiceImpl extends DefaultBaseService implements IAct
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserTask getNextUserTaskByExclusiveGatewayAndReportForm(ExclusiveGateway exclusiveGateway, Map<String, Object> reportForm) {
|
||||
public UserTask getNextUserTask(ExclusiveGateway exclusiveGateway, Map<String, Object> reportForm) {
|
||||
List<SequenceFlow> outgoingFlows = exclusiveGateway.getOutgoingFlows();
|
||||
for (SequenceFlow sequenceFlow : outgoingFlows) {
|
||||
FlowElement targetFlowElement = sequenceFlow.getTargetFlowElement();
|
||||
@ -118,14 +118,14 @@ public class ActivitiModelServiceImpl extends DefaultBaseService implements IAct
|
||||
return (UserTask) targetFlowElement;
|
||||
}
|
||||
} else if (targetFlowElement instanceof ExclusiveGateway) {
|
||||
return getNextUserTaskByExclusiveGatewayAndReportForm(exclusiveGateway, reportForm);
|
||||
return getNextUserTask(exclusiveGateway, reportForm);
|
||||
}
|
||||
}
|
||||
throw new SystemException("未找到下一节点用户任务");
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserTask getNextUserTaskByTaskDefinitionKeyAndProcessDefinitionIdAndReportForm(String currentTaskDefinitionKey, String processDefinitionId, Map<String, Object> reportForm) {
|
||||
public UserTask getNextUserTask(String currentTaskDefinitionKey, String processDefinitionId, Map<String, Object> reportForm) {
|
||||
FlowNode currentFlowNode = getCurrentFlowNode(currentTaskDefinitionKey, processDefinitionId);
|
||||
List<SequenceFlow> outgoingFlows = currentFlowNode.getOutgoingFlows();
|
||||
for (SequenceFlow sequenceFlow : outgoingFlows) {
|
||||
@ -135,7 +135,7 @@ public class ActivitiModelServiceImpl extends DefaultBaseService implements IAct
|
||||
} else if (targetFlowElement instanceof ExclusiveGateway) {
|
||||
LOG.debug("排他网关节点,继续查找");
|
||||
ExclusiveGateway exclusiveGateway = (ExclusiveGateway) targetFlowElement;
|
||||
return getNextUserTaskByExclusiveGatewayAndReportForm(exclusiveGateway, reportForm);
|
||||
return getNextUserTask(exclusiveGateway, reportForm);
|
||||
} else if (targetFlowElement instanceof EndEvent) {
|
||||
return null;
|
||||
}
|
||||
@ -447,14 +447,14 @@ public class ActivitiModelServiceImpl extends DefaultBaseService implements IAct
|
||||
}
|
||||
if (expression.contains("==")) {
|
||||
String[] primes = expression.split("==");
|
||||
String valExpr = primes[1].trim();
|
||||
if (valExpr.startsWith("'")) {
|
||||
valExpr = valExpr.substring(1);
|
||||
String valExpression = primes[1].trim();
|
||||
if (valExpression.startsWith("'")) {
|
||||
valExpression = valExpression.substring(1);
|
||||
}
|
||||
if (valExpr.endsWith("'")) {
|
||||
valExpr = valExpr.substring(0, valExpr.length() - 1);
|
||||
if (valExpression.endsWith("'")) {
|
||||
valExpression = valExpression.substring(0, valExpression.length() - 1);
|
||||
}
|
||||
if (primes.length == 2 && valExpr.equals(reportFormMap.get(IActivitiModelService.EXCLUSIVE_GATEWAY_CONDITION_KEY))) {
|
||||
if (primes.length == 2 && valExpression.equals(reportFormMap.get(IActivitiModelService.EXCLUSIVE_GATEWAY_CONDITION_KEY))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user