Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdst
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdst
提交
5faf8183
提交
5faf8183
编写于
3月 10, 2021
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dict 本地化
上级
361bb9ce
变更
5
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
283 行增加
和
6 行删除
+283
-6
CacheRefreshAspect.java
...izlab/core/dict/extensions/aspect/CacheRefreshAspect.java
+52
-0
DictCoreService.java
...ibizlab/core/dict/extensions/service/DictCoreService.java
+222
-0
AnalyseEntityServiceImpl.java
...lab/core/extensions/service/AnalyseEntityServiceImpl.java
+3
-2
DACoreService.java
...ava/cn/ibizlab/core/extensions/service/DACoreService.java
+3
-2
DstCoreResource.java
.../java/cn/ibizlab/api/rest/extensions/DstCoreResource.java
+3
-2
未找到文件。
ibzdst-core/src/main/java/cn/ibizlab/core/dict/extensions/aspect/CacheRefreshAspect.java
0 → 100644
浏览文件 @
5faf8183
package
cn
.
ibizlab
.
core
.
dict
.
extensions
.
aspect
;
import
cn.ibizlab.core.dict.domain.DictCatalog
;
import
cn.ibizlab.core.dict.extensions.service.DictCoreService
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Before
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StringUtils
;
@Aspect
@Order
(
0
)
@Component
public
class
CacheRefreshAspect
{
@Autowired
@Lazy
private
DictCoreService
dictCoreService
;
@Before
(
value
=
"execution(* cn.ibizlab.core.dict.service.IDictCatalogService.update(..))"
)
public
void
BeforeUpdateEmp
(
JoinPoint
point
)
throws
Exception
{
refreshDictCache
(
point
);
}
@Before
(
value
=
"execution(* cn.ibizlab.core.dict.service.IDictCatalogService.save(..))"
)
public
void
BeforeSaveEmp
(
JoinPoint
point
)
throws
Exception
{
refreshDictCache
(
point
);
}
private
void
refreshDictCache
(
JoinPoint
point
)
{
Object
[]
args
=
point
.
getArgs
();
if
(
args
.
length
>
0
)
{
Object
obj
=
args
[
0
];
if
(
obj
instanceof
DictCatalog
)
{
String
code
=((
DictCatalog
)
obj
).
getCode
();
if
(!
StringUtils
.
isEmpty
(
code
))
{
dictCoreService
.
resetDictCatalog
(
code
);
dictCoreService
.
resetCodeListCatalog
(
code
);
}
}
}
}
}
ibzdst-core/src/main/java/cn/ibizlab/core/dict/extensions/service/DictCoreService.java
0 → 100644
浏览文件 @
5faf8183
package
cn
.
ibizlab
.
core
.
dict
.
extensions
.
service
;
import
cn.ibizlab.core.dict.domain.DictCatalog
;
import
cn.ibizlab.core.dict.domain.DictOption
;
import
cn.ibizlab.core.dict.filter.DictOptionSearchContext
;
import
cn.ibizlab.core.dict.service.IDictCatalogService
;
import
cn.ibizlab.core.dict.service.IDictOptionService
;
import
cn.ibizlab.util.dict.Catalog
;
import
cn.ibizlab.util.dict.CodeItem
;
import
cn.ibizlab.util.dict.CodeList
;
import
cn.ibizlab.util.dict.Option
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.Cacheable
;
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
;
@Slf4j
@Service
public
class
DictCoreService
{
@Autowired
private
IDictCatalogService
dictCatalogService
;
@Autowired
private
IDictOptionService
optionService
;
@Cacheable
(
value
=
"dictcatalog"
,
key
=
"'dict:'+#p0"
)
public
Catalog
getDictCatalog
(
String
code
){
return
getDictCatalog
(
code
,
new
DictOptionSearchContext
());
}
public
Catalog
getDictCatalog
(
String
code
,
DictOptionSearchContext
context
)
{
Catalog
catalog
=
new
Catalog
();
if
(
code
.
equalsIgnoreCase
(
"dictcatalog"
))
{
catalog
.
setCode
(
"DictCatalog"
);
catalog
.
setName
(
"字典目录"
);
List
<
Option
>
list
=
new
ArrayList
<>();
LambdaQueryWrapper
<
DictCatalog
>
wrapper
=
Wrappers
.
lambdaQuery
();
if
(!
StringUtils
.
isEmpty
(
context
.
getN_val_like
()))
wrapper
.
like
(
DictCatalog:
:
getCode
,
context
.
getN_val_like
());
if
(!
StringUtils
.
isEmpty
(
context
.
getN_val_in
()))
wrapper
.
in
(
DictCatalog:
:
getCode
,
context
.
getN_val_in
());
if
(!
StringUtils
.
isEmpty
(
context
.
getN_val_leftlike
()))
wrapper
.
likeRight
(
DictCatalog:
:
getCode
,
context
.
getN_val_leftlike
());
if
(!
StringUtils
.
isEmpty
(
context
.
getN_val_notin
()))
wrapper
.
notIn
(
DictCatalog:
:
getCode
,
context
.
getN_val_notin
());
if
(!
StringUtils
.
isEmpty
(
context
.
getN_label_like
()))
wrapper
.
notIn
(
DictCatalog:
:
getName
,
context
.
getN_label_like
());
if
(!
StringUtils
.
isEmpty
(
context
.
getN_vfilter_like
()))
wrapper
.
like
(
DictCatalog:
:
getGroup
,
context
.
getN_vfilter_like
());
if
(!
StringUtils
.
isEmpty
(
context
.
getN_vfilter_in
()))
wrapper
.
in
(
DictCatalog:
:
getGroup
,
context
.
getN_vfilter_in
());
if
(!
StringUtils
.
isEmpty
(
context
.
getN_vfilter_leftlike
()))
wrapper
.
likeRight
(
DictCatalog:
:
getGroup
,
context
.
getN_vfilter_leftlike
());
if
(!
StringUtils
.
isEmpty
(
context
.
getN_vfilter_eq
()))
wrapper
.
eq
(
DictCatalog:
:
getGroup
,
context
.
getN_vfilter_eq
());
wrapper
.
orderByAsc
(
DictCatalog:
:
getGroup
,
DictCatalog:
:
getCode
);
dictCatalogService
.
list
(
wrapper
).
forEach
(
item
->{
list
.
add
(
new
Option
().
setValue
(
item
.
getCode
()).
setId
(
item
.
getCode
())
.
setDisabled
(
false
)
.
setFilter
(
item
.
getGroup
()).
setLabel
(
item
.
getName
())
);
});
catalog
.
setOptions
(
list
);
}
else
{
DictCatalog
dictCatalog
=
dictCatalogService
.
getOne
(
Wrappers
.<
DictCatalog
>
query
().
eq
(
"ccode"
,
code
));
catalog
.
setCode
(
dictCatalog
.
getCode
()).
setName
(
dictCatalog
.
getName
());
List
<
Option
>
list
=
new
ArrayList
<>();
optionService
.
list
(
context
.
getSelectCond
().
eq
(
"cid"
,
dictCatalog
.
getId
()).
orderByAsc
(
"showorder"
)).
forEach
(
item
->{
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
)
);
});
List
<
Option
>
codeItemTreeList
=
new
ArrayList
<
Option
>();
codeItemTreeList
=
loop
(
list
,
""
);
catalog
.
setOptions
(
codeItemTreeList
);
}
return
catalog
;
}
@CacheEvict
(
value
=
"dictcatalog"
,
key
=
"'dict:'+#p0"
)
public
void
resetDictCatalog
(
String
code
)
{
}
@Cacheable
(
value
=
"dictcatalog"
,
key
=
"'codelist:'+#p0"
)
public
CodeList
getCodeListCatalog
(
String
code
){
return
getCodeListCatalog
(
code
,
new
DictOptionSearchContext
());
}
public
CodeList
getCodeListCatalog
(
String
code
,
DictOptionSearchContext
context
)
{
CodeList
catalog
=
new
CodeList
();
if
(
code
.
equalsIgnoreCase
(
"dictcatalog"
))
{
catalog
.
setCode
(
"DictCatalog"
);
catalog
.
setName
(
"字典目录"
);
List
<
CodeItem
>
list
=
new
ArrayList
<>();
LambdaQueryWrapper
<
DictCatalog
>
wrapper
=
Wrappers
.
lambdaQuery
();
if
(!
StringUtils
.
isEmpty
(
context
.
getN_val_like
()))
wrapper
.
like
(
DictCatalog:
:
getCode
,
context
.
getN_val_like
());
if
(!
StringUtils
.
isEmpty
(
context
.
getN_val_in
()))
wrapper
.
in
(
DictCatalog:
:
getCode
,
context
.
getN_val_in
());
if
(!
StringUtils
.
isEmpty
(
context
.
getN_val_leftlike
()))
wrapper
.
likeRight
(
DictCatalog:
:
getCode
,
context
.
getN_val_leftlike
());
if
(!
StringUtils
.
isEmpty
(
context
.
getN_val_notin
()))
wrapper
.
notIn
(
DictCatalog:
:
getCode
,
context
.
getN_val_notin
());
if
(!
StringUtils
.
isEmpty
(
context
.
getN_label_like
()))
wrapper
.
notIn
(
DictCatalog:
:
getName
,
context
.
getN_label_like
());
if
(!
StringUtils
.
isEmpty
(
context
.
getN_vfilter_like
()))
wrapper
.
like
(
DictCatalog:
:
getGroup
,
context
.
getN_vfilter_like
());
if
(!
StringUtils
.
isEmpty
(
context
.
getN_vfilter_in
()))
wrapper
.
in
(
DictCatalog:
:
getGroup
,
context
.
getN_vfilter_in
());
if
(!
StringUtils
.
isEmpty
(
context
.
getN_vfilter_leftlike
()))
wrapper
.
likeRight
(
DictCatalog:
:
getGroup
,
context
.
getN_vfilter_leftlike
());
if
(!
StringUtils
.
isEmpty
(
context
.
getN_vfilter_eq
()))
wrapper
.
eq
(
DictCatalog:
:
getGroup
,
context
.
getN_vfilter_eq
());
wrapper
.
orderByAsc
(
DictCatalog:
:
getGroup
,
DictCatalog:
:
getCode
);
dictCatalogService
.
list
(
wrapper
).
forEach
(
item
->{
list
.
add
(
new
CodeItem
().
setValue
(
item
.
getCode
()).
setId
(
item
.
getCode
())
.
setDisabled
(
false
)
.
setFilter
(
item
.
getGroup
()).
setLabel
(
item
.
getName
())
);
});
catalog
.
setOptions
(
list
);
}
else
{
DictCatalog
dictCatalog
=
dictCatalogService
.
getOne
(
Wrappers
.<
DictCatalog
>
query
().
eq
(
"ccode"
,
code
));
catalog
.
setCode
(
dictCatalog
.
getCode
()).
setName
(
dictCatalog
.
getName
());
List
<
CodeItem
>
list
=
new
ArrayList
<>();
optionService
.
list
(
context
.
getSelectCond
().
eq
(
"cid"
,
dictCatalog
.
getId
()).
orderByAsc
(
"showorder"
)).
forEach
(
item
->{
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
);
}
return
catalog
;
}
@CacheEvict
(
value
=
"dictcatalog"
,
key
=
"'codelist:'+#p0"
)
public
void
resetCodeListCatalog
(
String
code
)
{
}
public
List
<
Option
>
loop
(
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
))
{
List
<
Option
>
childCodeItem
=
loop
(
listCodeItem
,
codeItem
.
getValue
());
if
(
childCodeItem
.
size
()
>
0
)
{
codeItem
.
setChildren
(
childCodeItem
);
}
trees
.
add
(
codeItem
);
}
}
return
trees
;
}
public
List
<
CodeItem
>
loopCodeItem
(
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
(
childCodeItem
.
size
()
>
0
)
{
codeItem
.
setChildren
(
childCodeItem
);
}
trees
.
add
(
codeItem
);
}
}
return
trees
;
}
}
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/AnalyseEntityServiceImpl.java
浏览文件 @
5faf8183
...
@@ -2,6 +2,7 @@ package cn.ibizlab.core.extensions.service;
...
@@ -2,6 +2,7 @@ package cn.ibizlab.core.extensions.service;
import
cn.ibizlab.core.analysis.domain.DADimension
;
import
cn.ibizlab.core.analysis.domain.DADimension
;
import
cn.ibizlab.core.analysis.service.IDABuildService
;
import
cn.ibizlab.core.analysis.service.IDABuildService
;
import
cn.ibizlab.core.dict.extensions.service.DictCoreService
;
import
cn.ibizlab.core.extensions.cql.ExecResult
;
import
cn.ibizlab.core.extensions.cql.ExecResult
;
import
cn.ibizlab.core.extensions.domain.BaseRequest
;
import
cn.ibizlab.core.extensions.domain.BaseRequest
;
import
cn.ibizlab.core.extensions.domain.ResultsMQMsg
;
import
cn.ibizlab.core.extensions.domain.ResultsMQMsg
;
...
@@ -41,7 +42,7 @@ public class AnalyseEntityServiceImpl extends BaseEntityServiceImpl {
...
@@ -41,7 +42,7 @@ public class AnalyseEntityServiceImpl extends BaseEntityServiceImpl {
@Autowired
@Autowired
@Lazy
@Lazy
private
cn
.
ibizlab
.
util
.
client
.
IBZDictFeignClient
ibzDictFeignClient
;
private
DictCoreService
dictCoreService
;
@Override
@Override
public
void
saveResult
(
ModelObj
param
,
String
RULEID
,
String
RULECODE
,
String
RULENAME
,
String
RU_EXECRESULTNAME
,
FieldObj
BUSINESSCAT
,
public
void
saveResult
(
ModelObj
param
,
String
RULEID
,
String
RULECODE
,
String
RULENAME
,
String
RU_EXECRESULTNAME
,
FieldObj
BUSINESSCAT
,
...
@@ -123,7 +124,7 @@ public class AnalyseEntityServiceImpl extends BaseEntityServiceImpl {
...
@@ -123,7 +124,7 @@ public class AnalyseEntityServiceImpl extends BaseEntityServiceImpl {
//维度指定代码表时,向上同时为每一个父节点添加一条数据
//维度指定代码表时,向上同时为每一个父节点添加一条数据
while
(
true
)
while
(
true
)
{
{
CodeItem
code
=
ibzDictFeignClient
.
getCodeList
(
dictname
).
findCodeItem
(
val
);
CodeItem
code
=
dictCoreService
.
getCodeListCatalog
(
dictname
).
findCodeItem
(
val
);
if
(
code
!=
null
)
if
(
code
!=
null
)
{
{
ExecResult
result2
=
new
ExecResult
();
ExecResult
result2
=
new
ExecResult
();
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/extensions/service/DACoreService.java
浏览文件 @
5faf8183
...
@@ -4,6 +4,7 @@ import cn.ibizlab.core.analysis.domain.DAMetric;
...
@@ -4,6 +4,7 @@ import cn.ibizlab.core.analysis.domain.DAMetric;
import
cn.ibizlab.core.analysis.domain.DAReport
;
import
cn.ibizlab.core.analysis.domain.DAReport
;
import
cn.ibizlab.core.analysis.filter.DAMetricSearchContext
;
import
cn.ibizlab.core.analysis.filter.DAMetricSearchContext
;
import
cn.ibizlab.core.analysis.service.impl.DAReportServiceImpl
;
import
cn.ibizlab.core.analysis.service.impl.DAReportServiceImpl
;
import
cn.ibizlab.core.dict.extensions.service.DictCoreService
;
import
cn.ibizlab.core.extensions.cql.ExecResult
;
import
cn.ibizlab.core.extensions.cql.ExecResult
;
import
cn.ibizlab.core.extensions.cql.ExecResultRepository
;
import
cn.ibizlab.core.extensions.cql.ExecResultRepository
;
import
cn.ibizlab.core.extensions.domain.FetchMetricDatasParam
;
import
cn.ibizlab.core.extensions.domain.FetchMetricDatasParam
;
...
@@ -52,7 +53,7 @@ public class DACoreService {
...
@@ -52,7 +53,7 @@ public class DACoreService {
@Autowired
@Autowired
@Lazy
@Lazy
private
cn
.
ibizlab
.
util
.
client
.
IBZDictFeignClient
ibzDictFeignClient
;
private
DictCoreService
dictCoreService
;
@Autowired
@Autowired
@Lazy
@Lazy
...
@@ -278,7 +279,7 @@ public class DACoreService {
...
@@ -278,7 +279,7 @@ public class DACoreService {
Hashtable
<
String
,
HashMap
<
String
,
Object
>>
dimsSet
=
new
Hashtable
<>();
Hashtable
<
String
,
HashMap
<
String
,
Object
>>
dimsSet
=
new
Hashtable
<>();
// CodeItem code=CodeListBase.getCodeList(dimcodelist).getCodeList().getCodeItemModelMap().get(dimval);
// CodeItem code=CodeListBase.getCodeList(dimcodelist).getCodeList().getCodeItemModelMap().get(dimval);
CodeItem
code
=
ibzDictFeignClient
.
getCodeList
(
dimcodelist
).
findChildren
(
dimval
);
CodeItem
code
=
dictCoreService
.
getCodeListCatalog
(
dimcodelist
).
findChildren
(
dimval
);
if
(
code
==
null
)
if
(
code
==
null
)
return
null
;
return
null
;
int
no
=
1
;
int
no
=
1
;
...
...
ibzdst-provider/ibzdst-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/DstCoreResource.java
浏览文件 @
5faf8183
package
cn
.
ibizlab
.
api
.
rest
.
extensions
;
package
cn
.
ibizlab
.
api
.
rest
.
extensions
;
import
cn.ibizlab.core.dict.extensions.service.DictCoreService
;
import
cn.ibizlab.core.lite.domain.DstSystem
;
import
cn.ibizlab.core.lite.domain.DstSystem
;
import
cn.ibizlab.core.lite.domain.MetaField
;
import
cn.ibizlab.core.lite.domain.MetaField
;
import
cn.ibizlab.core.lite.extensions.domain.*
;
import
cn.ibizlab.core.lite.extensions.domain.*
;
...
@@ -124,7 +125,7 @@ public class DstCoreResource {
...
@@ -124,7 +125,7 @@ public class DstCoreResource {
}
}
@Autowired
@Autowired
private
IBZDictFeignClient
dictFeignClient
;
private
DictCoreService
dictCoreService
;
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
{
"/dst/datamodels/{modelid}/{propertyname}.{fieldname}/dict"
})
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
{
"/dst/datamodels/{modelid}/{propertyname}.{fieldname}/dict"
})
public
ResponseEntity
<
List
<
CodeItem
>>
getDataModelFieldDict
(
@PathVariable
(
name
=
"modelid"
,
required
=
false
)
String
modelid
,
public
ResponseEntity
<
List
<
CodeItem
>>
getDataModelFieldDict
(
@PathVariable
(
name
=
"modelid"
,
required
=
false
)
String
modelid
,
...
@@ -141,7 +142,7 @@ public class DstCoreResource {
...
@@ -141,7 +142,7 @@ public class DstCoreResource {
String
dict
=
field
.
getDict
();
String
dict
=
field
.
getDict
();
if
(!
StringUtils
.
isEmpty
(
dict
))
if
(!
StringUtils
.
isEmpty
(
dict
))
{
{
CodeList
codeList
=
dict
FeignClient
.
getCodeList
(
dict
);
CodeList
codeList
=
dict
CoreService
.
getCodeListCatalog
(
dict
);
if
(
codeList
!=
null
)
if
(
codeList
!=
null
)
list
=
codeList
.
getOptions
();
list
=
codeList
.
getOptions
();
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录