提交 63be44ad 编写于 作者: sq3536's avatar sq3536

工作流部署

上级 d4ad014d
......@@ -325,8 +325,11 @@ public class WFCoreService
@Value("${ibiz.filePath:/app/file/}")
private String fileRoot;
public synchronized boolean wfdeploy(File bpmnFile)
public synchronized boolean wfdeploy(File bpmnFile,WFREModel wfreModel)
{
String deployInfo="";
if(!StringUtils.isEmpty(wfreModel.getName()))
deployInfo=wfreModel.getName();
XMLStreamReader reader = null;
InputStream inputStream = null;
try {
......@@ -338,6 +341,8 @@ public class WFCoreService
List<Process> processes = model.getProcesses();
Process curProcess = null;
if (CollectionUtils.isEmpty(processes)) {
deployInfo+=bpmnFile.getName()+"解析失败,没有找到流程配置信息"+"\r\n";
wfreModel.setName(deployInfo);
return false;
}
curProcess = processes.get(0);
......@@ -346,6 +351,8 @@ public class WFCoreService
if(!curProcess.getExtensionElements().containsKey("field"))
{
log.error(bpmnFile.getName()+"没有实体订阅");
deployInfo+=bpmnFile.getName()+"解析失败,没有实体订阅配置"+"\r\n";
wfreModel.setName(deployInfo);
return false;
}
for(ExtensionElement field:curProcess.getExtensionElements().get("field"))
......@@ -358,6 +365,8 @@ public class WFCoreService
if(StringUtils.isEmpty(bookings))
{
log.error(bpmnFile.getName()+"没有实体订阅");
deployInfo+=bpmnFile.getName()+"解析失败,没有实体订阅配置"+"\r\n";
wfreModel.setName(deployInfo);
return false;
}
if(!StringUtils.isEmpty(refgroups))
......@@ -385,6 +394,8 @@ public class WFCoreService
if(params.length!=2)
{
log.error(bpmnFile.getName()+"没有系统名称");
deployInfo+=bpmnFile.getName()+"解析失败,没有发布系统配置"+"\r\n";
wfreModel.setName(deployInfo);
return false;
}
String system=params[0];
......@@ -423,6 +434,8 @@ public class WFCoreService
if(bmpmfileId.equals(old.getMd5check()))
{
log.warn("部署流程没有变化,忽略 name:" + curProcess.getName() + " key " + processDefinitionKey + " deploy " + bmpmfileId);
deployInfo+=curProcess.getName()+" key:" + processDefinitionKey +",流程配置没有变化,忽略发布"+"\r\n";
wfreModel.setName(deployInfo);
continue;
}
fileFullPath = this.fileRoot+"ibizutil"+File.separator+bmpmfileId+File.separator+processDefinitionKey+".bpmn20.xml";
......@@ -466,20 +479,22 @@ public class WFCoreService
wfProcessDefinition.setMd5check(bmpmfileId);
iwfProcessDefinitionService.save(wfProcessDefinition);
log.warn("部署流程 name:"+curProcess.getName()+" key "+deployment.getKey() + " deploy "+deployment);
deployInfo+=curProcess.getName()+" key:" + processDefinitionKey +",部署成功"+"\r\n";
wfreModel.setName(deployInfo);
}
return true;
}
catch (Exception e){
log.error(bpmnFile.getName()+"BPMN模型创建流程异常",e);
deployInfo+=bpmnFile.getName()+"BPMN模型创建流程异常"+"\r\n";
wfreModel.setName(deployInfo);
return false;
}
finally {
try {
reader.close();
} catch (Exception e) {
log.error(bpmnFile.getName()+"关闭异常",e);
}
}
......
......@@ -46,6 +46,7 @@ public class WFREModelServiceImpl implements IWFREModelService {
@Override
public boolean update(WFREModel et) {
publish(et);
return true;
}
......@@ -85,6 +86,7 @@ public class WFREModelServiceImpl implements IWFREModelService {
public void publish(WFREModel et)
{
et.setName("");
if(StringUtils.isEmpty(et.getBpmnfile()))
return;
......@@ -97,7 +99,7 @@ public class WFREModelServiceImpl implements IWFREModelService {
File bpmnFile=fileService.getFile(item.getId());
if(!bpmnFile.exists())
return;
wfCoreService.wfdeploy(bpmnFile);
wfCoreService.wfdeploy(bpmnFile,et);
}
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册