提交 518ceaad 编写于 作者: ibiz4j's avatar ibiz4j

workflow

上级 04469c92
...@@ -499,6 +499,37 @@ public class EntityModel extends BaseModel { ...@@ -499,6 +499,37 @@ public class EntityModel extends BaseModel {
return publishers; return publishers;
} }
public List<OptionItem> getDataScopes()
{
List<OptionItem> dataScopes=new ArrayList<>();
dataScopes.add(new OptionItem().setId("all").setName("全部数据"));
boolean hasOrgId=false,hasDetpId=false,hasCreateBy=false;
for(FieldModel field:getFields())
{
if("ORGID".equalsIgnoreCase(field.getDataEntityField().getPredefinedType()))
hasOrgId=true;
else if("ORGSECTORID".equalsIgnoreCase(field.getDataEntityField().getPredefinedType()))
hasDetpId=true;
else if("CREATEMAN".equalsIgnoreCase(field.getDataEntityField().getPredefinedType()))
hasCreateBy=true;
}
if(hasOrgId)
{
dataScopes.add(new OptionItem().setId("curorg").setName("当前单位"));
dataScopes.add(new OptionItem().setId("porg").setName("上级单位"));
dataScopes.add(new OptionItem().setId("sorg").setName("下级单位"));
}
if(hasDetpId)
{
dataScopes.add(new OptionItem().setId("curorgdept").setName("当前部门"));
dataScopes.add(new OptionItem().setId("porgdept").setName("上级部门"));
dataScopes.add(new OptionItem().setId("sorgdept").setName("下级部门"));
}
if(hasCreateBy)
dataScopes.add(new OptionItem().setId("createman").setName("创建人"));
return dataScopes;
}
private Map<String, POSchema> poSchemas; private Map<String, POSchema> poSchemas;
public POSchema getDefaultPOSchema() public POSchema getDefaultPOSchema()
......
package cn.ibizlab.codegen.model;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
public class OptionItem {
private String id;
private String name;
}
...@@ -37,6 +37,7 @@ import {{packageName}}.core.{{entity.module}}.service.I{{entity.codeName}}Servic ...@@ -37,6 +37,7 @@ import {{packageName}}.core.{{entity.module}}.service.I{{entity.codeName}}Servic
import {{packageName}}.core.{{entity.module}}.mapper.{{entity.codeName}}Mapper; import {{packageName}}.core.{{entity.module}}.mapper.{{entity.codeName}}Mapper;
import cn.ibizlab.util.helper.CachedBeanCopier; import cn.ibizlab.util.helper.CachedBeanCopier;
import cn.ibizlab.util.helper.DEFieldCacheMap; import cn.ibizlab.util.helper.DEFieldCacheMap;
import cn.ibizlab.util.security.AuthenticationUser;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...@@ -340,7 +341,14 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam ...@@ -340,7 +341,14 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam
{{/entity.extActions}} {{/entity.extActions}}
{{#entity.dataSets}} {{#entity.dataSets}}
public Page<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> search{{pascalCase codeName}}({{entity.codeName}}SearchContext context) { public Page<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> search{{pascalCase codeName}}({{entity.codeName}}SearchContext context) {
{{#if entity.hasPSDEWF}}
Map<String,Map<String,Object>> businesskeys = fillWFTaskContext(context);
{{/if}}
com.baomidou.mybatisplus.extension.plugins.pagination.Page<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> pages=baseMapper.search{{pascalCase codeName}}(context.getPages(),context,context.getSelectCond()); com.baomidou.mybatisplus.extension.plugins.pagination.Page<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> pages=baseMapper.search{{pascalCase codeName}}(context.getPages(),context,context.getSelectCond());
{{#if entity.hasPSDEWF}}
if(!StringUtils.isEmpty(context.getSrfWF()))
fillWFParam(pages,businesskeys);
{{/if}}
return new PageImpl<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}>(pages.getRecords(), context.getPageable(), pages.getTotal()); return new PageImpl<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}>(pages.getRecords(), context.getPageable(), pages.getTotal());
} }
public List<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> list{{pascalCase codeName}}({{entity.codeName}}SearchContext context) { public List<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> list{{pascalCase codeName}}({{entity.codeName}}SearchContext context) {
...@@ -393,4 +401,51 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam ...@@ -393,4 +401,51 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam
{{/entity.references}} {{/entity.references}}
{{#if entity.hasPSDEWF}}
@Autowired
private cn.ibizlab.util.client.IBZWFFeignClient ibzwfFeignClient;
/**
* 查询统一工作流待办
* @param context
*/
private Map<String,Map<String,Object>> fillWFTaskContext({{entity.codeName}}SearchContext context){
Map<String, Map<String, Object>> keys = null;
Collection<String> businessKeys = null;
if(!StringUtils.isEmpty(context.getSrfWF())){
keys= ibzwfFeignClient.getMyTask("{{lowerCase system.codeName}}", "", "{{pluralize entity.codeName}}");
if(!ObjectUtils.isEmpty(keys))
businessKeys = keys.keySet();
}
else if(!StringUtils.isEmpty(context.getUserTaskId()) && !StringUtils.isEmpty(context.getProcessDefinitionKey()))
businessKeys= ibzwfFeignClient.getbusinesskeysByUserId("{{lowerCase system.codeName}}", AuthenticationUser.getAuthenticationUser().getUserid(),"{{pluralize entity.codeName}}",context.getProcessDefinitionKey(),context.getUserTaskId());
if(!ObjectUtils.isEmpty(businessKeys))
context.getSelectCond().in("{{entity.keyField.columnName}}",businessKeys);
else
context.getSelectCond().apply("1<>1");
return keys;
}
/**
* 填充工作流参数
* @param pages
* @param businesskeys
*/
private void fillWFParam(com.baomidou.mybatisplus.extension.plugins.pagination.Page<{{entity.codeName}}> pages, Map<String, Map<String, Object>> businesskeys) {
if (!ObjectUtils.isEmpty(businesskeys)) {
for ({{entity.codeName}} entity : pages.getRecords()) {
Object id = entity.get{{pascalCase entity.keyField.codeName}}();
if (!ObjectUtils.isEmpty(id) && businesskeys.containsKey(id)) {
Map<String, Object> params = businesskeys.get(id);
for (Map.Entry<String, Object> entry : params.entrySet()) {
entity.set(entry.getKey(), entry.getValue());
}
}
}
}
}
{{/if}}
} }
\ No newline at end of file
{{#if system.allPSSysMsgTempls}}
[
{{#each system.allPSSysMsgTempls as |msgTempl|}}
{
"tid":"{{lowerCase msgTempl.codeName}}",
"template_name":"{{msgTempl.getName}}",
"content":"{{msgTempl.content}}"
}{{#unless @last}},{{/unless}}
{{/each}}
]
{{/if}}
\ No newline at end of file
{{#*inline "getAppMenuItems"}}[
{{#each menuGroup.psAppMenuItems as |appMenuItem|}}
{
"id": "{{appMenuItem.name}}",
"name": "{{appMenuItem.caption}}"{{#if appMenuItem.psAppMenuItems}},
"item": {{>getAppMenuItems menuGroup=appMenuItem}}
{{/if}}
}{{#unless @last}},{{/unless}}
{{/each}}
]
{{/inline}}
{
"systemid": "{{system.codeName}}",
"systemname": "{{system.logicName}}",
"unires": [
{{#each system.allPSSysUniReses as |unires|}}
{
"unirescode": "{{unires.resCode}}",
"uniresname": "{{unires.name}}"
}{{#unless @last}},{{/unless}}
{{/each}}
],
"appmenus": [
{{#each system.apps as |app|}}
{
"appid": "{{app.codeName}}",
"appname": "{{app.name}}",
"appmenu": [
{{#each app.allPSAppMenuModels as |appMenu|}}
{
"menuid": "{{appMenu.codeName}}",
"menuname": "{{appMenu.name}}",
"menuitem": {{>getAppMenuItems menuGroup=appMenu}}
}{{#unless @last}},{{/unless}}
{{/each}}
]
}{{#unless @last}},{{/unless}}
{{/each}}
],
"entities": [
{{#each system.entities as |de|}}
{
"dename":"{{de.codeName}}",
"delogicname": "{{de.logicName}}",
"sysmodule": {
"id": "{{upperCase de.psSystemModule.codeName}}",
"name": "{{de.psSystemModule.name}}"
},
"dedataset": [
{{#each de.dataSets as |dataSet|}}
{
"id": "{{dataSet.codeName}}",
"name": "{{#if dataSet.logicName}}{{dataSet.logicName}}{{else}}{{dataSet.codeName}}{{/if}}"
}{{#unless @last}},{{/unless}}
{{/each}}
],
"deaction": [
{{#each de.actions as |action|}}
{
"id": "{{action.codeName}}",
"name": "{{#if action.logicName}}{{action.logicName}}{{else}}{{action.codeName}}{{/if}}",
"type": "{{action.actionType}}"
}{{#unless @last}},{{/unless}}
{{/each}}
],
"datascope": [
{{#each de.dataScopes as |dataScope|}}
{
"id": "{{dataScope.id}}",
"name": "{{dataScope.name}}"
}{{#unless @last}},{{/unless}}
{{/each}}
]
}{{#unless @last}},{{/unless}}
{{/each}}
]
}
{{#eq system.codeName "1"}}
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
{
"systemid":"${sys.codeName}",
"systemname":"${sys.getLogicName()}",
"entities":[
<#if sys.getAllPSDataEntities()??>
<#list sys.getAllPSDataEntities() as de>
{
"entity_name":"${de.name}",
"logic_name":"${de.logicName}",
"code_name":"${de.codeName}",
"table_name":"${de.getTableName()}",
"system_id":"${sys.codeName}",
"system_name":"${sys.logicName}",
"module_id":"${de.getPSSystemModule().codeName}",
"module_name":"${de.getPSSystemModule().name}",
<#--"ds_id":null,-->
<#--"ds_name":"",-->
"fields":[
<#if de.getPSDEFields()??>
<#list de.getPSDEFields() as defield>
{
"fieldname":"${defield.name}" ,
"codename":"${defield.codeName}",
"field_logic_name":"${defield.logicName}",
"entity_name":"${de.name}",
<#if defield.getRelatedPSDEField?? && defield.getRelatedPSDEField()??>
"ref_de":"${defield.getRelatedPSDEField().getPSDataEntity().name}",
"ref_field_name":"${defield.getRelatedPSDEField().name}",
</#if>
<#if (((defield.getDataType())!'')=='PICKUP' || ((defield.getDataType())!'')=='PICKUPDATA' || ((defield.getDataType())!'')=='PICKUPTEXT' ) && defield.getPSDER1N()?? >
"relation_name":"${defield.getPSDER1N().getName()}",
"relation_codename":"${defield.getPSDER1N().getCodeName()}",
</#if>
"field_type":"${defield.getDataType()}",
<#if defield.getPSCodeList()??>
"dict":"${defield.getPSCodeList().codeName}",
</#if>
"nullable":<#if defield.isAllowEmpty()>1<#else>0</#if>,
"physical_field":<#if defield.isPhisicalDEField()>1<#else>0</#if>,
"data_type":"${srfdatatype(defield.getStdDataType())}",
<#if defield.getLength()?c!='-1'>
"data_length":${defield.getLength()?c},
</#if>
<#if defield.getPrecision()?c!='0'>
"data_preci":${defield.getPrecision()?c},
</#if>
<#if defield.getDefaultPSDEFDTColumn?? && defield.getDefaultPSDEFDTColumn()?? && defield.getDefaultPSDEFDTColumn().isFormula()==true>
"expression":"${defield.getDefaultPSDEFDTColumn().getFormulaFormat()}",
</#if>
<#if defield.getPredefinedType()?? && defield.getPredefinedType()!=''>
"predefined":"${defield.getPredefinedType()}",
</#if>
"key_field":<#if defield.isKeyDEField()==true>1<#else>0</#if>,
<#if defield.getUnionKeyValue()?? && defield.getUnionKeyValue()!=''>
"union_key":"${defield.getUnionKeyValue()}",
</#if>
<#if defield.getOrderValue?? && defield.getOrderValue()??>
"show_order":${defield.getOrderValue()?c},
</#if>
"major_field":<#if defield.isMajorDEField()==true>1<#else>0</#if>
}<#if defield_has_next>,</#if>
</#list>
</#if>
],
"subEntitys":[
<#if de.getMinorPSDERs()??>
<#list de.getMajorPSDERs() as majorPSDER>
{"name":"${majorPSDER.name}",
"relation_type":"${majorPSDER.getDERType()}",
"code_name":"${majorPSDER.getCodeName()}",
"entity_name":"${majorPSDER.getMinorPSDataEntity().name}",
"ref_entity_name":"${majorPSDER.getMajorPSDataEntity().name}"
<#--"nested_name":"",-->
<#--"lookup":""-->
}<#if majorPSDER_has_next>,</#if>
</#list>
</#if>
],
"parentEntitys":[
<#if de.getMinorPSDERs()??>
<#list de.getMinorPSDERs() as minorPSDER>
{"name":"${minorPSDER.name}",
"relation_type":"${minorPSDER.getDERType()}",
"code_name":"${minorPSDER.getCodeName()}",
"entity_name":"${minorPSDER.getMinorPSDataEntity().name}",
"ref_entity_name":"${minorPSDER.getMajorPSDataEntity().name}"
<#--"nested_name":"",-->
<#--"lookup":""-->
}<#if minorPSDER_has_next>,</#if>
</#list>
</#if>
]
}
<#if de_has_next>,</#if>
</#list>
</#if>
]
}
{{/eq}}
\ No newline at end of file
[
{{#each system.allPSCodeLists as |codelist|}}
{{#eq codelist.predefinedType 'RUNTIME'}}
{
"name": "{{codelist.name}}",
"code": "{{codelist.codeName}}",
"group": "",
"memo": "",
{{#if codelist.allPSCodeItems}}
"items": [
{{#each codelist.allPSCodeItems as |codeItem|}}
{
"catalog_id": "{{codelist.codeName}}",
"catalog_name": "{{codelist.name}}",
"value_key": "{{codelist.codeName}}-{{codeItem.codeName}}",
"value": "{{codeItem.value}}",
"label":"{{codeItem.text}}",
"disabled": "0",
{{#if codeItem.parentCodeItem}}
"parent": "{{codeItem.parentCodeItem.value}}",
{{/if}}
"showorder": {{@index}}
}{{#unless @last}},{{/unless}}
{{/each}}
]
{{/if}}
}
{{/eq}}
{{/each}}
]
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册