Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
084f5e4e
提交
084f5e4e
编写于
11月 07, 2022
作者:
chenxiang@lab.ibiz5.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
处理逻辑模板
上级
b49a9f53
变更
9
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
385 行增加
和
10 行删除
+385
-10
pom.xml
modules/ibizlab-generator-core/pom.xml
+1
-1
LogicLinkModel.java
...rc/main/java/cn/ibizlab/codegen/model/LogicLinkModel.java
+113
-0
LogicModel.java
...re/src/main/java/cn/ibizlab/codegen/model/LogicModel.java
+51
-4
LogicNodeModel.java
...rc/main/java/cn/ibizlab/codegen/model/LogicNodeModel.java
+39
-2
RawSQLAndLoopCall.hbs
...in/resources/templ/@macro/logic/drl/RawSQLAndLoopCall.hbs
+45
-1
RawSQLCall.hbs
.../src/main/resources/templ/@macro/logic/drl/RawSQLCall.hbs
+54
-1
StartWF.hbs
...dge/src/main/resources/templ/@macro/logic/drl/StartWF.hbs
+10
-1
{{entityLogics}}Rule.drl.hbs
...resources/rules/{{entities}}/{{entityLogics}}Rule.drl.hbs
+3
-0
{{entityLogics}}RuleFlow.bpmn.hbs
...rces/rules/{{entities}}/{{entityLogics}}RuleFlow.bpmn.hbs
+69
-0
未找到文件。
modules/ibizlab-generator-core/pom.xml
浏览文件 @
084f5e4e
...
...
@@ -164,7 +164,7 @@
<dependency>
<groupId>
net.ibizsys.plugin
</groupId>
<artifactId>
ibiz-model
</artifactId>
<version>
8.1.0.
18
1
</version>
<version>
8.1.0.
24
1
</version>
<exclusions>
<exclusion>
<artifactId>
slf4j-simple
</artifactId>
...
...
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/LogicLinkModel.java
0 → 100644
浏览文件 @
084f5e4e
package
cn
.
ibizlab
.
codegen
.
model
;
import
net.ibizsys.model.dataentity.logic.*
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
LogicLinkModel
extends
BaseModel
{
private
LogicModel
logicModel
;
public
LogicLinkModel
(
LogicModel
logicModel
,
IPSDELogicLink
iPSDELogicLink
)
{
this
.
opt
=
iPSDELogicLink
;
this
.
logicModel
=
logicModel
;
this
.
setCodeName
(
iPSDELogicLink
.
getCodeName
());
this
.
setName
(
iPSDELogicLink
.
getName
());
this
.
setId
(
String
.
format
(
"%1$s-%2$s"
,
logicModel
.
getCodeName
(),
iPSDELogicLink
.
getCodeName
()));
}
public
LogicModel
getLogicModel
()
{
return
logicModel
;
}
public
IPSDELogicLink
getPSDELogicLink
()
{
return
(
IPSDELogicLink
)
opt
;
}
public
boolean
hasCondtion
()
{
if
(
this
.
getPSDELogicLink
().
getPSDELogicLinkGroupCond
()
!=
null
)
{
return
true
;
}
return
false
;
}
public
String
getSourceNodeId
()
{
String
strSourceNodeId
=
this
.
getPSDELogicLink
().
getSrcPSDELogicNode
().
getCodeName
().
toLowerCase
();
if
(
this
.
getPSDELogicLink
().
getPSDELogicLinkGroupCond
()
!=
null
)
{
strSourceNodeId
=
String
.
format
(
"gateway-%s"
,
strSourceNodeId
);
}
return
strSourceNodeId
;
}
public
String
getTargetNodeId
()
{
String
strTargetNodeId
=
this
.
getPSDELogicLink
().
getSrcPSDELogicNode
().
getCodeName
().
toLowerCase
();
if
(
this
.
getPSDELogicLink
().
getPSDELogicLinkGroupCond
()
!=
null
)
{
strTargetNodeId
=
String
.
format
(
"gateway-%s"
,
strTargetNodeId
);
}
return
strTargetNodeId
;
}
public
String
getConditionExpression
()
{
StringBuffer
strConditionException
=
new
StringBuffer
();
if
(
hasCondtion
())
{
if
(
CollectionUtils
.
isEmpty
(
logicModel
.
getPSDELogic
().
getPSDELogicParams
()))
{
for
(
IPSDELogicParam
iPSDELogicParam
:
logicModel
.
getPSDELogic
().
getPSDELogicParams
())
{
if
(
iPSDELogicParam
.
getParamPSDataEntity
()
!=
null
)
{
strConditionException
.
append
(
String
.
format
(
"$%s:%s();\t\n"
,
iPSDELogicParam
.
getCodeName
().
toLowerCase
(),
iPSDELogicParam
.
getParamPSDataEntity
().
getCodeName
()));
}
else
{
strConditionException
.
append
(
String
.
format
(
"$%s:Map();\t\n"
,
iPSDELogicParam
.
getCodeName
().
toLowerCase
()));
}
}
for
(
int
i
=
0
;
i
<
logicModel
.
getPSDELogic
().
getPSDELogicParams
().
size
();
i
++)
{
IPSDELogicParam
iPSDELogicParam
=
logicModel
.
getPSDELogic
().
getPSDELogicParams
().
get
(
i
);
if
(
iPSDELogicParam
.
getParamPSDataEntity
()
!=
null
)
{
strConditionException
.
append
(
String
.
format
(
"$%s==%s;\t\n"
,
iPSDELogicParam
.
getCodeName
().
toLowerCase
(),
iPSDELogicParam
.
getCodeName
().
toLowerCase
()));
}
if
(
i
<
logicModel
.
getPSDELogic
().
getPSDELogicParams
().
size
()
-
1
)
strConditionException
.
append
(
" && "
);
}
}
strConditionException
.
append
(
"eval"
);
appendGroupCondition
(
strConditionException
,
this
.
getPSDELogicLink
().
getPSDELogicLinkGroupCond
());
}
return
strConditionException
.
toString
();
}
public
void
appendGroupCondition
(
StringBuffer
strConditionException
,
IPSDELogicLinkGroupCond
iPSDELogicLinkGroupCond
)
{
strConditionException
.
append
(
"("
);
for
(
int
i
=
0
;
i
<
iPSDELogicLinkGroupCond
.
getPSDELogicLinkConds
().
size
();
i
++)
{
IPSDELogicLinkCond
childLinkCond
=
iPSDELogicLinkGroupCond
.
getPSDELogicLinkConds
().
get
(
i
);
if
(
childLinkCond
instanceof
IPSDELogicLinkGroupCond
)
{
appendGroupCondition
(
strConditionException
,
(
IPSDELogicLinkGroupCond
)
childLinkCond
);
}
else
if
(
childLinkCond
instanceof
IPSDELogicLinkSingleCond
)
{
appendSignleCondition
(
strConditionException
,
(
IPSDELogicLinkSingleCond
)
childLinkCond
);
}
if
(
i
<
logicModel
.
getPSDELogic
().
getPSDELogicParams
().
size
()
-
1
)
{
if
(
iPSDELogicLinkGroupCond
.
getGroupOP
().
equals
(
"AND"
))
{
strConditionException
.
append
(
" && "
);
}
else
if
(
iPSDELogicLinkGroupCond
.
getGroupOP
().
equals
(
"OR"
))
{
strConditionException
.
append
(
" || "
);
}
}
}
strConditionException
.
append
(
")"
);
}
public
void
appendSignleCondition
(
StringBuffer
strConditionException
,
IPSDELogicLinkSingleCond
iPSDELogicLinkSingleCond
)
{
strConditionException
.
append
(
"("
);
strConditionException
.
append
(
"RuleUtils.test($"
);
strConditionException
.
append
(
iPSDELogicLinkSingleCond
.
getDstLogicParam
().
getCodeName
().
toLowerCase
());
strConditionException
.
append
(
".get(\""
);
strConditionException
.
append
(
iPSDELogicLinkSingleCond
.
getDstFieldName
().
toLowerCase
());
strConditionException
.
append
(
"\"),\""
);
strConditionException
.
append
(
iPSDELogicLinkSingleCond
.
getCondOP
());
strConditionException
.
append
(
"\",\""
);
strConditionException
.
append
(
iPSDELogicLinkSingleCond
.
getValue
());
strConditionException
.
append
(
"\")"
);
strConditionException
.
append
(
")"
);
}
}
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/LogicModel.java
浏览文件 @
084f5e4e
...
...
@@ -2,6 +2,7 @@ package cn.ibizlab.codegen.model;
import
net.ibizsys.model.dataentity.IPSDataEntity
;
import
net.ibizsys.model.dataentity.logic.IPSDELogic
;
import
net.ibizsys.model.dataentity.logic.IPSDELogicLink
;
import
net.ibizsys.model.dataentity.logic.IPSDELogicNode
;
import
net.ibizsys.model.dataentity.logic.IPSDELogicParam
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -19,9 +20,13 @@ public class LogicModel extends BaseModel {
private
boolean
hasStartWF
=
false
;
private
List
<
String
>
ruleGlobalParams
=
new
ArrayList
<>();
private
List
<
String
>
bpmnTnsParams
=
new
ArrayList
<>();
private
List
<
LogicNodeModel
>
logicNodeModels
=
new
ArrayList
<>();
public
LogicModel
(
EntityModel
entityModel
,
IPSDELogic
iPSDELogic
)
{
private
List
<
LogicLinkModel
>
logicLinkModels
=
new
ArrayList
();
public
LogicModel
(
EntityModel
entityModel
,
IPSDELogic
iPSDELogic
)
{
this
.
opt
=
iPSDELogic
;
this
.
entity
=
entityModel
;
this
.
setCodeName
(
iPSDELogic
.
getCodeName
());
...
...
@@ -37,6 +42,12 @@ public class LogicModel extends BaseModel {
iPSDELogicParam
.
getParamPSDataEntity
().
getCodeName
()
);
ruleGlobalParams
.
add
(
String
.
format
(
"global %s %s;"
,
strDataType
,
strParamName
));
String
bpmnGlobalIdentifier
=
String
.
format
(
"<tns:global identifier=\"%s\" type=\"%s.core.%s.domain.%s\" />"
,
strParamName
,
entityModel
.
getSystem
().
getPackageName
(),
iPSDELogicParam
.
getParamPSDataEntity
().
getPSSystemModule
().
getCodeName
().
toLowerCase
(),
iPSDELogicParam
.
getParamPSDataEntity
().
getCodeName
());
bpmnTnsParams
.
add
(
bpmnGlobalIdentifier
);
}
else
{
String
strDataType
=
"java.util.Map"
;
ruleGlobalParams
.
add
(
String
.
format
(
"global %s %s;"
,
strDataType
,
strParamName
));
...
...
@@ -46,8 +57,14 @@ public class LogicModel extends BaseModel {
if
(!
CollectionUtils
.
isEmpty
(
iPSDELogic
.
getPSDELogicNodes
()))
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
for
(
IPSDELogicNode
iPSDELogicNode
:
iPSDELogic
.
getPSDELogicNodes
())
{
LogicNodeModel
logicNodeModel
=
new
LogicNodeModel
(
this
,
iPSDELogicNode
);
LogicNodeModel
logicNodeModel
=
new
LogicNodeModel
(
this
,
iPSDELogicNode
);
logicNodeModels
.
add
(
logicNodeModel
);
if
(!
CollectionUtils
.
isEmpty
(
iPSDELogicNode
.
getPSDELogicLinks
()))
{
for
(
IPSDELogicLink
iPSDELogicLink
:
iPSDELogicNode
.
getPSDELogicLinks
())
{
logicLinkModels
.
add
(
new
LogicLinkModel
(
this
,
iPSDELogicLink
));
}
}
if
(
iPSDELogicNode
.
getLogicNodeType
().
equals
(
"STARTWF"
))
{
hasStartWF
=
true
;
}
...
...
@@ -60,14 +77,23 @@ public class LogicModel extends BaseModel {
dstPSDataEntity
.
getPSSystemModule
().
getCodeName
().
toLowerCase
(),
dstPSDataEntity
.
getCodeName
()
);
ruleGlobalParams
.
add
(
String
.
format
(
"global %s %s;"
,
strDataType
,
String
.
format
(
"%sservice"
,
dstPSDataEntity
.
getCodeName
().
toLowerCase
())));
ruleGlobalParams
.
add
(
String
.
format
(
"global %s %s;"
,
strDataType
,
String
.
format
(
"%sservice"
,
dstPSDataEntity
.
getCodeName
().
toLowerCase
())));
map
.
put
(
dstPSDataEntity
.
getName
(),
dstPSDataEntity
.
getName
());
String
bpmnService
=
String
.
format
(
"<tns:metaData express=\"T(cn.ibizlab.util.security.SpringContextHolder).getBean(T(%s.core.%s.service.I%sService))\" name=\"%sservice\" type=\"service\"/>"
,
entityModel
.
getSystem
().
getPackageName
(),
dstPSDataEntity
.
getPSSystemModule
().
getCodeName
().
toLowerCase
(),
dstPSDataEntity
.
getCodeName
(),
dstPSDataEntity
.
getCodeName
().
toLowerCase
()
);
bpmnTnsParams
.
add
(
bpmnService
);
}
}
catch
(
Exception
e
)
{
}
}
}
if
(
hasStartWF
)
{
String
strDataType
=
"cn.ibizlab.util.client"
;
ruleGlobalParams
.
add
(
String
.
format
(
"global %s %s;"
,
strDataType
,
"wfClient"
));
...
...
@@ -78,20 +104,41 @@ public class LogicModel extends BaseModel {
entityModel
.
getDataEntity
().
getPSSystemModule
().
getCodeName
().
toLowerCase
(),
entityModel
.
getDataEntity
().
getCodeName
()
);
ruleGlobalParams
.
add
(
String
.
format
(
"global %s %s;"
,
strDataType
,
String
.
format
(
"iBzSys%sDefaultService"
,
entityModel
.
getCodeName
())));
ruleGlobalParams
.
add
(
String
.
format
(
"global %s %s;"
,
strDataType
,
String
.
format
(
"iBzSys%sDefaultService"
,
entityModel
.
getCodeName
())));
String
strBpmnService
=
String
.
format
(
"<tns:metaData express=\"T(cn.ibizlab.util.security.SpringContextHolder).getBean(T(%s.core.%s.service.I%sService))\" name=\"iBzSys%sDefaultService\" type=\"service\"/>"
,
entityModel
.
getSystem
().
getPackageName
(),
entityModel
.
getDataEntity
().
getPSSystemModule
().
getCodeName
().
toLowerCase
(),
entityModel
.
getDataEntity
().
getCodeName
(),
entityModel
.
getDataEntity
().
getCodeName
());
bpmnTnsParams
.
add
(
strBpmnService
);
}
ruleGlobalParams
.
add
(
String
.
format
(
"global %s %s;"
,
"cn.ibizlab.util.security.AuthenticationUser"
,
"curuser"
));
bpmnTnsParams
.
add
(
"<tns:metaData express=\"T(cn.ibizlab.util.security.AuthenticationUser).getAuthenticationUser()\" name=\"curuser\" type=\"session\"/>"
);
}
public
IPSDELogic
getPSDELogic
()
{
return
(
IPSDELogic
)
opt
;
}
public
EntityModel
getEntity
()
{
return
entity
;
}
public
List
<
String
>
getRuleGlobalParams
()
{
return
ruleGlobalParams
;
}
public
List
<
String
>
getBpmnTnsParams
()
{
return
bpmnTnsParams
;
}
public
List
<
LogicNodeModel
>
getLogicNodeModels
()
{
return
logicNodeModels
;
}
public
List
<
LogicLinkModel
>
getLogicLinkModels
()
{
return
logicLinkModels
;
}
}
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/LogicNodeModel.java
浏览文件 @
084f5e4e
package
cn
.
ibizlab
.
codegen
.
model
;
import
net.ibizsys.model.dataentity.logic.IPSDELogicNode
;
import
net.ibizsys.model.dataentity.logic.*
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -21,7 +22,7 @@ public class LogicNodeModel extends BaseModel {
}
public
String
getLogicNodeType
(){
public
String
getLogicNodeType
()
{
return
this
.
getPSDELogicNode
().
getLogicNodeType
();
}
...
...
@@ -33,4 +34,40 @@ public class LogicNodeModel extends BaseModel {
return
(
IPSDELogicNode
)
opt
;
}
public
String
getRawSql
()
{
String
strSql
=
null
;
if
(
this
.
getPSDELogicNode
()
instanceof
IPSDERawSqlCallLogic
)
{
IPSDERawSqlCallLogic
iPSDERawSqlCallLogic
=
(
IPSDERawSqlCallLogic
)
this
.
getPSDELogicNode
();
strSql
=
iPSDERawSqlCallLogic
.
getSql
();
if
(!
CollectionUtils
.
isEmpty
(
iPSDERawSqlCallLogic
.
getPSDELogicNodeParams
()))
{
int
i
=
0
;
while
(
strSql
.
indexOf
(
"?"
)
>
-
1
)
{
strSql
=
strSql
.
replaceFirst
(
"\\?"
,
String
.
format
(
"#{et.param%s}"
,
String
.
valueOf
(
i
)));
i
++;
}
}
}
if
(
this
.
getPSDELogicNode
()
instanceof
IPSDERawSqlAndLoopCallLogic
)
{
IPSDERawSqlAndLoopCallLogic
iPSDERawSqlAndLoopCallLogic
=
(
IPSDERawSqlAndLoopCallLogic
)
this
.
getPSDELogicNode
();
strSql
=
iPSDERawSqlAndLoopCallLogic
.
getSql
();
if
(!
CollectionUtils
.
isEmpty
(
iPSDERawSqlAndLoopCallLogic
.
getPSDELogicNodeParams
()))
{
int
i
=
0
;
while
(
strSql
.
indexOf
(
"?"
)
>
-
1
)
{
strSql
=
strSql
.
replaceFirst
(
"\\?"
,
String
.
format
(
"#{et.param%s}"
,
String
.
valueOf
(
i
)));
i
++;
}
}
}
return
strSql
;
}
public
String
getAppName
(){
String
strAppName
=
""
;
if
(
this
.
getPSDELogicNode
()
instanceof
IPSDEStartWFLogic
)
{
IPSDEStartWFLogic
iPSDEStartWFLogic
=
(
IPSDEStartWFLogic
)
this
.
getPSDELogicNode
();
}
return
strAppName
;
}
}
modules/ibizlab-template/ibizlab-template-ibizedge/src/main/resources/templ/@macro/logic/drl/RawSQLAndLoopCall.hbs
浏览文件 @
084f5e4e
//RawSQLAndLoopCall
\ No newline at end of file
{{#if
logicNodeModel
.
pSDELogicNode
.
pSDELogicNodeParams
}}
Map param =new HashMap();
{{#
each
logicNodeModel
.
pSDELogicNode
.
pSDELogicNodeParams
as
|
nodeParam
|
}}
{{#if
(
eq
nodeParam
.
srcValueType
"SRCDLPARAM"
)
}}
param.put("param
{{
@index
}}
",
{{
lowerCase
nodeParam
.
srcPSDELogicParam
.
codeName
}}
.get("
{{
lowerCase
nodeParam
.
srcFieldName
}}
"));
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"WEBCONTEXT"
)
}}
param.put("param
{{
@index
}}
",default.get("
{{
lowerCase
nodeParam
.
srcFieldName
}}
"));
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"APPDATA"
)
}}
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"APPLICATION"
)
}}
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"SESSION"
)
}}
param.put("param
{{
@index
}}
",curuser.getSessionParams().get("
{{
lowerCase
nodeParam
.
srcFieldName
}}
"));
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"DATACONTEXT"
)
}}
param.put("param
{{
@index
}}
",default.get("
{{
lowerCase
nodeParam
.
srcFieldName
}}
"));
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"ENVPARAM"
)
}}
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"VIEWPARAM"
)
}}
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"NONE"
)
}}
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"NULLVALUE"
)
}}
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"SRCVALUE"
)
}}
param.put("param
{{
@index
}}
",default.get("
{{
lowerCase
nodeParam
.
srcValue
}}
"));
{{/if}}
{{/
each
}}
{{else}}
Map param = null;
{{/if}}
String strSql="
{{
logicNodeModel
.
rawSql
}}
";
java.util.List
<JSONObject>
entities=iBzSys
{{
logicNodeModel
.
logicModel
.
entity
.
codeName
}}
DefaultService.select(strSql,param);//SQL调用
if(entities.size()>0
&&
!ObjectUtils.isEmpty(entities.get(0))){
for(JSONObject entity:entities){
{{
packageName
}}
.core.
{{
lowerCase
logicNodeModel
.
pSDELogicNode
.
dstPSDataEntity
.
pSSystemModule
.
codeName
}}
.domain.
{{
logicNodeModel
.
pSDELogicNode
.
dstPSDataEntity
.
codeName
}}
targetEntity =new
{{
packageName
}}
.core.
{{
lowerCase
logicNodeModel
.
pSDELogicNode
.
dstPSDataEntity
.
pSSystemModule
.
codeName
}}
.domain.
{{
logicNodeModel
.
pSDELogicNode
.
dstPSDataEntity
.
codeName
}}
();
for (Map.Entry
<String
,
Object
>
entry : entity.entrySet()) {
targetEntity.set(entry.getKey(),entry.getValue());
}
{{
lowerCase
logicNodeModel
.
pSDELogicNode
.
dstPSDataEntity
.
codeName
}}
service.${logicNodeModel.pSDELogicNode.dstPSDEAction}(targetEntity);
}
}
\ No newline at end of file
modules/ibizlab-template/ibizlab-template-ibizedge/src/main/resources/templ/@macro/logic/drl/RawSQLCall.hbs
浏览文件 @
084f5e4e
//RawSQLCall
\ No newline at end of file
{{#if
logicNodeModel
.
pSDELogicNode
.
pSDELogicNodeParams
}}
Map param =new HashMap();
{{#
each
logicNodeModel
.
pSDELogicNode
.
pSDELogicNodeParams
as
|
nodeParam
|
}}
{{#if
(
eq
nodeParam
.
srcValueType
"SRCDLPARAM"
)
}}
param.put("param
{{
@index
}}
",
{{
lowerCase
nodeParam
.
srcPSDELogicParam
.
codeName
}}
.get("
{{
lowerCase
nodeParam
.
srcFieldName
}}
"));
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"WEBCONTEXT"
)
}}
param.put("param
{{
@index
}}
",default.get("
{{
lowerCase
nodeParam
.
srcFieldName
}}
"));
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"APPDATA"
)
}}
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"APPLICATION"
)
}}
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"SESSION"
)
}}
param.put("param
{{
@index
}}
",curuser.getSessionParams().get("
{{
lowerCase
nodeParam
.
srcFieldName
}}
"));
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"DATACONTEXT"
)
}}
param.put("param
{{
@index
}}
",default.get("
{{
lowerCase
nodeParam
.
srcFieldName
}}
"));
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"ENVPARAM"
)
}}
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"VIEWPARAM"
)
}}
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"NONE"
)
}}
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"NULLVALUE"
)
}}
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"SRCVALUE"
)
}}
param.put("param
{{
@index
}}
",default.get("
{{
lowerCase
nodeParam
.
srcValue
}}
"));
{{/if}}
{{/
each
}}
{{else}}
Map param = null;
{{/if}}
String strSql="
{{
logicNodeModel
.
rawSql
}}
";
{{#if
logicNodeModel
.
pSDELogicNode
.
isFillDstLogicParam
}}
{{#if
logicNodeModel
.
pSDELogicNode
.
isFillDstLogicParam
}}
java.util.List
<JSONObject>
entities=iBzSys
{{
logicNodeModel
.
logicModel
.
entity
.
codeName
}}
DefaultService.select(strSql,param);//SQL调用
if(entities.size()>0
&&
!ObjectUtils.isEmpty(entities.get(0))){
JSONObject entity=entities.get(0);
{{#if
logicNodeModel
.
pSDELogicNode
.
dstPSDELogicParam
.
paramPSDataEntity
}}
for (Map.Entry entry : entity.entrySet()) {
{{
lowerCase
logicNodeModel
.
pSDELogicNode
.
dstPSDELogicParam
.
codeName
}}
.set(String.valueOf(entry.getKey()),entry.getValue());
}
{{else}}
{{
lowerCase
logicNodeModel
.
pSDELogicNode
.
dstPSDELogicParam
.
codeName
}}
.putAll(entity);
{{/if}}
}
{{else}}
iBzSys
{{
logicNodeModel
.
logicModel
.
entity
.
codeName
}}
DefaultService.select(strSql,param);//SQL调用
{{/if}}
{{else}}
iBzSys
{{
logicNodeModel
.
logicModel
.
entity
.
codeName
}}
DefaultService.select(strSql,param);//SQL调用
{{/if}}
\ No newline at end of file
modules/ibizlab-template/ibizlab-template-ibizedge/src/main/resources/templ/@macro/logic/drl/StartWF.hbs
浏览文件 @
084f5e4e
//StartWF
\ No newline at end of file
{{!--
JSONObject activeData=(JSONObject) JSONObject.toJSON({{lowerCase logicNodeModel.pSDELogicNode.dstPSDELogicParam}});
Object businessKey={{lowerCase logicNodeModel.pSDELogicNode.dstPSDELogicParam}}.get("{{logicNodeModel.pSDELogicNode.pSDEWF.pSDataEntity.keyPSDEField.codeName}}");
String appName="${appName}";
if(StringUtils.isEmpty(appName))
throw new BadRequestAlertException("无法获取流程应用名称,请检查[${wfDE.getLogicName()}]实体是否已经添加到应用","StartWF","");
if(ObjectUtils.isEmpty(businessKey))
throw new BadRequestAlertException("启动流程失败,逻辑参数[${wfParam.codeName?lower_case}]中未包含实体业务主键","StartWF","");
wfClient.wfstart("${sys.codeName}",appName,"${wfDECodeName}",String.valueOf(businessKey),activeData);
--}}
\ No newline at end of file
modules/ibizlab-template/ibizlab-template-ibizedge/src/main/resources/templ/{{projectName}}-core/src/main/resources/rules/{{entities}}/{{entityLogics}}Rule.drl.hbs
浏览文件 @
084f5e4e
package
{{
packageName
}}
.
{{
entityLogic
.
entity
.
module
}}
.logic.
{{
lowerCase
entityLogic
.
entity
.
codeName
}}
logic.
{{
lowerCase
entityLogic
.
codeName
}}
;
import java.util.Map;
import java.util.HashMap;
import com.alibaba.fastjson.JSONObject;
...
...
@@ -9,6 +11,7 @@ import cn.ibizlab.util.errors.BadRequestAlertException;
{{
ruleGlobalParam
}}
{{/
each
}}
no-loop
{{#
each
entityLogic
.
logicNodeModels
as
|
logicNodeModel
|
}}
//逻辑处理节点[
{{
logicNodeModel
.
name
}}
]
...
...
modules/ibizlab-template/ibizlab-template-ibizedge/src/main/resources/templ/{{projectName}}-core/src/main/resources/rules/{{entities}}/{{entityLogics}}RuleFlow.bpmn.hbs
0 → 100644
浏览文件 @
084f5e4e
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti=
"http://activiti.org/bpmn"
xmlns:bpmndi=
"http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:dc=
"http://www.omg.org/spec/DD/20100524/DC"
xmlns:di=
"http://www.omg.org/spec/DD/20100524/DI"
xmlns:g=
"http://www.jboss.org/drools/flow/gpd"
xmlns:tns=
"http://www.jboss.org/drools"
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
expressionLanguage=
"http://www.mvel.org/2.0"
id=
"Definition"
name=
""
targetNamespace=
"http://www.jboss.org/drools"
typeLanguage=
"http://www.java.com/javaTypes"
>
<process
id=
"
{{
packageName
}}
.core.
{{
entityLogic
.
entity
.
module
}}
.service.logic.
{{
lowerCase
entityLogic
.
entity
.
codeName
}}{{
lowerCase
entityLogic
.
codeName
}}
"
isClosed=
"false"
isExecutable=
"true"
name=
"
{{
entityLogic
.
entity
.
module
}}
_
{{
lowerCase
entityLogic
.
entity
.
codeName
}}
_
{{
lowerCase
entityLogic
.
codeName
}}
_RuleFlow"
processType=
"Private"
tns:packageName=
"
{{
packageName
}}
.core.
{{
entityLogic
.
entity
.
module
}}
.service.logic.
{{
lowerCase
entityLogic
.
entity
.
codeName
}}{{
lowerCase
entityLogic
.
codeName
}}
"
>
<extensionElements>
<tns:import
name=
"java.util.Map"
/>
<tns:import
name=
"org.springframework.util.StringUtils"
/>
<tns:import
name=
"cn.ibizlab.util.helper.RuleUtils"
/>
{{#
each
entityLogic
.
pSDELogicParams
as
|
logicParam
|
}}
{{#if
logicParam
.
isDefault
}}
<tns:metaData
express=
""
name=
"
{{
lowerCase
logicParam
.
codeName
}}
"
type=
"entity"
/>
{{else}}
{{#if
logicParam
.
paramPSDataEntity
}}
<tns:metaData
express=
"new
{{
packageName
}}
.core.
{{
lowerCase
logicParam
.
paramPSDataEntity
.
pSSystemModule
.
codeName
}}
.domain.
{{
logicParam
.
paramPSDataEntity
.
codeName
}}
()"
name=
"
{{
lowerCase
logicParam
.
codeName
}}
"
type=
"refentity"
/>
{{else}}
<tns:metaData
express=
"new HashMap()"
name=
"
{{
lowerCase
logicParam
.
codeName
}}
"
type=
"refentity"
/>
{{/if}}
{{/if}}
{{/
each
}}
{{#
each
entityLogic
.
bpmnTnsParams
as
|
bpmnTnsParam
|
}}
{{
bpmnTnsParam
}}
{{/
each
}}
</extensionElements>
{{!-- 绘制处理节点 --}}
{{#
each
entityLogic
.
logicNodeModels
as
|
logicNodeModel
|
}}
<!--
{{
logicNodeModel
.
name
}}
-->
{{#if
(
eq
logicNodeModel
.
getLogicNodeType
'BEGIN'
)
}}
<startEvent
id=
"
{{
lowerCase
logicNodeModel
.
codeName
}}
"
isInterrupting=
"true"
/>
{{else}}
<businessRuleTask
activiti:exclusive=
"true"
g:ruleFlowGroup=
"
{{
lowerCase
logicNodeModel
.
codeName
}}
"
id=
"
{{
lowerCase
logicNodeModel
.
codeName
}}
"
implementation=
"http://www.jboss.org/drools/rule"
name=
"
{{
lowerCase
logicNodeModel
.
name
}}
"
/>
{{/if}}
{{#if
logicNodeModel
.
pSDELogicNode
.
getPSDELogicLinks
}}
{{else}}
<!-- 最后结束节点 -->
<endEvent
id=
"
{{
lowerCase
logicNodeModel
.
codeName
}}
_end"
name=
"end"
/>
<sequenceFlow
id=
"
{{
lowerCase
logicNodeModel
.
codeName
}}
_end_line"
sourceRef=
"
{{
lowerCase
logicNodeModel
.
codeName
}}
"
targetRef=
"
{{
lowerCase
logicNodeModel
.
codeName
}}
_end"
/>
{{/if}}
{{/
each
}}
{{!-- 绘制节点连线 --}}
{{#
each
entityLogic
.
logicLinkModels
as
|
logicLinkModel
|
}}
<!--
{{
logicLinkModel
.
name
}}
-->
<sequenceFlow
id=
"
{{
logicLinkModel
.
sourceNodeId
}}
_
{{
logicLinkModel
.
targetNodeId
}}
"
sourceRef=
"
{{
logicLinkModel
.
sourceNodeId
}}
"
targetRef=
"
{{
logicLinkModel
.
targetNodeId
}}
"
>
{{#if
logicLinkModel
.
hasCondtion
}}
<conditionExpression
language=
"http://www.jboss.org/drools/rule"
>
<
![
CDATA
[
{{
logicLinkModel
.
conditionExpression
}}
]]
>
</conditionExpression>
{{/if}}
</sequenceFlow>
{{/
each
}}
{{!-- 生成交互网关节点--}}
{{#
each
entityLogic
.
logicLinkModels
as
|
logicLinkModel
|
}}
{{#if
logicLinkModel
.
hasCondtion
}}
<exclusiveGateway
id=
"${gatewayId}"
name=
"Gateway"
gatewayDirection=
"Diverging"
default=
"${gatewayId}_end_line"
></exclusiveGateway>
<sequenceFlow
id=
"${sourceNodeId}_${gatewayId}_gatewayline"
sourceRef=
"${sourceNodeId}"
targetRef=
"${gatewayId}"
></sequenceFlow>
<sequenceFlow
id=
"${gatewayId}_end_line"
sourceRef=
"${gatewayId}"
targetRef=
"${gatewayId}_end"
/><
#
comment
>
生成流程最后一个处理节点与End节点之间的连线
</
#
comment>
<endEvent
id=
"${gatewayId}_end"
name=
"end"
/>
{{/if}}
{{/
each
}}
</process>
</definitions>
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录