提交 8ab5eec2 编写于 作者: ibiz4j's avatar ibiz4j

合并分支 'dev' 到 'master'

Dev

查看合并请求 !13
......@@ -4,7 +4,7 @@ TARGET=PSSYSTEM
package ${pub.getPKGCodeName()}.util.client;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.*;
@Component
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) {
return null;
}
@Override
public Boolean deployBpmnFile(List<Map<String, Object>> bpmnfiles) {
return null;
}
}
......@@ -5,7 +5,7 @@ package ${pub.getPKGCodeName()}.util.client;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.*;
@FeignClient(value = "ibzwf-api",fallback = IBZWFFallback.class)
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")
List<String> getbusinesskeysByUserId(@PathVariable("system") String system,@PathVariable("userId") String userId,
@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 @@
TARGET=PSSYSTEM
</#ibiztemplate>
<#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;
import ${pub.getPKGCodeName()}.util.client.IBZUAAFeignClient;
......@@ -15,7 +25,9 @@ import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import org.springframework.util.DigestUtils;
import java.io.InputStream;
import java.util.*;
/**
* 权限:向uaa同步当前系统菜单、权限资源任务类
......@@ -25,15 +37,19 @@ import java.io.InputStream;
@ConditionalOnProperty( name = "ibiz.enablePermissionValid", havingValue = "true")
public class PermissionSyncJob implements ApplicationRunner {
@Autowired
@Lazy
private IBZUAAFeignClient client;
@Value("${r'$'}{ibiz.systemid:${sid}}")
private String systemId;
<#if hasWF>
@Autowired
@Lazy
private ${pub.getPKGCodeName()}.util.client.IBZWFFeignClient client2;
</#if>
@Override
public void run(ApplicationArguments args) {
try {
......@@ -44,6 +60,7 @@ public class PermissionSyncJob implements ApplicationRunner {
system.put("pssystemid",systemId);
system.put("pssystemname",systemId);
system.put("sysstructure",JSONObject.parseObject(permissionResult));
system.put("md5check",DigestUtils.md5DigestAsHex(permissionResult.getBytes()));
if(client.syncSysAuthority(system)){
log.info("向[UAA]同步系统资源成功");
}else{
......@@ -53,5 +70,25 @@ public class PermissionSyncJob implements ApplicationRunner {
catch (Exception 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>
if(client2.deployBpmnFile(bpmnfiles)){
log.info("部署流程成功");
}else{
log.error("部署流程失败");
}
}catch(Exception ex){
log.error(String.format("部署流程失败,请检查[WF]服务是否正常! [%s]",ex));
}
</#if>
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册