Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdst
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdst
提交
e3b67fec
提交
e3b67fec
编写于
1月 21, 2021
作者:
tangyaolong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改导出模型逻辑
上级
eddcb8b5
变更
1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
52 行增加
和
30 行删除
+52
-30
MetaModelExService.java
...n/ibizlab/core/extensions/service/MetaModelExService.java
+52
-30
未找到文件。
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/MetaModelExService.java
浏览文件 @
e3b67fec
...
...
@@ -3,7 +3,11 @@ package cn.ibizlab.core.extensions.service;
import
cn.ibizlab.core.analysis.domain.DABuild
;
import
cn.ibizlab.core.analysis.domain.DADimension
;
import
cn.ibizlab.core.analysis.domain.DAMetric
;
import
cn.ibizlab.core.analysis.filter.DABuildSearchContext
;
import
cn.ibizlab.core.analysis.filter.DADimensionSearchContext
;
import
cn.ibizlab.core.analysis.filter.DAMetricSearchContext
;
import
cn.ibizlab.core.analysis.service.IDABuildService
;
import
cn.ibizlab.core.analysis.service.IDADimensionService
;
import
cn.ibizlab.core.analysis.service.IDAMetricService
;
import
cn.ibizlab.core.extensions.domain.AssembleModel
;
import
cn.ibizlab.core.lite.domain.*
;
...
...
@@ -14,6 +18,7 @@ import cn.ibizlab.core.lite.extensions.model.DataModel;
import
cn.ibizlab.core.lite.extensions.model.Property
;
import
cn.ibizlab.core.lite.extensions.service.LiteModelService
;
import
cn.ibizlab.core.lite.filter.DstDataSourceSearchContext
;
import
cn.ibizlab.core.lite.filter.MetaFieldSearchContext
;
import
cn.ibizlab.core.lite.service.*
;
import
cn.ibizlab.core.lite.service.impl.MetaModelServiceImpl
;
import
cn.ibizlab.core.rule.domain.RuleItem
;
...
...
@@ -24,6 +29,7 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.base.Joiner
;
import
liquibase.pro.packaged.D
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -43,6 +49,7 @@ import java.io.*;
import
java.nio.charset.StandardCharsets
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* 实体[模型] 自定义服务对象
...
...
@@ -67,6 +74,10 @@ public class MetaModelExService extends MetaModelServiceImpl {
@Lazy
public
IDAMetricService
idaMetricService
;
@Resource
@Lazy
public
IDADimensionService
idaDimensionService
;
@Resource
@Lazy
private
LiteModelService
liteModelService
;
...
...
@@ -253,11 +264,13 @@ public class MetaModelExService extends MetaModelServiceImpl {
Map
<
String
,
DstSystem
>
systemMap
=
new
HashMap
();
LinkedHashSet
<
String
>
entities
=
new
LinkedHashSet
<>();
List
<
DstDataSource
>
dataSources
=
new
ArrayList
<>();
// 查询模型
MetaModel
metaModel
=
metaModelService
.
get
(
et
.
getId
());
// 查询模型对应的N个规则
/*if(!ObjectUtils.isEmpty(metaModel.getRuleitems())){
for (RuleItem ruleItem : metaModel.getRuleitems()) {
List
<
RuleItem
>
ruleItems
=
ruleItemService
.
selectByModelId
(
metaModel
.
getId
());
if
(!
ObjectUtils
.
isEmpty
(
ruleItems
)){
for
(
RuleItem
ruleItem
:
ruleItems
)
{
JSONObject
fieldSet
=
JSONObject
.
parseObject
(
ruleItem
.
getFieldSet
());
if
(!
ObjectUtils
.
isEmpty
(
fieldSet
))
{
for
(
String
entityName
:
fieldSet
.
keySet
())
{
...
...
@@ -268,31 +281,39 @@ public class MetaModelExService extends MetaModelServiceImpl {
}
}
}
// 查询模型对应的N个(分析)构建
if (!ObjectUtils.isEmpty(metaModel.getBuilds())) {
for (DABuild build : metaModel.getBuilds()) {
build = idaBuildService.get(build.getBuildId());
// 维度中用到的实体
if (!ObjectUtils.isEmpty(build.getDadimension())) {
for (DADimension dimension : build.getDadimension()) {
if (!ObjectUtils.isEmpty(dimension.getName())) {
entities.add(dimension.getName());
}
}
// 查询模型下的N个构建
List
<
DABuild
>
daBuilds
=
dabuildService
.
selectByModelId
(
metaModel
.
getId
());
List
<
String
>
daBuildIds
=
daBuilds
.
stream
().
map
(
DABuild:
:
getBuildId
).
collect
(
Collectors
.
toList
());
// 查询构建下关联的N个指标
DAMetricSearchContext
damSearchContext
=
new
DAMetricSearchContext
();
damSearchContext
.
setN_buildid_in
(
Joiner
.
on
(
";"
).
join
(
daBuildIds
));
Page
<
DAMetric
>
daMetrics
=
idaMetricService
.
searchDefault
(
damSearchContext
);
// 查询构建下关联的N个维度
DADimensionSearchContext
dadSearchContext
=
new
DADimensionSearchContext
();
dadSearchContext
.
setN_buildid_in
(
Joiner
.
on
(
";"
).
join
(
daBuildIds
));
Page
<
DADimension
>
daDimensions
=
idaDimensionService
.
searchDefault
(
dadSearchContext
);
// 维度中用到的实体
if
(!
ObjectUtils
.
isEmpty
(
daDimensions
.
getContent
()))
{
for
(
DADimension
dimension
:
daDimensions
.
getContent
())
{
if
(!
ObjectUtils
.
isEmpty
(
dimension
.
getName
()))
{
entities
.
add
(
dimension
.
getName
());
}
// 指标
if (!ObjectUtils.isEmpty(build.getMetrics())) {
for (DAMetric metric : build.getMetrics()) {
JSONObject fieldSet = JSON.parseObject(metric.getFieldSet());
for (String entityName : fieldSet.keySe
t()) {
if (entityName.endsWith("entity")) {
entities.add(entityName);
}
}
}
}
// 指标中用到的实体
if
(!
ObjectUtils
.
isEmpty
(
daMetrics
.
getContent
()))
{
for
(
DAMetric
metric
:
daMetrics
.
getConten
t
())
{
JSONObject
fieldSet
=
JSON
.
parseObject
(
metric
.
getFieldSet
());
for
(
String
entityName
:
fieldSet
.
keySet
())
{
if
(
entityName
.
endsWith
(
"entity"
))
{
entities
.
add
(
entityName
);
}
metrics.addAll(build.getMetrics());
}
}
metrics
.
addAll
(
daMetrics
.
getContent
());
}
// 用到的数据源和系统
List
<
EntityModel
>
entityModels
=
getEntityModel
(
modelId
);
...
...
@@ -303,21 +324,22 @@ public class MetaModelExService extends MetaModelServiceImpl {
systemMap
.
put
(
entityModel
.
getEntity
().
getSystem
().
getPssystemid
(),
entityModel
.
getEntity
().
getSystem
());
}
}
// 查询数据源
if
(
masterDsName
.
size
()>
0
){
DstDataSourceSearchContext
s
earchContext = new DstDataSourceSearchContext();
s
earchContext.setN_dsid_in(Joiner.on(";").join(masterDsName));
s
earchContext.setSize(entityModels.size());
Page<DstDataSource> dstDataSources = dstDataSourceService.searchDefault(
s
earchContext);
DstDataSourceSearchContext
dstDataSourceS
earchContext
=
new
DstDataSourceSearchContext
();
dstDataSourceS
earchContext
.
setN_dsid_in
(
Joiner
.
on
(
";"
).
join
(
masterDsName
));
dstDataSourceS
earchContext
.
setSize
(
entityModels
.
size
());
Page
<
DstDataSource
>
dstDataSources
=
dstDataSourceService
.
searchDefault
(
dstDataSourceS
earchContext
);
dataSources
.
addAll
(
dstDataSources
.
getContent
());
}
models
.
setMetrics
(
metrics
);
models
.
setMetaModel
(
metaModel
);
models
.
setEntityModels
(
entityModels
);
models.setDaBuilds(
metaModel.getBuilds()
);
models.setRuleItems(
metaModel.getRuleitems()
);
models
.
setDaBuilds
(
daBuilds
);
models
.
setRuleItems
(
ruleItems
);
models
.
setDataSources
(
dataSources
);
models.setSystems(new ArrayList<>(systemMap.values()));
*/
models
.
setSystems
(
new
ArrayList
<>(
systemMap
.
values
()));
return
models
;
}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录