提交 132fea4b 编写于 作者: zhouweidong's avatar zhouweidong

修复工作流完成状态值未能正常回填问题

上级 a441d29b
...@@ -13,7 +13,6 @@ import lombok.extern.slf4j.Slf4j; ...@@ -13,7 +13,6 @@ import lombok.extern.slf4j.Slf4j;
import org.flowable.bpmn.model.FormProperty; import org.flowable.bpmn.model.FormProperty;
import org.flowable.bpmn.model.UserTask; import org.flowable.bpmn.model.UserTask;
import org.flowable.common.engine.api.delegate.event.*; import org.flowable.common.engine.api.delegate.event.*;
import org.flowable.common.engine.impl.event.FlowableEntityEventImpl;
import org.flowable.engine.TaskService; import org.flowable.engine.TaskService;
import org.flowable.engine.delegate.DelegateExecution; import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.event.FlowableProcessEngineEvent; import org.flowable.engine.delegate.event.FlowableProcessEngineEvent;
...@@ -101,6 +100,9 @@ public class ProcessInstanceListener extends AbstractFlowableEventListener { ...@@ -101,6 +100,9 @@ public class ProcessInstanceListener extends AbstractFlowableEventListener {
String udstateingval="20"; String udstateingval="20";
if(setting.containsKey("udstateingval"+"_"+entity)) if(setting.containsKey("udstateingval"+"_"+entity))
udstateingval=setting.get("udstateingval"+"_"+entity).toString(); udstateingval=setting.get("udstateingval"+"_"+entity).toString();
String wffinishval="30";
if(setting.containsKey("wffinishval"+"_"+entity))
wffinishval=setting.get("wffinishval"+"_"+entity).toString();
String wfverfield=""; String wfverfield="";
if(setting.containsKey("wfverfield"+"_"+entity)) if(setting.containsKey("wfverfield"+"_"+entity))
wfverfield=setting.get("wfverfield"+"_"+entity).toString(); wfverfield=setting.get("wfverfield"+"_"+entity).toString();
...@@ -116,6 +118,7 @@ public class ProcessInstanceListener extends AbstractFlowableEventListener { ...@@ -116,6 +118,7 @@ public class ProcessInstanceListener extends AbstractFlowableEventListener {
executionEntity.setVariable("wfinstfield",wfinstfield); executionEntity.setVariable("wfinstfield",wfinstfield);
executionEntity.setVariable("udstatefield",udstatefield); executionEntity.setVariable("udstatefield",udstatefield);
executionEntity.setVariable("udstateingval",udstateingval); executionEntity.setVariable("udstateingval",udstateingval);
executionEntity.setVariable("wffinishval",wffinishval);
executionEntity.setVariable("wfstatefield",wfstatefield); executionEntity.setVariable("wfstatefield",wfstatefield);
executionEntity.setVariable("wfverfield",wfverfield); executionEntity.setVariable("wfverfield",wfverfield);
executionEntity.setVariable("majortextfield",majortext_field); executionEntity.setVariable("majortextfield",majortext_field);
...@@ -287,40 +290,33 @@ public class ProcessInstanceListener extends AbstractFlowableEventListener { ...@@ -287,40 +290,33 @@ public class ProcessInstanceListener extends AbstractFlowableEventListener {
} }
} }
} }
else if(evt instanceof FlowableEntityEventImpl && evt.getType() != null && FlowableEngineEventType.PROCESS_COMPLETED == evt.getType()) else if(evt instanceof FlowableEngineEntityEvent && evt.getType() != null && FlowableEngineEventType.PROCESS_COMPLETED == evt.getType())
{ {
FlowableEntityEventImpl event=((FlowableEntityEventImpl) evt); FlowableEngineEntityEvent event=((FlowableEngineEntityEvent) evt);
FlowableEventType eventType = event.getType(); ExecutionEntityImpl executionEntity= (ExecutionEntityImpl) event.getEntity();
if(eventType == FlowableEngineEventType.PROCESS_COMPLETED){ if(executionEntity.getVariable("cloud-serviceid")==null)
ExecutionEntityImpl executionEntity= (ExecutionEntityImpl) event.getEntity(); return;
if(executionEntity.getVariable("cloud-serviceid")==null) String businessKey=(String)executionEntity.getVariable("businessKey");
FlowUser curUser=FlowUser.getCurUser();
String entity=executionEntity.getVariable("entitys").toString();
String cloudServiceid=executionEntity.getVariable("cloud-serviceid").toString();
String wfstepfield = executionEntity.getVariable("wfstepfield").toString();
String udstatefield = executionEntity.getVariable("udstatefield").toString();
Object wffinishval = executionEntity.getVariable("wffinishval");
if(ObjectUtils.isEmpty(wffinishval))
wffinishval = "30";
Map callbackArg=new LinkedHashMap();
if(!StringUtils.isEmpty(udstatefield))
callbackArg.put(udstatefield,wffinishval);
if(!StringUtils.isEmpty(wfstepfield))
callbackArg.put(wfstepfield,"");
if(callbackArg.size()>0) {
if(StringUtils.isEmpty(curUser.getToken()))
return; return;
String businessKey=(String)executionEntity.getVariable("businessKey"); String token=curUser.getToken();
//HashMap curUser=(HashMap) executionEntity.getVariable("curuser"); remoteService.getClient(cloudServiceid).put(entity + "/" + businessKey, token,callbackArg);
FlowUser curUser=FlowUser.getCurUser();
String entity=executionEntity.getVariable("entitys").toString();
String cloudServiceid=executionEntity.getVariable("cloud-serviceid").toString();
String wfstepfield = executionEntity.getVariable("wfstepfield").toString();
Object udstateingval = executionEntity.getVariable("udstateingval");
if(ObjectUtils.isEmpty(udstateingval))
udstateingval = "20";
String udstatefield = executionEntity.getVariable("udstatefield").toString();
String wfstate = executionEntity.getVariable("wfstate").toString();
Map callbackArg=new LinkedHashMap();
if(!StringUtils.isEmpty(wfstate))
callbackArg.put(wfstate,2);
if(!StringUtils.isEmpty(udstatefield) && "20".equals(udstateingval.toString()))
callbackArg.put(udstatefield,"30");
if(!StringUtils.isEmpty(wfstepfield))
callbackArg.put(wfstepfield,"");
if(callbackArg.size()>0) {
if(StringUtils.isEmpty(curUser.getToken()))
return;
String token=curUser.getToken();
remoteService.getClient(cloudServiceid).put(entity + "/" + businessKey, token,callbackArg);
}
} }
} }
else if(evt instanceof FlowableActivityEventImpl && evt.getType() != null && FlowableEngineEventType.ACTIVITY_COMPLETED == evt.getType()) { else if(evt instanceof FlowableActivityEventImpl && evt.getType() != null && FlowableEngineEventType.ACTIVITY_COMPLETED == evt.getType()) {
FlowableActivityEventImpl event = ((FlowableActivityEventImpl) evt); FlowableActivityEventImpl event = ((FlowableActivityEventImpl) evt);
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册