Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdst
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdst
提交
2fcc245e
提交
2fcc245e
编写于
12月 17, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
控制查询
上级
37de354e
变更
6
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
55 行增加
和
33 行删除
+55
-33
RuleEngineExService.java
.../ibizlab/core/extensions/service/RuleEngineExService.java
+16
-3
RuleItemExService.java
...cn/ibizlab/core/extensions/service/RuleItemExService.java
+11
-7
CommonEntityService.java
...lab/core/lite/extensions/service/CommonEntityService.java
+5
-4
DbEntityService.java
...ibizlab/core/lite/extensions/service/DbEntityService.java
+17
-14
MongoEntityService.java
...zlab/core/lite/extensions/service/MongoEntityService.java
+5
-4
DstCoreResource.java
.../java/cn/ibizlab/api/rest/extensions/DstCoreResource.java
+1
-1
未找到文件。
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/RuleEngineExService.java
浏览文件 @
2fcc245e
...
...
@@ -8,6 +8,7 @@ import cn.ibizlab.core.rule.filter.RuleItemSearchContext;
import
cn.ibizlab.core.rule.service.IRuleItemService
;
import
cn.ibizlab.core.rule.service.impl.RuleEngineServiceImpl
;
import
cn.ibizlab.util.helper.CachedBeanCopier
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.toolkit.IdWorker
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -65,23 +66,35 @@ public class RuleEngineExService extends RuleEngineServiceImpl {
msg
.
setId
(
IdWorker
.
getIdStr
());
msg
.
setModel
(
et
.
getModelName
());
java
.
sql
.
Timestamp
starttime
=
new
java
.
sql
.
Timestamp
(
System
.
currentTimeMillis
());
msg
.
setDatas
(
dbEntityService
.
getModelObjs
(
et
.
getModelId
(),
et
.
getLastRuntime
()));
List
<
String
>
rules
=
new
ArrayList
<>();
HashSet
<
String
>
propertys
=
new
HashSet
<>();
ruleItemService
.
list
(
Wrappers
.<
RuleItem
>
lambdaQuery
()
.
select
(
RuleItem:
:
getRuleId
).
eq
(
RuleItem:
:
getModelId
,
et
.
getModelId
()).
ne
(
RuleItem:
:
getGroup
,
"REP"
).
like
(
RuleItem:
:
getGroup
,
et
.
getGroup
()))
.
eq
(
RuleItem:
:
getModelId
,
et
.
getModelId
()).
ne
(
RuleItem:
:
getGroup
,
"REP"
).
like
(
RuleItem:
:
getGroup
,
et
.
getGroup
()))
.
forEach
(
ruleItem
->
{
String
path
=
rulePath
+
et
.
getGroup
()
+
File
.
separator
+
ruleItem
.
getRuleId
()
+
".drl"
;
File
file
=
new
File
(
path
);
if
(!
file
.
exists
())
{
ruleItemService
.
buildRuleFile
(
ruleItem
);
}
if
(
file
.
exists
())
{
rules
.
add
(
path
);
}
if
((!
StringUtils
.
isEmpty
(
ruleItem
.
getCond
()))&&
ruleItem
.
getCond
().
startsWith
(
"["
))
propertys
.
addAll
(
JSON
.
toJavaObject
(
JSON
.
parseArray
(
ruleItem
.
getCond
()),
LinkedHashSet
.
class
));
});
msg
.
setRules
(
rules
);
msg
.
setDatas
(
dbEntityService
.
getModelObjs
(
et
.
getModelId
(),
propertys
,
et
.
getLastRuntime
()));
ExecLog
execlog
=
baseEntityService
.
processAll
(
msg
);
if
(
execlog
.
getRetCode
()
!=
0
)
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/RuleItemExService.java
浏览文件 @
2fcc245e
...
...
@@ -138,13 +138,10 @@ public class RuleItemExService extends RuleItemServiceImpl {
boolean
b
=
false
;
for
(
String
key
:
modelset
.
keySet
())
{
if
(
key
.
equalsIgnoreCase
(
"datamodelname"
))
continue
;
if
(
key
.
equalsIgnoreCase
(
"EXIST"
))
if
(
key
.
equalsIgnoreCase
(
"datamodelname"
)||
key
.
startsWith
(
"EXIST"
)||
key
.
startsWith
(
"NOTEXIST"
))
continue
;
b
=
true
;
break
;
}
if
(!
b
)
{
...
...
@@ -170,16 +167,21 @@ public class RuleItemExService extends RuleItemServiceImpl {
}
param
.
put
(
"hasbusinesscatfield"
,
hasBusinesscatField
);
JSONArray
cond
=
new
JSONArray
();
LinkedHashSet
<
String
>
cond
=
new
LinkedHashSet
();
for
(
String
key
:
modelset
.
keySet
())
{
if
(
key
.
equalsIgnoreCase
(
"datamodelname"
))
continue
;
if
(
key
.
equalsIgnoreCase
(
"EXIST"
))
if
(
key
.
startsWith
(
"EXIST"
)||
key
.
startsWith
(
"NOTEXIST"
))
{
DataModel
sub
=
dataModel
.
findDataModel
(
modelset
.
get
(
key
),
"DOWN"
);
if
(
sub
!=
null
)
cond
.
add
(
sub
.
getFactPorperty
().
getPropertyName
());
continue
;
}
cond
.
add
(
key
);
}
et
.
setCond
(
cond
.
toJSONString
(
));
et
.
setCond
(
JSONArray
.
toJSONString
(
cond
));
}
...
...
@@ -356,8 +358,10 @@ public class RuleItemExService extends RuleItemServiceImpl {
{
strRelationResult
=
String
.
format
(
"%s:ModelObj %s from %s.getNested(\"%s\")"
,
relaEntity
,
strGroupCond
,
modelset
.
get
(
"datamodelname"
),
relaEntity
);
modelset
.
put
(
"EXIST"
,
relaEntity
);
modelset
.
put
(
"EXIST-"
+
relaEntity
,
relaEntity
);
}
else
if
(
relaConn
.
equals
(
"not exists"
)){
modelset
.
put
(
"NOTEXIST-"
+
relaEntity
,
relaEntity
);
strRelationResult
=
String
.
format
(
"not(exists ModelObj %s from %s.getNested(\"%s\"))"
,
strGroupCond
,
modelset
.
get
(
"datamodelname"
),
relaEntity
);
}
}
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/lite/extensions/service/CommonEntityService.java
浏览文件 @
2fcc245e
...
...
@@ -8,6 +8,7 @@ import cn.ibizlab.util.filter.QueryFilter;
import
java.sql.Timestamp
;
import
java.util.List
;
import
java.util.Set
;
public
interface
CommonEntityService
{
...
...
@@ -21,10 +22,10 @@ public interface CommonEntityService {
int
saveResultBatch
(
List
<
ExecResult
>
var1
);
int
clearResultBatch
(
List
<
ExecResult
>
var1
);
List
<
ModelObj
>
getModelObjs
(
String
metaModelId
,
Timestamp
lastModify
);
ModelObj
getModelObjs
(
String
metaModelId
,
Object
factKey
);
ModelObj
getModelObjs
(
String
metaModelId
,
Object
...
factUniKey
);
List
<
ModelObj
>
getModelObjs
(
String
metaModelId
,
List
<
EntityObj
>
kEntityObjs
);
List
<
ModelObj
>
getModelObjs
(
String
metaModelId
,
Set
<
String
>
fillPropertys
,
Timestamp
lastModify
);
ModelObj
getModelObjs
(
String
metaModelId
,
Set
<
String
>
fillPropertys
,
Object
factKey
);
ModelObj
getModelObjs
(
String
metaModelId
,
Set
<
String
>
fillPropertys
,
Object
...
factUniKey
);
List
<
ModelObj
>
getModelObjs
(
String
metaModelId
,
Set
<
String
>
fillPropertys
,
List
<
EntityObj
>
kEntityObjs
);
}
ibzdst-core/src/main/java/cn/ibizlab/core/lite/extensions/service/DbEntityService.java
浏览文件 @
2fcc245e
...
...
@@ -27,6 +27,7 @@ import java.io.Reader;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Set
;
@Service
@Primary
...
...
@@ -160,7 +161,7 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl
@Override
public
List
<
ModelObj
>
getModelObjs
(
String
metaModelId
,
Timestamp
lastModify
)
public
List
<
ModelObj
>
getModelObjs
(
String
metaModelId
,
Set
<
String
>
fillPropertys
,
Timestamp
lastModify
)
{
DataModel
dataModel
=
JSON
.
toJavaObject
(
JSON
.
parseObject
(
metaModelService
.
get
(
metaModelId
).
getConfig
()),
DataModel
.
class
);
EntityModel
entityModel
=
dataModel
.
getFactEntityModel
();
...
...
@@ -172,23 +173,23 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl
List
<
EntityObj
>
kEntityObjs
=
this
.
selectCore
(
entityModel
,
filter
);
return
getModelObjs
(
dataModel
,
kEntityObjs
);
return
getModelObjs
(
dataModel
,
fillPropertys
,
kEntityObjs
);
}
@Override
public
ModelObj
getModelObjs
(
String
metaModelId
,
Object
factKey
)
public
ModelObj
getModelObjs
(
String
metaModelId
,
Set
<
String
>
fillPropertys
,
Object
factKey
)
{
DataModel
dataModel
=
JSON
.
toJavaObject
(
JSON
.
parseObject
(
metaModelService
.
get
(
metaModelId
).
getConfig
()),
DataModel
.
class
);
List
<
EntityObj
>
kEntityObjs
=
new
ArrayList
<>();
kEntityObjs
.
add
(
new
EntityObj
().
set
(
dataModel
.
getFactEntityModel
().
getKeyField
().
getColumnName
(),
factKey
));
List
<
ModelObj
>
list
=
getModelObjs
(
dataModel
,
kEntityObjs
);
List
<
ModelObj
>
list
=
getModelObjs
(
dataModel
,
fillPropertys
,
kEntityObjs
);
if
(
list
.
size
()>
0
)
return
list
.
get
(
0
);
return
null
;
}
@Override
public
ModelObj
getModelObjs
(
String
metaModelId
,
Object
...
factUniKey
)
public
ModelObj
getModelObjs
(
String
metaModelId
,
Set
<
String
>
fillPropertys
,
Object
...
factUniKey
)
{
DataModel
dataModel
=
JSON
.
toJavaObject
(
JSON
.
parseObject
(
metaModelService
.
get
(
metaModelId
).
getConfig
()),
DataModel
.
class
);
List
<
EntityObj
>
kEntityObjs
=
new
ArrayList
<>();
...
...
@@ -197,35 +198,36 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl
for
(
int
i
=
0
;
i
<
uniKeys
.
size
();
i
++)
entityObj
.
set
(
uniKeys
.
get
(
i
).
getColumnName
(),
factUniKey
[
i
]);
kEntityObjs
.
add
(
entityObj
);
List
<
ModelObj
>
list
=
getModelObjs
(
dataModel
,
kEntityObjs
);
List
<
ModelObj
>
list
=
getModelObjs
(
dataModel
,
fillPropertys
,
kEntityObjs
);
if
(
list
.
size
()>
0
)
return
list
.
get
(
0
);
return
null
;
}
@Override
public
List
<
ModelObj
>
getModelObjs
(
String
metaModelId
,
List
<
EntityObj
>
kEntityObjs
)
public
List
<
ModelObj
>
getModelObjs
(
String
metaModelId
,
Set
<
String
>
fillPropertys
,
List
<
EntityObj
>
kEntityObjs
)
{
DataModel
dataModel
=
JSON
.
toJavaObject
(
JSON
.
parseObject
(
metaModelService
.
get
(
metaModelId
).
getConfig
()),
DataModel
.
class
);
return
getModelObjs
(
dataModel
,
kEntityObjs
);
return
getModelObjs
(
dataModel
,
fillPropertys
,
kEntityObjs
);
}
public
List
<
ModelObj
>
getModelObjs
(
DataModel
dataModel
,
List
<
EntityObj
>
kEntityObjs
)
public
List
<
ModelObj
>
getModelObjs
(
DataModel
dataModel
,
Set
<
String
>
fillPropertys
,
List
<
EntityObj
>
kEntityObjs
)
{
EntityModel
entityModel
=
dataModel
.
getFactEntityModel
();
List
<
ModelObj
>
rt
=
new
ArrayList
<>();
List
<
EntityObj
>
factEntityList
=
new
ArrayList
<>();
if
(
fillPropertys
==
null
||
fillPropertys
.
size
()==
0
||
fillPropertys
.
contains
(
dataModel
.
getFactPorperty
().
getPropertyName
()))
splitList
(
kEntityObjs
,
1000
).
forEach
(
list
->
factEntityList
.
addAll
(
this
.
selectBase
(
entityModel
,
QueryFilter
.
createQuery
().
cust
(
dataModel
.
lookup
(
list
)))));
factEntityList
.
forEach
(
entityObj
->
rt
.
add
(
new
ModelObj
().
setDataModel
(
dataModel
).
setFactEntity
(
entityObj
.
setProperty
(
dataModel
.
getFactPorperty
()))));
fillEntityObj
(
dataModel
,
rt
);
fillEntityObj
(
dataModel
,
fillPropertys
,
rt
);
dataModel
.
getNestedDataModels
().
forEach
(
subModel
->
this
.
getModelObjs
(
subModel
,
factEntityList
).
forEach
(
subObj
->
subObj
.
findParent
(
rt
)));
this
.
getModelObjs
(
subModel
,
fillPropertys
,
factEntityList
).
forEach
(
subObj
->
subObj
.
findParent
(
rt
)));
rt
.
forEach
(
modelObj
->
modelObj
.
getTimestamp
());
return
rt
;
}
public
void
fillEntityObj
(
DataModel
dataModel
,
List
<
ModelObj
>
modelObjs
)
public
void
fillEntityObj
(
DataModel
dataModel
,
Set
<
String
>
fillPropertys
,
List
<
ModelObj
>
modelObjs
)
{
if
(
dataModel
.
getObjectProperties
().
size
()>
1
)
{
...
...
@@ -235,6 +237,7 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl
continue
;
EntityModel
entityModel
=
property
.
getEntityModel
();
List
<
EntityObj
>
entityObjs
=
new
ArrayList
<>();
if
(
fillPropertys
==
null
||
fillPropertys
.
size
()==
0
||
fillPropertys
.
contains
(
property
.
getPropertyName
()))
splitList
(
modelObjs
,
1000
).
forEach
(
list
->
entityObjs
.
addAll
(
this
.
selectBase
(
entityModel
,
QueryFilter
.
createQuery
().
cust
(
property
.
lookup
(
list
)))));
entityObjs
.
forEach
(
entityObj
->
{
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/lite/extensions/service/MongoEntityService.java
浏览文件 @
2fcc245e
...
...
@@ -9,6 +9,7 @@ import org.springframework.stereotype.Service;
import
java.sql.Timestamp
;
import
java.util.List
;
import
java.util.Set
;
@Service
public
class
MongoEntityService
implements
CommonEntityService
{
...
...
@@ -46,22 +47,22 @@ public class MongoEntityService implements CommonEntityService{
}
@Override
public
List
<
ModelObj
>
getModelObjs
(
String
metaModelId
,
Timestamp
lastModify
)
{
public
List
<
ModelObj
>
getModelObjs
(
String
metaModelId
,
Set
<
String
>
fillPropertys
,
Timestamp
lastModify
)
{
return
null
;
}
@Override
public
ModelObj
getModelObjs
(
String
metaModelId
,
Object
factKey
)
{
public
ModelObj
getModelObjs
(
String
metaModelId
,
Set
<
String
>
fillPropertys
,
Object
factKey
)
{
return
null
;
}
@Override
public
ModelObj
getModelObjs
(
String
metaModelId
,
Object
...
factUniKey
)
{
public
ModelObj
getModelObjs
(
String
metaModelId
,
Set
<
String
>
fillPropertys
,
Object
...
factUniKey
)
{
return
null
;
}
@Override
public
List
<
ModelObj
>
getModelObjs
(
String
metaModelId
,
List
<
EntityObj
>
kEntityObjs
)
{
public
List
<
ModelObj
>
getModelObjs
(
String
metaModelId
,
Set
<
String
>
fillPropertys
,
List
<
EntityObj
>
kEntityObjs
)
{
return
null
;
}
}
ibzdst-provider/ibzdst-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/DstCoreResource.java
浏览文件 @
2fcc245e
...
...
@@ -48,7 +48,7 @@ public class DstCoreResource {
if
(
StringUtils
.
isEmpty
(
modelid
))
modelid
=
"dataModelff8080816a8b510c016a8c2f18b10001"
;
List
<
ModelObj
>
list
=
dbEntityService
.
getModelObjs
(
modelid
,
DataObject
.
getBeginDate
());
List
<
ModelObj
>
list
=
dbEntityService
.
getModelObjs
(
modelid
,
null
,
DataObject
.
getBeginDate
());
return
ResponseEntity
.
ok
(
list
);
}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录