提交 15b1eeed 编写于 作者: zhouweidong's avatar zhouweidong

预置代码表

上级 54eac910
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#comment>系统是否包含预定义代码表</#comment>
<#assign hasPredefinedCodeList=false>
<#list sys.getAllPSCodeLists() as codelist>
<#if codelist.getPredefinedType()?? && codelist.getPredefinedType()=='RUNTIME'>
<#assign hasPredefinedCodeList=true>
<#break>
</#if>
</#list>
<#if hasPredefinedCodeList>
<#assign isFirstCodeList=true>
[ <#list sys.getAllPSCodeLists() as codelist>
<#if codelist.getPredefinedType()?? && codelist.getPredefinedType()=='RUNTIME'>
<#if isFirstCodeList==false>,</#if>
{
"name":"${codelist.name}",
"code":"${sys.codeName}-${codelist.codeName}",
"group":"",
"memo":"",
"enable":"",
<#if codelist.getAllPSCodeItems()??>
"items":[<#list codelist.getAllPSCodeItems() as codeItem>
{
"catalog_id":"${sys.codeName}-${codelist.codeName}",
"catalog_name":"${codelist.name}",
"value_key":"${sys.codeName}-${codelist.codeName}-${codeItem.codeName}",
"value":"${codeItem.value}",
"label":"${codeItem.text}",
"disabled":"",
"showorder":""
<#if codeItem.getParentCodeItem?? && codeItem.getParentCodeItem()??>
"parent":"${sys.codeName}-${codelist.codeName}-${codeItem.getParentCodeItem().codeName}"
</#if>
}<#if codeItem_has_next>,</#if>
</#list>
]
</#if>
}
<#assign isFirstCodeList==false>
</#if>
</#list>
]
</#if>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#comment>系统是否包含预定义代码表</#comment>
<#assign hasPredefinedCodeList=false>
<#list sys.getAllPSCodeLists() as codelist>
<#if codelist.getPredefinedType()?? && codelist.getPredefinedType()=='RUNTIME'>
<#assign hasPredefinedCodeList=true>
<#break>
</#if>
</#list>
<#if hasPredefinedCodeList>
package ${pub.getPKGCodeName()}.util.client;
import com.alibaba.fastjson.JSONObject;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
import java.util.Set;
@Component
public class IBZDictFallback implements IBZDictFeignClient {
@Override
public ResponseEntity<Boolean> syncRuntimeDict(List<JSONObject> catalogs) {
return null;
}
}
</#if>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#comment>系统是否包含预定义代码表</#comment>
<#assign hasPredefinedCodeList=false>
<#list sys.getAllPSCodeLists() as codelist>
<#if codelist.getPredefinedType()?? && codelist.getPredefinedType()=='RUNTIME'>
<#assign hasPredefinedCodeList=true>
<#break>
</#if>
</#list>
<#if hasPredefinedCodeList>
package ${pub.getPKGCodeName()}.util.client;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import java.util.List;
import java.util.Map;
@FeignClient(value = "${r'${ibiz.ref.service.dict:ibzdict-api}'}",contextId = "dict",fallback = IBZDictFallback.class)
public interface IBZDictFeignClient
{
@RequestMapping(method = RequestMethod.POST, value = "/dictionarys/catalogs/sync")
Boolean syncRuntimeDict(@RequestBody JSONArray catalogs);
}
</#if>
\ No newline at end of file
......@@ -20,6 +20,14 @@ TARGET=PSSYSTEM
<#break>
</#list>
</#if>
<#comment>系统是否包含预定义代码表</#comment>
<#assign hasPredefinedCodeList=false>
<#list sys.getAllPSCodeLists() as codelist>
<#if codelist.getPredefinedType()?? && codelist.getPredefinedType()=='RUNTIME'>
<#assign hasPredefinedCodeList=true>
<#break>
</#if>
</#list>
package ${pub.getPKGCodeName()}.util.job;
import ${pub.getPKGCodeName()}.util.client.IBZUAAFeignClient;
......@@ -73,6 +81,12 @@ public class PermissionSyncJob implements ApplicationRunner {
@Lazy
IBZLiteFeignClient liteFeignClient;
<#if hasPredefinedCodeList>
@Autowired
@Lazy
${pub.getPKGCodeName()}.util.client.IBZDictFeignClient dictFeignClient;
</#if>
@Override
public void run(ApplicationArguments args) {
try {
......@@ -142,5 +156,19 @@ public class PermissionSyncJob implements ApplicationRunner {
log.error("推送消息模板失败");
}
</#if>
<#if hasPredefinedCodeList>
try {
InputStream runtimeDict= this.getClass().getResourceAsStream("/sysmodel/RuntimeDict.json"); //获取当前系统所有实体资源能力
String strRuntimeDict = IOUtils.toString(runtimeDict,"UTF-8");
if(dictFeignClient.syncRuntimeDict(JSONArray.parseArray(strRuntimeDict))){
log.info("推送系统预置代码表成功");
}else{
log.error("推送系统预置代码表失败");
}
} catch (Exception e) {
log.error("推送系统预置代码表失败");
}
</#if>
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册