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

工作流部署

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