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