Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdst
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdst
提交
ba976042
提交
ba976042
编写于
11月 02, 2021
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
反查逻辑
上级
be285ae8
变更
4
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
113 行增加
和
4 行删除
+113
-4
LookupResult.java
...ain/java/cn/ibizlab/core/extensions/dto/LookupResult.java
+76
-0
BuildResultService.java
...n/ibizlab/core/extensions/service/BuildResultService.java
+15
-3
ExecResultExMapper.xml
...n/resources/mapper/rule/execresult/ExecResultExMapper.xml
+1
-1
DstCoreResource.java
.../java/cn/ibizlab/api/rest/extensions/DstCoreResource.java
+21
-0
未找到文件。
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/dto/LookupResult.java
0 → 100644
浏览文件 @
ba976042
package
cn
.
ibizlab
.
core
.
extensions
.
dto
;
import
cn.ibizlab.core.analysis.domain.DAMetric
;
import
cn.ibizlab.util.dict.Catalog
;
import
cn.ibizlab.util.dict.Option
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
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.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
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.Map
;
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@Getter
@Setter
@NoArgsConstructor
@Accessors
(
chain
=
true
)
public
class
LookupResult
{
private
List
<
String
>
keys
;
private
String
metricId
;
private
String
dimValue
;
private
DAMetric
metric
;
public
String
getField
()
{
if
(
metric
!=
null
&&(!
StringUtils
.
isEmpty
(
metric
.
getFieldSet
())))
{
JSONObject
jo
=
JSON
.
parseObject
(
metric
.
getFieldSet
());
String
keyvaluefield
=
""
;
if
(
jo
.
containsKey
(
"keyvaluefield"
))
keyvaluefield
=
jo
.
getString
(
"keyvaluefield"
);
if
(
StringUtils
.
isEmpty
(
keyvaluefield
)&&(
jo
.
containsKey
(
"metricfield"
)))
keyvaluefield
=
jo
.
getString
(
"metricfield"
);
return
keyvaluefield
;
}
return
null
;
}
@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
Integer
page
=
0
;
private
Integer
size
=
1000
;
private
Integer
total
=
0
;
public
Integer
getTotalPages
()
{
return
this
.
getSize
()
==
0
?
1
:
(
int
)
Math
.
ceil
((
double
)
this
.
total
/
(
double
)
this
.
getSize
());
}
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
@JSONField
(
name
=
"snapTime"
,
format
=
"yyyy-MM-dd HH:mm:ss"
)
private
Timestamp
snapTime
;
}
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/BuildResultService.java
浏览文件 @
ba976042
...
...
@@ -364,7 +364,15 @@ public class BuildResultService {
}
@Cacheable
(
value
=
"dataAnalyse"
,
key
=
"'rows:lookup:'+#p0.getId()"
)
public
List
<
String
>
lookup
(
FetchParam
fetchParam
)
{
public
LookupResult
lookup
(
FetchParam
fetchParam
)
{
prepareFetchParam
(
fetchParam
);
LookupResult
lookupResult
=
new
LookupResult
();
lookupResult
.
setDimValue
(
fetchParam
.
getDimValue
());
lookupResult
.
setMetricId
(
fetchParam
.
getMetricId
());
if
(
fetchParam
.
getMetrics
()!=
null
)
lookupResult
.
setMetric
(
fetchParam
.
getMetrics
().
get
(
fetchParam
.
getMetricId
()));
lookupResult
.
setPage
(
fetchParam
.
getPage
()).
setSize
(
fetchParam
.
getSize
()).
setTotal
(
fetchParam
.
getTotal
()).
setStartTime
(
fetchParam
.
getStartTime
()).
setEndTime
(
fetchParam
.
getEndTime
());
List
<
String
>
ret
=
new
ArrayList
<>();
if
(!
StringUtils
.
isEmpty
(
cassandraHost
))
{
...
...
@@ -389,7 +397,7 @@ public class BuildResultService {
}
else
{
//prepareFetchParam(fetchParam);
Map
<
String
,
Set
<
String
>>
tab
=
fetchParam
.
getDimTables
();
tab
.
keySet
().
forEach
(
key
->{
String
[]
args
=
key
.
split
(
"\\|"
);
...
...
@@ -397,6 +405,8 @@ public class BuildResultService {
String
tableName
=
args
[
1
];
Page
<
ExecResult
>
page
=
execResultExService
.
lookupResult
(
fetchParam
.
getPage
(),
fetchParam
.
getSize
(),
dsName
,
tableName
,
"keyvaluefield"
,
fetchParam
.
getMetricId
(),
fetchParam
.
getDimValue
(),
fetchParam
.
getStartTime
(),
fetchParam
.
getEndTime
());
if
(
lookupResult
.
getTotal
()==
0
||
lookupResult
.
getTotal
()==
null
)
lookupResult
.
setTotal
((
int
)
page
.
getTotalElements
());
page
.
getContent
().
forEach
(
item
->{
ret
.
add
(
item
.
getKeyValueField
());
});
...
...
@@ -405,7 +415,9 @@ public class BuildResultService {
}
return
ret
;
lookupResult
.
setKeys
(
ret
);
lookupResult
.
setSnapTime
(
new
Timestamp
(
System
.
currentTimeMillis
()));
return
lookupResult
;
}
...
...
ibzdst-core/src/main/resources/mapper/rule/execresult/ExecResultExMapper.xml
浏览文件 @
ba976042
...
...
@@ -131,7 +131,7 @@
</select>
<select
id=
"lookupResult"
>
<select
id=
"lookupResult"
resultType=
"cn.ibizlab.core.rule.domain.ExecResult"
>
select ${columns} from ${resultTableName} where ruleid = #{ruleid}
and RETVALUE=1 and DIMFIELD = #{dimfield}
...
...
ibzdst-provider/ibzdst-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/DstCoreResource.java
浏览文件 @
ba976042
...
...
@@ -3,6 +3,7 @@ package cn.ibizlab.api.rest.extensions;
import
cn.ibizlab.core.dict.extensions.service.DictDstService
;
import
cn.ibizlab.core.extensions.dto.FetchParam
;
import
cn.ibizlab.core.extensions.dto.FetchResult
;
import
cn.ibizlab.core.extensions.dto.LookupResult
;
import
cn.ibizlab.core.extensions.service.BuildResultService
;
import
cn.ibizlab.core.lite.domain.DstSystem
;
import
cn.ibizlab.core.lite.domain.MetaEntity
;
...
...
@@ -342,6 +343,26 @@ public class DstCoreResource
return
ResponseEntity
.
ok
(
buildResultService
.
getAnalyseResult
(
param
));
}
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
{
"/dst/lookup/{metricId}/{dimValue}"
,
"/lite/lookup/{metricId}/{dimValue}"
})
public
ResponseEntity
<
LookupResult
>
lookup
(
@PathVariable
(
name
=
"metricId"
)
String
metricId
,
@PathVariable
(
name
=
"dimValue"
)
String
dimValue
,
@RequestParam
(
name
=
"startTime"
,
required
=
false
)
String
startTime
,
@RequestParam
(
name
=
"endTime"
,
required
=
false
)
String
endTime
,
@RequestParam
(
name
=
"page"
,
required
=
false
)
Integer
page
,
@RequestParam
(
name
=
"size"
,
required
=
false
)
Integer
size
,
@RequestParam
(
name
=
"total"
,
required
=
false
)
Integer
total
)
{
FetchParam
param
=
new
FetchParam
().
setMetricId
(
metricId
).
setDimValue
(
dimValue
)
.
setStartTime
(
DataObject
.
getTimestampValue
(
startTime
,
null
)).
setEndTime
(
DataObject
.
getTimestampValue
(
endTime
,
null
));
if
(
page
!=
null
)
param
.
setPage
(
page
);
if
(
size
!=
null
)
param
.
setSize
(
size
);
if
(
total
!=
null
)
param
.
setTotal
(
total
);
return
ResponseEntity
.
ok
(
buildResultService
.
lookup
(
param
));
}
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
{
"/dst/report/{reportId}/{dimValue}.xls"
,
"/dst/report/{reportId}.xls"
,
"/lite/report/{reportId}/{dimValue}.xls"
,
"/lite/report/{reportId}.xls"
})
public
void
exportReportdatas
(
@PathVariable
(
name
=
"reportId"
)
String
reportId
,
@PathVariable
(
name
=
"dimValue"
,
required
=
false
)
String
dimValue
,
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录