提交 7ec069c0 编写于 作者: zhouweidong's avatar zhouweidong

job部署bpmn

上级 40be47e2
...@@ -4,7 +4,7 @@ TARGET=PSSYSTEM ...@@ -4,7 +4,7 @@ TARGET=PSSYSTEM
package ${pub.getPKGCodeName()}.util.client; package ${pub.getPKGCodeName()}.util.client;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List; import java.util.*;
@Component @Component
public class IBZWFFallback implements IBZWFFeignClient { public class IBZWFFallback implements IBZWFFeignClient {
...@@ -18,4 +18,9 @@ public class IBZWFFallback implements IBZWFFeignClient { ...@@ -18,4 +18,9 @@ public class IBZWFFallback implements IBZWFFeignClient {
public List<String> getbusinesskeysByUserId(String system, String userId, String entity, String processDefinitionKey, String taskDefinitionKey) { public List<String> getbusinesskeysByUserId(String system, String userId, String entity, String processDefinitionKey, String taskDefinitionKey) {
return null; return null;
} }
@Override
public Boolean deployBpmnFile(List<Map<String, Object>> bpmnfiles) {
return null;
}
} }
...@@ -5,7 +5,7 @@ package ${pub.getPKGCodeName()}.util.client; ...@@ -5,7 +5,7 @@ package ${pub.getPKGCodeName()}.util.client;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.*;
@FeignClient(value = "ibzwf-api",fallback = IBZWFFallback.class) @FeignClient(value = "ibzwf-api",fallback = IBZWFFallback.class)
public interface IBZWFFeignClient public interface IBZWFFeignClient
...@@ -18,4 +18,7 @@ public interface IBZWFFeignClient ...@@ -18,4 +18,7 @@ public interface IBZWFFeignClient
@RequestMapping(method = RequestMethod.POST, value = "/{system}-user-{userId}/{entity}/process-definitions/{processDefinitionKey}/usertasks/{taskDefinitionKey}/tasks") @RequestMapping(method = RequestMethod.POST, value = "/{system}-user-{userId}/{entity}/process-definitions/{processDefinitionKey}/usertasks/{taskDefinitionKey}/tasks")
List<String> getbusinesskeysByUserId(@PathVariable("system") String system,@PathVariable("userId") String userId, List<String> getbusinesskeysByUserId(@PathVariable("system") String system,@PathVariable("userId") String userId,
@PathVariable("entity") String entity,@PathVariable("processDefinitionKey") String processDefinitionKey,@PathVariable("taskDefinitionKey") String taskDefinitionKey); @PathVariable("entity") String entity,@PathVariable("processDefinitionKey") String processDefinitionKey,@PathVariable("taskDefinitionKey") String taskDefinitionKey);
@RequestMapping(method = RequestMethod.POST, value = "/deploybpmn")
Boolean deployBpmnFile(@RequestBody List<Map<String,Object>> bpmnfiles);
} }
...@@ -2,6 +2,16 @@ ...@@ -2,6 +2,16 @@
TARGET=PSSYSTEM TARGET=PSSYSTEM
</#ibiztemplate> </#ibiztemplate>
<#assign sid = sys.getName()/> <#assign sid = sys.getName()/>
<#assign hasWF=false>
<#if sys.getAllPSWorkflows()??>
<#list sys.getAllPSWorkflows() as wf>
<#if wf.getPSWFVersions()??>
<#list wf.getPSWFVersions() as wfvs>
<#assign hasWF=true>
</#list>
</#if>
</#list>
</#if>
package ${pub.getPKGCodeName()}.util.job; package ${pub.getPKGCodeName()}.util.job;
import ${pub.getPKGCodeName()}.util.client.IBZUAAFeignClient; import ${pub.getPKGCodeName()}.util.client.IBZUAAFeignClient;
...@@ -16,6 +26,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; ...@@ -16,6 +26,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.InputStream; import java.io.InputStream;
import java.util.*;
/** /**
* 权限:向uaa同步当前系统菜单、权限资源任务类 * 权限:向uaa同步当前系统菜单、权限资源任务类
...@@ -25,15 +36,19 @@ import java.io.InputStream; ...@@ -25,15 +36,19 @@ import java.io.InputStream;
@ConditionalOnProperty( name = "ibiz.enablePermissionValid", havingValue = "true") @ConditionalOnProperty( name = "ibiz.enablePermissionValid", havingValue = "true")
public class PermissionSyncJob implements ApplicationRunner { public class PermissionSyncJob implements ApplicationRunner {
@Autowired @Autowired
@Lazy @Lazy
private IBZUAAFeignClient client; private IBZUAAFeignClient client;
@Value("${r'$'}{ibiz.systemid:${sid}}") @Value("${r'$'}{ibiz.systemid:${sid}}")
private String systemId; private String systemId;
<#if hasWF>
@Autowired
@Lazy
private ${pub.getPKGCodeName()}.util.client.IBZWFFeignClient client2;
</#if>
@Override @Override
public void run(ApplicationArguments args) { public void run(ApplicationArguments args) {
try { try {
...@@ -53,5 +68,21 @@ public class PermissionSyncJob implements ApplicationRunner { ...@@ -53,5 +68,21 @@ public class PermissionSyncJob implements ApplicationRunner {
catch (Exception ex) { catch (Exception ex) {
log.error(String.format("向[UAA]同步系统资源失败,请检查[UAA]服务是否正常! [%s]",ex)); log.error(String.format("向[UAA]同步系统资源失败,请检查[UAA]服务是否正常! [%s]",ex));
} }
<#if hasWF>
try{
List<Map<String,Object>> bpmnfiles=new ArrayList();
<#list sys.getAllPSWorkflows() as wf>
<#if wf.getPSWFVersions()??>
<#list wf.getPSWFVersions() as wfvs>
bpmnfiles.add(new HashMap<String,Object>(){{put("${wfvs.codeName}.bpmn",IOUtils.toString(this.getClass().getResourceAsStream("/workflow/${wfvs.codeName}.bpmn"),"UTF-8"));}});
</#list>
</#if>
</#list>
client2.deployBpmnFile(bpmnfiles);
}catch(Exception ex){
log.error(String.format("部署流程失败,请检查[WF]服务是否正常! [%s]",ex));
}
</#if>
} }
} }
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册