Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdst
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdst
提交
0ce8481a
提交
0ce8481a
编写于
9月 09, 2021
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
调整报表
上级
ef9f2ef9
变更
12
展开全部
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
1800 行增加
和
294 行删除
+1800
-294
dareport-bbzscustom-view.less
...is/dareport-bbzscustom-view/dareport-bbzscustom-view.less
+2
-2
dareport-bbzscustom-view.vue
...sis/dareport-bbzscustom-view/dareport-bbzscustom-view.vue
+114
-127
BaseRequest.java
...n/java/cn/ibizlab/core/extensions/domain/BaseRequest.java
+18
-2
FetchParam.java
.../main/java/cn/ibizlab/core/extensions/dto/FetchParam.java
+27
-19
FetchResult.java
...main/java/cn/ibizlab/core/extensions/dto/FetchResult.java
+18
-5
VMConfig.java
...rc/main/java/cn/ibizlab/core/extensions/dto/VMConfig.java
+17
-0
BuildResultService.java
...n/ibizlab/core/extensions/service/BuildResultService.java
+102
-4
DABuildExService.java
.../cn/ibizlab/core/extensions/service/DABuildExService.java
+108
-73
RuleEngineExService.java
.../ibizlab/core/extensions/service/RuleEngineExService.java
+77
-53
ExcelTool.java
.../main/java/cn/ibizlab/core/extensions/util/ExcelTool.java
+1236
-0
DAGridCoreResource.java
...va/cn/ibizlab/api/rest/extensions/DAGridCoreResource.java
+3
-9
DstCoreResource.java
.../java/cn/ibizlab/api/rest/extensions/DstCoreResource.java
+78
-0
未找到文件。
app_web/src/pages/analysis/dareport-bbzscustom-view/dareport-bbzscustom-view.less
浏览文件 @
0ce8481a
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
padding: 10px 0;
padding: 10px 0;
> .vue-treeselect {
> .vue-treeselect {
width:
14%
;
width:
300px
;
> .vue-treeselect__control {
> .vue-treeselect__control {
height: 40px;
height: 40px;
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
}
}
> .el-select {
> .el-select {
width:
9%
;
width:
150px
;
}
}
}
}
...
...
app_web/src/pages/analysis/dareport-bbzscustom-view/dareport-bbzscustom-view.vue
浏览文件 @
0ce8481a
此差异已折叠。
点击以展开。
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/domain/BaseRequest.java
浏览文件 @
0ce8481a
package
cn
.
ibizlab
.
core
.
extensions
.
domain
;
package
cn
.
ibizlab
.
core
.
extensions
.
domain
;
import
cn.ibizlab.core.lite.extensions.domain.ModelObj
;
import
cn.ibizlab.core.lite.extensions.domain.ModelObj
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.Data
;
import
lombok.Data
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
...
@@ -9,6 +12,7 @@ import java.math.BigDecimal;
...
@@ -9,6 +12,7 @@ import java.math.BigDecimal;
import
java.math.BigInteger
;
import
java.math.BigInteger
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
@Data
@Data
...
@@ -30,6 +34,8 @@ public class BaseRequest
...
@@ -30,6 +34,8 @@ public class BaseRequest
'}'
;
'}'
;
}
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
String
toString2
()
{
public
String
toString2
()
{
return
"BaseRequest{"
+
return
"BaseRequest{"
+
"id='"
+
id
+
'\''
+
"id='"
+
id
+
'\''
+
...
@@ -42,6 +48,7 @@ public class BaseRequest
...
@@ -42,6 +48,7 @@ public class BaseRequest
}
}
private
List
<
ModelObj
>
datas
;
private
List
<
ModelObj
>
datas
;
private
String
modelId
;
private
String
model
;
private
String
model
;
private
String
engineId
;
private
String
engineId
;
private
String
resultDataSource
;
private
String
resultDataSource
;
...
@@ -50,17 +57,26 @@ public class BaseRequest
...
@@ -50,17 +57,26 @@ public class BaseRequest
private
List
<
String
>
rules
;
private
List
<
String
>
rules
;
private
List
<
String
>
ruleIds
;
private
List
<
String
>
ruleIds
;
private
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
);
private
HashSet
<
String
>
fillpropertys
;
public
String
getBatch
()
public
String
getBatch
()
{
{
if
(
batch
==
null
||
batch
.
equals
(
""
))
if
(
batch
==
null
||
batch
.
equals
(
""
))
{
{
batch
=
format
.
format
(
new
java
.
util
.
Date
())+
"["
+
model
+
"]"
;
batch
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
)
.
format
(
new
java
.
util
.
Date
())+
"["
+
model
+
"]"
;
}
}
return
this
.
batch
;
return
this
.
batch
;
}
}
public
BaseRequest
copy
(
boolean
reset
)
{
BaseRequest
baseRequest
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
this
),
BaseRequest
.
class
);
return
baseRequest
;
}
}
}
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/dto/FetchParam.java
浏览文件 @
0ce8481a
...
@@ -30,35 +30,43 @@ import java.util.*;
...
@@ -30,35 +30,43 @@ import java.util.*;
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
public
class
FetchParam
{
public
class
FetchParam
{
@JsonIgnore
@JSONField
(
serialize
=
false
)
private
String
id
;
@JsonIgnore
@JsonIgnore
@JSONField
(
serialize
=
false
)
@JSONField
(
serialize
=
false
)
public
String
getId
()
{
public
String
getId
()
{
String
str
=
"FetchParam{"
+
if
(
StringUtils
.
isEmpty
(
id
))
"reportId='"
+
reportId
+
'\''
+
{
", chartId='"
+
chartId
+
'\''
+
String
str
=
"FetchParam{"
+
", buildId='"
+
buildId
+
'\''
+
"reportId='"
+
reportId
+
'\''
+
", displayType='"
+
displayType
+
'\''
+
", chartId='"
+
chartId
+
'\''
+
", dimDict='"
+
dimDict
+
'\''
+
", buildId='"
+
buildId
+
'\''
+
", dimValues="
+
dimValues
+
", displayType='"
+
displayType
+
'\''
+
", dimValue='"
+
dimValue
+
'\''
+
", dimDict='"
+
dimDict
+
'\''
+
", includeChild="
+
includeChild
+
", dimValues="
+
dimValues
+
", metricIds="
+
metricIds
+
", dimValue='"
+
dimValue
+
'\''
+
", metricId='"
+
metricId
+
'\''
+
", includeChild="
+
includeChild
+
", startTime="
+
startTime
+
", metricIds="
+
metricIds
+
", endTime="
+
endTime
+
", metricId='"
+
metricId
+
'\''
+
", page="
+
page
+
", startTime="
+
startTime
+
", size="
+
size
+
", endTime="
+
endTime
+
", total="
+
total
+
", page="
+
page
+
", group='"
+
group
+
'\''
+
", size="
+
size
+
'}'
;
", total="
+
total
+
return
DigestUtils
.
md5DigestAsHex
(
str
.
getBytes
());
", group='"
+
group
+
'\''
+
'}'
;
id
=
DigestUtils
.
md5DigestAsHex
(
str
.
getBytes
());
}
return
id
;
}
}
private
String
reportId
;
private
String
reportId
;
private
String
chartId
;
private
String
chartId
;
private
String
buildId
;
private
String
buildId
;
private
String
title
;
// 表格展示类型:1. default(维度数据以行的形式展示),2. LIST_BOX(维度数据以列的形式展示)
// 表格展示类型:1. default(维度数据以行的形式展示),2. LIST_BOX(维度数据以列的形式展示)
private
String
displayType
=
"default"
;
private
String
displayType
=
"default"
;
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/dto/FetchResult.java
浏览文件 @
0ce8481a
...
@@ -3,6 +3,7 @@ package cn.ibizlab.core.extensions.dto;
...
@@ -3,6 +3,7 @@ package cn.ibizlab.core.extensions.dto;
import
cn.ibizlab.core.analysis.domain.DAMetric
;
import
cn.ibizlab.core.analysis.domain.DAMetric
;
import
cn.ibizlab.util.dict.Catalog
;
import
cn.ibizlab.util.dict.Catalog
;
import
cn.ibizlab.util.dict.CodeItem
;
import
cn.ibizlab.util.dict.CodeItem
;
import
cn.ibizlab.util.dict.Option
;
import
cn.ibizlab.util.helper.DataObject
;
import
cn.ibizlab.util.helper.DataObject
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
...
@@ -30,6 +31,8 @@ public class FetchResult {
...
@@ -30,6 +31,8 @@ public class FetchResult {
// 表格展示类型:1. default(维度数据以行的形式展示),2. LIST_BOX(维度数据以列的形式展示)
// 表格展示类型:1. default(维度数据以行的形式展示),2. LIST_BOX(维度数据以列的形式展示)
private
String
displayType
=
"default"
;
private
String
displayType
=
"default"
;
private
String
title
;
private
List
<
FetchItem
>
rows
;
private
List
<
FetchItem
>
rows
;
private
List
<
VMConfig
>
headers
;
private
List
<
VMConfig
>
headers
;
...
@@ -38,8 +41,8 @@ public class FetchResult {
...
@@ -38,8 +41,8 @@ public class FetchResult {
if
(
headers
==
null
)
if
(
headers
==
null
)
{
{
headers
=
new
ArrayList
<>();
headers
=
new
ArrayList
<>();
headers
.
add
(
new
VMConfig
().
setHeaderName
(
"序号"
).
setEntity
(
"item"
).
setField
(
"no"
).
setPinned
(
"left"
));
headers
.
add
(
new
VMConfig
().
setHeaderName
(
"序号"
).
setEntity
(
"item"
).
set
Width
(
50
).
set
Field
(
"no"
).
setPinned
(
"left"
));
headers
.
add
(
new
VMConfig
().
setHeaderName
(
getGroup
()).
setEntity
(
"item"
).
setField
(
"itemName"
).
setPinned
(
"left"
));
headers
.
add
(
new
VMConfig
().
setHeaderName
(
getGroup
()).
setEntity
(
"item"
).
set
Width
(
250
).
set
Field
(
"itemName"
).
setPinned
(
"left"
));
if
(
vmConfigs
!=
null
)
if
(
vmConfigs
!=
null
)
headers
.
addAll
(
vmConfigs
);
headers
.
addAll
(
vmConfigs
);
}
}
...
@@ -104,14 +107,17 @@ public class FetchResult {
...
@@ -104,14 +107,17 @@ public class FetchResult {
@JSONField
(
serialize
=
false
)
@JSONField
(
serialize
=
false
)
private
List
<
VMConfig
>
vmConfigs
;
private
List
<
VMConfig
>
vmConfigs
;
@JsonIgnore
@JSONField
(
serialize
=
false
)
private
String
group
;
private
String
group
;
private
Catalog
dict
;
private
Catalog
dict
;
private
String
selectValue
;
private
String
selectValue
;
@JsonIgnore
@JSONField
(
serialize
=
false
)
private
Option
selectDimItem
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
@JSONField
(
name
=
"startTime"
,
format
=
"yyyy-MM-dd"
)
@JSONField
(
name
=
"startTime"
,
format
=
"yyyy-MM-dd"
)
private
Timestamp
startTime
;
private
Timestamp
startTime
;
...
@@ -119,6 +125,12 @@ public class FetchResult {
...
@@ -119,6 +125,12 @@ public class FetchResult {
@JSONField
(
name
=
"endTime"
,
format
=
"yyyy-MM-dd"
)
@JSONField
(
name
=
"endTime"
,
format
=
"yyyy-MM-dd"
)
private
Timestamp
endTime
;
private
Timestamp
endTime
;
private
String
snapId
;
@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
;
public
static
FetchResult
from
(
FetchParam
fetchParam
)
public
static
FetchResult
from
(
FetchParam
fetchParam
)
{
{
FetchResult
fetchResult
=
new
FetchResult
();
FetchResult
fetchResult
=
new
FetchResult
();
...
@@ -129,7 +141,8 @@ public class FetchResult {
...
@@ -129,7 +141,8 @@ public class FetchResult {
fetchResult
.
setVmConfigs
(
fetchParam
.
getVmConfigs
());
fetchResult
.
setVmConfigs
(
fetchParam
.
getVmConfigs
());
}
}
fetchResult
.
setGroup
(
StringUtils
.
isEmpty
(
fetchParam
.
getGroup
())?
"分项"
:
fetchParam
.
getGroup
());
fetchResult
.
setGroup
(
StringUtils
.
isEmpty
(
fetchParam
.
getGroup
())?
"分项"
:
fetchParam
.
getGroup
());
fetchResult
.
setDict
(
fetchParam
.
getDict
()).
setSelectValue
(
fetchParam
.
getDimValue
()).
setStartTime
(
fetchParam
.
getStartTime
()).
setEndTime
(
fetchParam
.
getEndTime
());
fetchResult
.
setTitle
(
fetchParam
.
getTitle
()).
setDict
(
fetchParam
.
getDict
()).
setSelectValue
(
fetchParam
.
getDimValue
()).
setStartTime
(
fetchParam
.
getStartTime
()).
setEndTime
(
fetchParam
.
getEndTime
()).
setSelectDimItem
(
fetchParam
.
getDimItem
());
return
fetchResult
;
return
fetchResult
;
}
}
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/dto/VMConfig.java
浏览文件 @
0ce8481a
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
...
@@ -18,10 +19,18 @@ import java.util.*;
...
@@ -18,10 +19,18 @@ import java.util.*;
@Getter
@Getter
@Setter
@Setter
@NoArgsConstructor
@NoArgsConstructor
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
public
class
VMConfig
{
public
class
VMConfig
{
private
String
headerName
;
private
String
headerName
;
private
Integer
width
;
private
Integer
width
;
public
Integer
getWidth
()
{
if
(
width
==
null
&&(!
StringUtils
.
isEmpty
(
field
)))
return
100
;
return
width
;
}
@JSONField
(
name
=
"entity"
)
@JSONField
(
name
=
"entity"
)
@JsonProperty
(
"entity"
)
@JsonProperty
(
"entity"
)
private
String
entity
;
private
String
entity
;
...
@@ -29,8 +38,16 @@ public class VMConfig {
...
@@ -29,8 +38,16 @@ public class VMConfig {
@JsonProperty
(
"field"
)
@JsonProperty
(
"field"
)
private
String
field
;
private
String
field
;
private
String
pinned
;
private
String
pinned
;
private
Boolean
hide
;
private
List
<
VMConfig
>
children
;
private
List
<
VMConfig
>
children
;
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
boolean
isHide
()
{
return
hide
!=
null
&&
hide
;
}
public
void
setChildren
(
List
<
VMConfig
>
children
)
{
public
void
setChildren
(
List
<
VMConfig
>
children
)
{
if
(
children
!=
null
)
if
(
children
!=
null
)
children
.
forEach
(
item
->{
children
.
forEach
(
item
->{
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/BuildResultService.java
浏览文件 @
0ce8481a
...
@@ -10,15 +10,19 @@ import cn.ibizlab.core.analysis.service.impl.DAReportServiceImpl;
...
@@ -10,15 +10,19 @@ import cn.ibizlab.core.analysis.service.impl.DAReportServiceImpl;
import
cn.ibizlab.core.dict.extensions.service.DictDstService
;
import
cn.ibizlab.core.dict.extensions.service.DictDstService
;
import
cn.ibizlab.core.extensions.cql.ExecResultRepository
;
import
cn.ibizlab.core.extensions.cql.ExecResultRepository
;
import
cn.ibizlab.core.extensions.dto.*
;
import
cn.ibizlab.core.extensions.dto.*
;
import
cn.ibizlab.core.extensions.util.ExcelTool
;
import
cn.ibizlab.core.rule.domain.ExecResult
;
import
cn.ibizlab.core.rule.domain.ExecResult
;
import
cn.ibizlab.core.rule.service.IExecResultService
;
import
cn.ibizlab.core.rule.service.IExecResultService
;
import
cn.ibizlab.util.dict.Catalog
;
import
cn.ibizlab.util.dict.Catalog
;
import
cn.ibizlab.util.dict.CodeItem
;
import
cn.ibizlab.util.dict.CodeItem
;
import
cn.ibizlab.util.dict.CodeList
;
import
cn.ibizlab.util.dict.CodeList
;
import
cn.ibizlab.util.dict.Option
;
import
cn.ibizlab.util.dict.Option
;
import
cn.ibizlab.util.helper.DataObject
;
import
cn.ibizlab.util.helper.Setting
;
import
cn.ibizlab.util.helper.Setting
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder
;
import
com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder
;
import
com.baomidou.mybatisplus.core.toolkit.IdWorker
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.datastax.driver.core.PagingState
;
import
com.datastax.driver.core.PagingState
;
import
com.datastax.driver.core.ResultSet
;
import
com.datastax.driver.core.ResultSet
;
...
@@ -36,8 +40,12 @@ import org.springframework.util.Assert;
...
@@ -36,8 +40,12 @@ import org.springframework.util.Assert;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
java.io.File
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
import
static
com
.
datastax
.
driver
.
core
.
querybuilder
.
QueryBuilder
.
lte
;
import
static
com
.
datastax
.
driver
.
core
.
querybuilder
.
QueryBuilder
.
lte
;
...
@@ -82,6 +90,10 @@ public class BuildResultService {
...
@@ -82,6 +90,10 @@ public class BuildResultService {
@Lazy
@Lazy
private
ExecResultExService
execResultExService
;
private
ExecResultExService
execResultExService
;
@Autowired
@Lazy
BuildResultService
proxy
;
@Value
(
"${defaultResultDataSource:default}"
)
@Value
(
"${defaultResultDataSource:default}"
)
private
String
Default_ResultDataSource
;
private
String
Default_ResultDataSource
;
...
@@ -89,7 +101,7 @@ public class BuildResultService {
...
@@ -89,7 +101,7 @@ public class BuildResultService {
private
String
Default_ResultTableName
;
private
String
Default_ResultTableName
;
p
rivate
void
prepareFetchParam
(
FetchParam
fetchParam
)
p
ublic
void
prepareFetchParam
(
FetchParam
fetchParam
)
{
{
if
(
fetchParam
.
isFilled
())
if
(
fetchParam
.
isFilled
())
return
;
return
;
...
@@ -109,6 +121,7 @@ public class BuildResultService {
...
@@ -109,6 +121,7 @@ public class BuildResultService {
if
(!
StringUtils
.
isEmpty
(
daReport
.
getGroup
()))
if
(!
StringUtils
.
isEmpty
(
daReport
.
getGroup
()))
fetchParam
.
setGroup
(
daReport
.
getGroup
());
fetchParam
.
setGroup
(
daReport
.
getGroup
());
fetchParam
.
setTitle
(
daReport
.
getReportName
());
}
}
}
}
else
if
(!
StringUtils
.
isEmpty
(
fetchParam
.
getChartId
()))
else
if
(!
StringUtils
.
isEmpty
(
fetchParam
.
getChartId
()))
...
@@ -123,6 +136,8 @@ public class BuildResultService {
...
@@ -123,6 +136,8 @@ public class BuildResultService {
if
(!
StringUtils
.
isEmpty
(
daChart
.
getGroup
()))
if
(!
StringUtils
.
isEmpty
(
daChart
.
getGroup
()))
fetchParam
.
setGroup
(
daChart
.
getGroup
());
fetchParam
.
setGroup
(
daChart
.
getGroup
());
fetchParam
.
setTitle
(
daChart
.
getChartName
());
}
}
}
}
...
@@ -201,7 +216,8 @@ public class BuildResultService {
...
@@ -201,7 +216,8 @@ public class BuildResultService {
dimValues
.
add
(
codeItem
.
getValue
().
toString
());
dimValues
.
add
(
codeItem
.
getValue
().
toString
());
});
});
}
}
dimValues
.
add
(
fetchParam
.
getDimValue
());
if
(
dimValues
.
size
()==
0
)
dimValues
.
add
(
fetchParam
.
getDimValue
());
fetchParam
.
setDimValues
(
dimValues
);
fetchParam
.
setDimValues
(
dimValues
);
}
}
...
@@ -473,7 +489,7 @@ public class BuildResultService {
...
@@ -473,7 +489,7 @@ public class BuildResultService {
else
else
bcalsum
=
true
;
bcalsum
=
true
;
sumobj
.
setNo
(
no
).
setDimId
(
fetchParam
.
getDimValue
()).
setDimName
(
"合计"
);
sumobj
.
setNo
(
no
).
setDimId
(
fetchParam
.
getDimValue
()).
setDimName
(
(
bcalsum
||
fetchParam
.
getDimItem
()==
null
)?
"合计"
:
fetchParam
.
getDimItem
().
getLabel
()
);
for
(
DAMetric
metric:
fetchParam
.
getMetrics
().
values
())
for
(
DAMetric
metric:
fetchParam
.
getMetrics
().
values
())
{
{
sumobj
.
setVal
(
metric
.
getMetricId
(),
BigDecimal
.
ZERO
);
sumobj
.
setVal
(
metric
.
getMetricId
(),
BigDecimal
.
ZERO
);
...
@@ -701,12 +717,18 @@ public class BuildResultService {
...
@@ -701,12 +717,18 @@ public class BuildResultService {
}
}
@Cacheable
(
value
=
"dataAnalyse"
,
key
=
"'rows:cg:'+#p0.getId()"
)
public
FetchResult
getReportConfig
(
FetchParam
fetchParam
)
{
prepareFetchParam
(
fetchParam
);
return
FetchResult
.
from
(
fetchParam
);
}
@Cacheable
(
value
=
"dataAnalyse"
,
key
=
"'rows:ar:'+#p0.getId()"
)
@Cacheable
(
value
=
"dataAnalyse"
,
key
=
"'rows:ar:'+#p0.getId()"
)
public
FetchResult
getAnalyseResult
(
FetchParam
fetchParam
)
public
FetchResult
getAnalyseResult
(
FetchParam
fetchParam
)
{
{
List
<
FetchItem
>
rows
=
this
.
getResult
(
fetchParam
);
List
<
FetchItem
>
rows
=
this
.
getResult
(
fetchParam
);
return
FetchResult
.
from
(
fetchParam
).
setRows
(
rows
);
return
FetchResult
.
from
(
fetchParam
).
setRows
(
rows
)
.
setSnapId
(
fetchParam
.
getId
()).
setSnapTime
(
new
Timestamp
(
System
.
currentTimeMillis
()))
;
}
}
@CacheEvict
(
value
=
"dataAnalyse"
,
allEntries
=
true
)
@CacheEvict
(
value
=
"dataAnalyse"
,
allEntries
=
true
)
...
@@ -714,4 +736,80 @@ public class BuildResultService {
...
@@ -714,4 +736,80 @@ public class BuildResultService {
{
{
}
}
public
File
exportExcel
(
FetchParam
fetchParam
)
{
FetchResult
result
=
proxy
.
getAnalyseResult
(
fetchParam
);
Assert
.
notNull
(
result
,
"报表数据查询失败"
);
Map
<
String
,
Object
>
resultDataMap
=
new
HashMap
<
String
,
Object
>();
String
headname
=
result
.
getTitle
();
// 报表名称
Timestamp
starttime
=
result
.
getStartTime
();
// 查询开始时间
Timestamp
endtime
=
result
.
getEndTime
();
// 查询结束时间
List
<
Map
<
String
,
String
>>
titleList
=
new
ArrayList
<
Map
<
String
,
String
>>();
{
Map
<
String
,
String
>
titleMap
=
new
HashMap
<
String
,
String
>();
titleMap
.
put
(
"id"
,
"report"
);
titleMap
.
put
(
"pid"
,
"0"
);
titleMap
.
put
(
"content"
,
headname
);
titleMap
.
put
(
"fieldName"
,
"report"
);
titleList
.
add
(
titleMap
);
}
{
Map
<
String
,
String
>
titleMap
=
new
HashMap
<
String
,
String
>();
titleMap
.
put
(
"id"
,
"filter"
);
titleMap
.
put
(
"pid"
,
"report"
);
titleMap
.
put
(
"content"
,
DataObject
.
dayFormat
.
format
(
result
.
getStartTime
()).
concat
(
"到"
).
concat
(
DataObject
.
dayFormat
.
format
(
result
.
getEndTime
())));
titleMap
.
put
(
"fieldName"
,
"filter"
);
titleList
.
add
(
titleMap
);
this
.
onHandleColumn
(
result
.
getHeaders
(),
titleList
,
"filter"
);
}
return
this
.
onCreateExcelFile
(
titleList
,
result
.
getRows
(),
headname
,
headname
+
fetchParam
.
getId
(),
starttime
,
endtime
);
}
public
List
<
Map
<
String
,
String
>>
onHandleColumn
(
List
<
VMConfig
>
headers
,
List
<
Map
<
String
,
String
>>
columnDataList
,
String
pid
)
{
if
(
columnDataList
==
null
)
columnDataList
=
new
ArrayList
<
Map
<
String
,
String
>>();
if
(
StringUtils
.
isEmpty
(
pid
))
pid
=
"0"
;
for
(
VMConfig
col:
headers
){
Map
<
String
,
String
>
titleMap
=
new
HashMap
<
String
,
String
>();
String
field
=
StringUtils
.
isEmpty
(
col
.
getField
())?
IdWorker
.
get32UUID
():
col
.
getField
();
if
(
col
.
isHide
())
continue
;
titleMap
.
put
(
"id"
,
field
);
titleMap
.
put
(
"pid"
,
pid
);
titleMap
.
put
(
"content"
,
col
.
getHeaderName
());
titleMap
.
put
(
"fieldName"
,
field
);
columnDataList
.
add
(
titleMap
);
if
(!
ObjectUtils
.
isEmpty
(
col
.
getChildren
()))
onHandleColumn
(
col
.
getChildren
(),
columnDataList
,
field
);
}
return
columnDataList
;
}
public
File
onCreateExcelFile
(
List
<
Map
<
String
,
String
>>
titleList
,
List
<
FetchItem
>
rowList
,
String
headName
,
String
fileName
,
Timestamp
startTime
,
Timestamp
endTime
)
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Date
date
=
new
Date
();
String
strNowDate
=
simpleDateFormat
.
format
(
date
);
String
dirPath
=
System
.
getProperty
(
"java.io.tmpdir"
)
+
"reportExcel"
+
File
.
separator
+
strNowDate
+
File
.
separator
;
File
dir
=
new
File
(
dirPath
);
if
(!
dir
.
exists
())
dir
.
mkdirs
();
String
strFilePath
=
dirPath
+
fileName
+
".xls"
;
ExcelTool
excelTool
=
new
ExcelTool
(
"报表"
,
20
,
20
);
try
{
excelTool
.
exportExcel
(
excelTool
.
columnTransformer
(
titleList
,
"id"
,
"pid"
,
"content"
,
"fieldName"
,
"0"
),
rowList
,
strFilePath
,
true
,
false
);
}
catch
(
Exception
exception
)
{
exception
.
printStackTrace
();
}
File
file
=
new
File
(
strFilePath
);
if
(
file
.
exists
())
return
file
;
return
null
;
}
}
}
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/DABuildExService.java
浏览文件 @
0ce8481a
...
@@ -15,6 +15,7 @@ import cn.ibizlab.core.lite.extensions.service.LiteDataCallback;
...
@@ -15,6 +15,7 @@ import cn.ibizlab.core.lite.extensions.service.LiteDataCallback;
import
cn.ibizlab.core.lite.extensions.service.LiteDataService
;
import
cn.ibizlab.core.lite.extensions.service.LiteDataService
;
import
cn.ibizlab.core.lite.extensions.service.LiteModelService
;
import
cn.ibizlab.core.lite.extensions.service.LiteModelService
;
import
cn.ibizlab.core.rule.domain.ExecLog
;
import
cn.ibizlab.core.rule.domain.ExecLog
;
import
cn.ibizlab.core.rule.domain.RuleEngine
;
import
cn.ibizlab.core.rule.domain.RuleItem
;
import
cn.ibizlab.core.rule.domain.RuleItem
;
import
cn.ibizlab.core.rule.service.IExecLogService
;
import
cn.ibizlab.core.rule.service.IExecLogService
;
import
cn.ibizlab.core.rule.service.IRuleItemService
;
import
cn.ibizlab.core.rule.service.IRuleItemService
;
...
@@ -35,6 +36,7 @@ import org.springframework.context.annotation.Lazy;
...
@@ -35,6 +36,7 @@ import org.springframework.context.annotation.Lazy;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Assert
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
java.io.File
;
import
java.io.File
;
...
@@ -123,10 +125,6 @@ public class DABuildExService extends DABuildServiceImpl {
...
@@ -123,10 +125,6 @@ public class DABuildExService extends DABuildServiceImpl {
* @return
* @return
*/
*/
@Override
@Override
@Caching
(
evict
=
{
@CacheEvict
(
value
={
"dabuild"
,
"dabuilddims"
},
key
=
"'row:'+#p0.buildId"
),
@CacheEvict
(
value
=
"dataAnalyse"
,
allEntries
=
true
)
})
public
DABuild
run
(
DABuild
et
)
{
public
DABuild
run
(
DABuild
et
)
{
if
(!
StringUtils
.
isEmpty
(
et
.
getBuildId
()))
if
(!
StringUtils
.
isEmpty
(
et
.
getBuildId
()))
{
{
...
@@ -179,24 +177,10 @@ public class DABuildExService extends DABuildServiceImpl {
...
@@ -179,24 +177,10 @@ public class DABuildExService extends DABuildServiceImpl {
public
void
processData
(
EngineMQMsg
engineMQMsg
){
public
void
processData
(
EngineMQMsg
engineMQMsg
){
DABuild
et
=
get
(
engineMQMsg
.
getEngineId
());
try
{
try
{
BaseRequest
msg
=
new
BaseRequest
(
);
BaseRequest
msg
=
proxy
.
getRequest
(
engineMQMsg
.
getEngineId
(),
engineMQMsg
.
getBatch
()).
copy
(
true
);
msg
.
setId
(
IdWorker
.
getIdStr
());
msg
.
setId
(
IdWorker
.
getIdStr
());
msg
.
setModel
(
et
.
getModelName
());
msg
.
setBatch
(
engineMQMsg
.
getBatch
());
msg
.
setSystemid
(
et
.
getSystemId
());
msg
.
setEngineId
(
engineMQMsg
.
getEngineId
());
String
resultDataSource
=
Setting
.
getValue
(
et
.
getExtParams
(),
"resultDataSource"
);
String
resultTableName
=
Setting
.
getValue
(
et
.
getExtParams
(),
"resultTableName"
);
if
(
StringUtils
.
isEmpty
(
resultDataSource
)){
resultDataSource
=
Default_ResultDataSource
;
}
if
(
StringUtils
.
isEmpty
(
resultTableName
)){
resultTableName
=
Default_ResultTableName
;
}
msg
.
setResultDataSource
(
resultDataSource
);
msg
.
setResultTableName
(
resultTableName
);
ExecLog
execlog
=
new
ExecLog
();
ExecLog
execlog
=
new
ExecLog
();
execlog
.
setId
(
msg
.
getId
());
execlog
.
setId
(
msg
.
getId
());
...
@@ -205,59 +189,7 @@ public class DABuildExService extends DABuildServiceImpl {
...
@@ -205,59 +189,7 @@ public class DABuildExService extends DABuildServiceImpl {
execlog
.
setSystemId
(
msg
.
getSystemid
());
execlog
.
setSystemId
(
msg
.
getSystemid
());
ruExecLogService
.
create
(
execlog
);
ruExecLogService
.
create
(
execlog
);
List
<
String
>
ruleIds
=
new
ArrayList
<>();
msg
.
setDatas
(
liteDataService
.
getModelObjs
(
msg
.
getModelId
(),
msg
.
getFillpropertys
(),
engineMQMsg
.
getDatas
()));
List
<
String
>
rulePaths
=
new
ArrayList
<>();
DataModel
dataModel
=
liteModelService
.
getDataModel
(
et
.
getModelId
());
HashSet
<
String
>
fillpropertys
=
new
HashSet
<>();
List
<
String
>
metrics
=
new
ArrayList
<>();
idaMetricService
.
list
(
Wrappers
.<
DAMetric
>
lambdaQuery
().
eq
(
DAMetric:
:
getBuildId
,
et
.
getBuildId
()))
.
forEach
(
daMetric
->
{
metrics
.
add
(
daMetric
.
getMetricId
());
});
if
(
metrics
.
size
()
==
0
){
log
.
error
(
String
.
format
(
"构建数据失败:未配置指标"
));
return
;
}
ruleItemService
.
list
(
Wrappers
.<
RuleItem
>
lambdaQuery
().
in
(
RuleItem:
:
getRuleId
,
metrics
))
.
forEach
(
ruleItem
->
{
String
path
=
rulePath
+
ruleItem
.
getGroup
()
+
File
.
separator
+
ruleItem
.
getRuleId
()
+
".drl"
;
File
file
=
new
File
(
path
);
if
(!
file
.
exists
())
{
ruleItemService
.
buildRuleFile
(
ruleItem
);
}
if
(
file
.
exists
())
{
rulePaths
.
add
(
path
);
ruleIds
.
add
(
ruleItem
.
getRuleId
());
}
if
((!
StringUtils
.
isEmpty
(
ruleItem
.
getCond
()))&&
ruleItem
.
getCond
().
startsWith
(
"["
))
fillpropertys
.
addAll
(
JSON
.
toJavaObject
(
JSON
.
parseArray
(
ruleItem
.
getCond
()),
LinkedHashSet
.
class
));
});
if
(
ruleIds
.
size
()
==
0
){
log
.
error
(
String
.
format
(
"构建数据失败:无有效规则"
));
return
;
}
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
.
setRuleIds
(
ruleIds
);
msg
.
setRules
(
rulePaths
);
msg
.
setDatas
(
liteDataService
.
getModelObjs
(
et
.
getModelId
(),
fillpropertys
,
engineMQMsg
.
getDatas
()));
analyseEntityServiceImpl
.
processAll
(
msg
);
analyseEntityServiceImpl
.
processAll
(
msg
);
...
@@ -273,8 +205,110 @@ public class DABuildExService extends DABuildServiceImpl {
...
@@ -273,8 +205,110 @@ public class DABuildExService extends DABuildServiceImpl {
param
.
put
(
"runtime"
,
engineMQMsg
.
getRunTime
());
param
.
put
(
"runtime"
,
engineMQMsg
.
getRunTime
());
param
.
put
(
"engineId"
,
engineMQMsg
.
getEngineId
());
param
.
put
(
"engineId"
,
engineMQMsg
.
getEngineId
());
this
.
execute
(
updateSql
,
param
);
this
.
execute
(
updateSql
,
param
);
if
(
this
.
count
(
Wrappers
.<
DABuild
>
lambdaQuery
().
eq
(
DABuild:
:
getBuildId
,
engineMQMsg
.
getEngineId
()).
eq
(
DABuild:
:
getState
,
"FINISH"
))==
1
)
{
proxy
.
resetRequest
(
engineMQMsg
.
getEngineId
(),
engineMQMsg
.
getBatch
());
proxy
.
resetBuild
(
engineMQMsg
.
getEngineId
());
proxy
.
resetDataAnalyseResult
();
}
}
@Cacheable
(
value
=
"dabuild"
,
key
=
"'batch:'+#p0+#p1"
)
public
BaseRequest
getRequest
(
String
id
,
String
batch
)
{
DABuild
et
=
get
(
id
);
BaseRequest
msg
=
new
BaseRequest
();
msg
.
setModelId
(
et
.
getModelId
());
msg
.
setModel
(
et
.
getModelName
());
msg
.
setBatch
(
batch
);
msg
.
setSystemid
(
et
.
getSystemId
());
msg
.
setEngineId
(
id
);
String
resultDataSource
=
Setting
.
getValue
(
et
.
getExtParams
(),
"resultDataSource"
);
String
resultTableName
=
Setting
.
getValue
(
et
.
getExtParams
(),
"resultTableName"
);
if
(
StringUtils
.
isEmpty
(
resultDataSource
)){
resultDataSource
=
Default_ResultDataSource
;
}
if
(
StringUtils
.
isEmpty
(
resultTableName
)){
resultTableName
=
Default_ResultTableName
;
}
msg
.
setResultDataSource
(
resultDataSource
);
msg
.
setResultTableName
(
resultTableName
);
List
<
String
>
ruleIds
=
new
ArrayList
<>();
List
<
String
>
rulePaths
=
new
ArrayList
<>();
DataModel
dataModel
=
liteModelService
.
getDataModel
(
et
.
getModelId
());
HashSet
<
String
>
fillpropertys
=
new
HashSet
<>();
List
<
String
>
metrics
=
new
ArrayList
<>();
idaMetricService
.
list
(
Wrappers
.<
DAMetric
>
lambdaQuery
().
eq
(
DAMetric:
:
getBuildId
,
et
.
getBuildId
()))
.
forEach
(
daMetric
->
{
metrics
.
add
(
daMetric
.
getMetricId
());
});
Assert
.
notEmpty
(
metrics
,
"构建数据失败:未配置指标"
);
ruleItemService
.
list
(
Wrappers
.<
RuleItem
>
lambdaQuery
().
in
(
RuleItem:
:
getRuleId
,
metrics
))
.
forEach
(
ruleItem
->
{
String
path
=
rulePath
+
ruleItem
.
getGroup
()
+
File
.
separator
+
ruleItem
.
getRuleId
()
+
".drl"
;
File
file
=
new
File
(
path
);
if
(!
file
.
exists
())
{
ruleItemService
.
buildRuleFile
(
ruleItem
);
}
if
(
file
.
exists
())
{
rulePaths
.
add
(
path
);
ruleIds
.
add
(
ruleItem
.
getRuleId
());
}
if
((!
StringUtils
.
isEmpty
(
ruleItem
.
getCond
()))&&
ruleItem
.
getCond
().
startsWith
(
"["
))
fillpropertys
.
addAll
(
JSON
.
toJavaObject
(
JSON
.
parseArray
(
ruleItem
.
getCond
()),
LinkedHashSet
.
class
));
});
Assert
.
notEmpty
(
ruleIds
,
"构建数据失败:无有效规则"
);
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
.
setFillpropertys
(
fillpropertys
);
msg
.
setRuleIds
(
ruleIds
);
msg
.
setRules
(
rulePaths
);
return
msg
;
}
}
@CacheEvict
(
value
=
"dabuild"
,
key
=
"'batch:'+#p0+#p1"
)
public
void
resetRequest
(
String
id
,
String
batch
)
{
}
@CacheEvict
(
value
=
"dataAnalyse"
,
allEntries
=
true
)
public
void
resetDataAnalyseResult
()
{
}
@CacheEvict
(
value
={
"dabuild"
,
"dabuilddims"
},
key
=
"'row:'+#p0"
)
public
void
resetBuild
(
String
id
)
{
}
@Autowired
@Lazy
DABuildExService
proxy
;
@Cacheable
(
value
=
"dabuilddims"
,
key
=
"'row:'+#p0"
)
@Cacheable
(
value
=
"dabuilddims"
,
key
=
"'row:'+#p0"
)
public
List
<
DADimension
>
getDims
(
String
id
)
public
List
<
DADimension
>
getDims
(
String
id
)
...
@@ -282,6 +316,7 @@ public class DABuildExService extends DABuildServiceImpl {
...
@@ -282,6 +316,7 @@ public class DABuildExService extends DABuildServiceImpl {
return
this
.
get
(
id
).
getDadimension
();
return
this
.
get
(
id
).
getDadimension
();
}
}
@Override
@Override
@Transactional
@Transactional
@CacheEvict
(
value
={
"dabuild"
,
"dabuilddims"
},
key
=
"'row:'+#p0.buildId"
)
@CacheEvict
(
value
={
"dabuild"
,
"dabuilddims"
},
key
=
"'row:'+#p0.buildId"
)
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/RuleEngineExService.java
浏览文件 @
0ce8481a
...
@@ -23,6 +23,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
...
@@ -23,6 +23,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -133,24 +135,10 @@ public class RuleEngineExService extends RuleEngineServiceImpl {
...
@@ -133,24 +135,10 @@ public class RuleEngineExService extends RuleEngineServiceImpl {
protected
IExecLogService
ruExecLogService
;
protected
IExecLogService
ruExecLogService
;
public
void
processData
(
EngineMQMsg
engineMQMsg
){
public
void
processData
(
EngineMQMsg
engineMQMsg
){
RuleEngine
et
=
get
(
engineMQMsg
.
getEngineId
());
try
{
try
{
BaseRequest
msg
=
new
BaseRequest
(
);
BaseRequest
msg
=
proxy
.
getRequest
(
engineMQMsg
.
getEngineId
(),
engineMQMsg
.
getBatch
()).
copy
(
true
);
msg
.
setId
(
IdWorker
.
getIdStr
());
msg
.
setId
(
IdWorker
.
getIdStr
());
msg
.
setModel
(
et
.
getModelName
());
msg
.
setBatch
(
engineMQMsg
.
getBatch
());
msg
.
setSystemid
(
et
.
getSystemId
());
msg
.
setEngineId
(
engineMQMsg
.
getEngineId
());
String
resultDataSource
=
Setting
.
getValue
(
et
.
getExtParams
(),
"resultDataSource"
);
String
resultTableName
=
Setting
.
getValue
(
et
.
getExtParams
(),
"resultTableName"
);
if
(
StringUtils
.
isEmpty
(
resultDataSource
)){
resultDataSource
=
Default_ResultDataSource
;
}
if
(
StringUtils
.
isEmpty
(
resultTableName
)){
resultTableName
=
Default_ResultTableName
;
}
msg
.
setResultDataSource
(
resultDataSource
);
msg
.
setResultTableName
(
resultTableName
);
ExecLog
execlog
=
new
ExecLog
();
ExecLog
execlog
=
new
ExecLog
();
execlog
.
setId
(
msg
.
getId
());
execlog
.
setId
(
msg
.
getId
());
...
@@ -158,43 +146,7 @@ public class RuleEngineExService extends RuleEngineServiceImpl {
...
@@ -158,43 +146,7 @@ public class RuleEngineExService extends RuleEngineServiceImpl {
execlog
.
setKeyValueField
(
msg
.
getModel
());
execlog
.
setKeyValueField
(
msg
.
getModel
());
execlog
.
setSystemId
(
msg
.
getSystemid
());
execlog
.
setSystemId
(
msg
.
getSystemid
());
ruExecLogService
.
create
(
execlog
);
ruExecLogService
.
create
(
execlog
);
msg
.
setDatas
(
liteDataService
.
getModelObjs
(
msg
.
getModelId
(),
msg
.
getFillpropertys
(),
engineMQMsg
.
getDatas
()));
List
<
String
>
rules
=
new
ArrayList
<>();
DataModel
dataModel
=
liteModelService
.
getDataModel
(
et
.
getModelId
());
HashSet
<
String
>
fillpropertys
=
new
HashSet
<>();
ruleItemService
.
list
(
Wrappers
.<
RuleItem
>
lambdaQuery
()
.
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
(
"["
))
fillpropertys
.
addAll
(
JSON
.
toJavaObject
(
JSON
.
parseArray
(
ruleItem
.
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
.
setDatas
(
liteDataService
.
getModelObjs
(
et
.
getModelId
(),
fillpropertys
,
engineMQMsg
.
getDatas
()));
baseEntityService
.
processAll
(
msg
);
baseEntityService
.
processAll
(
msg
);
}
catch
(
Exception
ex
){
}
catch
(
Exception
ex
){
...
@@ -209,7 +161,79 @@ public class RuleEngineExService extends RuleEngineServiceImpl {
...
@@ -209,7 +161,79 @@ public class RuleEngineExService extends RuleEngineServiceImpl {
param
.
put
(
"runtime"
,
engineMQMsg
.
getRunTime
());
param
.
put
(
"runtime"
,
engineMQMsg
.
getRunTime
());
param
.
put
(
"engineId"
,
engineMQMsg
.
getEngineId
());
param
.
put
(
"engineId"
,
engineMQMsg
.
getEngineId
());
this
.
execute
(
updateSql
,
param
);
this
.
execute
(
updateSql
,
param
);
if
(
this
.
count
(
Wrappers
.<
RuleEngine
>
lambdaQuery
().
eq
(
RuleEngine:
:
getEngineId
,
engineMQMsg
.
getEngineId
()).
eq
(
RuleEngine:
:
getState
,
"FINISH"
))==
1
)
{
proxy
.
resetRequest
(
engineMQMsg
.
getEngineId
(),
engineMQMsg
.
getBatch
());
}
}
}
@Autowired
@Lazy
RuleEngineExService
proxy
;
@Cacheable
(
value
=
"ruleengine"
,
key
=
"'batch:'+#p0+#p1"
)
public
BaseRequest
getRequest
(
String
id
,
String
batch
)
{
RuleEngine
et
=
get
(
id
);
BaseRequest
msg
=
new
BaseRequest
();
msg
.
setModelId
(
et
.
getModelId
());
msg
.
setModel
(
et
.
getModelName
());
msg
.
setBatch
(
batch
);
msg
.
setSystemid
(
et
.
getSystemId
());
msg
.
setEngineId
(
id
);
String
resultDataSource
=
Setting
.
getValue
(
et
.
getExtParams
(),
"resultDataSource"
);
String
resultTableName
=
Setting
.
getValue
(
et
.
getExtParams
(),
"resultTableName"
);
if
(
StringUtils
.
isEmpty
(
resultDataSource
)){
resultDataSource
=
Default_ResultDataSource
;
}
if
(
StringUtils
.
isEmpty
(
resultTableName
)){
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
<>();
ruleItemService
.
list
(
Wrappers
.<
RuleItem
>
lambdaQuery
()
.
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
(
"["
))
fillpropertys
.
addAll
(
JSON
.
toJavaObject
(
JSON
.
parseArray
(
ruleItem
.
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
);
return
msg
;
}
@CacheEvict
(
value
=
"ruleengine"
,
key
=
"'batch:'+#p0+#p1"
)
public
void
resetRequest
(
String
id
,
String
batch
)
{
}
/**
/**
* [Check:校验] 行为扩展
* [Check:校验] 行为扩展
* @param et
* @param et
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/util/ExcelTool.java
0 → 100644
浏览文件 @
0ce8481a
此差异已折叠。
点击以展开。
ibzdst-provider/ibzdst-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/DAGridCoreResource.java
浏览文件 @
0ce8481a
...
@@ -9,6 +9,7 @@ import cn.ibizlab.core.extensions.dto.FetchParam;
...
@@ -9,6 +9,7 @@ import cn.ibizlab.core.extensions.dto.FetchParam;
import
cn.ibizlab.core.extensions.dto.FetchResult
;
import
cn.ibizlab.core.extensions.dto.FetchResult
;
import
cn.ibizlab.core.extensions.service.BuildResultService
;
import
cn.ibizlab.core.extensions.service.BuildResultService
;
import
cn.ibizlab.core.extensions.service.DACoreService
;
import
cn.ibizlab.core.extensions.service.DACoreService
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
import
cn.ibizlab.util.helper.DataObject
;
import
cn.ibizlab.util.helper.DataObject
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
...
@@ -24,6 +25,8 @@ import org.springframework.http.ResponseEntity;
...
@@ -24,6 +25,8 @@ import org.springframework.http.ResponseEntity;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.util.List
;
import
java.util.List
;
...
@@ -42,16 +45,7 @@ public class DAGridCoreResource {
...
@@ -42,16 +45,7 @@ public class DAGridCoreResource {
@Lazy
@Lazy
private
DictOptionServiceImpl
dictOptionService
;
private
DictOptionServiceImpl
dictOptionService
;
@Autowired
private
BuildResultService
buildResultService
;
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
{
"/dst/report/{reportId}/{dimValue}"
,
"/dst/report/{reportId}"
})
public
ResponseEntity
<
FetchResult
>
getReportdatas
(
@PathVariable
(
name
=
"reportId"
)
String
reportId
,
@PathVariable
(
name
=
"dimValue"
,
required
=
false
)
String
dimValue
,
@RequestParam
(
name
=
"startTime"
,
required
=
false
)
String
startTime
,
@RequestParam
(
name
=
"endTime"
,
required
=
false
)
String
endTime
)
{
FetchParam
param
=
new
FetchParam
().
setReportId
(
reportId
).
setDimValue
(
dimValue
).
setStartTime
(
DataObject
.
getTimestampValue
(
startTime
,
null
)).
setEndTime
(
DataObject
.
getTimestampValue
(
endTime
,
null
));
return
ResponseEntity
.
ok
(
buildResultService
.
getAnalyseResult
(
param
));
}
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/ibizutil/reportdatas"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/ibizutil/reportdatas"
)
public
ResponseEntity
<
JSONObject
>
getReportdatas
(
@RequestBody
JSONObject
data
)
{
public
ResponseEntity
<
JSONObject
>
getReportdatas
(
@RequestBody
JSONObject
data
)
{
...
...
ibzdst-provider/ibzdst-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/DstCoreResource.java
浏览文件 @
0ce8481a
package
cn
.
ibizlab
.
api
.
rest
.
extensions
;
package
cn
.
ibizlab
.
api
.
rest
.
extensions
;
import
cn.ibizlab.core.dict.extensions.service.DictDstService
;
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.service.BuildResultService
;
import
cn.ibizlab.core.lite.domain.DstSystem
;
import
cn.ibizlab.core.lite.domain.DstSystem
;
import
cn.ibizlab.core.lite.domain.MetaEntity
;
import
cn.ibizlab.core.lite.domain.MetaEntity
;
import
cn.ibizlab.core.lite.domain.MetaField
;
import
cn.ibizlab.core.lite.domain.MetaField
;
...
@@ -16,12 +19,15 @@ import cn.ibizlab.core.lite.service.IMetaFieldService;
...
@@ -16,12 +19,15 @@ import cn.ibizlab.core.lite.service.IMetaFieldService;
import
cn.ibizlab.util.dict.CodeItem
;
import
cn.ibizlab.util.dict.CodeItem
;
import
cn.ibizlab.util.dict.CodeList
;
import
cn.ibizlab.util.dict.CodeList
;
import
cn.ibizlab.util.dict.Option
;
import
cn.ibizlab.util.dict.Option
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
import
cn.ibizlab.util.filter.QueryFilter
;
import
cn.ibizlab.util.filter.QueryFilter
;
import
cn.ibizlab.util.helper.DataObject
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
...
@@ -29,6 +35,8 @@ import org.springframework.util.StringUtils;
...
@@ -29,6 +35,8 @@ import org.springframework.util.StringUtils;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -279,4 +287,74 @@ public class DstCoreResource {
...
@@ -279,4 +287,74 @@ public class DstCoreResource {
}
}
@Autowired
private
BuildResultService
buildResultService
;
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
{
"/dst/report/{reportId}/{dimValue}/config"
,
"/dst/report/{reportId}/config"
,
"/lite/report/{reportId}/{dimValue}/config"
,
"/lite/report/{reportId}/config"
})
public
ResponseEntity
<
FetchResult
>
getReportViews
(
@PathVariable
(
name
=
"reportId"
)
String
reportId
,
@PathVariable
(
name
=
"dimValue"
,
required
=
false
)
String
dimValue
,
@RequestParam
(
name
=
"startTime"
,
required
=
false
)
String
startTime
,
@RequestParam
(
name
=
"endTime"
,
required
=
false
)
String
endTime
)
{
FetchParam
param
=
new
FetchParam
().
setReportId
(
reportId
).
setDimValue
(
dimValue
).
setStartTime
(
DataObject
.
getTimestampValue
(
startTime
,
null
)).
setEndTime
(
DataObject
.
getTimestampValue
(
endTime
,
null
));
return
ResponseEntity
.
ok
(
buildResultService
.
getReportConfig
(
param
));
}
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
{
"/dst/report/{reportId}/{dimValue}"
,
"/dst/report/{reportId}"
,
"/lite/report/{reportId}/{dimValue}"
,
"/lite/report/{reportId}"
})
public
ResponseEntity
<
FetchResult
>
getReportdatas
(
@PathVariable
(
name
=
"reportId"
)
String
reportId
,
@PathVariable
(
name
=
"dimValue"
,
required
=
false
)
String
dimValue
,
@RequestParam
(
name
=
"startTime"
,
required
=
false
)
String
startTime
,
@RequestParam
(
name
=
"endTime"
,
required
=
false
)
String
endTime
)
{
FetchParam
param
=
new
FetchParam
().
setReportId
(
reportId
).
setDimValue
(
dimValue
).
setStartTime
(
DataObject
.
getTimestampValue
(
startTime
,
null
)).
setEndTime
(
DataObject
.
getTimestampValue
(
endTime
,
null
));
return
ResponseEntity
.
ok
(
buildResultService
.
getAnalyseResult
(
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
,
@RequestParam
(
name
=
"startTime"
,
required
=
false
)
String
startTime
,
@RequestParam
(
name
=
"endTime"
,
required
=
false
)
String
endTime
,
HttpServletResponse
response
)
{
FetchParam
param
=
new
FetchParam
().
setReportId
(
reportId
).
setDimValue
(
dimValue
).
setStartTime
(
DataObject
.
getTimestampValue
(
startTime
,
null
)).
setEndTime
(
DataObject
.
getTimestampValue
(
endTime
,
null
));
File
file
=
buildResultService
.
exportExcel
(
param
);
if
(
file
==
null
)
throw
new
BadRequestAlertException
(
"导出报表失败"
,
"Report"
,
reportId
);
try
{
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
new
String
(
file
.
getName
().
getBytes
(
"utf-8"
),
"iso8859-1"
));
//防止中文乱码
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
BufferedInputStream
bis
=
null
;
BufferedOutputStream
bos
=
null
;
try
{
bis
=
new
BufferedInputStream
(
new
FileInputStream
(
file
));
bos
=
new
BufferedOutputStream
(
response
.
getOutputStream
());
byte
[]
buff
=
new
byte
[
2048
];
int
bytesRead
;
while
(-
1
!=
(
bytesRead
=
bis
.
read
(
buff
,
0
,
buff
.
length
)))
{
bos
.
write
(
buff
,
0
,
bytesRead
);
}
}
catch
(
Exception
e
)
{
//throw e;
}
finally
{
if
(
bis
!=
null
)
{
try
{
bis
.
close
();
}
catch
(
IOException
e
)
{
}
}
if
(
bos
!=
null
)
{
try
{
bos
.
close
();
}
catch
(
IOException
e
)
{
}
}
}
}
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录