Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdst
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdst
提交
0ddb3cad
提交
0ddb3cad
编写于
9月 17, 2021
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
调试
上级
3ea12227
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
115 行增加
和
2 行删除
+115
-2
RuleItemExService.java
...cn/ibizlab/core/extensions/service/RuleItemExService.java
+96
-1
DstCoreResource.java
.../java/cn/ibizlab/api/rest/extensions/DstCoreResource.java
+19
-1
未找到文件。
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/RuleItemExService.java
浏览文件 @
0ddb3cad
package
cn
.
ibizlab
.
core
.
extensions
.
service
;
import
cn.ibizlab.core.extensions.domain.BaseRequest
;
import
cn.ibizlab.core.extensions.util.FreeMakerHelper
;
import
cn.ibizlab.core.lite.extensions.domain.DataObj
;
import
cn.ibizlab.core.lite.extensions.domain.EntityObj
;
import
cn.ibizlab.core.lite.extensions.model.DataModel
;
import
cn.ibizlab.core.lite.extensions.service.LiteDataService
;
import
cn.ibizlab.core.lite.extensions.service.LiteModelService
;
import
cn.ibizlab.core.lite.extensions.util.LiteStorage
;
import
cn.ibizlab.core.rule.service.impl.RuleItemServiceImpl
;
import
cn.ibizlab.util.helper.DataObject
;
import
cn.ibizlab.util.helper.Setting
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
lombok.extern.slf4j.Slf4j
;
import
cn.ibizlab.core.rule.domain.RuleItem
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.context.annotation.Primary
;
...
...
@@ -407,5 +415,92 @@ public class RuleItemExService extends RuleItemServiceImpl {
String
staticValue
=
StringUtils
.
isEmpty
(
value
)?
""
:
value
.
replace
(
"\\"
,
""
);
return
modelset
.
get
(
"datamodelname"
)+
".$S(\""
+
staticValue
+
"\")"
;
}
@Value
(
"${defaultResultDataSource:default}"
)
private
String
Default_ResultDataSource
;
@Value
(
"${defaultResultTableName:IBZRULERESULT}"
)
private
String
Default_ResultTableName
;
@Autowired
@Lazy
private
LiteDataService
liteDataService
;
@Autowired
@Lazy
private
BaseEntityService
baseEntityService
;
@Override
public
RuleItem
testRule
(
RuleItem
ruleItem
)
{
//自定义代码
String
debugKey
=
DataObject
.
getStringValue
(
ruleItem
.
get
(
"debug-key"
),
DataObject
.
getStringValue
(
ruleItem
.
get
(
"debugKey"
),
""
));
if
(
StringUtils
.
isEmpty
(
debugKey
))
return
ruleItem
;
String
tag
=
DataObject
.
getStringValue
(
ruleItem
.
getRuleId
(),
DataObject
.
getStringValue
(
ruleItem
.
getRuleCode
(),
""
));
this
.
list
(
Wrappers
.<
RuleItem
>
lambdaQuery
().
eq
(
RuleItem:
:
getRuleId
,
tag
).
or
().
eq
(
RuleItem:
:
getRuleCode
,
tag
))
.
forEach
(
et
->
{
if
(
"REP"
.
equals
(
et
.
getGroup
()))
return
;
BaseRequest
msg
=
new
BaseRequest
();
msg
.
setModelId
(
et
.
getModelId
());
msg
.
setModel
(
et
.
getModelName
());
msg
.
setSystemid
(
et
.
getSystemId
());
msg
.
setEngineId
(
"TESTRULE-DEBUG"
);
String
resultDataSource
=
Default_ResultDataSource
;
String
resultTableName
=
Default_ResultTableName
;
msg
.
setResultDataSource
(
resultDataSource
);
msg
.
setResultTableName
(
resultTableName
);
List
<
String
>
rules
=
new
ArrayList
<>();
DataModel
dataModel
=
liteModelService
.
getDataModel
(
et
.
getModelId
());
HashSet
<
String
>
fillpropertys
=
new
HashSet
<>();
String
path
=
rulePath
+
et
.
getGroup
()
+
File
.
separator
+
et
.
getRuleId
()
+
".drl"
;
File
file
=
new
File
(
path
);
if
(!
file
.
exists
())
{
this
.
buildRuleFile
(
et
);
}
if
(
file
.
exists
())
{
rules
.
add
(
path
);
}
if
((!
StringUtils
.
isEmpty
(
et
.
getCond
()))&&
et
.
getCond
().
startsWith
(
"["
))
fillpropertys
.
addAll
(
JSON
.
toJavaObject
(
JSON
.
parseArray
(
et
.
getCond
()),
LinkedHashSet
.
class
));
dataModel
.
getAllProperty
().
forEach
(
prop
->{
if
(
fillpropertys
.
contains
(
prop
.
getPropertyName
()))
{
DataModel
p
=
prop
.
getOwnerDataModel
().
getParentDataModel
();
while
(
p
!=
null
)
{
fillpropertys
.
add
(
p
.
getFactPorperty
().
getPropertyName
());
p
=
p
.
getParentDataModel
();
}
}
});
msg
.
setRules
(
rules
);
msg
.
setFillpropertys
(
fillpropertys
);
List
<
EntityObj
>
entityObjs
=
new
ArrayList
<>();
for
(
String
key:
debugKey
.
split
(
";|,"
))
{
EntityObj
entityObj
=
new
EntityObj
();
entityObj
.
put
(
dataModel
.
getFactEntityModel
().
getKeyField
().
getColumnName
().
toUpperCase
(),
key
);
entityObjs
.
add
(
entityObj
);
}
msg
.
setDatas
(
liteDataService
.
getModelObjs
(
msg
.
getModelId
(),
msg
.
getFillpropertys
(),
entityObjs
));
baseEntityService
.
processAll
(
msg
);
});
return
ruleItem
;
}
}
ibzdst-provider/ibzdst-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/DstCoreResource.java
浏览文件 @
0ddb3cad
...
...
@@ -16,6 +16,8 @@ import cn.ibizlab.core.lite.extensions.service.LiteModelService;
import
cn.ibizlab.core.lite.filter.MetaFieldSearchContext
;
import
cn.ibizlab.core.lite.service.IMetaEntityService
;
import
cn.ibizlab.core.lite.service.IMetaFieldService
;
import
cn.ibizlab.core.rule.domain.RuleItem
;
import
cn.ibizlab.core.rule.service.IRuleItemService
;
import
cn.ibizlab.util.dict.CodeItem
;
import
cn.ibizlab.util.dict.CodeList
;
import
cn.ibizlab.util.dict.Option
;
...
...
@@ -45,7 +47,8 @@ import java.util.Map;
@Api
(
tags
=
{
"接口"
})
@RestController
(
"api-litecore"
)
@RequestMapping
(
""
)
public
class
DstCoreResource
{
public
class
DstCoreResource
{
@Autowired
private
LiteModelService
liteModelService
;
...
...
@@ -53,6 +56,21 @@ public class DstCoreResource {
@Autowired
private
LiteDataService
liteDataService
;
@Autowired
private
IRuleItemService
ruleItemService
;
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
{
"/dst/test/{rulecode}/{key}"
})
public
ResponseEntity
<
Boolean
>
testRule
(
@PathVariable
(
"rulecode"
)
String
rulecode
,
@PathVariable
(
"key"
)
String
key
)
{
RuleItem
ruleItem
=
new
RuleItem
();
ruleItem
.
setRuleCode
(
rulecode
);
ruleItem
.
set
(
"debugkey"
,
key
);
ruleItemService
.
testRule
(
ruleItem
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
{
"/dst/datamodels/{modelid}/data/{key}"
,
"/lite/datamodels/{modelid}/data/{key}"
})
public
ResponseEntity
<
ModelObj
>
getModelObj
(
@PathVariable
(
name
=
"modelid"
,
required
=
false
)
String
modelid
,
@PathVariable
(
name
=
"key"
,
required
=
false
)
String
key
)
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录