Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdst
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdst
提交
f33f3e42
提交
f33f3e42
编写于
9月 10, 2021
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dict调整
上级
00c35f15
变更
5
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
198 行增加
和
44 行删除
+198
-44
DictDstService.java
.../ibizlab/core/dict/extensions/service/DictDstService.java
+108
-43
BuildResultService.java
...n/ibizlab/core/extensions/service/BuildResultService.java
+49
-1
20210910113410_changelog.xml
...esources/liquibase/changelog/20210910113410_changelog.xml
+13
-0
CodeItem.java
ibzdst-util/src/main/java/cn/ibizlab/util/dict/CodeItem.java
+14
-0
Option.java
ibzdst-util/src/main/java/cn/ibizlab/util/dict/Option.java
+14
-0
未找到文件。
ibzdst-core/src/main/java/cn/ibizlab/core/dict/extensions/service/DictDstService.java
浏览文件 @
f33f3e42
...
...
@@ -20,10 +20,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
@Slf4j
@Service
...
...
@@ -80,23 +77,57 @@ public class DictDstService
}
else
{
DictCatalog
dictCatalog
=
dictCatalogService
.
getOne
(
Wrappers
.<
DictCatalog
>
query
().
eq
(
"ccode"
,
code
));
catalog
.
setCode
(
dictCatalog
.
getCode
()).
setName
(
dictCatalog
.
getName
());
String
codeName
=
code
;
String
filter
=
""
;
String
subCode
=
""
;
if
(
codeName
.
indexOf
(
"."
)>
0
)
{
String
[]
arg
=
codeName
.
split
(
"[.]"
);
codeName
=
arg
[
0
];
subCode
=
arg
[
1
];
}
if
(
codeName
.
indexOf
(
"-"
)>
0
)
{
String
[]
arg
=
codeName
.
split
(
"-"
);
codeName
=
arg
[
0
];
filter
=
arg
[
1
];
}
DictCatalog
dictCatalog
=
dictCatalogService
.
getOne
(
Wrappers
.<
DictCatalog
>
query
().
eq
(
"ccode"
,
codeName
));
catalog
.
setCode
(
code
).
setName
(
dictCatalog
.
getName
());
List
<
Option
>
list
=
new
ArrayList
<>();
optionService
.
list
(
context
.
getSelectCond
().
eq
(
"cid"
,
dictCatalog
.
getId
()).
orderByAsc
(
"showorder"
)).
forEach
(
item
->{
Map
<
String
,
List
<
Option
>>
map
=
new
LinkedHashMap
<>();
Option
subOption
=
null
;
for
(
DictOption
item:
optionService
.
list
(
context
.
getSelectCond
().
eq
(
"cid"
,
dictCatalog
.
getId
()).
orderByAsc
(
"showorder"
)))
{
Map
<
String
,
Object
>
extension
=
new
HashMap
<>();
if
(!
StringUtils
.
isEmpty
(
item
.
getExtension
()))
extension
=
JSONObject
.
parseObject
(
item
.
getExtension
(),
Map
.
class
);
list
.
add
(
new
Option
().
setValue
(
item
.
getValue
()).
setId
(
item
.
getValue
())
.
setDisabled
(((
item
.
getDisabled
()!=
null
&&
item
.
getDisabled
()==
1
)||(
item
.
getExpired
()!=
null
&&
item
.
getExpired
()==
1
))?
true
:
false
)
.
setFilter
(
item
.
getFilter
()).
setIconClass
(
item
.
getIconClass
()).
setLabel
(
item
.
getLabel
()).
setParent
(
item
.
getParent
()).
setExtension
(
extension
)
);
});
String
pid
=
StringUtils
.
isEmpty
(
item
.
getParent
())?
"_root"
:
item
.
getParent
();
List
<
Option
>
list
=
null
;
if
(!
map
.
containsKey
(
pid
))
{
list
=
new
ArrayList
<>();
map
.
put
(
pid
,
list
);
}
else
list
=
map
.
get
(
pid
);
List
<
Option
>
codeItemTreeList
=
new
ArrayList
<
Option
>();
codeItemTreeList
=
loop
(
list
,
""
);
Option
option
=
new
Option
().
setValue
(
item
.
getValue
()).
setId
(
item
.
getValue
())
.
setDisabled
(((
item
.
getDisabled
()!=
null
&&
item
.
getDisabled
()==
1
)||(
item
.
getExpired
()!=
null
&&
item
.
getExpired
()==
1
))?
true
:
false
)
.
setFilter
(
item
.
getFilter
()).
setIconClass
(
item
.
getIconClass
()).
setLabel
(
item
.
getLabel
()).
setParent
(
item
.
getParent
()).
setExtension
(
extension
);
if
(
option
.
getValue
().
equals
(
subCode
))
subOption
=
option
;
if
(
StringUtils
.
isEmpty
(
filter
)||
option
.
getFilterSet
().
contains
(
filter
))
list
.
add
(
option
);
}
List
<
Option
>
codeItemTreeList
=
loop
(
map
,
(
StringUtils
.
isEmpty
(
subCode
))?
"_root"
:
subCode
);
if
(
subOption
!=
null
)
{
subOption
.
setChildren
(
codeItemTreeList
).
setParent
(
""
);
catalog
.
getOptions
().
add
(
subOption
);
}
else
catalog
.
setOptions
(
codeItemTreeList
);
}
return
catalog
;
...
...
@@ -152,25 +183,67 @@ public class DictDstService
catalog
.
setOptions
(
list
);
}
else
{
DictCatalog
dictCatalog
=
dictCatalogService
.
getOne
(
Wrappers
.<
DictCatalog
>
query
().
eq
(
"ccode"
,
code
));
catalog
.
setCode
(
dictCatalog
.
getCode
()).
setName
(
dictCatalog
.
getName
());
String
codeName
=
code
;
String
filter
=
""
;
String
subCode
=
""
;
if
(
codeName
.
indexOf
(
"."
)>
0
)
{
String
[]
arg
=
codeName
.
split
(
"[.]"
);
codeName
=
arg
[
0
];
subCode
=
arg
[
1
];
}
if
(
codeName
.
indexOf
(
"-"
)>
0
)
{
String
[]
arg
=
codeName
.
split
(
"-"
);
codeName
=
arg
[
0
];
filter
=
arg
[
1
];
}
List
<
CodeItem
>
list
=
new
ArrayList
<>();
optionService
.
list
(
context
.
getSelectCond
().
eq
(
"cid"
,
dictCatalog
.
getId
()).
orderByAsc
(
"showorder"
)).
forEach
(
item
->{
DictCatalog
dictCatalog
=
dictCatalogService
.
getOne
(
Wrappers
.<
DictCatalog
>
query
().
eq
(
"ccode"
,
codeName
));
catalog
.
setCode
(
code
).
setName
(
dictCatalog
.
getName
());
Map
<
String
,
List
<
CodeItem
>>
map
=
new
LinkedHashMap
<>();
List
<
CodeItem
>
alllist
=
new
ArrayList
<>();
CodeItem
subOption
=
null
;
for
(
DictOption
item:
optionService
.
list
(
context
.
getSelectCond
().
eq
(
"cid"
,
dictCatalog
.
getId
()).
orderByAsc
(
"showorder"
))){
Map
<
String
,
Object
>
extension
=
new
HashMap
<>();
if
(!
StringUtils
.
isEmpty
(
item
.
getExtension
()))
extension
=
JSONObject
.
parseObject
(
item
.
getExtension
(),
Map
.
class
);
list
.
add
(
new
CodeItem
().
setValue
(
item
.
getValue
()).
setId
(
item
.
getValue
())
.
setDisabled
(((
item
.
getDisabled
()!=
null
&&
item
.
getDisabled
()==
1
)||(
item
.
getExpired
()!=
null
&&
item
.
getExpired
()==
1
))?
true
:
false
)
.
setFilter
(
item
.
getFilter
()).
setIconClass
(
item
.
getIconClass
()).
setLabel
(
item
.
getLabel
()).
setParent
(
item
.
getParent
()).
setExtension
(
extension
)
);
}
);
catalog
.
setOptions
(
list
);
String
pid
=
StringUtils
.
isEmpty
(
item
.
getParent
())?
"_root"
:
item
.
getParent
();
List
<
CodeItem
>
list
=
null
;
if
(!
map
.
containsKey
(
pid
)
)
{
list
=
new
ArrayList
<>(
);
map
.
put
(
pid
,
list
);
}
else
list
=
map
.
get
(
pid
);
CodeItem
option
=
new
CodeItem
().
setValue
(
item
.
getValue
()).
setId
(
item
.
getValue
())
.
setDisabled
(((
item
.
getDisabled
()!=
null
&&
item
.
getDisabled
()==
1
)||(
item
.
getExpired
()!=
null
&&
item
.
getExpired
()==
1
))?
true
:
false
)
.
setFilter
(
item
.
getFilter
()).
setIconClass
(
item
.
getIconClass
()).
setLabel
(
item
.
getLabel
()).
setParent
(
item
.
getParent
()).
setExtension
(
extension
);
if
(
option
.
getValue
().
equals
(
subCode
))
subOption
=
option
;
if
(
StringUtils
.
isEmpty
(
filter
)||
option
.
getFilterSet
().
contains
(
filter
))
{
alllist
.
add
(
option
);
list
.
add
(
option
);
}
}
if
(
subOption
!=
null
)
{
List
<
CodeItem
>
codeItemTreeList
=
loopItem
(
map
,
subCode
);
codeItemTreeList
.
add
(
0
,
subOption
);
catalog
.
setOptions
(
codeItemTreeList
);
}
else
catalog
.
setOptions
(
alllist
);
}
return
catalog
;
}
...
...
@@ -181,14 +254,10 @@ public class DictDstService
}
public
List
<
Option
>
loop
(
List
<
Option
>
listCodeItem
,
Object
parentValue
)
{
public
List
<
Option
>
loop
(
Map
<
String
,
List
<
Option
>
>
listCodeItem
,
Object
parentValue
)
{
List
<
Option
>
trees
=
new
ArrayList
<
Option
>();
for
(
Option
codeItem
:
listCodeItem
)
{
String
codeItemParentValue
=
codeItem
.
getParent
();
if
(
StringUtils
.
isEmpty
(
codeItemParentValue
))
{
codeItemParentValue
=
""
;
}
if
(
parentValue
.
equals
(
codeItemParentValue
))
{
if
(
listCodeItem
.
containsKey
(
parentValue
))
{
for
(
Option
codeItem
:
listCodeItem
.
get
(
parentValue
))
{
List
<
Option
>
childCodeItem
=
loop
(
listCodeItem
,
codeItem
.
getValue
());
if
(
childCodeItem
.
size
()
>
0
)
{
codeItem
.
setChildren
(
childCodeItem
);
...
...
@@ -199,19 +268,15 @@ public class DictDstService
return
trees
;
}
public
List
<
CodeItem
>
loop
CodeItem
(
List
<
CodeItem
>
listCodeItem
,
Object
parentValue
)
{
public
List
<
CodeItem
>
loop
Item
(
Map
<
String
,
List
<
CodeItem
>
>
listCodeItem
,
Object
parentValue
)
{
List
<
CodeItem
>
trees
=
new
ArrayList
<
CodeItem
>();
for
(
CodeItem
codeItem
:
listCodeItem
)
{
String
codeItemParentValue
=
codeItem
.
getParent
();
if
(
StringUtils
.
isEmpty
(
codeItemParentValue
))
{
codeItemParentValue
=
""
;
}
if
(
parentValue
.
equals
(
codeItemParentValue
))
{
List
<
CodeItem
>
childCodeItem
=
loopCodeItem
(
listCodeItem
,
codeItem
.
getValue
());
if
(
listCodeItem
.
containsKey
(
parentValue
))
{
for
(
CodeItem
codeItem
:
listCodeItem
.
get
(
parentValue
))
{
trees
.
add
(
codeItem
);
List
<
CodeItem
>
childCodeItem
=
loopItem
(
listCodeItem
,
codeItem
.
getValue
());
if
(
childCodeItem
.
size
()
>
0
)
{
codeItem
.
setChildren
(
childCodeItem
);
trees
.
addAll
(
childCodeItem
);
}
trees
.
add
(
codeItem
);
}
}
return
trees
;
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/BuildResultService.java
浏览文件 @
f33f3e42
...
...
@@ -720,7 +720,55 @@ public class BuildResultService {
@Cacheable
(
value
=
"dataAnalyse"
,
key
=
"'rows:cg:'+#p0.getId()"
)
public
FetchResult
getReportConfig
(
FetchParam
fetchParam
)
{
prepareFetchParam
(
fetchParam
);
String
vmConfig
=
""
;
if
(!
StringUtils
.
isEmpty
(
fetchParam
.
getReportId
()))
{
DAReport
daReport
=
daReportService
.
getById
(
fetchParam
.
getReportId
());
if
(
daReport
!=
null
)
{
vmConfig
=
daReport
.
getConfig
();
if
(!
StringUtils
.
isEmpty
(
daReport
.
getDict
()))
fetchParam
.
setDimDict
(
daReport
.
getDict
());
else
fetchParam
.
setDimDict
(
"CL_DST_REGION"
);
if
(!
StringUtils
.
isEmpty
(
daReport
.
getGroup
()))
fetchParam
.
setGroup
(
daReport
.
getGroup
());
fetchParam
.
setTitle
(
daReport
.
getReportName
());
}
}
else
if
(!
StringUtils
.
isEmpty
(
fetchParam
.
getChartId
()))
{
DAChart
daChart
=
daChartService
.
getById
(
fetchParam
.
getChartId
());
if
(
daChart
!=
null
)
{
vmConfig
=
daChart
.
getConfig
();
if
(!
StringUtils
.
isEmpty
(
daChart
.
getDict
()))
fetchParam
.
setDimDict
(
daChart
.
getDict
());
else
fetchParam
.
setDimDict
(
"CL_DST_REGION"
);
if
(!
StringUtils
.
isEmpty
(
daChart
.
getGroup
()))
fetchParam
.
setGroup
(
daChart
.
getGroup
());
fetchParam
.
setTitle
(
daChart
.
getChartName
());
}
}
if
(!
StringUtils
.
isEmpty
(
vmConfig
))
{
fetchParam
.
setVmConfigs
(
JSONArray
.
parseArray
(
vmConfig
,
VMConfig
.
class
));
}
if
(!
StringUtils
.
isEmpty
(
fetchParam
.
getDimDict
()))
{
Catalog
dict
=
dictDstService
.
getDictCatalog
(
fetchParam
.
getDimDict
());
if
(
StringUtils
.
isEmpty
(
fetchParam
.
getGroup
()))
fetchParam
.
setGroup
(
dict
.
getName
());
Assert
.
notNull
(
dict
,
"未找到数据字典"
+
fetchParam
.
getDimDict
());
Assert
.
notEmpty
(
dict
.
getOptions
(),
"未找到数据字典"
+
fetchParam
.
getDimDict
());
fetchParam
.
setDict
(
dict
);
Option
dimItem
=
null
;
if
(
StringUtils
.
isEmpty
(
fetchParam
.
getDimValue
()))
{
dimItem
=
dict
.
getOptions
().
get
(
0
);
fetchParam
.
setDimValue
(
dimItem
.
getValue
().
toString
());
}
}
return
FetchResult
.
from
(
fetchParam
);
}
...
...
ibzdst-core/src/main/resources/liquibase/changelog/20210910113410_changelog.xml
0 → 100644
浏览文件 @
f33f3e42
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog
xmlns=
"http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext=
"http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:pro=
"http://www.liquibase.org/xml/ns/pro"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-3.9.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.9.xsd"
>
<changeSet
author=
"mac (generated)"
id=
"1631273658303-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"IBZDICTCATALOG"
columnName=
"EXTPARAMS"
/>
</not>
</preConditions>
<addColumn
tableName=
"IBZDICTCATALOG"
>
<column
name=
"EXTPARAMS"
type=
"CLOB(2147483647)"
/>
</addColumn>
</changeSet>
</databaseChangeLog>
ibzdst-util/src/main/java/cn/ibizlab/util/dict/CodeItem.java
浏览文件 @
f33f3e42
...
...
@@ -4,14 +4,17 @@ package cn.ibizlab.util.dict;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
liquibase.util.StringUtils
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
@Getter
@Setter
...
...
@@ -40,4 +43,15 @@ public class CodeItem
{
return
label
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
Set
<
String
>
getFilterSet
()
{
Set
<
String
>
set
=
new
HashSet
<>();
if
(!
StringUtils
.
isEmpty
(
filter
))
for
(
String
str:
filter
.
split
(
";|,"
))
set
.
add
(
str
);
return
set
;
}
}
ibzdst-util/src/main/java/cn/ibizlab/util/dict/Option.java
浏览文件 @
f33f3e42
...
...
@@ -4,13 +4,17 @@ package cn.ibizlab.util.dict;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
liquibase.util.StringUtils
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
@Getter
@Setter
...
...
@@ -31,4 +35,14 @@ public class Option
private
String
parent
;
private
Map
<
String
,
Object
>
extension
;
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
Set
<
String
>
getFilterSet
()
{
Set
<
String
>
set
=
new
HashSet
<>();
if
(!
StringUtils
.
isEmpty
(
filter
))
for
(
String
str:
filter
.
split
(
";|,"
))
set
.
add
(
str
);
return
set
;
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录