Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdst
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdst
提交
cb3a98b0
提交
cb3a98b0
编写于
6月 11, 2021
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
提交
上级
3c56a765
变更
4
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
257 行增加
和
9 行删除
+257
-9
BuildResult.java
...main/java/cn/ibizlab/core/extensions/dto/BuildResult.java
+1
-1
FetchParam.java
.../main/java/cn/ibizlab/core/extensions/dto/FetchParam.java
+95
-0
VMConfig.java
...rc/main/java/cn/ibizlab/core/extensions/dto/VMConfig.java
+78
-0
BuildResultService.java
...n/ibizlab/core/extensions/service/BuildResultService.java
+83
-8
未找到文件。
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/d
omain
/BuildResult.java
→
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/d
to
/BuildResult.java
浏览文件 @
cb3a98b0
package
cn
.
ibizlab
.
core
.
extensions
.
d
omain
;
package
cn
.
ibizlab
.
core
.
extensions
.
d
to
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/dto/FetchParam.java
0 → 100644
浏览文件 @
cb3a98b0
package
cn
.
ibizlab
.
core
.
extensions
.
dto
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
org.springframework.util.StringUtils
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@Getter
@Setter
@NoArgsConstructor
@Accessors
(
chain
=
true
)
public
class
FetchParam
{
private
String
reportId
;
private
String
chartId
;
private
String
buildId
;
// 表格展示类型:1. default(维度数据以行的形式展示),2. LIST_BOX(维度数据以列的形式展示)
private
String
displayType
=
"default"
;
private
String
dimDict
=
"DST_cl_dst_region"
;
private
List
<
String
>
dimValues
;
private
String
dimValue
;
private
boolean
includeChild
=
true
;
private
List
<
String
>
metricIds
;
private
String
metricId
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
@JSONField
(
name
=
"startTime"
,
format
=
"yyyy-MM-dd"
)
private
Timestamp
startTime
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
@JSONField
(
name
=
"endTime"
,
format
=
"yyyy-MM-dd"
)
private
Timestamp
endTime
;
private
int
page
=
0
;
private
int
size
=
100
;
public
List
<
String
>
getDimValues
()
{
if
(
dimValues
==
null
&&(!
includeChild
)&&(!
StringUtils
.
isEmpty
(
dimValue
)))
{
dimValues
=
new
ArrayList
<>();
dimValues
.
add
(
dimValue
);
}
return
dimValues
;
}
public
List
<
String
>
getMetricIds
()
{
if
(
metricIds
==
null
)
{
metricIds
=
new
ArrayList
<>();
if
(
StringUtils
.
isEmpty
(
metricId
))
metricIds
.
add
(
metricId
);
}
return
metricIds
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
private
Map
<
String
,
List
<
String
>>
dimTables
;
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
Map
<
String
,
List
<
String
>>
getDimTables
()
{
if
(
dimTables
==
null
)
dimTables
=
new
LinkedHashMap
<>();
return
dimTables
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
FetchParam
getDimTables
(
Map
<
String
,
List
<
String
>>
dimTables
)
{
this
.
dimTables
=
dimTables
;
return
this
;
}
}
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/dto/VMConfig.java
0 → 100644
浏览文件 @
cb3a98b0
package
cn
.
ibizlab
.
core
.
extensions
.
dto
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
java.util.*
;
@Getter
@Setter
@NoArgsConstructor
@Accessors
(
chain
=
true
)
public
class
VMConfig
{
private
String
headerName
;
private
String
width
;
@JSONField
(
name
=
"entity"
)
@JsonProperty
(
"entity"
)
private
String
buildId
;
@JSONField
(
name
=
"field"
)
@JsonProperty
(
"field"
)
private
String
metricId
;
private
List
<
VMConfig
>
children
;
public
Map
<
String
,
Set
<
String
>>
getBuilds
(
Map
<
String
,
Set
<
String
>>
builds
)
{
if
(
builds
==
null
)
{
builds
=
new
LinkedHashMap
<>();
}
if
((!
StringUtils
.
isEmpty
(
buildId
))
&&
(!
StringUtils
.
isEmpty
(
metricId
)))
{
if
(
builds
.
containsKey
(
buildId
))
{
builds
.
get
(
buildId
).
add
(
metricId
);
}
else
{
Set
<
String
>
metricIds
=
new
LinkedHashSet
<>();
metricIds
.
add
(
metricId
);
builds
.
put
(
buildId
,
metricIds
);
}
}
if
(!
ObjectUtils
.
isEmpty
(
children
))
{
for
(
VMConfig
item:
children
)
item
.
getBuilds
(
builds
);
}
return
builds
;
}
public
static
Map
<
String
,
Set
<
String
>>
getBuilds
(
String
vmConfig
)
{
if
(!
StringUtils
.
isEmpty
(
vmConfig
))
{
List
<
VMConfig
>
cols
=
JSONArray
.
parseArray
(
vmConfig
,
VMConfig
.
class
);
return
getBuilds
(
cols
);
}
return
new
LinkedHashMap
<>();
}
public
static
Map
<
String
,
Set
<
String
>>
getBuilds
(
List
<
VMConfig
>
list
)
{
Map
<
String
,
Set
<
String
>>
builds
=
new
LinkedHashMap
<>();
list
.
forEach
(
item
->{
item
.
getBuilds
(
builds
);
});
return
builds
;
}
}
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/BuildResultService.java
浏览文件 @
cb3a98b0
package
cn
.
ibizlab
.
core
.
extensions
.
service
;
import
cn.ibizlab.core.analysis.domain.DAChart
;
import
cn.ibizlab.core.analysis.domain.DAReport
;
import
cn.ibizlab.core.analysis.service.IDAChartService
;
import
cn.ibizlab.core.analysis.service.impl.DAReportServiceImpl
;
import
cn.ibizlab.core.dict.extensions.service.DictDstService
;
import
cn.ibizlab.core.extensions.cql.ExecResult
;
import
cn.ibizlab.core.extensions.cql.ExecResultRepository
;
import
cn.ibizlab.core.extensions.domain.BuildResult
;
import
com.datastax.driver.core.LocalDate
;
import
com.datastax.driver.core.PagingState
;
import
com.datastax.driver.core.ResultSet
;
import
com.datastax.driver.core.Statement
;
import
cn.ibizlab.core.extensions.dto.BuildResult
;
import
cn.ibizlab.core.extensions.dto.FetchParam
;
import
cn.ibizlab.core.extensions.dto.VMConfig
;
import
cn.ibizlab.util.dict.CodeItem
;
import
cn.ibizlab.util.dict.CodeList
;
import
com.alibaba.fastjson.JSONArray
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.*
;
import
static
com
.
datastax
.
driver
.
core
.
querybuilder
.
QueryBuilder
.*;
import
static
com
.
datastax
.
driver
.
core
.
querybuilder
.
QueryBuilder
.
lte
;
@Service
...
...
@@ -34,6 +39,76 @@ public class BuildResultService {
@Lazy
private
ExecResultRepository
execResultRepository
;
@Autowired
@Lazy
private
DictDstService
dictDstService
;
@Autowired
@Lazy
private
DAReportServiceImpl
daReportService
;
@Autowired
@Lazy
private
IDAChartService
daChartService
;
@Autowired
@Lazy
private
DABuildExService
daBuildExService
;
private
void
prepareFetchParam
(
FetchParam
fetchParam
)
{
if
(
(!
StringUtils
.
isEmpty
(
fetchParam
.
getDimDict
()))
&&
(!
StringUtils
.
isEmpty
(
fetchParam
.
getDimValue
()))
&&
fetchParam
.
isIncludeChild
()
&&
fetchParam
.
getDimValues
()
==
null
)
{
List
<
String
>
dimValues
=
new
ArrayList
<>();
dimValues
.
add
(
fetchParam
.
getDimValue
());
CodeList
dict
=
dictDstService
.
getCodeListCatalog
(
fetchParam
.
getDimDict
());
if
(
dict
!=
null
)
{
CodeItem
code
=
dict
.
findChildren
(
fetchParam
.
getDimValue
());
if
(
code
!=
null
&&
code
.
getChildren
()!=
null
)
{
code
.
getChildren
().
forEach
(
codeItem
->
{
dimValues
.
add
(
codeItem
.
getValue
().
toString
());
});
}
}
fetchParam
.
setDimValues
(
dimValues
);
}
if
(
ObjectUtils
.
isEmpty
(
fetchParam
.
getMetricIds
()))
{
String
vmConfig
=
""
;
if
(!
StringUtils
.
isEmpty
(
fetchParam
.
getReportId
()))
{
DAReport
daReport
=
daReportService
.
getById
(
fetchParam
.
getReportId
());
if
(
daReport
!=
null
)
vmConfig
=
daReport
.
getConfig
();
}
else
if
(!
StringUtils
.
isEmpty
(
fetchParam
.
getChartId
()))
{
DAChart
daChart
=
daChartService
.
getById
(
fetchParam
.
getChartId
());
if
(
daChart
!=
null
)
vmConfig
=
daChart
.
getConfig
();
}
Map
<
String
,
Set
<
String
>>
builds
=
null
;
if
(
StringUtils
.
isEmpty
(
vmConfig
))
builds
=
VMConfig
.
getBuilds
(
vmConfig
);
else
{
builds
=
new
LinkedHashMap
<>();
if
(
StringUtils
.
isEmpty
(
fetchParam
.
getBuildId
()))
{
builds
.
put
(
fetchParam
.
getBuildId
(),
new
LinkedHashSet
<>());
}
}
builds
.
keySet
().
forEach
(
key
->{
});
}
}
public
List
<
BuildResult
>
sum
(
List
<
String
>
ruleids
,
Integer
retValue
,
List
<
String
>
dims
,
Timestamp
start
,
Timestamp
end
)
{
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录