提交 6413e9db 编写于 作者: zhouweidong's avatar zhouweidong

消息集成

上级 208035e4
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#assign hasMsgTemplate=false>
<#if sys.getAllPSSysMsgTempls()??>
<#list sys.getAllPSSysMsgTempls() as msgTempl>
<#assign hasMsgTemplate=true>
<#break>
</#list>
</#if>
<#if hasMsgTemplate>
[
<#list sys.getAllPSSysMsgTempls() as msgTempl>
{
"tid":"${msgTempl.getCodeName()}",
"template_name":"${msgTempl.getName()}",
"content":"${msgTempl.getContent()}"
}
<#if msgTempl_has_next>
,
</#if>
</#list>
]
</#if>
......@@ -205,6 +205,12 @@ TARGET=PSWFVERSION
</#if>
<userTask flowable:category="${r'${businessKey}'}" flowable:candidateUsers="${assignCond}" flowable:exclusive="true" id="tid-${WFProcess.getWFStepValue()}-${WFProcess.getDeployId()}" name="${WFProcess.getName()}" <#if WFProcess.getWFProcessType()?? && (WFProcess.getWFProcessType()=="CALLORGACTIVITY" || WFProcess.getWFProcessType()=="EMBED")>flowable:formKey="${WFProcess.getWFProcessType()}"</#if>><#comment>标记子流程节点</#comment>
<documentation>${r'${majortext}'}</documentation>
<#if WFProcess.isSendInform()>
<#assign msgTempl=WFProcess.getPSSysMsgTempl()>
<extensionElements>
<flowable:formProperty id="${msgTempl.getCodeName()}" name="${msgTempl.getName()}" variable="${assignGroupCond}" type="${msgTempl.getMsgType()}" />
</extensionElements>
</#if>
<#--<#if assignGroupCond!="">-->
<#--<extensionElements>-->
<#--<flowable:field name="assignGroups"><flowable:string>${assignGroupCond}</flowable:string></flowable:field>-->
......
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
package ${pub.getPKGCodeName()}.util.client;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
@Component
public class IBZNotifyFallback implements IBZNotifyFeignClient {
@Override
public Boolean SendMsg(JSONObject msg) {
return null;
}
@Override
public Boolean createMsgTemplate(JSONObject template) {
return null;
}
}
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
package ${pub.getPKGCodeName()}.util.client;
import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
@FeignClient(value = "${r'${ibiz.ref.service.notify:ibznotify-api}'}",fallback = IBZNotifyFallback.class)
public interface IBZNotifyFeignClient
{
@RequestMapping(method = RequestMethod.POST,value = "/SendMsg")
Boolean SendMsg(@RequestBody JSONObject msg);
@RequestMapping(method = RequestMethod.POST,value = "/createMsgTemplate")
Boolean createMsgTemplate(@RequestBody JSONObject template);
}
......@@ -13,6 +13,13 @@ TARGET=PSSYSTEM
</#if>
</#list>
</#if>
<#assign hasMsgTemplate=false>
<#if sys.getAllPSSysMsgTempls()??>
<#list sys.getAllPSSysMsgTempls() as msgTempl>
<#assign hasMsgTemplate=true>
<#break>
</#list>
</#if>
package ${pub.getPKGCodeName()}.util.job;
import ${pub.getPKGCodeName()}.util.client.IBZUAAFeignClient;
......@@ -54,6 +61,12 @@ public class PermissionSyncJob implements ApplicationRunner {
private ${pub.getPKGCodeName()}.util.client.IBZWFFeignClient client2;
</#if>
<#if hasMsgTemplate>
@Autowired
@Lazy
private ${pub.getPKGCodeName()}.util.client.IBZNotifyFeignClient noticeFeignClient;
</#if>
@Override
public void run(ApplicationArguments args) {
try {
......@@ -94,5 +107,25 @@ public class PermissionSyncJob implements ApplicationRunner {
log.error(String.format("部署流程失败,请检查[WF]服务是否正常! [%s]",ex));
}
</#if>
<#if hasMsgTemplate>
try {
InputStream msgTemplate= this.getClass().getResourceAsStream("/msgtempl/systemMsgTempl.json"); //获取当前系统所有实体资源能力
String strMsgTemplate = IOUtils.toString(msgTemplate,"UTF-8");
JSONObject template= new JSONObject();
template.put("system",systemId);
template.put("template",JSONArray.parseArray(strMsgTemplate));
//数值代码表:email(2)sms(4)wechat(32)dingtalk(64)
template.put("templtypes", 102);
// system.put("md5check",DigestUtils.md5DigestAsHex(permissionResult.getBytes()));
if(noticeFeignClient.createMsgTemplate(template)){
log.info("推送消息模板成功");
}else{
log.error("推送消息模板失败");
}
} catch (IOException e) {
log.error("推送消息模板失败");
}
</#if>
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册