Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdict
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdict
提交
d66e47b7
提交
d66e47b7
编写于
11月 13, 2020
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ibiz4j 发布系统代码 [ibz-dict,字典]
上级
cad48994
变更
64
展开全部
显示空白字符变更
内嵌
并排
正在显示
64 个修改的文件
包含
1382 行增加
和
802 行删除
+1382
-802
package.json
app_web/package.json
+9
-1
app-register.ts
app_web/src/app-register.ts
+3
-1
app-picker.vue
app_web/src/components/app-picker/app-picker.vue
+1
-0
menu-icon.less
app_web/src/components/menu-icon/menu-icon.less
+0
-0
menu-icon.tsx
app_web/src/components/menu-icon/menu-icon.tsx
+41
-0
search-view-engine.ts
app_web/src/engine/view/search-view-engine.ts
+9
-0
app-index-view-base.vue
...web/src/pages/dict/app-index-view/app-index-view-base.vue
+4
-4
dict-catalog-edit-view-base.vue
...ct/dict-catalog-edit-view/dict-catalog-edit-view-base.vue
+4
-4
dict-catalog-grid-view-base.vue
...ct/dict-catalog-grid-view/dict-catalog-grid-view-base.vue
+4
-4
dict-catalog-pickup-grid-view-base.vue
...g-pickup-grid-view/dict-catalog-pickup-grid-view-base.vue
+4
-4
dict-catalog-pickup-view-base.vue
...ict-catalog-pickup-view/dict-catalog-pickup-view-base.vue
+4
-4
dict-option-edit-view-base.vue
...dict/dict-option-edit-view/dict-option-edit-view-base.vue
+4
-4
dict-option-grid-edit-view-base.vue
...option-grid-edit-view/dict-option-grid-edit-view-base.vue
+4
-4
dict-option-grid-view-base.vue
...dict/dict-option-grid-view/dict-option-grid-view-base.vue
+4
-4
default.less
app_web/src/styles/default.less
+1
-1
interceptor.ts
app_web/src/utils/interceptor/interceptor.ts
+7
-1
app-index-view-appmenu-base.vue
...pp/app-index-view-appmenu/app-index-view-appmenu-base.vue
+10
-2
control-service.ts
app_web/src/widgets/control-service.ts
+19
-0
main-form-base.vue
...web/src/widgets/dict-catalog/main-form/main-form-base.vue
+135
-37
main-grid-base.vue
...web/src/widgets/dict-catalog/main-grid/main-grid-base.vue
+65
-26
main-form-base.vue
app_web/src/widgets/dict-option/main-form/main-form-base.vue
+135
-37
main-grid-base.vue
app_web/src/widgets/dict-option/main-grid/main-grid-base.vue
+64
-25
options-grid-base.vue
...rc/widgets/dict-option/options-grid/options-grid-base.vue
+64
-25
DictOption.java
...src/main/java/cn/ibizlab/core/dict/domain/DictOption.java
+45
-45
DictCatalogSearchContext.java
...cn/ibizlab/core/dict/filter/DictCatalogSearchContext.java
+1
-0
DictOptionSearchContext.java
.../cn/ibizlab/core/dict/filter/DictOptionSearchContext.java
+1
-0
DictCatalogMapper.java
...n/java/cn/ibizlab/core/dict/mapper/DictCatalogMapper.java
+14
-14
DictOptionMapper.java
...in/java/cn/ibizlab/core/dict/mapper/DictOptionMapper.java
+10
-10
IDictCatalogService.java
...ava/cn/ibizlab/core/dict/service/IDictCatalogService.java
+18
-18
IDictOptionService.java
...java/cn/ibizlab/core/dict/service/IDictOptionService.java
+14
-14
DictCatalogServiceImpl.java
...bizlab/core/dict/service/impl/DictCatalogServiceImpl.java
+15
-12
DictOptionServiceImpl.java
...ibizlab/core/dict/service/impl/DictOptionServiceImpl.java
+14
-11
pom.xml
ibzdict-dependencies/pom.xml
+0
-1
DictCatalogMapping.java
.../main/java/cn/ibizlab/api/mapping/DictCatalogMapping.java
+3
-4
DictOptionMapping.java
...c/main/java/cn/ibizlab/api/mapping/DictOptionMapping.java
+3
-4
AuditAspect.java
...til/src/main/java/cn/ibizlab/util/aspect/AuditAspect.java
+56
-57
DEFieldDefaultValueAspect.java
...ava/cn/ibizlab/util/aspect/DEFieldDefaultValueAspect.java
+62
-56
VersionCheckAspect.java
.../main/java/cn/ibizlab/util/aspect/VersionCheckAspect.java
+50
-43
DTOBase.java
...ct-util/src/main/java/cn/ibizlab/util/domain/DTOBase.java
+12
-6
EntityBase.java
...util/src/main/java/cn/ibizlab/util/domain/EntityBase.java
+15
-11
EntityMP.java
...t-util/src/main/java/cn/ibizlab/util/domain/EntityMP.java
+6
-6
EntityMongo.java
...til/src/main/java/cn/ibizlab/util/domain/EntityMongo.java
+0
-2
QueryBuildContext.java
...c/main/java/cn/ibizlab/util/filter/QueryBuildContext.java
+4
-3
QueryFilter.java
...til/src/main/java/cn/ibizlab/util/filter/QueryFilter.java
+8
-5
QueryWrapperContext.java
...main/java/cn/ibizlab/util/filter/QueryWrapperContext.java
+14
-12
SearchContextBase.java
...c/main/java/cn/ibizlab/util/filter/SearchContextBase.java
+6
-4
CachedBeanCopier.java
...rc/main/java/cn/ibizlab/util/helper/CachedBeanCopier.java
+2
-3
DEFieldCacheMap.java
...src/main/java/cn/ibizlab/util/helper/DEFieldCacheMap.java
+52
-31
DataObject.java
...util/src/main/java/cn/ibizlab/util/helper/DataObject.java
+62
-38
RuleUtils.java
...-util/src/main/java/cn/ibizlab/util/helper/RuleUtils.java
+102
-54
PermissionSyncJob.java
.../src/main/java/cn/ibizlab/util/job/PermissionSyncJob.java
+4
-4
AppController.java
...til/src/main/java/cn/ibizlab/util/rest/AppController.java
+12
-6
AuthenticationController.java
...n/java/cn/ibizlab/util/rest/AuthenticationController.java
+1
-1
AuthPermissionEvaluator.java
...ava/cn/ibizlab/util/security/AuthPermissionEvaluator.java
+33
-17
AuthenticationUser.java
...ain/java/cn/ibizlab/util/security/AuthenticationUser.java
+4
-2
IBZConfigService.java
...c/main/java/cn/ibizlab/util/service/IBZConfigService.java
+8
-4
IBZUAAUserService.java
.../main/java/cn/ibizlab/util/service/IBZUAAUserService.java
+4
-3
IBZUSERServiceImpl.java
...main/java/cn/ibizlab/util/service/IBZUSERServiceImpl.java
+12
-6
SimpleAuditService.java
...main/java/cn/ibizlab/util/service/SimpleAuditService.java
+99
-85
SimpleFileService.java
.../main/java/cn/ibizlab/util/service/SimpleFileService.java
+7
-6
SimpleUserService.java
.../main/java/cn/ibizlab/util/service/SimpleUserService.java
+7
-7
FeignRequestInterceptor.java
...ain/java/cn/ibizlab/util/web/FeignRequestInterceptor.java
+2
-1
IBZOperationParameterReader.java
...java/cn/ibizlab/util/web/IBZOperationParameterReader.java
+5
-5
SearchContextHandlerMethodArgumentResolver.java
.../util/web/SearchContextHandlerMethodArgumentResolver.java
+0
-3
未找到文件。
app_web/package.json
浏览文件 @
d66e47b7
...
@@ -9,7 +9,8 @@
...
@@ -9,7 +9,8 @@
"dev-build"
:
"node --max_old_space_size=8102 ./node_modules/@vue/cli-service/bin/vue-cli-service build --mode development"
,
"dev-build"
:
"node --max_old_space_size=8102 ./node_modules/@vue/cli-service/bin/vue-cli-service build --mode development"
,
"test:unit"
:
"vue-cli-service test:unit"
,
"test:unit"
:
"vue-cli-service test:unit"
,
"test:e2e"
:
"vue-cli-service test:e2e"
,
"test:e2e"
:
"vue-cli-service test:e2e"
,
"lint"
:
"vue-cli-service lint"
"lint"
:
"vue-cli-service lint"
,
"format-code"
:
"prettier-eslint --write
\"
src/**/*.js
\"
\"
src/**/*.vue
\"
\"
src/**/*.tsx
\"
\"
src/**/*.ts
\"
\"
src/**/*.less
\"
"
},
},
"dependencies"
:
{
"dependencies"
:
{
"@fullcalendar/core"
:
"^4.4.0"
,
"@fullcalendar/core"
:
"^4.4.0"
,
...
@@ -66,5 +67,12 @@
...
@@ -66,5 +67,12 @@
"script-loader"
:
"^0.7.2"
,
"script-loader"
:
"^0.7.2"
,
"typescript"
:
"~3.5.3"
,
"typescript"
:
"~3.5.3"
,
"vue-template-compiler"
:
"^2.6.10"
"vue-template-compiler"
:
"^2.6.10"
},
"eslintConfig"
:
{
"root"
:
true
,
"extends"
:
[
"gitee"
,
"stylelint-config-prettier"
]
}
}
}
}
app_web/src/app-register.ts
浏览文件 @
d66e47b7
...
@@ -98,6 +98,7 @@ import AppAlert from './components/app-alert/app-alert.vue'
...
@@ -98,6 +98,7 @@ import AppAlert from './components/app-alert/app-alert.vue'
import
AppAlertGroup
from
'./components/app-alert-group/app-alert-group.vue'
import
AppAlertGroup
from
'./components/app-alert-group/app-alert-group.vue'
import
AppRawItem
from
'./components/app-rawitem/app-rawitem.vue'
import
AppRawItem
from
'./components/app-rawitem/app-rawitem.vue'
import
AppImageRomate
from
'./components/app-image-romate/app-image-romate.vue'
import
AppImageRomate
from
'./components/app-image-romate/app-image-romate.vue'
import
{
MenuIcon
}
from
'./components/menu-icon/menu-icon'
// 全局挂载UI实体服务注册中心
// 全局挂载UI实体服务注册中心
window
[
'uiServiceRegister'
]
=
uiServiceRegister
;
window
[
'uiServiceRegister'
]
=
uiServiceRegister
;
...
@@ -210,6 +211,7 @@ export const AppComponents = {
...
@@ -210,6 +211,7 @@ export const AppComponents = {
v
.
component
(
'app-alert'
,
AppAlert
);
v
.
component
(
'app-alert'
,
AppAlert
);
v
.
component
(
'app-alert-group'
,
AppAlertGroup
);
v
.
component
(
'app-alert-group'
,
AppAlertGroup
);
v
.
component
(
'app-rawitem'
,
AppRawItem
);
v
.
component
(
'app-rawitem'
,
AppRawItem
);
v
.
component
(
'app-image-romate'
,
AppImageRomate
)
v
.
component
(
'app-image-romate'
,
AppImageRomate
);
v
.
component
(
'menu-icon'
,
MenuIcon
);
},
},
};
};
\ No newline at end of file
app_web/src/components/app-picker/app-picker.vue
浏览文件 @
d66e47b7
...
@@ -341,6 +341,7 @@ export default class AppPicker extends Vue {
...
@@ -341,6 +341,7 @@ export default class AppPicker extends Vue {
public
onSelectOpen
(
flag
:
boolean
):
void
{
public
onSelectOpen
(
flag
:
boolean
):
void
{
this
.
open
=
flag
;
this
.
open
=
flag
;
if
(
this
.
open
)
{
if
(
this
.
open
)
{
this
.
items
=
[];
//设置下拉列表的最大宽度
//设置下拉列表的最大宽度
this
.
setDropdownWidth
();
this
.
setDropdownWidth
();
this
.
onSearch
(
this
.
curvalue
,
null
,
true
);
this
.
onSearch
(
this
.
curvalue
,
null
,
true
);
...
...
app_web/src/components/menu-icon/menu-icon.less
0 → 100644
浏览文件 @
d66e47b7
app_web/src/components/menu-icon/menu-icon.tsx
0 → 100644
浏览文件 @
d66e47b7
import
{
Vue
,
Component
,
Prop
}
from
'vue-property-decorator'
;
import
'./menu-icon.less'
;
/**
* 平台菜单按钮适配
*
* @export
* @class MenuIcon
* @extends {Vue}
*/
@
Component
({})
export
class
MenuIcon
extends
Vue
{
/**
* 项数据
*
* @type {*}
* @memberof MenuIcon
*/
@
Prop
()
public
item
:
any
;
/**
* 绘制图标
*
* @returns {*}
* @memberof MenuIcon
*/
public
render
():
any
{
if
(
this
.
item
)
{
if
(
this
.
item
.
iconcls
)
{
return
<
i
class=
{
this
.
item
.
iconcls
}
/>
}
if
(
this
.
item
.
icon
)
{
return
<
img
src=
{
this
.
item
.
icon
}
/>
}
}
return
<
span
/>
}
}
\ No newline at end of file
app_web/src/engine/view/search-view-engine.ts
浏览文件 @
d66e47b7
...
@@ -97,6 +97,15 @@ export class SearchViewEngine extends ViewEngine {
...
@@ -97,6 +97,15 @@ export class SearchViewEngine extends ViewEngine {
if
(
this
.
view
&&
!
this
.
view
.
isExpandSearchForm
)
{
if
(
this
.
view
&&
!
this
.
view
.
isExpandSearchForm
)
{
Object
.
assign
(
arg
,
{
query
:
this
.
view
.
query
});
Object
.
assign
(
arg
,
{
query
:
this
.
view
.
query
});
}
}
// 快速分组和快速搜索栏
let
otherQueryParam
:
any
=
{};
if
(
this
.
view
&&
this
.
view
.
quickGroupData
){
Object
.
assign
(
otherQueryParam
,
this
.
view
.
quickGroupData
);
}
if
(
this
.
view
&&
this
.
view
.
quickFormData
){
Object
.
assign
(
otherQueryParam
,
this
.
view
.
quickFormData
);
}
Object
.
assign
(
arg
,{
viewparams
:
otherQueryParam
});
}
}
...
...
app_web/src/pages/dict/app-index-view/app-index-view-base.vue
浏览文件 @
d66e47b7
...
@@ -167,11 +167,11 @@ export default class AppIndexViewBase extends Vue {
...
@@ -167,11 +167,11 @@ export default class AppIndexViewBase extends Vue {
@
Watch
(
'viewparam'
,{
immediate
:
true
,
deep
:
true
})
@
Watch
(
'viewparam'
,{
immediate
:
true
,
deep
:
true
})
onParamData
(
newVal
:
any
,
oldVal
:
any
)
{
onParamData
(
newVal
:
any
,
oldVal
:
any
)
{
if
(
newVal
){
if
(
newVal
){
for
(
let
key
in
this
.
viewparams
){
this
.
viewparams
=
{};
delete
this
.
viewparams
[
key
];
if
(
typeof
newVal
==
'string'
)
{
}
if
(
typeof
this
.
viewparams
==
'string'
)
{
Object
.
assign
(
this
.
viewparams
,
JSON
.
parse
(
this
.
viewparam
));
Object
.
assign
(
this
.
viewparams
,
JSON
.
parse
(
this
.
viewparam
));
}
else
{
this
.
viewparams
=
Util
.
deepCopy
(
this
.
viewparam
);
}
}
}
}
...
...
app_web/src/pages/dict/dict-catalog-edit-view/dict-catalog-edit-view-base.vue
浏览文件 @
d66e47b7
...
@@ -254,11 +254,11 @@ export default class DictCatalogEditViewBase extends Vue {
...
@@ -254,11 +254,11 @@ export default class DictCatalogEditViewBase extends Vue {
@
Watch
(
'viewparam'
,{
immediate
:
true
,
deep
:
true
})
@
Watch
(
'viewparam'
,{
immediate
:
true
,
deep
:
true
})
onParamData
(
newVal
:
any
,
oldVal
:
any
)
{
onParamData
(
newVal
:
any
,
oldVal
:
any
)
{
if
(
newVal
){
if
(
newVal
){
for
(
let
key
in
this
.
viewparams
){
this
.
viewparams
=
{};
delete
this
.
viewparams
[
key
];
if
(
typeof
newVal
==
'string'
)
{
}
if
(
typeof
this
.
viewparams
==
'string'
)
{
Object
.
assign
(
this
.
viewparams
,
JSON
.
parse
(
this
.
viewparam
));
Object
.
assign
(
this
.
viewparams
,
JSON
.
parse
(
this
.
viewparam
));
}
else
{
this
.
viewparams
=
Util
.
deepCopy
(
this
.
viewparam
);
}
}
}
}
...
...
app_web/src/pages/dict/dict-catalog-grid-view/dict-catalog-grid-view-base.vue
浏览文件 @
d66e47b7
...
@@ -276,11 +276,11 @@ export default class DictCatalogGridViewBase extends Vue {
...
@@ -276,11 +276,11 @@ export default class DictCatalogGridViewBase extends Vue {
@
Watch
(
'viewparam'
,{
immediate
:
true
,
deep
:
true
})
@
Watch
(
'viewparam'
,{
immediate
:
true
,
deep
:
true
})
onParamData
(
newVal
:
any
,
oldVal
:
any
)
{
onParamData
(
newVal
:
any
,
oldVal
:
any
)
{
if
(
newVal
){
if
(
newVal
){
for
(
let
key
in
this
.
viewparams
){
this
.
viewparams
=
{};
delete
this
.
viewparams
[
key
];
if
(
typeof
newVal
==
'string'
)
{
}
if
(
typeof
this
.
viewparams
==
'string'
)
{
Object
.
assign
(
this
.
viewparams
,
JSON
.
parse
(
this
.
viewparam
));
Object
.
assign
(
this
.
viewparams
,
JSON
.
parse
(
this
.
viewparam
));
}
else
{
this
.
viewparams
=
Util
.
deepCopy
(
this
.
viewparam
);
}
}
}
}
...
...
app_web/src/pages/dict/dict-catalog-pickup-grid-view/dict-catalog-pickup-grid-view-base.vue
浏览文件 @
d66e47b7
...
@@ -178,11 +178,11 @@ export default class DictCatalogPickupGridViewBase extends Vue {
...
@@ -178,11 +178,11 @@ export default class DictCatalogPickupGridViewBase extends Vue {
@
Watch
(
'viewparam'
,{
immediate
:
true
,
deep
:
true
})
@
Watch
(
'viewparam'
,{
immediate
:
true
,
deep
:
true
})
onParamData
(
newVal
:
any
,
oldVal
:
any
)
{
onParamData
(
newVal
:
any
,
oldVal
:
any
)
{
if
(
newVal
){
if
(
newVal
){
for
(
let
key
in
this
.
viewparams
){
this
.
viewparams
=
{};
delete
this
.
viewparams
[
key
];
if
(
typeof
newVal
==
'string'
)
{
}
if
(
typeof
this
.
viewparams
==
'string'
)
{
Object
.
assign
(
this
.
viewparams
,
JSON
.
parse
(
this
.
viewparam
));
Object
.
assign
(
this
.
viewparams
,
JSON
.
parse
(
this
.
viewparam
));
}
else
{
this
.
viewparams
=
Util
.
deepCopy
(
this
.
viewparam
);
}
}
}
}
...
...
app_web/src/pages/dict/dict-catalog-pickup-view/dict-catalog-pickup-view-base.vue
浏览文件 @
d66e47b7
...
@@ -165,11 +165,11 @@ export default class DictCatalogPickupViewBase extends Vue {
...
@@ -165,11 +165,11 @@ export default class DictCatalogPickupViewBase extends Vue {
@
Watch
(
'viewparam'
,{
immediate
:
true
,
deep
:
true
})
@
Watch
(
'viewparam'
,{
immediate
:
true
,
deep
:
true
})
onParamData
(
newVal
:
any
,
oldVal
:
any
)
{
onParamData
(
newVal
:
any
,
oldVal
:
any
)
{
if
(
newVal
){
if
(
newVal
){
for
(
let
key
in
this
.
viewparams
){
this
.
viewparams
=
{};
delete
this
.
viewparams
[
key
];
if
(
typeof
newVal
==
'string'
)
{
}
if
(
typeof
this
.
viewparams
==
'string'
)
{
Object
.
assign
(
this
.
viewparams
,
JSON
.
parse
(
this
.
viewparam
));
Object
.
assign
(
this
.
viewparams
,
JSON
.
parse
(
this
.
viewparam
));
}
else
{
this
.
viewparams
=
Util
.
deepCopy
(
this
.
viewparam
);
}
}
if
(
this
.
viewparams
.
selectedData
){
if
(
this
.
viewparams
.
selectedData
){
this
.
selectedData
=
JSON
.
stringify
(
this
.
viewparams
.
selectedData
);
this
.
selectedData
=
JSON
.
stringify
(
this
.
viewparams
.
selectedData
);
...
...
app_web/src/pages/dict/dict-option-edit-view/dict-option-edit-view-base.vue
浏览文件 @
d66e47b7
...
@@ -186,11 +186,11 @@ export default class DictOptionEditViewBase extends Vue {
...
@@ -186,11 +186,11 @@ export default class DictOptionEditViewBase extends Vue {
@
Watch
(
'viewparam'
,{
immediate
:
true
,
deep
:
true
})
@
Watch
(
'viewparam'
,{
immediate
:
true
,
deep
:
true
})
onParamData
(
newVal
:
any
,
oldVal
:
any
)
{
onParamData
(
newVal
:
any
,
oldVal
:
any
)
{
if
(
newVal
){
if
(
newVal
){
for
(
let
key
in
this
.
viewparams
){
this
.
viewparams
=
{};
delete
this
.
viewparams
[
key
];
if
(
typeof
newVal
==
'string'
)
{
}
if
(
typeof
this
.
viewparams
==
'string'
)
{
Object
.
assign
(
this
.
viewparams
,
JSON
.
parse
(
this
.
viewparam
));
Object
.
assign
(
this
.
viewparams
,
JSON
.
parse
(
this
.
viewparam
));
}
else
{
this
.
viewparams
=
Util
.
deepCopy
(
this
.
viewparam
);
}
}
}
}
...
...
app_web/src/pages/dict/dict-option-grid-edit-view/dict-option-grid-edit-view-base.vue
浏览文件 @
d66e47b7
...
@@ -263,11 +263,11 @@ export default class DictOptionGridEditViewBase extends Vue {
...
@@ -263,11 +263,11 @@ export default class DictOptionGridEditViewBase extends Vue {
@
Watch
(
'viewparam'
,{
immediate
:
true
,
deep
:
true
})
@
Watch
(
'viewparam'
,{
immediate
:
true
,
deep
:
true
})
onParamData
(
newVal
:
any
,
oldVal
:
any
)
{
onParamData
(
newVal
:
any
,
oldVal
:
any
)
{
if
(
newVal
){
if
(
newVal
){
for
(
let
key
in
this
.
viewparams
){
this
.
viewparams
=
{};
delete
this
.
viewparams
[
key
];
if
(
typeof
newVal
==
'string'
)
{
}
if
(
typeof
this
.
viewparams
==
'string'
)
{
Object
.
assign
(
this
.
viewparams
,
JSON
.
parse
(
this
.
viewparam
));
Object
.
assign
(
this
.
viewparams
,
JSON
.
parse
(
this
.
viewparam
));
}
else
{
this
.
viewparams
=
Util
.
deepCopy
(
this
.
viewparam
);
}
}
}
}
...
...
app_web/src/pages/dict/dict-option-grid-view/dict-option-grid-view-base.vue
浏览文件 @
d66e47b7
...
@@ -263,11 +263,11 @@ export default class DictOptionGridViewBase extends Vue {
...
@@ -263,11 +263,11 @@ export default class DictOptionGridViewBase extends Vue {
@
Watch
(
'viewparam'
,{
immediate
:
true
,
deep
:
true
})
@
Watch
(
'viewparam'
,{
immediate
:
true
,
deep
:
true
})
onParamData
(
newVal
:
any
,
oldVal
:
any
)
{
onParamData
(
newVal
:
any
,
oldVal
:
any
)
{
if
(
newVal
){
if
(
newVal
){
for
(
let
key
in
this
.
viewparams
){
this
.
viewparams
=
{};
delete
this
.
viewparams
[
key
];
if
(
typeof
newVal
==
'string'
)
{
}
if
(
typeof
this
.
viewparams
==
'string'
)
{
Object
.
assign
(
this
.
viewparams
,
JSON
.
parse
(
this
.
viewparam
));
Object
.
assign
(
this
.
viewparams
,
JSON
.
parse
(
this
.
viewparam
));
}
else
{
this
.
viewparams
=
Util
.
deepCopy
(
this
.
viewparam
);
}
}
}
}
...
...
app_web/src/styles/default.less
浏览文件 @
d66e47b7
...
@@ -246,7 +246,7 @@
...
@@ -246,7 +246,7 @@
}
}
}
}
.view-container.degridview, .view-container.degridview9, .view-container.dewfgridview, .view-container.delistview, .view-container.delistview9, .view-container.dedataview, .view-container.dedataview9{
.view-container.degridview, .view-container.degridview9, .view-container.dewfgridview, .view-container.delistview, .view-container.delistview9, .view-container.dedataview, .view-container.dedataview9
,.view-container.dechartview,.view-container.dechartview9
{
>.view-card.view-no-caption{
>.view-card.view-no-caption{
>.ivu-card-body{
>.ivu-card-body{
height: 100%;
height: 100%;
...
...
app_web/src/utils/interceptor/interceptor.ts
浏览文件 @
d66e47b7
...
@@ -109,7 +109,13 @@ export class Interceptors {
...
@@ -109,7 +109,13 @@ export class Interceptors {
error
=
error
?
error
:
{
response
:
{}
};
error
=
error
?
error
:
{
response
:
{}
};
let
{
response
:
res
}
=
error
;
let
{
response
:
res
}
=
error
;
let
{
data
:
_data
}
=
res
;
let
{
data
:
_data
}
=
res
;
// 处理异常
if
(
res
.
headers
&&
res
.
headers
[
'x-ibz-error'
]){
res
.
data
.
errorKey
=
res
.
headers
[
'x-ibz-error'
];
}
if
(
res
.
headers
&&
res
.
headers
[
'x-ibz-params'
]){
res
.
data
.
entityName
=
res
.
headers
[
'x-ibz-params'
];
}
if
(
res
.
status
===
401
)
{
if
(
res
.
status
===
401
)
{
this
.
doNoLogin
(
_data
.
data
);
this
.
doNoLogin
(
_data
.
data
);
}
}
...
...
app_web/src/widgets/app/app-index-view-appmenu/app-index-view-appmenu-base.vue
浏览文件 @
d66e47b7
...
@@ -629,9 +629,17 @@ export default class AppIndexViewBase extends Vue implements ControlInterface {
...
@@ -629,9 +629,17 @@ export default class AppIndexViewBase extends Vue implements ControlInterface {
item
.
items
.
map
((
singleItem
:
any
)
=>
{
item
.
items
.
map
((
singleItem
:
any
)
=>
{
if
(
!
singleItem
.
hidden
){
if
(
!
singleItem
.
hidden
){
item
.
hidden
=
false
;
item
.
hidden
=
false
;
}
}
else
{
if
(
singleItem
.
items
&&
singleItem
.
items
.
length
>
0
){
if
(
singleItem
.
items
&&
singleItem
.
items
.
length
>
0
){
this
.
computeParentMenus
(
singleItem
.
items
);
singleItem
.
items
.
map
((
grandsonItem
:
any
)
=>
{
if
(
!
grandsonItem
.
hidden
){
item
.
hidden
=
false
;
}
})
}
}
if
(
item
.
items
&&
item
.
items
.
length
>
0
){
this
.
computeParentMenus
(
item
.
items
);
}
}
})
})
}
}
...
...
app_web/src/widgets/control-service.ts
浏览文件 @
d66e47b7
...
@@ -310,4 +310,23 @@ export default class ControlService {
...
@@ -310,4 +310,23 @@ export default class ControlService {
}
}
})
})
}
}
/**
* 根据后台标识获取数据标识名称
*
* @param prop 后台标识
* @memberof ControlService
*/
public
getNameByProp
(
prop
:
any
)
{
let
model
:
any
=
this
.
getMode
();
if
(
!
model
||
!
prop
)
{
return
false
;
}
let
dataItems
:
any
[]
=
model
.
getDataItems
();
prop
=
prop
.
replace
(
/
([
A-Z
])
/g
,
"_$1"
).
toLowerCase
();
let
data
:
any
=
dataItems
.
find
((
item
:
any
)
=>
{
return
Object
.
is
(
prop
,
item
.
prop
);
});
return
data
.
name
;
}
}
}
\ No newline at end of file
app_web/src/widgets/dict-catalog/main-form/main-form-base.vue
浏览文件 @
d66e47b7
此差异已折叠。
点击以展开。
app_web/src/widgets/dict-catalog/main-grid/main-grid-base.vue
浏览文件 @
d66e47b7
...
@@ -265,7 +265,6 @@ export default class MainBase extends Vue implements ControlInterface {
...
@@ -265,7 +265,6 @@ export default class MainBase extends Vue implements ControlInterface {
}
}
/**
/**
* 代码表服务对象
* 代码表服务对象
*
*
...
@@ -274,6 +273,14 @@ export default class MainBase extends Vue implements ControlInterface {
...
@@ -274,6 +273,14 @@ export default class MainBase extends Vue implements ControlInterface {
*/
*/
public
codeListService
:
CodeListService
=
new
CodeListService
({
$store
:
this
.
$store
});
public
codeListService
:
CodeListService
=
new
CodeListService
({
$store
:
this
.
$store
});
/**
* 主信息表格列
*
* @type {string}
* @memberof MainBase
*/
public
majorInfoColName
:
string
=
"cname"
;
/**
/**
* 界面UI服务对象
* 界面UI服务对象
*
*
...
@@ -774,16 +781,18 @@ export default class MainBase extends Vue implements ControlInterface {
...
@@ -774,16 +781,18 @@ export default class MainBase extends Vue implements ControlInterface {
this
.
errorMessages
=
[];
this
.
errorMessages
=
[];
let
validateState
=
true
;
let
validateState
=
true
;
let
index
=
-
1
;
let
index
=
-
1
;
for
(
let
item
of
this
.
items
){
for
(
let
item
of
this
.
items
)
{
let
tempMessage
:
string
=
''
;
index
++
;
index
++
;
if
(
item
.
rowDataState
===
"create"
||
item
.
rowDataState
===
"update"
)
{
if
(
item
.
rowDataState
===
"create"
||
item
.
rowDataState
===
"update"
)
{
for
(
let
property
of
Object
.
keys
(
this
.
rules
))
{
for
(
let
property
of
Object
.
keys
(
this
.
rules
))
{
if
(
!
await
this
.
validate
(
property
,
item
,
index
))
{
if
(
!
await
this
.
validate
(
property
,
item
,
index
))
{
validateState
=
false
;
validateState
=
false
;
this
.
errorMessages
.
push
(
this
.
gridItemsModel
[
index
][
property
].
error
)
;
tempMessage
=
tempMessage
+
'<p>'
+
this
.
gridItemsModel
[
index
][
property
].
error
+
'<p>'
;
}
}
}
}
}
}
this
.
errorMessages
.
push
(
tempMessage
);
}
}
return
validateState
;
return
validateState
;
}
}
...
@@ -908,7 +917,7 @@ export default class MainBase extends Vue implements ControlInterface {
...
@@ -908,7 +917,7 @@ export default class MainBase extends Vue implements ControlInterface {
}
}
let
dataInfo
=
''
;
let
dataInfo
=
''
;
_datas
.
forEach
((
record
:
any
,
index
:
number
)
=>
{
_datas
.
forEach
((
record
:
any
,
index
:
number
)
=>
{
let
srfmajortext
=
record
.
name
;
let
srfmajortext
=
record
.
c
name
;
if
(
index
<
5
)
{
if
(
index
<
5
)
{
if
(
!
Object
.
is
(
dataInfo
,
''
))
{
if
(
!
Object
.
is
(
dataInfo
,
''
))
{
dataInfo
+=
'、'
;
dataInfo
+=
'、'
;
...
@@ -920,9 +929,9 @@ export default class MainBase extends Vue implements ControlInterface {
...
@@ -920,9 +929,9 @@ export default class MainBase extends Vue implements ControlInterface {
});
});
if
(
_datas
.
length
<
5
)
{
if
(
_datas
.
length
<
5
)
{
dataInfo
=
dataInfo
+
' '
+
(
this
.
$t
(
'app.gridpage.totle'
)
as
string
)
+
_datas
.
length
+
(
this
.
$t
(
'app.gridpage.records'
)
as
string
)
+
(
this
.
$t
(
'app.gridpage.data'
)
as
string
);
dataInfo
=
dataInfo
+
' '
+
(
this
.
$t
(
'app.gridpage.totle'
)
as
string
)
+
_datas
.
length
+
(
this
.
$t
(
'app.gridpage.records'
)
as
string
)
+
(
this
.
$t
(
'app.gridpage.data'
)
as
string
);
}
else
{
}
else
{
dataInfo
=
dataInfo
+
'...'
+
' '
+
(
this
.
$t
(
'app.gridpage.totle'
)
as
string
)
+
_datas
.
length
+
(
this
.
$t
(
'app.gridpage.desc2
'
)
as
string
);
dataInfo
=
' ... '
+
(
this
.
$t
(
'app.gridpage.totle'
)
as
string
)
+
_datas
.
length
+
(
this
.
$t
(
'app.gridpage.records'
)
as
string
)
+
(
this
.
$t
(
'app.gridpage.data
'
)
as
string
);
}
}
const
removeData
=
()
=>
{
const
removeData
=
()
=>
{
...
@@ -1226,7 +1235,7 @@ export default class MainBase extends Vue implements ControlInterface {
...
@@ -1226,7 +1235,7 @@ export default class MainBase extends Vue implements ControlInterface {
return
;
return
;
}
}
if
(
Object
.
is
(
'load'
,
action
))
{
if
(
Object
.
is
(
'load'
,
action
))
{
this
.
load
(
data
);
this
.
load
(
data
,
true
);
}
}
if
(
Object
.
is
(
'remove'
,
action
))
{
if
(
Object
.
is
(
'remove'
,
action
))
{
this
.
remove
(
data
);
this
.
remove
(
data
);
...
@@ -1719,11 +1728,7 @@ export default class MainBase extends Vue implements ControlInterface {
...
@@ -1719,11 +1728,7 @@ export default class MainBase extends Vue implements ControlInterface {
}
}
if
(
!
await
this
.
validateAll
())
{
if
(
!
await
this
.
validateAll
())
{
if
(
this
.
errorMessages
&&
this
.
errorMessages
.
length
>
0
)
{
if
(
this
.
errorMessages
&&
this
.
errorMessages
.
length
>
0
)
{
let
descMessage
:
string
=
''
;
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.wrong'
)
as
string
),
desc
:
this
.
errorMessages
[
0
]
});
this
.
errorMessages
.
forEach
((
message
:
any
)
=>
{
descMessage
=
descMessage
+
'<p>'
+
message
+
'<p>'
;
})
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.wrong'
)
as
string
),
desc
:
descMessage
});
}
else
{
}
else
{
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.wrong'
)
as
string
),
desc
:
(
this
.
$t
(
'app.commonWords.rulesException'
)
as
string
)
});
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.wrong'
)
as
string
),
desc
:
(
this
.
$t
(
'app.commonWords.rulesException'
)
as
string
)
});
}
}
...
@@ -1764,9 +1769,39 @@ export default class MainBase extends Vue implements ControlInterface {
...
@@ -1764,9 +1769,39 @@ export default class MainBase extends Vue implements ControlInterface {
if
(
errorItems
.
length
===
0
&&
successItems
.
length
>
0
&&
!
this
.
isformDruipart
){
if
(
errorItems
.
length
===
0
&&
successItems
.
length
>
0
&&
!
this
.
isformDruipart
){
this
.
$Notice
.
success
({
title
:
''
,
desc
:
(
this
.
$t
(
'app.commonWords.saveSuccess'
)
as
string
)
});
this
.
$Notice
.
success
({
title
:
''
,
desc
:
(
this
.
$t
(
'app.commonWords.saveSuccess'
)
as
string
)
});
}
else
{
}
else
{
errorItems
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
errorItems
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.wrong'
)
as
string
),
desc
:
errorMessage
[
index
].
data
.
message
});
if
(
errorMessage
[
index
]
&&
errorMessage
[
index
].
data
)
{
console
.
error
(
errorMessage
[
index
]);
if
(
Object
.
is
(
errorMessage
[
index
].
data
.
errorKey
,
'DupCheck'
))
{
let
errorProp
:
string
=
errorMessage
[
index
].
data
.
message
.
match
(
/
\[[
a-zA-Z
]
*
\]
/
)[
0
];
let
name
:
string
=
errorProp
?
this
.
service
.
getNameByProp
(
errorProp
.
substr
(
1
,
errorProp
.
length
-
2
))
:
''
;
if
(
name
)
{
let
desc
:
any
=
this
.
allColumns
.
find
((
column
:
any
)
=>
{
return
Object
.
is
(
column
.
name
,
name
);
});
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.createFailed'
)
as
string
),
desc
:
(
desc
?
desc
.
label
:
''
)
+
" : "
+
item
[
name
]
+
(
this
.
$t
(
'app.commonWords.isExist'
)
as
string
)
+
'!'
,
});
}
else
{
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.createFailed'
)
as
string
),
desc
:
errorMessage
[
index
].
data
.
message
?
errorMessage
[
index
].
data
.
message
:(
this
.
$t
(
'app.commonWords.sysException'
)
as
string
),
});
}
}
else
if
(
Object
.
is
(
errorMessage
[
index
].
data
.
errorKey
,
'DuplicateKeyException'
)){
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.saveFailed'
)
as
string
),
desc
:
errorMessage
[
index
].
data
.
message
?
errorMessage
[
index
].
data
.
message
:(
this
.
$t
(
'app.commonWords.sysException'
)
as
string
),
});
}
else
{
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.saveFailed'
)
as
string
),
desc
:
errorMessage
[
index
].
data
.
message
?
errorMessage
[
index
].
data
.
message
:(
this
.
$t
(
'app.commonWords.sysException'
)
as
string
),
});
}
}
else
{
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.saveFailed'
)
as
string
),
desc
:
(
item
[
this
.
majorInfoColName
]?
item
[
this
.
majorInfoColName
]:
""
)
+
(
this
.
$t
(
'app.commonWords.saveFailed'
)
as
string
)
+
'!'
});
}
});
});
}
}
return
successItems
;
return
successItems
;
...
@@ -2025,15 +2060,19 @@ export default class MainBase extends Vue implements ControlInterface {
...
@@ -2025,15 +2060,19 @@ export default class MainBase extends Vue implements ControlInterface {
let
startOp
=
(
val
:
boolean
)
=>
{
let
startOp
=
(
val
:
boolean
)
=>
{
if
(
falg
.
isPast
){
if
(
falg
.
isPast
){
if
(
opValue
){
if
(
opValue
){
falg
.
isPast
=
falg
&&
val
;
falg
.
isPast
=
falg
.
isPast
&&
val
;
}
else
{
}
else
{
falg
.
isPast
=
falg
||
val
;
falg
.
isPast
=
falg
.
isPast
||
val
;
}
}
}
else
{
}
else
{
falg
.
isPast
=
val
;
falg
.
isPast
=
val
;
}
}
}
}
rule
[
name
].
forEach
((
item
:
any
)
=>
{
rule
[
name
].
forEach
((
item
:
any
)
=>
{
if
((
value
===
null
||
value
===
undefined
||
value
===
""
)
&&
(
item
.
type
!=
'GROUP'
)){
startOp
(
true
);
return
falg
;
}
// 常规规则
// 常规规则
if
(
item
.
type
==
'SIMPLE'
){
if
(
item
.
type
==
'SIMPLE'
){
startOp
(
!
this
.
$verify
.
checkFieldSimpleRule
(
value
,
item
.
condOP
,
item
.
paramValue
,
item
.
ruleInfo
,
item
.
paramType
,
this
.
curEditRowData
,
item
.
isKeyCond
));
startOp
(
!
this
.
$verify
.
checkFieldSimpleRule
(
value
,
item
.
condOP
,
item
.
paramValue
,
item
.
ruleInfo
,
item
.
paramType
,
this
.
curEditRowData
,
item
.
isKeyCond
));
...
@@ -2056,7 +2095,7 @@ export default class MainBase extends Vue implements ControlInterface {
...
@@ -2056,7 +2095,7 @@ export default class MainBase extends Vue implements ControlInterface {
}
}
// 分组
// 分组
if
(
item
.
type
==
'GROUP'
){
if
(
item
.
type
==
'GROUP'
){
falg
=
this
.
verifyDeRules
(
'group'
,
item
,
"AND"
,
value
)
falg
=
this
.
verifyDeRules
(
'group'
,
item
,
item
.
condOP
?
item
.
condOP
:
"AND"
,
value
)
if
(
item
.
isNotMode
){
if
(
item
.
isNotMode
){
falg
.
isPast
=
!
falg
.
isPast
;
falg
.
isPast
=
!
falg
.
isPast
;
}
}
...
...
app_web/src/widgets/dict-option/main-form/main-form-base.vue
浏览文件 @
d66e47b7
此差异已折叠。
点击以展开。
app_web/src/widgets/dict-option/main-grid/main-grid-base.vue
浏览文件 @
d66e47b7
...
@@ -578,7 +578,6 @@ export default class MainBase extends Vue implements ControlInterface {
...
@@ -578,7 +578,6 @@ export default class MainBase extends Vue implements ControlInterface {
}
}
/**
/**
* 代码表服务对象
* 代码表服务对象
*
*
...
@@ -587,6 +586,14 @@ export default class MainBase extends Vue implements ControlInterface {
...
@@ -587,6 +586,14 @@ export default class MainBase extends Vue implements ControlInterface {
*/
*/
public
codeListService
:
CodeListService
=
new
CodeListService
({
$store
:
this
.
$store
});
public
codeListService
:
CodeListService
=
new
CodeListService
({
$store
:
this
.
$store
});
/**
* 主信息表格列
*
* @type {string}
* @memberof MainBase
*/
public
majorInfoColName
:
string
=
"label"
;
/**
/**
* 界面UI服务对象
* 界面UI服务对象
*
*
...
@@ -1233,16 +1240,18 @@ export default class MainBase extends Vue implements ControlInterface {
...
@@ -1233,16 +1240,18 @@ export default class MainBase extends Vue implements ControlInterface {
this
.
errorMessages
=
[];
this
.
errorMessages
=
[];
let
validateState
=
true
;
let
validateState
=
true
;
let
index
=
-
1
;
let
index
=
-
1
;
for
(
let
item
of
this
.
items
){
for
(
let
item
of
this
.
items
)
{
let
tempMessage
:
string
=
''
;
index
++
;
index
++
;
if
(
item
.
rowDataState
===
"create"
||
item
.
rowDataState
===
"update"
)
{
if
(
item
.
rowDataState
===
"create"
||
item
.
rowDataState
===
"update"
)
{
for
(
let
property
of
Object
.
keys
(
this
.
rules
))
{
for
(
let
property
of
Object
.
keys
(
this
.
rules
))
{
if
(
!
await
this
.
validate
(
property
,
item
,
index
))
{
if
(
!
await
this
.
validate
(
property
,
item
,
index
))
{
validateState
=
false
;
validateState
=
false
;
this
.
errorMessages
.
push
(
this
.
gridItemsModel
[
index
][
property
].
error
)
;
tempMessage
=
tempMessage
+
'<p>'
+
this
.
gridItemsModel
[
index
][
property
].
error
+
'<p>'
;
}
}
}
}
}
}
this
.
errorMessages
.
push
(
tempMessage
);
}
}
return
validateState
;
return
validateState
;
}
}
...
@@ -1379,9 +1388,9 @@ export default class MainBase extends Vue implements ControlInterface {
...
@@ -1379,9 +1388,9 @@ export default class MainBase extends Vue implements ControlInterface {
});
});
if
(
_datas
.
length
<
5
)
{
if
(
_datas
.
length
<
5
)
{
dataInfo
=
dataInfo
+
' '
+
(
this
.
$t
(
'app.gridpage.totle'
)
as
string
)
+
_datas
.
length
+
(
this
.
$t
(
'app.gridpage.records'
)
as
string
)
+
(
this
.
$t
(
'app.gridpage.data'
)
as
string
);
dataInfo
=
dataInfo
+
' '
+
(
this
.
$t
(
'app.gridpage.totle'
)
as
string
)
+
_datas
.
length
+
(
this
.
$t
(
'app.gridpage.records'
)
as
string
)
+
(
this
.
$t
(
'app.gridpage.data'
)
as
string
);
}
else
{
}
else
{
dataInfo
=
dataInfo
+
'...'
+
' '
+
(
this
.
$t
(
'app.gridpage.totle'
)
as
string
)
+
_datas
.
length
+
(
this
.
$t
(
'app.gridpage.desc2
'
)
as
string
);
dataInfo
=
' ... '
+
(
this
.
$t
(
'app.gridpage.totle'
)
as
string
)
+
_datas
.
length
+
(
this
.
$t
(
'app.gridpage.records'
)
as
string
)
+
(
this
.
$t
(
'app.gridpage.data
'
)
as
string
);
}
}
const
removeData
=
()
=>
{
const
removeData
=
()
=>
{
...
@@ -1701,7 +1710,7 @@ export default class MainBase extends Vue implements ControlInterface {
...
@@ -1701,7 +1710,7 @@ export default class MainBase extends Vue implements ControlInterface {
return
;
return
;
}
}
if
(
Object
.
is
(
'load'
,
action
))
{
if
(
Object
.
is
(
'load'
,
action
))
{
this
.
load
(
data
);
this
.
load
(
data
,
true
);
}
}
if
(
Object
.
is
(
'remove'
,
action
))
{
if
(
Object
.
is
(
'remove'
,
action
))
{
this
.
remove
(
data
);
this
.
remove
(
data
);
...
@@ -2202,11 +2211,7 @@ export default class MainBase extends Vue implements ControlInterface {
...
@@ -2202,11 +2211,7 @@ export default class MainBase extends Vue implements ControlInterface {
}
}
if
(
!
await
this
.
validateAll
())
{
if
(
!
await
this
.
validateAll
())
{
if
(
this
.
errorMessages
&&
this
.
errorMessages
.
length
>
0
)
{
if
(
this
.
errorMessages
&&
this
.
errorMessages
.
length
>
0
)
{
let
descMessage
:
string
=
''
;
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.wrong'
)
as
string
),
desc
:
this
.
errorMessages
[
0
]
});
this
.
errorMessages
.
forEach
((
message
:
any
)
=>
{
descMessage
=
descMessage
+
'<p>'
+
message
+
'<p>'
;
})
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.wrong'
)
as
string
),
desc
:
descMessage
});
}
else
{
}
else
{
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.wrong'
)
as
string
),
desc
:
(
this
.
$t
(
'app.commonWords.rulesException'
)
as
string
)
});
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.wrong'
)
as
string
),
desc
:
(
this
.
$t
(
'app.commonWords.rulesException'
)
as
string
)
});
}
}
...
@@ -2247,9 +2252,39 @@ export default class MainBase extends Vue implements ControlInterface {
...
@@ -2247,9 +2252,39 @@ export default class MainBase extends Vue implements ControlInterface {
if
(
errorItems
.
length
===
0
&&
successItems
.
length
>
0
&&
!
this
.
isformDruipart
){
if
(
errorItems
.
length
===
0
&&
successItems
.
length
>
0
&&
!
this
.
isformDruipart
){
this
.
$Notice
.
success
({
title
:
''
,
desc
:
(
this
.
$t
(
'app.commonWords.saveSuccess'
)
as
string
)
});
this
.
$Notice
.
success
({
title
:
''
,
desc
:
(
this
.
$t
(
'app.commonWords.saveSuccess'
)
as
string
)
});
}
else
{
}
else
{
errorItems
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
errorItems
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.wrong'
)
as
string
),
desc
:
errorMessage
[
index
].
data
.
message
});
if
(
errorMessage
[
index
]
&&
errorMessage
[
index
].
data
)
{
console
.
error
(
errorMessage
[
index
]);
if
(
Object
.
is
(
errorMessage
[
index
].
data
.
errorKey
,
'DupCheck'
))
{
let
errorProp
:
string
=
errorMessage
[
index
].
data
.
message
.
match
(
/
\[[
a-zA-Z
]
*
\]
/
)[
0
];
let
name
:
string
=
errorProp
?
this
.
service
.
getNameByProp
(
errorProp
.
substr
(
1
,
errorProp
.
length
-
2
))
:
''
;
if
(
name
)
{
let
desc
:
any
=
this
.
allColumns
.
find
((
column
:
any
)
=>
{
return
Object
.
is
(
column
.
name
,
name
);
});
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.createFailed'
)
as
string
),
desc
:
(
desc
?
desc
.
label
:
''
)
+
" : "
+
item
[
name
]
+
(
this
.
$t
(
'app.commonWords.isExist'
)
as
string
)
+
'!'
,
});
}
else
{
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.createFailed'
)
as
string
),
desc
:
errorMessage
[
index
].
data
.
message
?
errorMessage
[
index
].
data
.
message
:(
this
.
$t
(
'app.commonWords.sysException'
)
as
string
),
});
}
}
else
if
(
Object
.
is
(
errorMessage
[
index
].
data
.
errorKey
,
'DuplicateKeyException'
)){
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.saveFailed'
)
as
string
),
desc
:
errorMessage
[
index
].
data
.
message
?
errorMessage
[
index
].
data
.
message
:(
this
.
$t
(
'app.commonWords.sysException'
)
as
string
),
});
}
else
{
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.saveFailed'
)
as
string
),
desc
:
errorMessage
[
index
].
data
.
message
?
errorMessage
[
index
].
data
.
message
:(
this
.
$t
(
'app.commonWords.sysException'
)
as
string
),
});
}
}
else
{
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.saveFailed'
)
as
string
),
desc
:
(
item
[
this
.
majorInfoColName
]?
item
[
this
.
majorInfoColName
]:
""
)
+
(
this
.
$t
(
'app.commonWords.saveFailed'
)
as
string
)
+
'!'
});
}
});
});
}
}
return
successItems
;
return
successItems
;
...
@@ -2508,15 +2543,19 @@ export default class MainBase extends Vue implements ControlInterface {
...
@@ -2508,15 +2543,19 @@ export default class MainBase extends Vue implements ControlInterface {
let
startOp
=
(
val
:
boolean
)
=>
{
let
startOp
=
(
val
:
boolean
)
=>
{
if
(
falg
.
isPast
){
if
(
falg
.
isPast
){
if
(
opValue
){
if
(
opValue
){
falg
.
isPast
=
falg
&&
val
;
falg
.
isPast
=
falg
.
isPast
&&
val
;
}
else
{
}
else
{
falg
.
isPast
=
falg
||
val
;
falg
.
isPast
=
falg
.
isPast
||
val
;
}
}
}
else
{
}
else
{
falg
.
isPast
=
val
;
falg
.
isPast
=
val
;
}
}
}
}
rule
[
name
].
forEach
((
item
:
any
)
=>
{
rule
[
name
].
forEach
((
item
:
any
)
=>
{
if
((
value
===
null
||
value
===
undefined
||
value
===
""
)
&&
(
item
.
type
!=
'GROUP'
)){
startOp
(
true
);
return
falg
;
}
// 常规规则
// 常规规则
if
(
item
.
type
==
'SIMPLE'
){
if
(
item
.
type
==
'SIMPLE'
){
startOp
(
!
this
.
$verify
.
checkFieldSimpleRule
(
value
,
item
.
condOP
,
item
.
paramValue
,
item
.
ruleInfo
,
item
.
paramType
,
this
.
curEditRowData
,
item
.
isKeyCond
));
startOp
(
!
this
.
$verify
.
checkFieldSimpleRule
(
value
,
item
.
condOP
,
item
.
paramValue
,
item
.
ruleInfo
,
item
.
paramType
,
this
.
curEditRowData
,
item
.
isKeyCond
));
...
@@ -2539,7 +2578,7 @@ export default class MainBase extends Vue implements ControlInterface {
...
@@ -2539,7 +2578,7 @@ export default class MainBase extends Vue implements ControlInterface {
}
}
// 分组
// 分组
if
(
item
.
type
==
'GROUP'
){
if
(
item
.
type
==
'GROUP'
){
falg
=
this
.
verifyDeRules
(
'group'
,
item
,
"AND"
,
value
)
falg
=
this
.
verifyDeRules
(
'group'
,
item
,
item
.
condOP
?
item
.
condOP
:
"AND"
,
value
)
if
(
item
.
isNotMode
){
if
(
item
.
isNotMode
){
falg
.
isPast
=
!
falg
.
isPast
;
falg
.
isPast
=
!
falg
.
isPast
;
}
}
...
...
app_web/src/widgets/dict-option/options-grid/options-grid-base.vue
浏览文件 @
d66e47b7
...
@@ -566,7 +566,6 @@ export default class OptionsBase extends Vue implements ControlInterface {
...
@@ -566,7 +566,6 @@ export default class OptionsBase extends Vue implements ControlInterface {
}
}
/**
/**
* 代码表服务对象
* 代码表服务对象
*
*
...
@@ -575,6 +574,14 @@ export default class OptionsBase extends Vue implements ControlInterface {
...
@@ -575,6 +574,14 @@ export default class OptionsBase extends Vue implements ControlInterface {
*/
*/
public
codeListService
:
CodeListService
=
new
CodeListService
({
$store
:
this
.
$store
});
public
codeListService
:
CodeListService
=
new
CodeListService
({
$store
:
this
.
$store
});
/**
* 主信息表格列
*
* @type {string}
* @memberof OptionsBase
*/
public
majorInfoColName
:
string
=
"label"
;
/**
/**
* 界面UI服务对象
* 界面UI服务对象
*
*
...
@@ -1212,16 +1219,18 @@ export default class OptionsBase extends Vue implements ControlInterface {
...
@@ -1212,16 +1219,18 @@ export default class OptionsBase extends Vue implements ControlInterface {
this
.
errorMessages
=
[];
this
.
errorMessages
=
[];
let
validateState
=
true
;
let
validateState
=
true
;
let
index
=
-
1
;
let
index
=
-
1
;
for
(
let
item
of
this
.
items
){
for
(
let
item
of
this
.
items
)
{
let
tempMessage
:
string
=
''
;
index
++
;
index
++
;
if
(
item
.
rowDataState
===
"create"
||
item
.
rowDataState
===
"update"
)
{
if
(
item
.
rowDataState
===
"create"
||
item
.
rowDataState
===
"update"
)
{
for
(
let
property
of
Object
.
keys
(
this
.
rules
))
{
for
(
let
property
of
Object
.
keys
(
this
.
rules
))
{
if
(
!
await
this
.
validate
(
property
,
item
,
index
))
{
if
(
!
await
this
.
validate
(
property
,
item
,
index
))
{
validateState
=
false
;
validateState
=
false
;
this
.
errorMessages
.
push
(
this
.
gridItemsModel
[
index
][
property
].
error
)
;
tempMessage
=
tempMessage
+
'<p>'
+
this
.
gridItemsModel
[
index
][
property
].
error
+
'<p>'
;
}
}
}
}
}
}
this
.
errorMessages
.
push
(
tempMessage
);
}
}
return
validateState
;
return
validateState
;
}
}
...
@@ -1358,9 +1367,9 @@ export default class OptionsBase extends Vue implements ControlInterface {
...
@@ -1358,9 +1367,9 @@ export default class OptionsBase extends Vue implements ControlInterface {
});
});
if
(
_datas
.
length
<
5
)
{
if
(
_datas
.
length
<
5
)
{
dataInfo
=
dataInfo
+
' '
+
(
this
.
$t
(
'app.gridpage.totle'
)
as
string
)
+
_datas
.
length
+
(
this
.
$t
(
'app.gridpage.records'
)
as
string
)
+
(
this
.
$t
(
'app.gridpage.data'
)
as
string
);
dataInfo
=
dataInfo
+
' '
+
(
this
.
$t
(
'app.gridpage.totle'
)
as
string
)
+
_datas
.
length
+
(
this
.
$t
(
'app.gridpage.records'
)
as
string
)
+
(
this
.
$t
(
'app.gridpage.data'
)
as
string
);
}
else
{
}
else
{
dataInfo
=
dataInfo
+
'...'
+
' '
+
(
this
.
$t
(
'app.gridpage.totle'
)
as
string
)
+
_datas
.
length
+
(
this
.
$t
(
'app.gridpage.desc2
'
)
as
string
);
dataInfo
=
' ... '
+
(
this
.
$t
(
'app.gridpage.totle'
)
as
string
)
+
_datas
.
length
+
(
this
.
$t
(
'app.gridpage.records'
)
as
string
)
+
(
this
.
$t
(
'app.gridpage.data
'
)
as
string
);
}
}
const
removeData
=
()
=>
{
const
removeData
=
()
=>
{
...
@@ -1680,7 +1689,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
...
@@ -1680,7 +1689,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
return
;
return
;
}
}
if
(
Object
.
is
(
'load'
,
action
))
{
if
(
Object
.
is
(
'load'
,
action
))
{
this
.
load
(
data
);
this
.
load
(
data
,
true
);
}
}
if
(
Object
.
is
(
'remove'
,
action
))
{
if
(
Object
.
is
(
'remove'
,
action
))
{
this
.
remove
(
data
);
this
.
remove
(
data
);
...
@@ -2180,11 +2189,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
...
@@ -2180,11 +2189,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
}
}
if
(
!
await
this
.
validateAll
())
{
if
(
!
await
this
.
validateAll
())
{
if
(
this
.
errorMessages
&&
this
.
errorMessages
.
length
>
0
)
{
if
(
this
.
errorMessages
&&
this
.
errorMessages
.
length
>
0
)
{
let
descMessage
:
string
=
''
;
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.wrong'
)
as
string
),
desc
:
this
.
errorMessages
[
0
]
});
this
.
errorMessages
.
forEach
((
message
:
any
)
=>
{
descMessage
=
descMessage
+
'<p>'
+
message
+
'<p>'
;
})
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.wrong'
)
as
string
),
desc
:
descMessage
});
}
else
{
}
else
{
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.wrong'
)
as
string
),
desc
:
(
this
.
$t
(
'app.commonWords.rulesException'
)
as
string
)
});
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.wrong'
)
as
string
),
desc
:
(
this
.
$t
(
'app.commonWords.rulesException'
)
as
string
)
});
}
}
...
@@ -2225,9 +2230,39 @@ export default class OptionsBase extends Vue implements ControlInterface {
...
@@ -2225,9 +2230,39 @@ export default class OptionsBase extends Vue implements ControlInterface {
if
(
errorItems
.
length
===
0
&&
successItems
.
length
>
0
&&
!
this
.
isformDruipart
){
if
(
errorItems
.
length
===
0
&&
successItems
.
length
>
0
&&
!
this
.
isformDruipart
){
this
.
$Notice
.
success
({
title
:
''
,
desc
:
(
this
.
$t
(
'app.commonWords.saveSuccess'
)
as
string
)
});
this
.
$Notice
.
success
({
title
:
''
,
desc
:
(
this
.
$t
(
'app.commonWords.saveSuccess'
)
as
string
)
});
}
else
{
}
else
{
errorItems
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
errorItems
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.wrong'
)
as
string
),
desc
:
errorMessage
[
index
].
data
.
message
});
if
(
errorMessage
[
index
]
&&
errorMessage
[
index
].
data
)
{
console
.
error
(
errorMessage
[
index
]);
if
(
Object
.
is
(
errorMessage
[
index
].
data
.
errorKey
,
'DupCheck'
))
{
let
errorProp
:
string
=
errorMessage
[
index
].
data
.
message
.
match
(
/
\[[
a-zA-Z
]
*
\]
/
)[
0
];
let
name
:
string
=
errorProp
?
this
.
service
.
getNameByProp
(
errorProp
.
substr
(
1
,
errorProp
.
length
-
2
))
:
''
;
if
(
name
)
{
let
desc
:
any
=
this
.
allColumns
.
find
((
column
:
any
)
=>
{
return
Object
.
is
(
column
.
name
,
name
);
});
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.createFailed'
)
as
string
),
desc
:
(
desc
?
desc
.
label
:
''
)
+
" : "
+
item
[
name
]
+
(
this
.
$t
(
'app.commonWords.isExist'
)
as
string
)
+
'!'
,
});
}
else
{
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.createFailed'
)
as
string
),
desc
:
errorMessage
[
index
].
data
.
message
?
errorMessage
[
index
].
data
.
message
:(
this
.
$t
(
'app.commonWords.sysException'
)
as
string
),
});
}
}
else
if
(
Object
.
is
(
errorMessage
[
index
].
data
.
errorKey
,
'DuplicateKeyException'
)){
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.saveFailed'
)
as
string
),
desc
:
errorMessage
[
index
].
data
.
message
?
errorMessage
[
index
].
data
.
message
:(
this
.
$t
(
'app.commonWords.sysException'
)
as
string
),
});
}
else
{
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.saveFailed'
)
as
string
),
desc
:
errorMessage
[
index
].
data
.
message
?
errorMessage
[
index
].
data
.
message
:(
this
.
$t
(
'app.commonWords.sysException'
)
as
string
),
});
}
}
else
{
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'app.commonWords.saveFailed'
)
as
string
),
desc
:
(
item
[
this
.
majorInfoColName
]?
item
[
this
.
majorInfoColName
]:
""
)
+
(
this
.
$t
(
'app.commonWords.saveFailed'
)
as
string
)
+
'!'
});
}
});
});
}
}
return
successItems
;
return
successItems
;
...
@@ -2486,15 +2521,19 @@ export default class OptionsBase extends Vue implements ControlInterface {
...
@@ -2486,15 +2521,19 @@ export default class OptionsBase extends Vue implements ControlInterface {
let
startOp
=
(
val
:
boolean
)
=>
{
let
startOp
=
(
val
:
boolean
)
=>
{
if
(
falg
.
isPast
){
if
(
falg
.
isPast
){
if
(
opValue
){
if
(
opValue
){
falg
.
isPast
=
falg
&&
val
;
falg
.
isPast
=
falg
.
isPast
&&
val
;
}
else
{
}
else
{
falg
.
isPast
=
falg
||
val
;
falg
.
isPast
=
falg
.
isPast
||
val
;
}
}
}
else
{
}
else
{
falg
.
isPast
=
val
;
falg
.
isPast
=
val
;
}
}
}
}
rule
[
name
].
forEach
((
item
:
any
)
=>
{
rule
[
name
].
forEach
((
item
:
any
)
=>
{
if
((
value
===
null
||
value
===
undefined
||
value
===
""
)
&&
(
item
.
type
!=
'GROUP'
)){
startOp
(
true
);
return
falg
;
}
// 常规规则
// 常规规则
if
(
item
.
type
==
'SIMPLE'
){
if
(
item
.
type
==
'SIMPLE'
){
startOp
(
!
this
.
$verify
.
checkFieldSimpleRule
(
value
,
item
.
condOP
,
item
.
paramValue
,
item
.
ruleInfo
,
item
.
paramType
,
this
.
curEditRowData
,
item
.
isKeyCond
));
startOp
(
!
this
.
$verify
.
checkFieldSimpleRule
(
value
,
item
.
condOP
,
item
.
paramValue
,
item
.
ruleInfo
,
item
.
paramType
,
this
.
curEditRowData
,
item
.
isKeyCond
));
...
@@ -2517,7 +2556,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
...
@@ -2517,7 +2556,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
}
}
// 分组
// 分组
if
(
item
.
type
==
'GROUP'
){
if
(
item
.
type
==
'GROUP'
){
falg
=
this
.
verifyDeRules
(
'group'
,
item
,
"AND"
,
value
)
falg
=
this
.
verifyDeRules
(
'group'
,
item
,
item
.
condOP
?
item
.
condOP
:
"AND"
,
value
)
if
(
item
.
isNotMode
){
if
(
item
.
isNotMode
){
falg
.
isPast
=
!
falg
.
isPast
;
falg
.
isPast
=
!
falg
.
isPast
;
}
}
...
...
ibzdict-core/src/main/java/cn/ibizlab/core/dict/domain/DictOption.java
浏览文件 @
d66e47b7
...
@@ -38,7 +38,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
...
@@ -38,7 +38,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@Setter
@Setter
@NoArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties
(
value
=
"handler"
)
@JsonIgnoreProperties
(
value
=
"handler"
)
@TableName
(
value
=
"IBZDICTOPTION"
,
resultMap
=
"DictOptionResultMap"
)
@TableName
(
value
=
"IBZDICTOPTION"
,
resultMap
=
"DictOptionResultMap"
)
public
class
DictOption
extends
EntityMP
implements
Serializable
{
public
class
DictOption
extends
EntityMP
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
@@ -46,8 +46,8 @@ public class DictOption extends EntityMP implements Serializable {
...
@@ -46,8 +46,8 @@ public class DictOption extends EntityMP implements Serializable {
/**
/**
* 标识
* 标识
*/
*/
@DEField
(
name
=
"vkey"
,
isKeyField
=
true
)
@DEField
(
name
=
"vkey"
,
isKeyField
=
true
)
@TableId
(
value
=
"vkey"
,
type
=
IdType
.
ASSIGN_UUID
)
@TableId
(
value
=
"vkey"
,
type
=
IdType
.
ASSIGN_UUID
)
@JSONField
(
name
=
"value_key"
)
@JSONField
(
name
=
"value_key"
)
@JsonProperty
(
"value_key"
)
@JsonProperty
(
"value_key"
)
private
String
valueKey
;
private
String
valueKey
;
...
@@ -101,7 +101,7 @@ public class DictOption extends EntityMP implements Serializable {
...
@@ -101,7 +101,7 @@ public class DictOption extends EntityMP implements Serializable {
/**
/**
* 栏目样式
* 栏目样式
*/
*/
@DEField
(
defaultValue
=
"itemcls"
,
defaultValueType
=
DEFieldDefaultValueType
.
PARAM
)
@DEField
(
defaultValue
=
"itemcls"
,
defaultValueType
=
DEFieldDefaultValueType
.
PARAM
)
@TableField
(
value
=
"cls"
)
@TableField
(
value
=
"cls"
)
@JSONField
(
name
=
"cls"
)
@JSONField
(
name
=
"cls"
)
@JsonProperty
(
"cls"
)
@JsonProperty
(
"cls"
)
...
@@ -149,8 +149,8 @@ public class DictOption extends EntityMP implements Serializable {
...
@@ -149,8 +149,8 @@ public class DictOption extends EntityMP implements Serializable {
*/
*/
@DEField
(
preType
=
DEPredefinedFieldType
.
UPDATEDATE
)
@DEField
(
preType
=
DEPredefinedFieldType
.
UPDATEDATE
)
@TableField
(
value
=
"updatedate"
)
@TableField
(
value
=
"updatedate"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
@JSONField
(
name
=
"updatedate"
,
format
=
"yyyy-MM-dd HH:mm:ss"
)
@JSONField
(
name
=
"updatedate"
,
format
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonProperty
(
"updatedate"
)
@JsonProperty
(
"updatedate"
)
private
Timestamp
updatedate
;
private
Timestamp
updatedate
;
...
@@ -167,105 +167,105 @@ public class DictOption extends EntityMP implements Serializable {
...
@@ -167,105 +167,105 @@ public class DictOption extends EntityMP implements Serializable {
/**
/**
* 设置 [目录代码]
* 设置 [目录代码]
*/
*/
public
void
setCatalogId
(
String
catalogId
){
public
void
setCatalogId
(
String
catalogId
)
{
this
.
catalogId
=
catalogId
;
this
.
catalogId
=
catalogId
;
this
.
modify
(
"cid"
,
catalogId
);
this
.
modify
(
"cid"
,
catalogId
);
}
}
/**
/**
* 设置 [目录]
* 设置 [目录]
*/
*/
public
void
setCatalogName
(
String
catalogName
){
public
void
setCatalogName
(
String
catalogName
)
{
this
.
catalogName
=
catalogName
;
this
.
catalogName
=
catalogName
;
this
.
modify
(
"cname"
,
catalogName
);
this
.
modify
(
"cname"
,
catalogName
);
}
}
/**
/**
* 设置 [代码值]
* 设置 [代码值]
*/
*/
public
void
setValue
(
String
value
){
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
this
.
value
=
value
;
this
.
modify
(
"val"
,
value
);
this
.
modify
(
"val"
,
value
);
}
}
/**
/**
* 设置 [名称]
* 设置 [名称]
*/
*/
public
void
setLabel
(
String
label
){
public
void
setLabel
(
String
label
)
{
this
.
label
=
label
;
this
.
label
=
label
;
this
.
modify
(
"label"
,
label
);
this
.
modify
(
"label"
,
label
);
}
}
/**
/**
* 设置 [父代码值]
* 设置 [父代码值]
*/
*/
public
void
setParent
(
String
parent
){
public
void
setParent
(
String
parent
)
{
this
.
parent
=
parent
;
this
.
parent
=
parent
;
this
.
modify
(
"pval"
,
parent
);
this
.
modify
(
"pval"
,
parent
);
}
}
/**
/**
* 设置 [过滤项]
* 设置 [过滤项]
*/
*/
public
void
setFilter
(
String
filter
){
public
void
setFilter
(
String
filter
)
{
this
.
filter
=
filter
;
this
.
filter
=
filter
;
this
.
modify
(
"vfilter"
,
filter
);
this
.
modify
(
"vfilter"
,
filter
);
}
}
/**
/**
* 设置 [栏目样式]
* 设置 [栏目样式]
*/
*/
public
void
setCls
(
String
cls
){
public
void
setCls
(
String
cls
)
{
this
.
cls
=
cls
;
this
.
cls
=
cls
;
this
.
modify
(
"cls"
,
cls
);
this
.
modify
(
"cls"
,
cls
);
}
}
/**
/**
* 设置 [图标]
* 设置 [图标]
*/
*/
public
void
setIconClass
(
String
iconClass
){
public
void
setIconClass
(
String
iconClass
)
{
this
.
iconClass
=
iconClass
;
this
.
iconClass
=
iconClass
;
this
.
modify
(
"iconcls"
,
iconClass
);
this
.
modify
(
"iconcls"
,
iconClass
);
}
}
/**
/**
* 设置 [是否禁用]
* 设置 [是否禁用]
*/
*/
public
void
setDisabled
(
Integer
disabled
){
public
void
setDisabled
(
Integer
disabled
)
{
this
.
disabled
=
disabled
;
this
.
disabled
=
disabled
;
this
.
modify
(
"disabled"
,
disabled
);
this
.
modify
(
"disabled"
,
disabled
);
}
}
/**
/**
* 设置 [过期/失效]
* 设置 [过期/失效]
*/
*/
public
void
setExpired
(
Integer
expired
){
public
void
setExpired
(
Integer
expired
)
{
this
.
expired
=
expired
;
this
.
expired
=
expired
;
this
.
modify
(
"expired"
,
expired
);
this
.
modify
(
"expired"
,
expired
);
}
}
/**
/**
* 设置 [排序]
* 设置 [排序]
*/
*/
public
void
setShoworder
(
Integer
showorder
){
public
void
setShoworder
(
Integer
showorder
)
{
this
.
showorder
=
showorder
;
this
.
showorder
=
showorder
;
this
.
modify
(
"showorder"
,
showorder
);
this
.
modify
(
"showorder"
,
showorder
);
}
}
/**
/**
* 设置 [扩展]
* 设置 [扩展]
*/
*/
public
void
setExtension
(
String
extension
){
public
void
setExtension
(
String
extension
)
{
this
.
extension
=
extension
;
this
.
extension
=
extension
;
this
.
modify
(
"extension"
,
extension
);
this
.
modify
(
"extension"
,
extension
);
}
}
/**
/**
* 获取 [标识]
* 获取 [标识]
*/
*/
public
String
getValueKey
(){
public
String
getValueKey
()
{
if
(
ObjectUtils
.
isEmpty
(
valueKey
)){
if
(
ObjectUtils
.
isEmpty
(
valueKey
))
{
valueKey
=(
String
)
getDefaultKey
(
true
);
valueKey
=(
String
)
getDefaultKey
(
true
);
}
}
return
valueKey
;
return
valueKey
;
...
@@ -287,7 +287,7 @@ public class DictOption extends EntityMP implements Serializable {
...
@@ -287,7 +287,7 @@ public class DictOption extends EntityMP implements Serializable {
@Override
@Override
public
<
T
>
T
copyTo
(
T
targetEntity
,
boolean
bIncEmpty
)
{
public
<
T
>
T
copyTo
(
T
targetEntity
,
boolean
bIncEmpty
)
{
this
.
reset
(
"vkey"
);
this
.
reset
(
"vkey"
);
return
super
.
copyTo
(
targetEntity
,
bIncEmpty
);
return
super
.
copyTo
(
targetEntity
,
bIncEmpty
);
}
}
}
}
...
...
ibzdict-core/src/main/java/cn/ibizlab/core/dict/filter/DictCatalogSearchContext.java
浏览文件 @
d66e47b7
...
@@ -59,6 +59,7 @@ public class DictCatalogSearchContext extends QueryWrapperContext<DictCatalog> {
...
@@ -59,6 +59,7 @@ public class DictCatalogSearchContext extends QueryWrapperContext<DictCatalog> {
/**
/**
* 启用快速搜索
* 启用快速搜索
*/
*/
@Override
public
void
setQuery
(
String
query
)
public
void
setQuery
(
String
query
)
{
{
this
.
query
=
query
;
this
.
query
=
query
;
...
...
ibzdict-core/src/main/java/cn/ibizlab/core/dict/filter/DictOptionSearchContext.java
浏览文件 @
d66e47b7
...
@@ -73,6 +73,7 @@ public class DictOptionSearchContext extends QueryWrapperContext<DictOption> {
...
@@ -73,6 +73,7 @@ public class DictOptionSearchContext extends QueryWrapperContext<DictOption> {
/**
/**
* 启用快速搜索
* 启用快速搜索
*/
*/
@Override
public
void
setQuery
(
String
query
)
public
void
setQuery
(
String
query
)
{
{
this
.
query
=
query
;
this
.
query
=
query
;
...
...
ibzdict-core/src/main/java/cn/ibizlab/core/dict/mapper/DictCatalogMapper.java
浏览文件 @
d66e47b7
...
@@ -17,23 +17,23 @@ import java.io.Serializable;
...
@@ -17,23 +17,23 @@ import java.io.Serializable;
import
com.baomidou.mybatisplus.core.toolkit.Constants
;
import
com.baomidou.mybatisplus.core.toolkit.Constants
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
public
interface
DictCatalogMapper
extends
BaseMapper
<
DictCatalog
>{
public
interface
DictCatalogMapper
extends
BaseMapper
<
DictCatalog
>
{
Page
<
DictCatalog
>
searchDefault
(
IPage
page
,
@Param
(
"srf"
)
DictCatalogSearchContext
context
,
@Param
(
"ew"
)
Wrapper
<
DictCatalog
>
wrapper
)
;
Page
<
DictCatalog
>
searchDefault
(
IPage
page
,
@Param
(
"srf"
)
DictCatalogSearchContext
context
,
@Param
(
"ew"
)
Wrapper
<
DictCatalog
>
wrapper
);
@Override
@Override
@Cacheable
(
value
=
"dictcatalog"
,
key
=
"'row:'+#p0"
)
@Cacheable
(
value
=
"dictcatalog"
,
key
=
"'row:'+#p0"
)
DictCatalog
selectById
(
Serializable
id
);
DictCatalog
selectById
(
Serializable
id
);
@Override
@Override
@CacheEvict
(
value
=
"dictcatalog"
,
key
=
"'row:'+#p0.id"
)
@CacheEvict
(
value
=
"dictcatalog"
,
key
=
"'row:'+#p0.id"
)
int
insert
(
DictCatalog
entity
);
int
insert
(
DictCatalog
entity
);
@Override
@Override
@CacheEvict
(
value
=
"dictcatalog"
,
key
=
"'row:'+#p0.id"
)
@CacheEvict
(
value
=
"dictcatalog"
,
key
=
"'row:'+#p0.id"
)
int
updateById
(
@Param
(
Constants
.
ENTITY
)
DictCatalog
entity
);
int
updateById
(
@Param
(
Constants
.
ENTITY
)
DictCatalog
entity
);
@Override
@Override
@CacheEvict
(
value
=
"dictcatalog"
,
key
=
"'row:'+#p0.id"
)
@CacheEvict
(
value
=
"dictcatalog"
,
key
=
"'row:'+#p0.id"
)
int
update
(
@Param
(
Constants
.
ENTITY
)
DictCatalog
entity
,
@Param
(
"ew"
)
Wrapper
<
DictCatalog
>
updateWrapper
);
int
update
(
@Param
(
Constants
.
ENTITY
)
DictCatalog
entity
,
@Param
(
"ew"
)
Wrapper
<
DictCatalog
>
updateWrapper
);
@Override
@Override
@CacheEvict
(
value
=
"dictcatalog"
,
key
=
"'row:'+#p0"
)
@CacheEvict
(
value
=
"dictcatalog"
,
key
=
"'row:'+#p0"
)
int
deleteById
(
Serializable
id
);
int
deleteById
(
Serializable
id
);
/**
/**
* 自定义查询SQL
* 自定义查询SQL
...
...
ibzdict-core/src/main/java/cn/ibizlab/core/dict/mapper/DictOptionMapper.java
浏览文件 @
d66e47b7
...
@@ -17,9 +17,9 @@ import java.io.Serializable;
...
@@ -17,9 +17,9 @@ import java.io.Serializable;
import
com.baomidou.mybatisplus.core.toolkit.Constants
;
import
com.baomidou.mybatisplus.core.toolkit.Constants
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
public
interface
DictOptionMapper
extends
BaseMapper
<
DictOption
>{
public
interface
DictOptionMapper
extends
BaseMapper
<
DictOption
>
{
Page
<
DictOption
>
searchDefault
(
IPage
page
,
@Param
(
"srf"
)
DictOptionSearchContext
context
,
@Param
(
"ew"
)
Wrapper
<
DictOption
>
wrapper
)
;
Page
<
DictOption
>
searchDefault
(
IPage
page
,
@Param
(
"srf"
)
DictOptionSearchContext
context
,
@Param
(
"ew"
)
Wrapper
<
DictOption
>
wrapper
);
@Override
@Override
DictOption
selectById
(
Serializable
id
);
DictOption
selectById
(
Serializable
id
);
@Override
@Override
...
@@ -62,6 +62,6 @@ public interface DictOptionMapper extends BaseMapper<DictOption>{
...
@@ -62,6 +62,6 @@ public interface DictOptionMapper extends BaseMapper<DictOption>{
@Delete
(
"${sql}"
)
@Delete
(
"${sql}"
)
boolean
deleteBySQL
(
@Param
(
"sql"
)
String
sql
,
@Param
(
"et"
)
Map
param
);
boolean
deleteBySQL
(
@Param
(
"sql"
)
String
sql
,
@Param
(
"et"
)
Map
param
);
List
<
DictOption
>
selectByCatalogId
(
@Param
(
"id"
)
Serializable
id
)
;
List
<
DictOption
>
selectByCatalogId
(
@Param
(
"id"
)
Serializable
id
);
}
}
ibzdict-core/src/main/java/cn/ibizlab/core/dict/service/IDictCatalogService.java
浏览文件 @
d66e47b7
...
@@ -23,24 +23,24 @@ import com.baomidou.mybatisplus.extension.service.IService;
...
@@ -23,24 +23,24 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
/**
* 实体[DictCatalog] 服务对象接口
* 实体[DictCatalog] 服务对象接口
*/
*/
public
interface
IDictCatalogService
extends
IService
<
DictCatalog
>{
public
interface
IDictCatalogService
extends
IService
<
DictCatalog
>
{
boolean
create
(
DictCatalog
et
)
;
boolean
create
(
DictCatalog
et
);
@CacheEvict
(
value
=
"dictcatalog"
,
allEntries
=
true
)
@CacheEvict
(
value
=
"dictcatalog"
,
allEntries
=
true
)
void
createBatch
(
List
<
DictCatalog
>
list
)
;
void
createBatch
(
List
<
DictCatalog
>
list
);
boolean
update
(
DictCatalog
et
)
;
boolean
update
(
DictCatalog
et
);
@CacheEvict
(
value
=
"dictcatalog"
,
allEntries
=
true
)
@CacheEvict
(
value
=
"dictcatalog"
,
allEntries
=
true
)
void
updateBatch
(
List
<
DictCatalog
>
list
)
;
void
updateBatch
(
List
<
DictCatalog
>
list
);
boolean
remove
(
String
key
)
;
boolean
remove
(
String
key
);
@CacheEvict
(
value
=
"dictcatalog"
,
allEntries
=
true
)
@CacheEvict
(
value
=
"dictcatalog"
,
allEntries
=
true
)
void
removeBatch
(
Collection
<
String
>
idList
)
;
void
removeBatch
(
Collection
<
String
>
idList
);
DictCatalog
get
(
String
key
)
;
DictCatalog
get
(
String
key
);
DictCatalog
getDraft
(
DictCatalog
et
)
;
DictCatalog
getDraft
(
DictCatalog
et
);
boolean
checkKey
(
DictCatalog
et
)
;
boolean
checkKey
(
DictCatalog
et
);
boolean
save
(
DictCatalog
et
)
;
boolean
save
(
DictCatalog
et
);
@CacheEvict
(
value
=
"dictcatalog"
,
allEntries
=
true
)
@CacheEvict
(
value
=
"dictcatalog"
,
allEntries
=
true
)
void
saveBatch
(
List
<
DictCatalog
>
list
)
;
void
saveBatch
(
List
<
DictCatalog
>
list
);
Page
<
DictCatalog
>
searchDefault
(
DictCatalogSearchContext
context
)
;
Page
<
DictCatalog
>
searchDefault
(
DictCatalogSearchContext
context
);
/**
/**
*自定义查询SQL
*自定义查询SQL
* @param sql select * from table where id =#{et.param}
* @param sql select * from table where id =#{et.param}
...
...
ibzdict-core/src/main/java/cn/ibizlab/core/dict/service/IDictOptionService.java
浏览文件 @
d66e47b7
...
@@ -23,20 +23,20 @@ import com.baomidou.mybatisplus.extension.service.IService;
...
@@ -23,20 +23,20 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
/**
* 实体[DictOption] 服务对象接口
* 实体[DictOption] 服务对象接口
*/
*/
public
interface
IDictOptionService
extends
IService
<
DictOption
>{
public
interface
IDictOptionService
extends
IService
<
DictOption
>
{
boolean
create
(
DictOption
et
)
;
boolean
create
(
DictOption
et
);
void
createBatch
(
List
<
DictOption
>
list
)
;
void
createBatch
(
List
<
DictOption
>
list
);
boolean
update
(
DictOption
et
)
;
boolean
update
(
DictOption
et
);
void
updateBatch
(
List
<
DictOption
>
list
)
;
void
updateBatch
(
List
<
DictOption
>
list
);
boolean
remove
(
String
key
)
;
boolean
remove
(
String
key
);
void
removeBatch
(
Collection
<
String
>
idList
)
;
void
removeBatch
(
Collection
<
String
>
idList
);
DictOption
get
(
String
key
)
;
DictOption
get
(
String
key
);
DictOption
getDraft
(
DictOption
et
)
;
DictOption
getDraft
(
DictOption
et
);
boolean
checkKey
(
DictOption
et
)
;
boolean
checkKey
(
DictOption
et
);
boolean
save
(
DictOption
et
)
;
boolean
save
(
DictOption
et
);
void
saveBatch
(
List
<
DictOption
>
list
)
;
void
saveBatch
(
List
<
DictOption
>
list
);
Page
<
DictOption
>
searchDefault
(
DictOptionSearchContext
context
)
;
Page
<
DictOption
>
searchDefault
(
DictOptionSearchContext
context
);
List
<
DictOption
>
selectByCatalogId
(
String
id
);
List
<
DictOption
>
selectByCatalogId
(
String
id
);
void
removeByCatalogId
(
String
id
);
void
removeByCatalogId
(
String
id
);
/**
/**
...
...
ibzdict-core/src/main/java/cn/ibizlab/core/dict/service/impl/DictCatalogServiceImpl.java
浏览文件 @
d66e47b7
...
@@ -57,37 +57,39 @@ public class DictCatalogServiceImpl extends ServiceImpl<DictCatalogMapper, DictC
...
@@ -57,37 +57,39 @@ public class DictCatalogServiceImpl extends ServiceImpl<DictCatalogMapper, DictC
@Override
@Override
@Transactional
@Transactional
public
boolean
create
(
DictCatalog
et
)
{
public
boolean
create
(
DictCatalog
et
)
{
if
(!
this
.
retBool
(
this
.
baseMapper
.
insert
(
et
)))
if
(!
this
.
retBool
(
this
.
baseMapper
.
insert
(
et
)))
{
return
false
;
return
false
;
CachedBeanCopier
.
copy
(
get
(
et
.
getId
()),
et
);
}
CachedBeanCopier
.
copy
(
get
(
et
.
getId
()),
et
);
return
true
;
return
true
;
}
}
@Override
@Override
@Transactional
@Transactional
public
void
createBatch
(
List
<
DictCatalog
>
list
)
{
public
void
createBatch
(
List
<
DictCatalog
>
list
)
{
this
.
saveBatch
(
list
,
batchSize
);
this
.
saveBatch
(
list
,
batchSize
);
}
}
@Override
@Override
@Transactional
@Transactional
public
boolean
update
(
DictCatalog
et
)
{
public
boolean
update
(
DictCatalog
et
)
{
if
(!
update
(
et
,(
Wrapper
)
et
.
getUpdateWrapper
(
true
).
eq
(
"cid"
,
et
.
getId
())))
if
(!
update
(
et
,
(
Wrapper
)
et
.
getUpdateWrapper
(
true
).
eq
(
"cid"
,
et
.
getId
())))
{
return
false
;
return
false
;
CachedBeanCopier
.
copy
(
get
(
et
.
getId
()),
et
);
}
CachedBeanCopier
.
copy
(
get
(
et
.
getId
()),
et
);
return
true
;
return
true
;
}
}
@Override
@Override
@Transactional
@Transactional
public
void
updateBatch
(
List
<
DictCatalog
>
list
)
{
public
void
updateBatch
(
List
<
DictCatalog
>
list
)
{
updateBatchById
(
list
,
batchSize
);
updateBatchById
(
list
,
batchSize
);
}
}
@Override
@Override
@Transactional
@Transactional
public
boolean
remove
(
String
key
)
{
public
boolean
remove
(
String
key
)
{
boolean
result
=
removeById
(
key
);
boolean
result
=
removeById
(
key
);
return
result
;
return
result
;
}
}
...
@@ -101,11 +103,11 @@ public class DictCatalogServiceImpl extends ServiceImpl<DictCatalogMapper, DictC
...
@@ -101,11 +103,11 @@ public class DictCatalogServiceImpl extends ServiceImpl<DictCatalogMapper, DictC
@Transactional
@Transactional
public
DictCatalog
get
(
String
key
)
{
public
DictCatalog
get
(
String
key
)
{
DictCatalog
et
=
getById
(
key
);
DictCatalog
et
=
getById
(
key
);
if
(
et
==
null
){
if
(
et
==
null
){
et
=
new
DictCatalog
();
et
=
new
DictCatalog
();
et
.
setId
(
key
);
et
.
setId
(
key
);
}
}
else
{
else
{
}
}
return
et
;
return
et
;
}
}
...
@@ -117,13 +119,14 @@ public class DictCatalogServiceImpl extends ServiceImpl<DictCatalogMapper, DictC
...
@@ -117,13 +119,14 @@ public class DictCatalogServiceImpl extends ServiceImpl<DictCatalogMapper, DictC
@Override
@Override
public
boolean
checkKey
(
DictCatalog
et
)
{
public
boolean
checkKey
(
DictCatalog
et
)
{
return
(!
ObjectUtils
.
isEmpty
(
et
.
getId
()))
&&
(!
Objects
.
isNull
(
this
.
getById
(
et
.
getId
())));
return
(!
ObjectUtils
.
isEmpty
(
et
.
getId
()))
&&
(!
Objects
.
isNull
(
this
.
getById
(
et
.
getId
())));
}
}
@Override
@Override
@Transactional
@Transactional
public
boolean
save
(
DictCatalog
et
)
{
public
boolean
save
(
DictCatalog
et
)
{
if
(!
saveOrUpdate
(
et
))
if
(!
saveOrUpdate
(
et
))
{
return
false
;
return
false
;
}
return
true
;
return
true
;
}
}
...
...
ibzdict-core/src/main/java/cn/ibizlab/core/dict/service/impl/DictOptionServiceImpl.java
浏览文件 @
d66e47b7
...
@@ -58,9 +58,10 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt
...
@@ -58,9 +58,10 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt
@Transactional
@Transactional
public
boolean
create
(
DictOption
et
)
{
public
boolean
create
(
DictOption
et
)
{
fillParentData
(
et
);
fillParentData
(
et
);
if
(!
this
.
retBool
(
this
.
baseMapper
.
insert
(
et
)))
if
(!
this
.
retBool
(
this
.
baseMapper
.
insert
(
et
)))
{
return
false
;
return
false
;
CachedBeanCopier
.
copy
(
get
(
et
.
getValueKey
()),
et
);
}
CachedBeanCopier
.
copy
(
get
(
et
.
getValueKey
()),
et
);
return
true
;
return
true
;
}
}
...
@@ -75,9 +76,10 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt
...
@@ -75,9 +76,10 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt
@Transactional
@Transactional
public
boolean
update
(
DictOption
et
)
{
public
boolean
update
(
DictOption
et
)
{
fillParentData
(
et
);
fillParentData
(
et
);
if
(!
update
(
et
,(
Wrapper
)
et
.
getUpdateWrapper
(
true
).
eq
(
"vkey"
,
et
.
getValueKey
())))
if
(!
update
(
et
,
(
Wrapper
)
et
.
getUpdateWrapper
(
true
).
eq
(
"vkey"
,
et
.
getValueKey
())))
{
return
false
;
return
false
;
CachedBeanCopier
.
copy
(
get
(
et
.
getValueKey
()),
et
);
}
CachedBeanCopier
.
copy
(
get
(
et
.
getValueKey
()),
et
);
return
true
;
return
true
;
}
}
...
@@ -85,13 +87,13 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt
...
@@ -85,13 +87,13 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt
@Transactional
@Transactional
public
void
updateBatch
(
List
<
DictOption
>
list
)
{
public
void
updateBatch
(
List
<
DictOption
>
list
)
{
list
.
forEach
(
item
->
fillParentData
(
item
));
list
.
forEach
(
item
->
fillParentData
(
item
));
updateBatchById
(
list
,
batchSize
);
updateBatchById
(
list
,
batchSize
);
}
}
@Override
@Override
@Transactional
@Transactional
public
boolean
remove
(
String
key
)
{
public
boolean
remove
(
String
key
)
{
boolean
result
=
removeById
(
key
);
boolean
result
=
removeById
(
key
);
return
result
;
return
result
;
}
}
...
@@ -105,11 +107,11 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt
...
@@ -105,11 +107,11 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt
@Transactional
@Transactional
public
DictOption
get
(
String
key
)
{
public
DictOption
get
(
String
key
)
{
DictOption
et
=
getById
(
key
);
DictOption
et
=
getById
(
key
);
if
(
et
==
null
){
if
(
et
==
null
){
et
=
new
DictOption
();
et
=
new
DictOption
();
et
.
setValueKey
(
key
);
et
.
setValueKey
(
key
);
}
}
else
{
else
{
}
}
return
et
;
return
et
;
}
}
...
@@ -122,13 +124,14 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt
...
@@ -122,13 +124,14 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt
@Override
@Override
public
boolean
checkKey
(
DictOption
et
)
{
public
boolean
checkKey
(
DictOption
et
)
{
return
(!
ObjectUtils
.
isEmpty
(
et
.
getValueKey
()))
&&
(!
Objects
.
isNull
(
this
.
getById
(
et
.
getValueKey
())));
return
(!
ObjectUtils
.
isEmpty
(
et
.
getValueKey
()))
&&
(!
Objects
.
isNull
(
this
.
getById
(
et
.
getValueKey
())));
}
}
@Override
@Override
@Transactional
@Transactional
public
boolean
save
(
DictOption
et
)
{
public
boolean
save
(
DictOption
et
)
{
if
(!
saveOrUpdate
(
et
))
if
(!
saveOrUpdate
(
et
))
{
return
false
;
return
false
;
}
return
true
;
return
true
;
}
}
...
...
ibzdict-dependencies/pom.xml
浏览文件 @
d66e47b7
...
@@ -264,7 +264,6 @@
...
@@ -264,7 +264,6 @@
<version>
${baomidou-jobs.version}
</version>
<version>
${baomidou-jobs.version}
</version>
</dependency>
</dependency>
</dependencies>
</dependencies>
</dependencyManagement>
</dependencyManagement>
...
...
ibzdict-provider/ibzdict-provider-api/src/main/java/cn/ibizlab/api/mapping/DictCatalogMapping.java
浏览文件 @
d66e47b7
...
@@ -4,9 +4,8 @@ import org.mapstruct.*;
...
@@ -4,9 +4,8 @@ import org.mapstruct.*;
import
cn.ibizlab.core.dict.domain.DictCatalog
;
import
cn.ibizlab.core.dict.domain.DictCatalog
;
import
cn.ibizlab.api.dto.DictCatalogDTO
;
import
cn.ibizlab.api.dto.DictCatalogDTO
;
import
cn.ibizlab.util.domain.MappingBase
;
import
cn.ibizlab.util.domain.MappingBase
;
import
org.mapstruct.factory.Mappers
;
@Mapper
(
componentModel
=
"spring"
,
uses
=
{},
implementationName
=
"apiDictCatalogMapping"
,
@Mapper
(
componentModel
=
"spring"
,
uses
=
{},
implementationName
=
"apiDictCatalogMapping"
,
nullValuePropertyMappingStrategy
=
NullValuePropertyMappingStrategy
.
IGNORE
,
nullValuePropertyMappingStrategy
=
NullValuePropertyMappingStrategy
.
IGNORE
,
nullValueCheckStrategy
=
NullValueCheckStrategy
.
ALWAYS
)
nullValueCheckStrategy
=
NullValueCheckStrategy
.
ALWAYS
)
public
interface
DictCatalogMapping
extends
MappingBase
<
DictCatalogDTO
,
DictCatalog
>
{
public
interface
DictCatalogMapping
extends
MappingBase
<
DictCatalogDTO
,
DictCatalog
>
{
...
...
ibzdict-provider/ibzdict-provider-api/src/main/java/cn/ibizlab/api/mapping/DictOptionMapping.java
浏览文件 @
d66e47b7
...
@@ -4,9 +4,8 @@ import org.mapstruct.*;
...
@@ -4,9 +4,8 @@ import org.mapstruct.*;
import
cn.ibizlab.core.dict.domain.DictOption
;
import
cn.ibizlab.core.dict.domain.DictOption
;
import
cn.ibizlab.api.dto.DictOptionDTO
;
import
cn.ibizlab.api.dto.DictOptionDTO
;
import
cn.ibizlab.util.domain.MappingBase
;
import
cn.ibizlab.util.domain.MappingBase
;
import
org.mapstruct.factory.Mappers
;
@Mapper
(
componentModel
=
"spring"
,
uses
=
{},
implementationName
=
"apiDictOptionMapping"
,
@Mapper
(
componentModel
=
"spring"
,
uses
=
{},
implementationName
=
"apiDictOptionMapping"
,
nullValuePropertyMappingStrategy
=
NullValuePropertyMappingStrategy
.
IGNORE
,
nullValuePropertyMappingStrategy
=
NullValuePropertyMappingStrategy
.
IGNORE
,
nullValueCheckStrategy
=
NullValueCheckStrategy
.
ALWAYS
)
nullValueCheckStrategy
=
NullValueCheckStrategy
.
ALWAYS
)
public
interface
DictOptionMapping
extends
MappingBase
<
DictOptionDTO
,
DictOption
>
{
public
interface
DictOptionMapping
extends
MappingBase
<
DictOptionDTO
,
DictOption
>
{
...
...
ibzdict-util/src/main/java/cn/ibizlab/util/aspect/AuditAspect.java
浏览文件 @
d66e47b7
...
@@ -43,30 +43,31 @@ public class AuditAspect
...
@@ -43,30 +43,31 @@ public class AuditAspect
*/
*/
@AfterReturning
(
value
=
"execution(* cn.ibizlab.core.*.service.*.create(..))"
)
@AfterReturning
(
value
=
"execution(* cn.ibizlab.core.*.service.*.create(..))"
)
@SneakyThrows
@SneakyThrows
public
void
create
(
JoinPoint
point
){
public
void
create
(
JoinPoint
point
)
{
HttpServletRequest
request
=
null
;
HttpServletRequest
request
=
null
;
RequestAttributes
requestAttributes
=
RequestContextHolder
.
getRequestAttributes
();
RequestAttributes
requestAttributes
=
RequestContextHolder
.
getRequestAttributes
();
if
(
requestAttributes
!=
null
){
if
(
requestAttributes
!=
null
)
{
request
=
((
ServletRequestAttributes
)
requestAttributes
).
getRequest
();
request
=
((
ServletRequestAttributes
)
requestAttributes
).
getRequest
();
}
}
Object
[]
args
=
point
.
getArgs
();
Object
[]
args
=
point
.
getArgs
();
if
(
ObjectUtils
.
isEmpty
(
args
)
||
args
.
length
==
0
)
if
(
ObjectUtils
.
isEmpty
(
args
)
||
args
.
length
==
0
)
{
return
;
return
;
}
Object
serviceParam
=
args
[
0
];
Object
serviceParam
=
args
[
0
];
if
(
serviceParam
instanceof
EntityBase
){
if
(
serviceParam
instanceof
EntityBase
)
{
EntityBase
entity
=(
EntityBase
)
serviceParam
;
//创建数据
EntityBase
entity
=
(
EntityBase
)
serviceParam
;
Map
<
String
,
Audit
>
auditFields
=
DEFieldCacheMap
.
getAuditFields
(
entity
.
getClass
());
Map
<
String
,
Audit
>
auditFields
=
DEFieldCacheMap
.
getAuditFields
(
entity
.
getClass
());
if
(
auditFields
.
size
()==
0
)
//是否有审计属性
//是否有审计属性
if
(
auditFields
.
size
()==
0
)
{
return
;
return
;
}
String
idField
=
DEFieldCacheMap
.
getDEKeyField
(
entity
.
getClass
());
String
idField
=
DEFieldCacheMap
.
getDEKeyField
(
entity
.
getClass
());
Object
idValue
=
""
;
Object
idValue
=
""
;
if
(!
StringUtils
.
isEmpty
(
idField
)){
if
(!
StringUtils
.
isEmpty
(
idField
))
{
idValue
=
entity
.
get
(
idField
);
idValue
=
entity
.
get
(
idField
);
}
}
//记录审计日志
//记录审计日志
dataAuditService
.
createAudit
(
request
,
entity
,
idValue
,
auditFields
);
dataAuditService
.
createAudit
(
request
,
entity
,
idValue
,
auditFields
);
}
}
}
}
...
@@ -77,39 +78,38 @@ public class AuditAspect
...
@@ -77,39 +78,38 @@ public class AuditAspect
*/
*/
@Around
(
"execution(* cn.ibizlab.core.*.service.*.update(..))"
)
@Around
(
"execution(* cn.ibizlab.core.*.service.*.update(..))"
)
public
Object
update
(
ProceedingJoinPoint
point
)
throws
Throwable
{
public
Object
update
(
ProceedingJoinPoint
point
)
throws
Throwable
{
HttpServletRequest
request
=
null
;
HttpServletRequest
request
=
null
;
RequestAttributes
requestAttributes
=
RequestContextHolder
.
getRequestAttributes
();
RequestAttributes
requestAttributes
=
RequestContextHolder
.
getRequestAttributes
();
if
(
requestAttributes
!=
null
){
if
(
requestAttributes
!=
null
)
{
request
=((
ServletRequestAttributes
)
requestAttributes
).
getRequest
();
request
=((
ServletRequestAttributes
)
requestAttributes
).
getRequest
();
}
}
Object
serviceObj
=
point
.
getTarget
();
Object
serviceObj
=
point
.
getTarget
();
Object
args
[]=
point
.
getArgs
();
Object
args
[]
=
point
.
getArgs
();
if
(
ObjectUtils
.
isEmpty
(
args
)
||
args
.
length
==
0
)
{
if
(
ObjectUtils
.
isEmpty
(
args
)
||
args
.
length
==
0
)
return
point
.
proceed
();
return
point
.
proceed
();
}
Object
arg
=
args
[
0
];
Object
arg
=
args
[
0
];
if
(
arg
instanceof
EntityBase
){
if
(
arg
instanceof
EntityBase
)
{
EntityBase
entity
=
(
EntityBase
)
arg
;
EntityBase
entity
=
(
EntityBase
)
arg
;
Map
<
String
,
Audit
>
auditFields
=
DEFieldCacheMap
.
getAuditFields
(
entity
.
getClass
());
Map
<
String
,
Audit
>
auditFields
=
DEFieldCacheMap
.
getAuditFields
(
entity
.
getClass
());
//是否有审计属性
//是否有审计属性
if
(
auditFields
.
size
()==
0
)
if
(
auditFields
.
size
()==
0
)
{
return
point
.
proceed
();
return
point
.
proceed
();
String
idField
=
DEFieldCacheMap
.
getDEKeyField
(
entity
.
getClass
());
}
Object
idValue
=
""
;
String
idField
=
DEFieldCacheMap
.
getDEKeyField
(
entity
.
getClass
());
Object
idValue
=
""
;
if
(!
StringUtils
.
isEmpty
(
idField
)){
if
(!
StringUtils
.
isEmpty
(
idField
)){
idValue
=
entity
.
get
(
idField
);
idValue
=
entity
.
get
(
idField
);
}
}
if
(
ObjectUtils
.
isEmpty
(
idValue
))
if
(
ObjectUtils
.
isEmpty
(
idValue
))
{
return
point
.
proceed
();
return
point
.
proceed
();
}
//获取更新前实体
//获取更新前实体
EntityBase
beforeEntity
=
getEntity
(
serviceObj
,
idValue
);
EntityBase
beforeEntity
=
getEntity
(
serviceObj
,
idValue
);
//执行更新操作
//执行更新操作
point
.
proceed
();
point
.
proceed
();
//记录审计日志
//记录审计日志
dataAuditService
.
updateAudit
(
request
,
beforeEntity
,
serviceObj
,
idValue
,
auditFields
);
dataAuditService
.
updateAudit
(
request
,
beforeEntity
,
serviceObj
,
idValue
,
auditFields
);
return
true
;
return
true
;
}
}
return
point
.
proceed
();
return
point
.
proceed
();
...
@@ -124,28 +124,27 @@ public class AuditAspect
...
@@ -124,28 +124,27 @@ public class AuditAspect
*/
*/
@Around
(
"execution(* cn.ibizlab.core.*.service.*.remove(..))"
)
@Around
(
"execution(* cn.ibizlab.core.*.service.*.remove(..))"
)
public
Object
remove
(
ProceedingJoinPoint
point
)
throws
Throwable
{
public
Object
remove
(
ProceedingJoinPoint
point
)
throws
Throwable
{
HttpServletRequest
request
=
null
;
HttpServletRequest
request
=
null
;
RequestAttributes
requestAttributes
=
RequestContextHolder
.
getRequestAttributes
();
RequestAttributes
requestAttributes
=
RequestContextHolder
.
getRequestAttributes
();
if
(
requestAttributes
!=
null
)
{
if
(
requestAttributes
!=
null
)
{
request
=
((
ServletRequestAttributes
)
requestAttributes
).
getRequest
();
request
=
((
ServletRequestAttributes
)
requestAttributes
).
getRequest
();
}
}
Object
serviceObj
=
point
.
getTarget
();
Object
serviceObj
=
point
.
getTarget
();
Object
args
[]=
point
.
getArgs
();
Object
args
[]
=
point
.
getArgs
();
if
(
ObjectUtils
.
isEmpty
(
args
)
||
args
.
length
==
0
)
{
if
(
ObjectUtils
.
isEmpty
(
args
)
||
args
.
length
==
0
)
return
point
.
proceed
();
return
point
.
proceed
();
}
Object
idValue
=
args
[
0
];
Object
idValue
=
args
[
0
];
EntityBase
entity
=
getEntity
(
serviceObj
,
idValue
);
EntityBase
entity
=
getEntity
(
serviceObj
,
idValue
);
Map
<
String
,
Audit
>
auditFields
=
DEFieldCacheMap
.
getAuditFields
(
entity
.
getClass
());
Map
<
String
,
Audit
>
auditFields
=
DEFieldCacheMap
.
getAuditFields
(
entity
.
getClass
());
if
(
auditFields
.
size
()==
0
){
if
(
auditFields
.
size
()==
0
)
{
return
point
.
proceed
();
return
point
.
proceed
();
}
}
else
{
else
{
//执行删除操作
//执行删除操作
point
.
proceed
();
point
.
proceed
();
//记录审计日志
//记录审计日志
dataAuditService
.
removeAudit
(
request
,
entity
,
idValue
,
auditFields
);
dataAuditService
.
removeAudit
(
request
,
entity
,
idValue
,
auditFields
);
return
true
;
return
true
;
}
}
}
}
...
@@ -157,12 +156,12 @@ public class AuditAspect
...
@@ -157,12 +156,12 @@ public class AuditAspect
* @return
* @return
*/
*/
@SneakyThrows
@SneakyThrows
private
EntityBase
getEntity
(
Object
service
,
Object
id
){
private
EntityBase
getEntity
(
Object
service
,
Object
id
)
{
EntityBase
entity
=
null
;
EntityBase
entity
=
null
;
if
(!
ObjectUtils
.
isEmpty
(
service
)){
if
(!
ObjectUtils
.
isEmpty
(
service
))
{
EvaluationContext
oldContext
=
new
StandardEvaluationContext
();
EvaluationContext
oldContext
=
new
StandardEvaluationContext
();
oldContext
.
setVariable
(
"service"
,
service
);
oldContext
.
setVariable
(
"service"
,
service
);
oldContext
.
setVariable
(
"id"
,
id
);
oldContext
.
setVariable
(
"id"
,
id
);
Expression
oldExp
=
parser
.
parseExpression
(
"#service.get(#id)"
);
Expression
oldExp
=
parser
.
parseExpression
(
"#service.get(#id)"
);
return
oldExp
.
getValue
(
oldContext
,
EntityBase
.
class
);
return
oldExp
.
getValue
(
oldContext
,
EntityBase
.
class
);
}
}
...
...
ibzdict-util/src/main/java/cn/ibizlab/util/aspect/DEFieldDefaultValueAspect.java
浏览文件 @
d66e47b7
此差异已折叠。
点击以展开。
ibzdict-util/src/main/java/cn/ibizlab/util/aspect/VersionCheckAspect.java
浏览文件 @
d66e47b7
...
@@ -32,55 +32,62 @@ import java.util.Map;
...
@@ -32,55 +32,62 @@ import java.util.Map;
public
class
VersionCheckAspect
public
class
VersionCheckAspect
{
{
private
final
ExpressionParser
parser
=
new
SpelExpressionParser
();
private
final
ExpressionParser
parser
=
new
SpelExpressionParser
();
private
final
String
IgnoreField
=
"ignoreversioncheck"
;
private
final
String
IgnoreField
=
"ignoreversioncheck"
;
@SneakyThrows
@SneakyThrows
@Before
(
"execution(* cn.ibizlab.*.rest.*.update(..)) && @annotation(versionCheck)"
)
@Before
(
"execution(* cn.ibizlab.*.rest.*.update(..)) && @annotation(versionCheck)"
)
public
void
BeforeUpdate
(
JoinPoint
point
,
VersionCheck
versionCheck
){
public
void
BeforeUpdate
(
JoinPoint
point
,
VersionCheck
versionCheck
)
{
Object
[]
args
=
point
.
getArgs
();
Object
[]
args
=
point
.
getArgs
();
Object
id
=
args
[
0
];
Object
id
=
args
[
0
];
Object
dto
=
args
[
1
];
Object
dto
=
args
[
1
];
if
(
ObjectUtils
.
isEmpty
(
id
)
||
ObjectUtils
.
isEmpty
(
dto
))
if
(
ObjectUtils
.
isEmpty
(
id
)
||
ObjectUtils
.
isEmpty
(
dto
))
{
return
;
return
;
String
versionField
=
versionCheck
.
versionfield
();
}
if
(
StringUtils
.
isEmpty
(
versionField
))
String
versionField
=
versionCheck
.
versionfield
();
if
(
StringUtils
.
isEmpty
(
versionField
))
{
return
;
return
;
versionCheck
(
versionCheck
,
point
.
getTarget
(),
dto
,
id
);
}
versionCheck
(
versionCheck
,
point
.
getTarget
(),
dto
,
id
);
}
}
@SneakyThrows
@SneakyThrows
@Before
(
"execution(* cn.ibizlab.*.rest.*.updateBy*(..)) && @annotation(versionCheck)"
)
@Before
(
"execution(* cn.ibizlab.*.rest.*.updateBy*(..)) && @annotation(versionCheck)"
)
public
void
BeforeUpdateBy
(
JoinPoint
point
,
VersionCheck
versionCheck
){
public
void
BeforeUpdateBy
(
JoinPoint
point
,
VersionCheck
versionCheck
)
{
Object
[]
args
=
point
.
getArgs
();
Object
[]
args
=
point
.
getArgs
();
if
(
args
.
length
>=
2
){
if
(
args
.
length
>=
2
)
{
Object
id
=
args
[
args
.
length
-
2
];
Object
id
=
args
[
args
.
length
-
2
];
Object
dto
=
args
[
args
.
length
-
1
];
Object
dto
=
args
[
args
.
length
-
1
];
if
(
ObjectUtils
.
isEmpty
(
id
)
||
ObjectUtils
.
isEmpty
(
dto
))
if
(
ObjectUtils
.
isEmpty
(
id
)
||
ObjectUtils
.
isEmpty
(
dto
))
{
return
;
return
;
String
versionField
=
versionCheck
.
versionfield
();
}
if
(
StringUtils
.
isEmpty
(
versionField
))
String
versionField
=
versionCheck
.
versionfield
();
if
(
StringUtils
.
isEmpty
(
versionField
))
{
return
;
return
;
versionCheck
(
versionCheck
,
point
.
getTarget
(),
dto
,
id
);
}
versionCheck
(
versionCheck
,
point
.
getTarget
(),
dto
,
id
);
}
}
}
}
private
void
versionCheck
(
VersionCheck
versionCheck
,
Object
resource
,
Object
dto
,
Object
id
)
{
private
void
versionCheck
(
VersionCheck
versionCheck
,
Object
resource
,
Object
dto
,
Object
id
)
{
EvaluationContext
context
=
new
StandardEvaluationContext
();
EvaluationContext
context
=
new
StandardEvaluationContext
();
context
.
setVariable
(
"dto"
,
dto
);
context
.
setVariable
(
"dto"
,
dto
);
//忽略版本检查
//忽略版本检查
Expression
dtoParamsExp
=
parser
.
parseExpression
(
"#dto.extensionparams"
);
Expression
dtoParamsExp
=
parser
.
parseExpression
(
"#dto.extensionparams"
);
Map
dtoParam
=
dtoParamsExp
.
getValue
(
context
,
Map
.
class
);
Map
dtoParam
=
dtoParamsExp
.
getValue
(
context
,
Map
.
class
);
if
(!
ObjectUtils
.
isEmpty
(
dtoParam
)
&&
!
ObjectUtils
.
isEmpty
(
dtoParam
.
get
(
IgnoreField
))
&&
dtoParam
.
get
(
IgnoreField
).
equals
(
1
))
if
(!
ObjectUtils
.
isEmpty
(
dtoParam
)
&&
!
ObjectUtils
.
isEmpty
(
dtoParam
.
get
(
IgnoreField
))
&&
dtoParam
.
get
(
IgnoreField
).
equals
(
1
))
{
return
;
return
;
Expression
newExp
=
parser
.
parseExpression
(
String
.
format
(
"#dto.%s"
,
versionCheck
.
versionfield
()));
}
Object
newVersion
=
newExp
.
getValue
(
context
);
Expression
newExp
=
parser
.
parseExpression
(
String
.
format
(
"#dto.%s"
,
versionCheck
.
versionfield
()));
if
(
ObjectUtils
.
isEmpty
(
newVersion
))
Object
newVersion
=
newExp
.
getValue
(
context
);
if
(
ObjectUtils
.
isEmpty
(
newVersion
))
{
return
;
return
;
}
//进行版本检查
//进行版本检查
Object
oldVersion
=
getDBVersion
(
versionCheck
,
getService
(
resource
,
versionCheck
.
entity
()),
id
);
Object
oldVersion
=
getDBVersion
(
versionCheck
,
getService
(
resource
,
versionCheck
.
entity
()),
id
);
if
(!
ObjectUtils
.
isEmpty
(
oldVersion
)){
if
(!
ObjectUtils
.
isEmpty
(
oldVersion
))
{
if
(
RuleUtils
.
gt
(
newVersion
,
oldVersion
))
if
(
RuleUtils
.
gt
(
newVersion
,
oldVersion
))
{
throw
new
BadRequestAlertException
(
"数据已变更,可能后台数据已被修改,请重新加载数据"
,
"VersionCheckAspect"
,
"versionCheck"
);
throw
new
BadRequestAlertException
(
"数据已变更,可能后台数据已被修改,请重新加载数据"
,
"VersionCheckAspect"
,
"versionCheck"
);
}
}
}
}
}
...
@@ -91,12 +98,12 @@ public class VersionCheckAspect
...
@@ -91,12 +98,12 @@ public class VersionCheckAspect
* @return
* @return
*/
*/
@SneakyThrows
@SneakyThrows
private
Object
getService
(
Object
resource
,
String
entity
)
{
private
Object
getService
(
Object
resource
,
String
entity
)
{
Object
service
=
null
;
Object
service
=
null
;
Field
[]
fields
=
resource
.
getClass
().
getDeclaredFields
();
Field
[]
fields
=
resource
.
getClass
().
getDeclaredFields
();
for
(
Field
field
:
fields
){
for
(
Field
field
:
fields
)
{
if
(
field
.
getModifiers
()==
1
&&
field
.
getName
().
equalsIgnoreCase
(
String
.
format
(
"%sService"
,
entity
))){
if
(
field
.
getModifiers
()==
1
&&
field
.
getName
().
equalsIgnoreCase
(
String
.
format
(
"%sService"
,
entity
)))
{
service
=
field
.
get
(
resource
);
service
=
field
.
get
(
resource
);
break
;
break
;
}
}
}
}
...
@@ -111,21 +118,21 @@ public class VersionCheckAspect
...
@@ -111,21 +118,21 @@ public class VersionCheckAspect
* @return
* @return
*/
*/
@SneakyThrows
@SneakyThrows
private
Object
getDBVersion
(
VersionCheck
versionCheck
,
Object
service
,
Object
id
)
{
private
Object
getDBVersion
(
VersionCheck
versionCheck
,
Object
service
,
Object
id
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Timestamp
dbVersion
=
null
;
Timestamp
dbVersion
=
null
;
String
versionField
=
versionCheck
.
versionfield
();
String
versionField
=
versionCheck
.
versionfield
();
if
(!
ObjectUtils
.
isEmpty
(
service
)){
if
(!
ObjectUtils
.
isEmpty
(
service
))
{
EvaluationContext
oldContext
=
new
StandardEvaluationContext
();
EvaluationContext
oldContext
=
new
StandardEvaluationContext
();
oldContext
.
setVariable
(
"service"
,
service
);
oldContext
.
setVariable
(
"service"
,
service
);
oldContext
.
setVariable
(
"id"
,
id
);
oldContext
.
setVariable
(
"id"
,
id
);
Expression
oldExp
=
parser
.
parseExpression
(
"#service.get(#id)"
);
Expression
oldExp
=
parser
.
parseExpression
(
"#service.get(#id)"
);
EntityBase
oldEntity
=
oldExp
.
getValue
(
oldContext
,
EntityBase
.
class
);
EntityBase
oldEntity
=
oldExp
.
getValue
(
oldContext
,
EntityBase
.
class
);
Object
oldDate
=
oldEntity
.
get
(
versionField
);
Object
oldDate
=
oldEntity
.
get
(
versionField
);
if
(
oldDate
!=
null
&&
oldDate
instanceof
Timestamp
){
if
(
oldDate
!=
null
&&
oldDate
instanceof
Timestamp
)
{
Timestamp
db_time
=
(
Timestamp
)
oldDate
;
Timestamp
db_time
=
(
Timestamp
)
oldDate
;
Date
db_date
=
sdf
.
parse
(
sdf
.
format
(
db_time
));
Date
db_date
=
sdf
.
parse
(
sdf
.
format
(
db_time
));
dbVersion
=
new
Timestamp
(
db_date
.
getTime
());
dbVersion
=
new
Timestamp
(
db_date
.
getTime
());
}
}
}
}
return
dbVersion
;
return
dbVersion
;
...
...
ibzdict-util/src/main/java/cn/ibizlab/util/domain/DTOBase.java
浏览文件 @
d66e47b7
...
@@ -21,33 +21,39 @@ public class DTOBase implements Serializable {
...
@@ -21,33 +21,39 @@ public class DTOBase implements Serializable {
public
void
modify
(
String
field
,
Object
val
)
{
public
void
modify
(
String
field
,
Object
val
)
{
if
(
val
==
null
)
if
(
val
==
null
)
{
this
.
getFocusNull
(
true
).
add
(
field
.
toLowerCase
());
this
.
getFocusNull
(
true
).
add
(
field
.
toLowerCase
());
else
}
else
{
this
.
getFocusNull
(
true
).
remove
(
field
.
toLowerCase
());
this
.
getFocusNull
(
true
).
remove
(
field
.
toLowerCase
());
}
}
}
public
Set
<
String
>
getFocusNull
()
{
public
Set
<
String
>
getFocusNull
()
{
if
(
focusNull
==
null
)
if
(
focusNull
==
null
)
{
focusNull
=
new
HashSet
<>();
focusNull
=
new
HashSet
<>();
}
if
(
focusNull
.
size
()>
0
&&
extensionparams
.
containsKey
(
"dirtyflagenable"
))
if
(
focusNull
.
size
()>
0
&&
extensionparams
.
containsKey
(
"dirtyflagenable"
))
{
{
Set
<
String
>
nocheck
=
new
HashSet
<>();
Set
<
String
>
nocheck
=
new
HashSet
<>();
for
(
String
key:
focusNull
)
for
(
String
key:
focusNull
)
{
{
if
(!
extensionparams
.
containsKey
(
key
+
"dirtyflag"
))
if
(!
extensionparams
.
containsKey
(
key
+
"dirtyflag"
))
{
nocheck
.
add
(
key
);
nocheck
.
add
(
key
);
}
}
for
(
String
key:
nocheck
)
}
for
(
String
key:
nocheck
)
{
focusNull
.
remove
(
key
);
focusNull
.
remove
(
key
);
}
}
}
return
focusNull
;
return
focusNull
;
}
}
private
Set
<
String
>
getFocusNull
(
boolean
newflag
)
{
private
Set
<
String
>
getFocusNull
(
boolean
newflag
)
{
if
(
focusNull
==
null
)
if
(
focusNull
==
null
)
{
focusNull
=
new
HashSet
<>();
focusNull
=
new
HashSet
<>();
}
return
focusNull
;
return
focusNull
;
}
}
...
...
ibzdict-util/src/main/java/cn/ibizlab/util/domain/EntityBase.java
浏览文件 @
d66e47b7
...
@@ -24,8 +24,9 @@ public class EntityBase implements Serializable {
...
@@ -24,8 +24,9 @@ public class EntityBase implements Serializable {
private
Set
<
String
>
focusNull
;
private
Set
<
String
>
focusNull
;
public
Set
<
String
>
getFocusNull
()
{
public
Set
<
String
>
getFocusNull
()
{
if
(
focusNull
==
null
)
if
(
focusNull
==
null
)
{
focusNull
=
new
HashSet
<>();
focusNull
=
new
HashSet
<>();
}
return
focusNull
;
return
focusNull
;
}
}
...
@@ -50,8 +51,9 @@ public class EntityBase implements Serializable {
...
@@ -50,8 +51,9 @@ public class EntityBase implements Serializable {
private
BeanMap
getMap
()
private
BeanMap
getMap
()
{
{
if
(
map
==
null
)
if
(
map
==
null
)
{
map
=
BeanMap
.
create
(
this
);
map
=
BeanMap
.
create
(
this
);
}
return
map
;
return
map
;
}
}
...
@@ -68,16 +70,15 @@ public class EntityBase implements Serializable {
...
@@ -68,16 +70,15 @@ public class EntityBase implements Serializable {
this
.
extensionparams
=
extensionparams
;
this
.
extensionparams
=
extensionparams
;
}
}
public
Object
get
(
String
field
)
{
public
Object
get
(
String
field
)
{
String
fieldRealName
=
DEFieldCacheMap
.
getFieldRealName
(
this
.
getClass
(),
field
);
String
fieldRealName
=
DEFieldCacheMap
.
getFieldRealName
(
this
.
getClass
(),
field
);
if
(!
StringUtils
.
isEmpty
(
fieldRealName
))
if
(!
StringUtils
.
isEmpty
(
fieldRealName
))
{
return
getMap
().
get
(
fieldRealName
);
return
getMap
().
get
(
fieldRealName
);
else
}
else
{
return
this
.
extensionparams
.
get
(
field
.
toLowerCase
());
return
this
.
extensionparams
.
get
(
field
.
toLowerCase
());
}
}
}
@JsonAnyGetter
@JsonAnyGetter
public
Map
<
String
,
Object
>
any
()
{
public
Map
<
String
,
Object
>
any
()
{
...
@@ -89,14 +90,17 @@ public class EntityBase implements Serializable {
...
@@ -89,14 +90,17 @@ public class EntityBase implements Serializable {
field
=
field
.
toLowerCase
();
field
=
field
.
toLowerCase
();
String
fieldRealName
=
DEFieldCacheMap
.
getFieldRealName
(
this
.
getClass
(),
field
);
String
fieldRealName
=
DEFieldCacheMap
.
getFieldRealName
(
this
.
getClass
(),
field
);
if
(!
StringUtils
.
isEmpty
(
fieldRealName
))
{
if
(!
StringUtils
.
isEmpty
(
fieldRealName
))
{
if
(
value
==
null
)
if
(
value
==
null
)
{
getMap
().
put
(
fieldRealName
,
null
);
getMap
().
put
(
fieldRealName
,
null
);
else
}
else
{
getMap
().
put
(
fieldRealName
,
DEFieldCacheMap
.
fieldValueOf
(
this
.
getClass
(),
fieldRealName
,
value
));
getMap
().
put
(
fieldRealName
,
DEFieldCacheMap
.
fieldValueOf
(
this
.
getClass
(),
fieldRealName
,
value
));
}
}
else
}
else
{
this
.
extensionparams
.
put
(
field
.
toLowerCase
(),
value
);
this
.
extensionparams
.
put
(
field
.
toLowerCase
(),
value
);
}
}
}
/**
/**
* 复制当前对象数据到目标对象
* 复制当前对象数据到目标对象
...
...
ibzdict-util/src/main/java/cn/ibizlab/util/domain/EntityMP.java
浏览文件 @
d66e47b7
...
@@ -5,25 +5,26 @@ import org.springframework.util.StringUtils;
...
@@ -5,25 +5,26 @@ import org.springframework.util.StringUtils;
public
class
EntityMP
extends
EntityBase
{
public
class
EntityMP
extends
EntityBase
{
public
UpdateWrapper
getUpdateWrapper
(
boolean
clean
)
{
public
UpdateWrapper
getUpdateWrapper
(
boolean
clean
)
{
UpdateWrapper
wrapper
=
new
UpdateWrapper
();
UpdateWrapper
wrapper
=
new
UpdateWrapper
();
for
(
String
nullField:
getFocusNull
())
{
for
(
String
nullField:
getFocusNull
())
{
wrapper
.
set
(
nullField
,
null
);
wrapper
.
set
(
nullField
,
null
);
}
}
if
(
clean
)
if
(
clean
)
{
getFocusNull
().
clear
();
getFocusNull
().
clear
();
}
return
wrapper
;
return
wrapper
;
}
}
@Override
@Override
public
void
modify
(
String
field
,
Object
val
)
{
public
void
modify
(
String
field
,
Object
val
)
{
if
(
val
==
null
)
if
(
val
==
null
)
{
this
.
getFocusNull
().
add
(
field
.
toLowerCase
());
this
.
getFocusNull
().
add
(
field
.
toLowerCase
());
else
}
else
{
this
.
getFocusNull
().
remove
(
field
.
toLowerCase
());
this
.
getFocusNull
().
remove
(
field
.
toLowerCase
());
}
}
}
@Override
@Override
public
void
reset
(
String
field
){
public
void
reset
(
String
field
){
...
@@ -33,6 +34,5 @@ public class EntityMP extends EntityBase {
...
@@ -33,6 +34,5 @@ public class EntityMP extends EntityBase {
getFocusNull
().
remove
(
resetField
);
getFocusNull
().
remove
(
resetField
);
}
}
}
}
}
}
ibzdict-util/src/main/java/cn/ibizlab/util/domain/EntityMongo.java
浏览文件 @
d66e47b7
...
@@ -2,7 +2,5 @@ package cn.ibizlab.util.domain;
...
@@ -2,7 +2,5 @@ package cn.ibizlab.util.domain;
public
class
EntityMongo
extends
EntityBase
{
public
class
EntityMongo
extends
EntityBase
{
}
}
ibzdict-util/src/main/java/cn/ibizlab/util/filter/QueryBuildContext.java
浏览文件 @
d66e47b7
...
@@ -44,9 +44,9 @@ public class QueryBuildContext extends SearchContextBase implements ISearchConte
...
@@ -44,9 +44,9 @@ public class QueryBuildContext extends SearchContextBase implements ISearchConte
*/
*/
private
QueryBuilder
parseQueryFilter
(
QueryFilter
queryFilter
){
private
QueryBuilder
parseQueryFilter
(
QueryFilter
queryFilter
){
if
(
ObjectUtils
.
isEmpty
(
queryFilter
.
get
$and
())
&&
ObjectUtils
.
isEmpty
(
queryFilter
.
get
$or
())
&&
ObjectUtils
.
isEmpty
(
queryFilter
.
any
()))
if
(
ObjectUtils
.
isEmpty
(
queryFilter
.
get
$and
())
&&
ObjectUtils
.
isEmpty
(
queryFilter
.
get
$or
())
&&
ObjectUtils
.
isEmpty
(
queryFilter
.
any
()))
{
return
null
;
return
null
;
}
QueryBuilder
rsBuilder
=
QueryBuilder
.
start
();
QueryBuilder
rsBuilder
=
QueryBuilder
.
start
();
QueryBuilder
fieldBuilder
=
parseFieldMap
(
queryFilter
.
any
());
QueryBuilder
fieldBuilder
=
parseFieldMap
(
queryFilter
.
any
());
QueryBuilder
orBuilder
=
parseOrQueryFilter
(
queryFilter
.
get
$or
());
QueryBuilder
orBuilder
=
parseOrQueryFilter
(
queryFilter
.
get
$or
());
...
@@ -107,8 +107,9 @@ public class QueryBuildContext extends SearchContextBase implements ISearchConte
...
@@ -107,8 +107,9 @@ public class QueryBuildContext extends SearchContextBase implements ISearchConte
* @return
* @return
*/
*/
private
QueryBuilder
parseFieldMap
(
Map
<
String
,
QueryFilter
.
SegmentCond
>
fieldMap
)
{
private
QueryBuilder
parseFieldMap
(
Map
<
String
,
QueryFilter
.
SegmentCond
>
fieldMap
)
{
if
(
fieldMap
.
size
()==
0
)
if
(
fieldMap
.
size
()==
0
)
{
return
null
;
return
null
;
}
QueryBuilder
fieldBuilders
=
QueryBuilder
.
start
();
QueryBuilder
fieldBuilders
=
QueryBuilder
.
start
();
for
(
Map
.
Entry
<
String
,
QueryFilter
.
SegmentCond
>
entry:
fieldMap
.
entrySet
()){
for
(
Map
.
Entry
<
String
,
QueryFilter
.
SegmentCond
>
entry:
fieldMap
.
entrySet
()){
getSegmentCondSql
(
entry
.
getKey
(),
entry
.
getValue
(),
fieldBuilders
);
getSegmentCondSql
(
entry
.
getKey
(),
entry
.
getValue
(),
fieldBuilders
);
...
...
ibzdict-util/src/main/java/cn/ibizlab/util/filter/QueryFilter.java
浏览文件 @
d66e47b7
...
@@ -63,8 +63,9 @@ public class QueryFilter {
...
@@ -63,8 +63,9 @@ public class QueryFilter {
private
Map
<
String
,
SegmentCond
>
getMap
()
private
Map
<
String
,
SegmentCond
>
getMap
()
{
{
if
(
map
==
null
)
if
(
map
==
null
)
{
map
=
new
LinkedHashMap
<>();
map
=
new
LinkedHashMap
<>();
}
return
map
;
return
map
;
}
}
...
@@ -132,11 +133,12 @@ public class QueryFilter {
...
@@ -132,11 +133,12 @@ public class QueryFilter {
}
}
private
QueryFilter
op
(
String
column
,
SegmentCond
segmentCond
)
{
private
QueryFilter
op
(
String
column
,
SegmentCond
segmentCond
)
{
if
(
this
.
getMap
().
containsKey
(
column
))
{
if
(
this
.
getMap
().
containsKey
(
column
))
((
SegmentCond
)
this
.
getMap
().
get
(
column
)).
getMap
().
putAll
(
segmentCond
.
getMap
());
((
SegmentCond
)
this
.
getMap
().
get
(
column
)).
getMap
().
putAll
(
segmentCond
.
getMap
());
else
}
else
{
this
.
getMap
().
put
(
column
,
segmentCond
);
this
.
getMap
().
put
(
column
,
segmentCond
);
}
return
this
;
return
this
;
}
}
...
@@ -155,8 +157,9 @@ public class QueryFilter {
...
@@ -155,8 +157,9 @@ public class QueryFilter {
private
Map
<
String
,
Object
>
getMap
()
private
Map
<
String
,
Object
>
getMap
()
{
{
if
(
map
==
null
)
if
(
map
==
null
)
{
map
=
new
LinkedHashMap
<>();
map
=
new
LinkedHashMap
<>();
}
return
map
;
return
map
;
}
}
...
...
ibzdict-util/src/main/java/cn/ibizlab/util/filter/QueryWrapperContext.java
浏览文件 @
d66e47b7
...
@@ -37,17 +37,20 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
...
@@ -37,17 +37,20 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
int
pageSize
=
getPageable
().
getPageSize
();
int
pageSize
=
getPageable
().
getPageSize
();
//构造mybatis-plus分页
//构造mybatis-plus分页
if
(
StringUtils
.
isEmpty
(
currentPage
)
||
StringUtils
.
isEmpty
(
pageSize
))
if
(
StringUtils
.
isEmpty
(
currentPage
)
||
StringUtils
.
isEmpty
(
pageSize
))
{
page
=
new
Page
(
1
,
Short
.
MAX_VALUE
);
page
=
new
Page
(
1
,
Short
.
MAX_VALUE
);
else
}
else
{
page
=
new
Page
(
currentPage
+
1
,
pageSize
);
page
=
new
Page
(
currentPage
+
1
,
pageSize
);
}
//构造mybatis-plus排序
//构造mybatis-plus排序
Sort
sort
=
getPageable
().
getSort
();
Sort
sort
=
getPageable
().
getSort
();
Iterator
<
Sort
.
Order
>
it_sort
=
sort
.
iterator
();
Iterator
<
Sort
.
Order
>
it_sort
=
sort
.
iterator
();
if
(
ObjectUtils
.
isEmpty
(
it_sort
))
if
(
ObjectUtils
.
isEmpty
(
it_sort
))
{
return
page
;
return
page
;
}
ParameterizedType
parameterizedType
=
(
ParameterizedType
)
getClass
().
getGenericSuperclass
();
ParameterizedType
parameterizedType
=
(
ParameterizedType
)
getClass
().
getGenericSuperclass
();
Class
<
T
>
type
=
(
Class
<
T
>)
parameterizedType
.
getActualTypeArguments
()[
0
];
Class
<
T
>
type
=
(
Class
<
T
>)
parameterizedType
.
getActualTypeArguments
()[
0
];
...
@@ -95,9 +98,9 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
...
@@ -95,9 +98,9 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
* @return
* @return
*/
*/
private
Consumer
<
QueryWrapper
<
T
>>
parseQueryFilter
(
QueryFilter
queryFilter
){
private
Consumer
<
QueryWrapper
<
T
>>
parseQueryFilter
(
QueryFilter
queryFilter
){
if
(
queryFilter
.
any
().
size
()==
0
&&
queryFilter
.
get
$or
()==
null
&&
queryFilter
.
get
$and
()==
null
)
{
if
(
queryFilter
.
any
().
size
()==
0
&&
queryFilter
.
get
$or
()==
null
&&
queryFilter
.
get
$and
()==
null
)
return
null
;
return
null
;
}
Consumer
<
QueryWrapper
<
T
>>
consumer
=
queryWrapper
->
{
Consumer
<
QueryWrapper
<
T
>>
consumer
=
queryWrapper
->
{
Consumer
fieldConsumer
=
parseFieldMap
(
queryFilter
.
any
());
Consumer
fieldConsumer
=
parseFieldMap
(
queryFilter
.
any
());
Consumer
orConsumer
=
parseOrQueryFilter
(
queryFilter
.
get
$or
());
Consumer
orConsumer
=
parseOrQueryFilter
(
queryFilter
.
get
$or
());
...
@@ -121,7 +124,6 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
...
@@ -121,7 +124,6 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
* @return
* @return
*/
*/
private
Consumer
<
QueryWrapper
<
T
>>
parseOrQueryFilter
(
List
<
QueryFilter
>
queryFilters
)
{
private
Consumer
<
QueryWrapper
<
T
>>
parseOrQueryFilter
(
List
<
QueryFilter
>
queryFilters
)
{
if
(
queryFilters
==
null
||
queryFilters
.
size
()==
0
)
if
(
queryFilters
==
null
||
queryFilters
.
size
()==
0
)
return
null
;
return
null
;
Consumer
<
QueryWrapper
<
T
>>
consumer
=
queryWrapper
->
{
Consumer
<
QueryWrapper
<
T
>>
consumer
=
queryWrapper
->
{
...
@@ -139,9 +141,9 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
...
@@ -139,9 +141,9 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
* @return
* @return
*/
*/
private
Consumer
<
QueryWrapper
<
T
>>
parseAndQueryFilter
(
List
<
QueryFilter
>
queryFilters
)
{
private
Consumer
<
QueryWrapper
<
T
>>
parseAndQueryFilter
(
List
<
QueryFilter
>
queryFilters
)
{
if
(
queryFilters
==
null
||
queryFilters
.
size
()==
0
)
{
if
(
queryFilters
==
null
||
queryFilters
.
size
()==
0
)
return
null
;
return
null
;
}
Consumer
<
QueryWrapper
<
T
>>
consumer
=
queryWrapper
->
{
Consumer
<
QueryWrapper
<
T
>>
consumer
=
queryWrapper
->
{
for
(
QueryFilter
queryFilter:
queryFilters
){
for
(
QueryFilter
queryFilter:
queryFilters
){
Consumer
tempQueryWrapper
=
parseQueryFilter
(
queryFilter
);
Consumer
tempQueryWrapper
=
parseQueryFilter
(
queryFilter
);
...
@@ -157,9 +159,9 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
...
@@ -157,9 +159,9 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
* @return
* @return
*/
*/
private
Consumer
<
QueryWrapper
<
T
>>
parseFieldMap
(
Map
<
String
,
QueryFilter
.
SegmentCond
>
fieldMap
)
{
private
Consumer
<
QueryWrapper
<
T
>>
parseFieldMap
(
Map
<
String
,
QueryFilter
.
SegmentCond
>
fieldMap
)
{
if
(
fieldMap
.
size
()==
0
)
{
if
(
fieldMap
.
size
()==
0
)
return
null
;
return
null
;
}
Consumer
<
QueryWrapper
<
T
>>
consumer
=
queryWrapper
->
{
Consumer
<
QueryWrapper
<
T
>>
consumer
=
queryWrapper
->
{
for
(
Map
.
Entry
<
String
,
QueryFilter
.
SegmentCond
>
field:
fieldMap
.
entrySet
()){
for
(
Map
.
Entry
<
String
,
QueryFilter
.
SegmentCond
>
field:
fieldMap
.
entrySet
()){
String
fieldName
=
field
.
getKey
();
String
fieldName
=
field
.
getKey
();
...
...
ibzdict-util/src/main/java/cn/ibizlab/util/filter/SearchContextBase.java
浏览文件 @
d66e47b7
...
@@ -98,11 +98,13 @@ public class SearchContextBase implements ISearchContext{
...
@@ -98,11 +98,13 @@ public class SearchContextBase implements ISearchContext{
* @return
* @return
*/
*/
public
Pageable
getPageable
()
{
public
Pageable
getPageable
()
{
if
(
ObjectUtils
.
isEmpty
(
pageSort
))
if
(
ObjectUtils
.
isEmpty
(
pageSort
))
{
return
PageRequest
.
of
(
page
,
size
);
return
PageRequest
.
of
(
page
,
size
);
else
}
else
{
return
PageRequest
.
of
(
page
,
size
,
pageSort
);
return
PageRequest
.
of
(
page
,
size
,
pageSort
);
}
}
}
/**
/**
* 设置排序值
* 设置排序值
...
...
ibzdict-util/src/main/java/cn/ibizlab/util/helper/CachedBeanCopier.java
浏览文件 @
d66e47b7
...
@@ -13,8 +13,9 @@ public class CachedBeanCopier {
...
@@ -13,8 +13,9 @@ public class CachedBeanCopier {
}
}
public
static
void
copy
(
Object
srcObj
,
Object
destObj
,
boolean
useConverter
)
{
public
static
void
copy
(
Object
srcObj
,
Object
destObj
,
boolean
useConverter
)
{
if
(
srcObj
==
null
||
destObj
==
null
)
if
(
srcObj
==
null
||
destObj
==
null
)
{
return
;
return
;
}
getCopier
(
srcObj
,
destObj
,
useConverter
).
copy
(
srcObj
,
destObj
,
null
);
getCopier
(
srcObj
,
destObj
,
useConverter
).
copy
(
srcObj
,
destObj
,
null
);
}
}
...
@@ -29,6 +30,4 @@ public class CachedBeanCopier {
...
@@ -29,6 +30,4 @@ public class CachedBeanCopier {
}
}
return
copier
;
return
copier
;
}
}
}
}
ibzdict-util/src/main/java/cn/ibizlab/util/helper/DEFieldCacheMap.java
浏览文件 @
d66e47b7
...
@@ -36,13 +36,16 @@ public class DEFieldCacheMap {
...
@@ -36,13 +36,16 @@ public class DEFieldCacheMap {
*/
*/
public
static
<
T
>
Hashtable
<
String
,
Field
>
getFieldMap
(
Class
<
T
>
clazz
)
{
public
static
<
T
>
Hashtable
<
String
,
Field
>
getFieldMap
(
Class
<
T
>
clazz
)
{
String
className
=
clazz
.
getName
();
String
className
=
clazz
.
getName
();
if
(
className
.
indexOf
(
"_$"
)>
0
)
if
(
className
.
indexOf
(
"_$"
)>
0
)
{
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
if
(
cacheMap
.
containsKey
(
className
))
}
if
(
cacheMap
.
containsKey
(
className
))
{
return
cacheMap
.
get
(
className
);
return
cacheMap
.
get
(
className
);
}
synchronized
(
objLock1
)
{
synchronized
(
objLock1
)
{
if
(
cacheMap
.
containsKey
(
className
))
if
(
cacheMap
.
containsKey
(
className
))
{
return
cacheMap
.
get
(
className
);
return
cacheMap
.
get
(
className
);
}
Hashtable
<
String
,
Field
>
result
=
new
Hashtable
<
String
,
Field
>();
Hashtable
<
String
,
Field
>
result
=
new
Hashtable
<
String
,
Field
>();
List
<
Field
>
list
=
new
ArrayList
<
Field
>();
List
<
Field
>
list
=
new
ArrayList
<
Field
>();
Hashtable
<
String
,
String
>
keys
=
new
Hashtable
<
String
,
String
>();
Hashtable
<
String
,
String
>
keys
=
new
Hashtable
<
String
,
String
>();
...
@@ -58,9 +61,10 @@ public class DEFieldCacheMap {
...
@@ -58,9 +61,10 @@ public class DEFieldCacheMap {
Audit
auditField
=
field
.
getAnnotation
(
Audit
.
class
);
Audit
auditField
=
field
.
getAnnotation
(
Audit
.
class
);
if
(!
ObjectUtils
.
isEmpty
(
deField
))
{
if
(!
ObjectUtils
.
isEmpty
(
deField
))
{
defields
.
put
(
field
.
getName
(),
deField
);
defields
.
put
(
field
.
getName
(),
deField
);
if
(
deField
.
isKeyField
())
if
(
deField
.
isKeyField
())
{
cacheDEKeyField
.
put
(
className
,
field
.
getName
());
cacheDEKeyField
.
put
(
className
,
field
.
getName
());
}
}
}
if
(!
ObjectUtils
.
isEmpty
(
auditField
))
{
if
(!
ObjectUtils
.
isEmpty
(
auditField
))
{
auditfields
.
put
(
field
.
getName
(),
auditField
);
auditfields
.
put
(
field
.
getName
(),
auditField
);
}
}
...
@@ -74,10 +78,12 @@ public class DEFieldCacheMap {
...
@@ -74,10 +78,12 @@ public class DEFieldCacheMap {
}
}
}
}
public
static
Hashtable
<
String
,
Field
>
getFieldMap
(
String
className
)
{
public
static
Hashtable
<
String
,
Field
>
getFieldMap
(
String
className
)
{
if
(
className
.
indexOf
(
"_$"
)>
0
)
if
(
className
.
indexOf
(
"_$"
)>
0
)
{
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
if
(
cacheMap
.
containsKey
(
className
))
}
if
(
cacheMap
.
containsKey
(
className
))
{
return
cacheMap
.
get
(
className
);
return
cacheMap
.
get
(
className
);
}
Class
clazz
=
null
;
Class
clazz
=
null
;
try
{
try
{
clazz
=
Class
.
forName
(
className
);
clazz
=
Class
.
forName
(
className
);
...
@@ -96,10 +102,12 @@ public class DEFieldCacheMap {
...
@@ -96,10 +102,12 @@ public class DEFieldCacheMap {
*/
*/
public
static
<
T
>
Hashtable
<
String
,
DEField
>
getDEFields
(
Class
<
T
>
clazz
)
{
public
static
<
T
>
Hashtable
<
String
,
DEField
>
getDEFields
(
Class
<
T
>
clazz
)
{
String
className
=
clazz
.
getName
();
String
className
=
clazz
.
getName
();
if
(
className
.
indexOf
(
"_$"
)>
0
)
if
(
className
.
indexOf
(
"_$"
)>
0
)
{
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
if
(
cacheDEField
.
containsKey
(
className
))
}
if
(
cacheDEField
.
containsKey
(
className
))
{
return
cacheDEField
.
get
(
className
);
return
cacheDEField
.
get
(
className
);
}
else
{
else
{
DEFieldCacheMap
.
getFieldMap
(
className
);
DEFieldCacheMap
.
getFieldMap
(
className
);
return
cacheDEField
.
get
(
className
);
return
cacheDEField
.
get
(
className
);
...
@@ -113,10 +121,12 @@ public class DEFieldCacheMap {
...
@@ -113,10 +121,12 @@ public class DEFieldCacheMap {
*/
*/
public
static
<
T
>
Hashtable
<
String
,
Audit
>
getAuditFields
(
Class
<
T
>
clazz
)
{
public
static
<
T
>
Hashtable
<
String
,
Audit
>
getAuditFields
(
Class
<
T
>
clazz
)
{
String
className
=
clazz
.
getName
();
String
className
=
clazz
.
getName
();
if
(
className
.
indexOf
(
"_$"
)>
0
)
if
(
className
.
indexOf
(
"_$"
)>
0
)
{
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
if
(
cacheAuditField
.
containsKey
(
className
))
}
if
(
cacheAuditField
.
containsKey
(
className
))
{
return
cacheAuditField
.
get
(
className
);
return
cacheAuditField
.
get
(
className
);
}
else
{
else
{
DEFieldCacheMap
.
getFieldMap
(
className
);
DEFieldCacheMap
.
getFieldMap
(
className
);
return
cacheAuditField
.
get
(
className
);
return
cacheAuditField
.
get
(
className
);
...
@@ -130,10 +140,12 @@ public class DEFieldCacheMap {
...
@@ -130,10 +140,12 @@ public class DEFieldCacheMap {
*/
*/
public
static
<
T
>
String
getDEKeyField
(
Class
<
T
>
clazz
)
{
public
static
<
T
>
String
getDEKeyField
(
Class
<
T
>
clazz
)
{
String
className
=
clazz
.
getName
();
String
className
=
clazz
.
getName
();
if
(
className
.
indexOf
(
"_$"
)>
0
)
if
(
className
.
indexOf
(
"_$"
)>
0
)
{
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
if
(
cacheDEKeyField
.
containsKey
(
className
))
}
if
(
cacheDEKeyField
.
containsKey
(
className
))
{
return
cacheDEKeyField
.
get
(
className
);
return
cacheDEKeyField
.
get
(
className
);
}
else
{
else
{
DEFieldCacheMap
.
getFieldMap
(
className
);
DEFieldCacheMap
.
getFieldMap
(
className
);
return
cacheDEKeyField
.
get
(
className
);
return
cacheDEKeyField
.
get
(
className
);
...
@@ -148,10 +160,12 @@ public class DEFieldCacheMap {
...
@@ -148,10 +160,12 @@ public class DEFieldCacheMap {
*/
*/
public
static
<
T
>
List
<
Field
>
getFields
(
Class
<
T
>
clazz
)
{
public
static
<
T
>
List
<
Field
>
getFields
(
Class
<
T
>
clazz
)
{
String
className
=
clazz
.
getName
();
String
className
=
clazz
.
getName
();
if
(
className
.
indexOf
(
"_$"
)>
0
)
if
(
className
.
indexOf
(
"_$"
)>
0
)
{
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
if
(
cacheList
.
containsKey
(
className
))
}
if
(
cacheList
.
containsKey
(
className
))
{
return
cacheList
.
get
(
className
);
return
cacheList
.
get
(
className
);
}
else
{
else
{
DEFieldCacheMap
.
getFieldMap
(
className
);
DEFieldCacheMap
.
getFieldMap
(
className
);
return
cacheList
.
get
(
className
);
return
cacheList
.
get
(
className
);
...
@@ -159,10 +173,12 @@ public class DEFieldCacheMap {
...
@@ -159,10 +173,12 @@ public class DEFieldCacheMap {
}
}
public
static
List
<
Field
>
getFields
(
String
className
)
{
public
static
List
<
Field
>
getFields
(
String
className
)
{
if
(
className
.
indexOf
(
"_$"
)>
0
)
if
(
className
.
indexOf
(
"_$"
)>
0
)
{
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
if
(
cacheList
.
containsKey
(
className
))
}
if
(
cacheList
.
containsKey
(
className
))
{
return
cacheList
.
get
(
className
);
return
cacheList
.
get
(
className
);
}
else
{
else
{
DEFieldCacheMap
.
getFieldMap
(
className
);
DEFieldCacheMap
.
getFieldMap
(
className
);
return
cacheList
.
get
(
className
);
return
cacheList
.
get
(
className
);
...
@@ -176,10 +192,12 @@ public class DEFieldCacheMap {
...
@@ -176,10 +192,12 @@ public class DEFieldCacheMap {
*/
*/
public
static
<
T
>
Hashtable
<
String
,
String
>
getFieldKeys
(
Class
<
T
>
clazz
)
{
public
static
<
T
>
Hashtable
<
String
,
String
>
getFieldKeys
(
Class
<
T
>
clazz
)
{
String
className
=
clazz
.
getName
();
String
className
=
clazz
.
getName
();
if
(
className
.
indexOf
(
"_$"
)>
0
)
if
(
className
.
indexOf
(
"_$"
)>
0
)
{
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
if
(
cacheKey
.
containsKey
(
className
))
}
if
(
cacheKey
.
containsKey
(
className
))
{
return
cacheKey
.
get
(
className
);
return
cacheKey
.
get
(
className
);
}
else
{
else
{
DEFieldCacheMap
.
getFieldMap
(
className
);
DEFieldCacheMap
.
getFieldMap
(
className
);
return
cacheKey
.
get
(
className
);
return
cacheKey
.
get
(
className
);
...
@@ -189,21 +207,26 @@ public class DEFieldCacheMap {
...
@@ -189,21 +207,26 @@ public class DEFieldCacheMap {
public
static
<
T
>
String
getFieldRealName
(
Class
<
T
>
clazz
,
String
fieldname
)
{
public
static
<
T
>
String
getFieldRealName
(
Class
<
T
>
clazz
,
String
fieldname
)
{
fieldname
=
fieldname
.
toLowerCase
();
fieldname
=
fieldname
.
toLowerCase
();
Hashtable
<
String
,
String
>
keys
=
DEFieldCacheMap
.
getFieldKeys
(
clazz
);
Hashtable
<
String
,
String
>
keys
=
DEFieldCacheMap
.
getFieldKeys
(
clazz
);
if
(
keys
.
containsKey
(
fieldname
))
if
(
keys
.
containsKey
(
fieldname
))
{
return
keys
.
get
(
fieldname
);
return
keys
.
get
(
fieldname
);
else
if
(
keys
.
containsKey
(
fieldname
.
replace
(
"_"
,
""
)))
}
else
if
(
keys
.
containsKey
(
fieldname
.
replace
(
"_"
,
""
)))
{
return
keys
.
get
(
fieldname
.
replace
(
"_"
,
""
));
return
keys
.
get
(
fieldname
.
replace
(
"_"
,
""
));
else
}
else
{
return
""
;
return
""
;
}
}
}
public
static
<
T
>
Field
getField
(
Class
<
T
>
clazz
,
String
fieldname
)
{
public
static
<
T
>
Field
getField
(
Class
<
T
>
clazz
,
String
fieldname
)
{
String
fieldRealName
=
DEFieldCacheMap
.
getFieldRealName
(
clazz
,
fieldname
);
String
fieldRealName
=
DEFieldCacheMap
.
getFieldRealName
(
clazz
,
fieldname
);
if
(!
StringUtils
.
isEmpty
(
fieldRealName
))
if
(!
StringUtils
.
isEmpty
(
fieldRealName
))
{
return
DEFieldCacheMap
.
getFieldMap
(
clazz
).
get
(
fieldRealName
);
return
DEFieldCacheMap
.
getFieldMap
(
clazz
).
get
(
fieldRealName
);
else
}
else
{
return
null
;
return
null
;
}
}
}
public
static
<
T
>
String
getFieldColumnName
(
Class
<
T
>
clazz
,
String
fieldname
)
{
public
static
<
T
>
String
getFieldColumnName
(
Class
<
T
>
clazz
,
String
fieldname
)
{
Field
field
=
DEFieldCacheMap
.
getField
(
clazz
,
fieldname
);
Field
field
=
DEFieldCacheMap
.
getField
(
clazz
,
fieldname
);
...
@@ -226,6 +249,4 @@ public class DEFieldCacheMap {
...
@@ -226,6 +249,4 @@ public class DEFieldCacheMap {
}
}
return
resultValue
;
return
resultValue
;
}
}
}
}
\ No newline at end of file
ibzdict-util/src/main/java/cn/ibizlab/util/helper/DataObject.java
浏览文件 @
d66e47b7
...
@@ -19,30 +19,34 @@ public class DataObject {
...
@@ -19,30 +19,34 @@ public class DataObject {
final
static
public
DateFormat
dayFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
final
static
public
DateFormat
dayFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
final
static
public
String
getStringValue
(
Object
objValue
,
String
strDefault
)
{
final
static
public
String
getStringValue
(
Object
objValue
,
String
strDefault
)
{
if
(
objValue
==
null
)
return
strDefault
;
if
(
objValue
==
null
)
{
if
(
objValue
instanceof
String
)
return
(
String
)
objValue
;
return
strDefault
;
}
if
(
objValue
instanceof
String
)
{
return
(
String
)
objValue
;
}
if
(
objValue
instanceof
java
.
sql
.
Timestamp
||
objValue
instanceof
java
.
sql
.
Date
||
objValue
instanceof
java
.
util
.
Date
)
{
if
(
objValue
instanceof
java
.
sql
.
Timestamp
||
objValue
instanceof
java
.
sql
.
Date
||
objValue
instanceof
java
.
util
.
Date
)
{
String
rt
=
datetimeFormat
.
format
(
objValue
);
String
rt
=
datetimeFormat
.
format
(
objValue
);
if
(
rt
.
endsWith
(
" 00:00:00"
))
if
(
rt
.
endsWith
(
" 00:00:00"
))
{
rt
=
dayFormat
.
format
(
objValue
);
rt
=
dayFormat
.
format
(
objValue
);
else
if
(
rt
.
endsWith
(
":00"
))
}
else
if
(
rt
.
endsWith
(
":00"
))
{
rt
=
datetimeFormat2
.
format
(
objValue
);
rt
=
datetimeFormat2
.
format
(
objValue
);
}
return
rt
;
return
rt
;
}
}
return
objValue
.
toString
();
return
objValue
.
toString
();
}
}
public
static
<
T
>
Object
objectValueOf
(
Class
<
T
>
type
,
Object
fieldValue
)
{
public
static
<
T
>
Object
objectValueOf
(
Class
<
T
>
type
,
Object
fieldValue
)
{
if
(
fieldValue
==
null
)
if
(
fieldValue
==
null
)
{
return
null
;
return
null
;
}
Object
resultValue
=
fieldValue
;
Object
resultValue
=
fieldValue
;
String
targetType
=
type
.
getSimpleName
();
String
targetType
=
type
.
getSimpleName
();
if
(
targetType
.
equalsIgnoreCase
(
fieldValue
.
getClass
().
getSimpleName
()))
if
(
targetType
.
equalsIgnoreCase
(
fieldValue
.
getClass
().
getSimpleName
()))
{
return
resultValue
;
return
resultValue
;
}
if
(
targetType
.
equals
(
"Boolean"
)){
if
(
targetType
.
equals
(
"Boolean"
)){
resultValue
=
getBooleanValue
(
fieldValue
,
false
);
resultValue
=
getBooleanValue
(
fieldValue
,
false
);
}
}
...
@@ -79,10 +83,9 @@ public class DataObject {
...
@@ -79,10 +83,9 @@ public class DataObject {
else
if
(
targetType
.
equals
(
"String"
))
{
else
if
(
targetType
.
equals
(
"String"
))
{
resultValue
=
getStringValue
(
fieldValue
,
null
);
resultValue
=
getStringValue
(
fieldValue
,
null
);
}
}
if
(
resultValue
==
null
)
{
if
(
resultValue
==
null
)
return
null
;
return
null
;
}
return
resultValue
;
return
resultValue
;
}
}
...
@@ -95,8 +98,9 @@ public class DataObject {
...
@@ -95,8 +98,9 @@ public class DataObject {
if
(
objValue
==
null
)
{
if
(
objValue
==
null
)
{
return
jDefault
;
return
jDefault
;
}
}
if
(
objValue
instanceof
JSONObject
)
if
(
objValue
instanceof
JSONObject
)
{
return
(
JSONObject
)
objValue
;
return
(
JSONObject
)
objValue
;
}
String
strValue
=
objValue
.
toString
();
String
strValue
=
objValue
.
toString
();
try
{
try
{
return
JSONObject
.
parseObject
(
strValue
);
return
JSONObject
.
parseObject
(
strValue
);
...
@@ -111,8 +115,9 @@ public class DataObject {
...
@@ -111,8 +115,9 @@ public class DataObject {
if
(
objValue
==
null
)
{
if
(
objValue
==
null
)
{
return
jDefault
;
return
jDefault
;
}
}
if
(
objValue
instanceof
JSONArray
)
if
(
objValue
instanceof
JSONArray
)
{
return
(
JSONArray
)
objValue
;
return
(
JSONArray
)
objValue
;
}
String
strValue
=
objValue
.
toString
();
String
strValue
=
objValue
.
toString
();
try
{
try
{
return
JSONArray
.
parseArray
(
strValue
);
return
JSONArray
.
parseArray
(
strValue
);
...
@@ -133,9 +138,10 @@ public class DataObject {
...
@@ -133,9 +138,10 @@ public class DataObject {
List
<
String
>
chk1
=
new
ArrayList
<>();
List
<
String
>
chk1
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
arr
.
size
();
i
++)
for
(
int
i
=
0
;
i
<
arr
.
size
();
i
++)
{
{
if
(
arr
.
get
(
i
)
instanceof
String
)
if
(
arr
.
get
(
i
)
instanceof
String
)
{
chk1
.
add
(
arr
.
getString
(
i
));
chk1
.
add
(
arr
.
getString
(
i
));
}
}
}
return
chk1
;
return
chk1
;
}
}
else
else
...
@@ -146,8 +152,9 @@ public class DataObject {
...
@@ -146,8 +152,9 @@ public class DataObject {
}
}
final
static
public
Boolean
getBooleanValue
(
Object
objValue
,
Boolean
bDefault
)
{
final
static
public
Boolean
getBooleanValue
(
Object
objValue
,
Boolean
bDefault
)
{
if
(
objValue
==
null
)
return
bDefault
;
if
(
objValue
==
null
)
{
return
bDefault
;
}
if
(
objValue
instanceof
Boolean
)
{
if
(
objValue
instanceof
Boolean
)
{
return
(
Boolean
)
objValue
;
return
(
Boolean
)
objValue
;
}
}
...
@@ -155,20 +162,24 @@ public class DataObject {
...
@@ -155,20 +162,24 @@ public class DataObject {
}
}
final
static
public
char
[]
getCharacterValue
(
Object
objValue
,
char
[]
cDefault
)
{
final
static
public
char
[]
getCharacterValue
(
Object
objValue
,
char
[]
cDefault
)
{
if
(
objValue
==
null
)
return
cDefault
;
if
(
objValue
==
null
)
{
return
cDefault
;
}
return
objValue
.
toString
().
toCharArray
();
return
objValue
.
toString
().
toCharArray
();
}
}
final
static
public
Double
getDoubleValue
(
Object
objValue
,
Double
dDefault
)
{
final
static
public
Double
getDoubleValue
(
Object
objValue
,
Double
dDefault
)
{
if
(
objValue
==
null
)
return
dDefault
;
if
(
objValue
==
null
)
{
return
dDefault
;
}
if
(
objValue
instanceof
Double
)
{
if
(
objValue
instanceof
Double
)
{
return
(
Double
)
objValue
;
return
(
Double
)
objValue
;
}
}
String
strValue
=
objValue
.
toString
();
String
strValue
=
objValue
.
toString
();
if
(
StringUtils
.
isEmpty
(
strValue
))
return
null
;
if
(
StringUtils
.
isEmpty
(
strValue
))
{
return
null
;
}
strValue
=
strValue
.
replace
(
","
,
""
);
strValue
=
strValue
.
replace
(
","
,
""
);
return
Double
.
parseDouble
(
strValue
);
return
Double
.
parseDouble
(
strValue
);
}
}
...
@@ -179,8 +190,9 @@ public class DataObject {
...
@@ -179,8 +190,9 @@ public class DataObject {
return
nDefault
;
return
nDefault
;
}
}
if
(
objValue
instanceof
Integer
)
if
(
objValue
instanceof
Integer
)
{
return
(
Integer
)
objValue
;
return
(
Integer
)
objValue
;
}
if
(
objValue
instanceof
Double
)
{
if
(
objValue
instanceof
Double
)
{
return
((
Double
)
objValue
).
intValue
();
return
((
Double
)
objValue
).
intValue
();
...
@@ -191,8 +203,9 @@ public class DataObject {
...
@@ -191,8 +203,9 @@ public class DataObject {
}
}
String
strValue
=
objValue
.
toString
();
String
strValue
=
objValue
.
toString
();
if
(
StringUtils
.
isEmpty
(
strValue
))
if
(
StringUtils
.
isEmpty
(
strValue
))
{
return
nDefault
;
return
nDefault
;
}
strValue
=
strValue
.
replace
(
","
,
""
);
strValue
=
strValue
.
replace
(
","
,
""
);
return
Integer
.
parseInt
(
strValue
);
return
Integer
.
parseInt
(
strValue
);
}
}
...
@@ -204,12 +217,13 @@ public class DataObject {
...
@@ -204,12 +217,13 @@ public class DataObject {
}
}
try
{
try
{
if
(
objValue
instanceof
Float
)
if
(
objValue
instanceof
Float
)
{
return
(
Float
)
objValue
;
return
(
Float
)
objValue
;
}
String
strValue
=
objValue
.
toString
();
String
strValue
=
objValue
.
toString
();
if
(
StringUtils
.
isEmpty
(
strValue
))
if
(
StringUtils
.
isEmpty
(
strValue
))
{
return
fDefault
;
return
fDefault
;
}
strValue
=
strValue
.
replace
(
","
,
""
);
strValue
=
strValue
.
replace
(
","
,
""
);
return
Float
.
parseFloat
(
strValue
);
return
Float
.
parseFloat
(
strValue
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
...
@@ -233,8 +247,9 @@ public class DataObject {
...
@@ -233,8 +247,9 @@ public class DataObject {
return
BigDecimal
.
valueOf
((
Long
)
objValue
);
return
BigDecimal
.
valueOf
((
Long
)
objValue
);
}
}
String
strValue
=
objValue
.
toString
();
String
strValue
=
objValue
.
toString
();
if
(
StringUtils
.
isEmpty
(
strValue
))
if
(
StringUtils
.
isEmpty
(
strValue
))
{
return
fDefault
;
return
fDefault
;
}
strValue
=
strValue
.
replace
(
","
,
""
);
strValue
=
strValue
.
replace
(
","
,
""
);
return
BigDecimal
.
valueOf
(
Double
.
parseDouble
(
strValue
));
return
BigDecimal
.
valueOf
(
Double
.
parseDouble
(
strValue
));
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
...
@@ -253,9 +268,10 @@ public class DataObject {
...
@@ -253,9 +268,10 @@ public class DataObject {
}
}
else
{
else
{
Long
l
=
getLongValue
(
objValue
,
null
);
Long
l
=
getLongValue
(
objValue
,
null
);
if
(
l
!=
null
)
if
(
l
!=
null
)
{
return
BigInteger
.
valueOf
(
l
);
return
BigInteger
.
valueOf
(
l
);
}
}
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
}
}
...
@@ -283,8 +299,9 @@ public class DataObject {
...
@@ -283,8 +299,9 @@ public class DataObject {
}
}
String
strValue
=
objValue
.
toString
();
String
strValue
=
objValue
.
toString
();
if
(
StringUtils
.
isEmpty
(
strValue
))
if
(
StringUtils
.
isEmpty
(
strValue
))
{
return
nDefault
;
return
nDefault
;
}
strValue
=
strValue
.
replace
(
","
,
""
);
strValue
=
strValue
.
replace
(
","
,
""
);
return
Long
.
parseLong
(
strValue
);
return
Long
.
parseLong
(
strValue
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
...
@@ -294,7 +311,9 @@ public class DataObject {
...
@@ -294,7 +311,9 @@ public class DataObject {
final
static
public
byte
[]
getBinaryValue
(
Object
objValue
,
byte
[]
def
)
{
final
static
public
byte
[]
getBinaryValue
(
Object
objValue
,
byte
[]
def
)
{
if
(
objValue
==
null
)
return
def
;
if
(
objValue
==
null
)
{
return
def
;
}
if
(
objValue
instanceof
byte
[]){
if
(
objValue
instanceof
byte
[]){
return
(
byte
[])
objValue
;
return
(
byte
[])
objValue
;
}
}
...
@@ -312,7 +331,9 @@ public class DataObject {
...
@@ -312,7 +331,9 @@ public class DataObject {
* @
* @
*/
*/
final
static
public
java
.
sql
.
Timestamp
getTimestampValue
(
Object
objValue
,
java
.
sql
.
Timestamp
tDefault
)
{
final
static
public
java
.
sql
.
Timestamp
getTimestampValue
(
Object
objValue
,
java
.
sql
.
Timestamp
tDefault
)
{
if
(
objValue
==
null
)
return
tDefault
;
if
(
objValue
==
null
)
{
return
tDefault
;
}
if
(
objValue
instanceof
java
.
sql
.
Timestamp
)
{
if
(
objValue
instanceof
java
.
sql
.
Timestamp
)
{
java
.
sql
.
Timestamp
ti
=
(
java
.
sql
.
Timestamp
)
objValue
;
java
.
sql
.
Timestamp
ti
=
(
java
.
sql
.
Timestamp
)
objValue
;
...
@@ -332,7 +353,9 @@ public class DataObject {
...
@@ -332,7 +353,9 @@ public class DataObject {
if
(
objValue
instanceof
String
)
{
if
(
objValue
instanceof
String
)
{
String
strValue
=
(
String
)
objValue
;
String
strValue
=
(
String
)
objValue
;
strValue
=
strValue
.
trim
();
strValue
=
strValue
.
trim
();
if
(
StringUtils
.
isEmpty
(
strValue
))
return
null
;
if
(
StringUtils
.
isEmpty
(
strValue
))
{
return
null
;
}
try
{
try
{
java
.
util
.
Date
date
=
parse
((
String
)
objValue
);
java
.
util
.
Date
date
=
parse
((
String
)
objValue
);
...
@@ -373,7 +396,9 @@ public class DataObject {
...
@@ -373,7 +396,9 @@ public class DataObject {
* @
* @
*/
*/
public
static
Object
testDateTime
(
String
strInput
,
TimeZone
timeZone
)
throws
Exception
{
public
static
Object
testDateTime
(
String
strInput
,
TimeZone
timeZone
)
throws
Exception
{
if
(
StringUtils
.
isEmpty
(
strInput
))
return
null
;
if
(
StringUtils
.
isEmpty
(
strInput
))
{
return
null
;
}
Date
dtDate
=
parse
(
strInput
,
timeZone
);
Date
dtDate
=
parse
(
strInput
,
timeZone
);
java
.
sql
.
Timestamp
retDate
=
new
java
.
sql
.
Timestamp
(
dtDate
.
getTime
());
java
.
sql
.
Timestamp
retDate
=
new
java
.
sql
.
Timestamp
(
dtDate
.
getTime
());
return
retDate
;
return
retDate
;
...
@@ -425,8 +450,9 @@ public class DataObject {
...
@@ -425,8 +450,9 @@ public class DataObject {
if
(
strTimeString
.
indexOf
(
"T"
)!=-
1
){
if
(
strTimeString
.
indexOf
(
"T"
)!=-
1
){
strPart
=
strTimeString
.
split
(
"[T]"
);
strPart
=
strTimeString
.
split
(
"[T]"
);
}
}
else
else
{
strPart
=
strTimeString
.
split
(
" "
);
strPart
=
strTimeString
.
split
(
" "
);
}
if
(
strPart
.
length
==
2
)
{
if
(
strPart
.
length
==
2
)
{
// 两个部分
// 两个部分
String
strDate
=
""
;
String
strDate
=
""
;
...
@@ -589,6 +615,4 @@ public class DataObject {
...
@@ -589,6 +615,4 @@ public class DataObject {
return
new
Timestamp
(
cl
.
getTime
().
getTime
());
return
new
Timestamp
(
cl
.
getTime
().
getTime
());
}
}
}
}
ibzdict-util/src/main/java/cn/ibizlab/util/helper/RuleUtils.java
浏览文件 @
d66e47b7
此差异已折叠。
点击以展开。
ibzdict-util/src/main/java/cn/ibizlab/util/job/PermissionSyncJob.java
浏览文件 @
d66e47b7
...
@@ -46,14 +46,14 @@ public class PermissionSyncJob implements ApplicationRunner {
...
@@ -46,14 +46,14 @@ public class PermissionSyncJob implements ApplicationRunner {
public
void
run
(
ApplicationArguments
args
)
{
public
void
run
(
ApplicationArguments
args
)
{
try
{
try
{
Thread
.
sleep
(
10000
);
Thread
.
sleep
(
10000
);
InputStream
permission
=
this
.
getClass
().
getResourceAsStream
(
"/permission/systemResource.json"
);
//获取当前系统所有实体资源能力
InputStream
permission
=
this
.
getClass
().
getResourceAsStream
(
"/permission/systemResource.json"
);
//获取当前系统所有实体资源能力
String
permissionResult
=
IOUtils
.
toString
(
permission
,
"UTF-8"
);
String
permissionResult
=
IOUtils
.
toString
(
permission
,
"UTF-8"
);
JSONObject
system
=
new
JSONObject
();
JSONObject
system
=
new
JSONObject
();
system
.
put
(
"pssystemid"
,
systemId
);
system
.
put
(
"pssystemid"
,
systemId
);
system
.
put
(
"pssystemname"
,
systemName
);
system
.
put
(
"pssystemname"
,
systemName
);
system
.
put
(
"sysstructure"
,
JSONObject
.
parseObject
(
permissionResult
));
system
.
put
(
"sysstructure"
,
JSONObject
.
parseObject
(
permissionResult
));
system
.
put
(
"md5check"
,
DigestUtils
.
md5DigestAsHex
(
permissionResult
.
getBytes
()));
system
.
put
(
"md5check"
,
DigestUtils
.
md5DigestAsHex
(
permissionResult
.
getBytes
()));
if
(
client
.
syncSysAuthority
(
system
)){
if
(
client
.
syncSysAuthority
(
system
))
{
log
.
info
(
"向[UAA]同步系统资源成功"
);
log
.
info
(
"向[UAA]同步系统资源成功"
);
}
else
{
}
else
{
log
.
error
(
"向[UAA]同步系统资源失败"
);
log
.
error
(
"向[UAA]同步系统资源失败"
);
...
@@ -64,9 +64,9 @@ public class PermissionSyncJob implements ApplicationRunner {
...
@@ -64,9 +64,9 @@ public class PermissionSyncJob implements ApplicationRunner {
}
}
try
{
try
{
InputStream
sysModel
=
this
.
getClass
().
getResourceAsStream
(
"/sysmodel/ibzdict.json"
);
//获取当前系统所有实体资源能力
InputStream
sysModel
=
this
.
getClass
().
getResourceAsStream
(
"/sysmodel/ibzdict.json"
);
//获取当前系统所有实体资源能力
String
strSysModel
=
IOUtils
.
toString
(
sysModel
,
"UTF-8"
);
String
strSysModel
=
IOUtils
.
toString
(
sysModel
,
"UTF-8"
);
if
(
liteFeignClient
.
syncSysModel
(
JSONObject
.
parseObject
(
strSysModel
))){
if
(
liteFeignClient
.
syncSysModel
(
JSONObject
.
parseObject
(
strSysModel
)))
{
log
.
info
(
"向[lite]同步系统模型成功"
);
log
.
info
(
"向[lite]同步系统模型成功"
);
}
else
{
}
else
{
log
.
error
(
"向[lite]同步系统模型失败"
);
log
.
error
(
"向[lite]同步系统模型失败"
);
...
...
ibzdict-util/src/main/java/cn/ibizlab/util/rest/AppController.java
浏览文件 @
d66e47b7
...
@@ -42,12 +42,14 @@ public class AppController {
...
@@ -42,12 +42,14 @@ public class AppController {
while
(
it
.
hasNext
())
{
while
(
it
.
hasNext
())
{
GrantedAuthority
authority
=
(
GrantedAuthority
)
it
.
next
();
GrantedAuthority
authority
=
(
GrantedAuthority
)
it
.
next
();
String
strAuthority
=
authority
.
getAuthority
();
String
strAuthority
=
authority
.
getAuthority
();
if
(
strAuthority
.
startsWith
(
"UNIRES_"
+
systemId
))
if
(
strAuthority
.
startsWith
(
"UNIRES_"
+
systemId
))
{
uniRes
.
add
(
strAuthority
.
substring
(
systemId
.
length
()+
8
));
uniRes
.
add
(
strAuthority
.
substring
(
systemId
.
length
()+
8
));
else
if
(
strAuthority
.
startsWith
(
"APPMENU_"
+
systemId
))
}
else
if
(
strAuthority
.
startsWith
(
"APPMENU_"
+
systemId
)){
appMenu
.
add
(
strAuthority
.
substring
(
systemId
.
length
()+
9
));
appMenu
.
add
(
strAuthority
.
substring
(
systemId
.
length
()+
9
));
}
}
}
}
}
Map
<
String
,
Object
>
context
=
new
HashMap
<>();
Map
<
String
,
Object
>
context
=
new
HashMap
<>();
context
.
putAll
(
curUser
.
getSessionParams
());
context
.
putAll
(
curUser
.
getSessionParams
());
context
.
put
(
"srfusername"
,
curUser
.
getPersonname
());
context
.
put
(
"srfusername"
,
curUser
.
getPersonname
());
...
@@ -55,10 +57,12 @@ public class AppController {
...
@@ -55,10 +57,12 @@ public class AppController {
appData
.
put
(
"unires"
,
uniRes
);
appData
.
put
(
"unires"
,
uniRes
);
appData
.
put
(
"appmenu"
,
appMenu
);
appData
.
put
(
"appmenu"
,
appMenu
);
appData
.
put
(
"enablepermissionvalid"
,
enablePermissionValid
);
appData
.
put
(
"enablepermissionvalid"
,
enablePermissionValid
);
if
(
curUser
.
getSuperuser
()==
1
)
if
(
curUser
.
getSuperuser
()==
1
)
{
appData
.
put
(
"enablepermissionvalid"
,
false
);
appData
.
put
(
"enablepermissionvalid"
,
false
);
else
}
else
{
appData
.
put
(
"enablepermissionvalid"
,
enablePermissionValid
);
appData
.
put
(
"enablepermissionvalid"
,
enablePermissionValid
);
}
fillAppData
(
appData
);
fillAppData
(
appData
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
appData
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
appData
);
}
}
...
@@ -76,16 +80,18 @@ public class AppController {
...
@@ -76,16 +80,18 @@ public class AppController {
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/configs/{configType}/{targetType}"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/configs/{configType}/{targetType}"
)
public
ResponseEntity
<
Boolean
>
saveConfig
(
@PathVariable
(
"configType"
)
String
configType
,
@PathVariable
(
"targetType"
)
String
targetType
,
@RequestBody
JSONObject
config
)
{
public
ResponseEntity
<
Boolean
>
saveConfig
(
@PathVariable
(
"configType"
)
String
configType
,
@PathVariable
(
"targetType"
)
String
targetType
,
@RequestBody
JSONObject
config
)
{
String
userId
=
AuthenticationUser
.
getAuthenticationUser
().
getUserid
();
String
userId
=
AuthenticationUser
.
getAuthenticationUser
().
getUserid
();
if
(
StringUtils
.
isEmpty
(
userId
))
if
(
StringUtils
.
isEmpty
(
userId
))
{
throw
new
BadRequestAlertException
(
"保存配置失败,参数缺失"
,
"IBZConfig"
,
configType
);
throw
new
BadRequestAlertException
(
"保存配置失败,参数缺失"
,
"IBZConfig"
,
configType
);
}
return
ResponseEntity
.
ok
(
ibzConfigService
.
saveConfig
(
configType
,
targetType
,
userId
,
config
));
return
ResponseEntity
.
ok
(
ibzConfigService
.
saveConfig
(
configType
,
targetType
,
userId
,
config
));
}
}
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/configs/{configType}/{targetType}"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/configs/{configType}/{targetType}"
)
public
ResponseEntity
<
JSONObject
>
getConfig
(
@PathVariable
(
"configType"
)
String
configType
,
@PathVariable
(
"targetType"
)
String
targetType
)
{
public
ResponseEntity
<
JSONObject
>
getConfig
(
@PathVariable
(
"configType"
)
String
configType
,
@PathVariable
(
"targetType"
)
String
targetType
)
{
String
userId
=
AuthenticationUser
.
getAuthenticationUser
().
getUserid
();
String
userId
=
AuthenticationUser
.
getAuthenticationUser
().
getUserid
();
if
(
StringUtils
.
isEmpty
(
userId
))
if
(
StringUtils
.
isEmpty
(
userId
))
{
throw
new
BadRequestAlertException
(
"获取配置失败,参数缺失"
,
"IBZConfig"
,
configType
);
throw
new
BadRequestAlertException
(
"获取配置失败,参数缺失"
,
"IBZConfig"
,
configType
);
}
return
ResponseEntity
.
ok
(
ibzConfigService
.
getConfig
(
configType
,
targetType
,
userId
));
return
ResponseEntity
.
ok
(
ibzConfigService
.
getConfig
(
configType
,
targetType
,
userId
));
}
}
...
...
ibzdict-util/src/main/java/cn/ibizlab/util/rest/AuthenticationController.java
浏览文件 @
d66e47b7
ibzdict-util/src/main/java/cn/ibizlab/util/security/AuthPermissionEvaluator.java
浏览文件 @
d66e47b7
...
@@ -38,18 +38,22 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
...
@@ -38,18 +38,22 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
@Override
@Override
@SneakyThrows
@SneakyThrows
public
boolean
hasPermission
(
Authentication
authentication
,
Object
entity
,
Object
action
)
{
public
boolean
hasPermission
(
Authentication
authentication
,
Object
entity
,
Object
action
)
{
if
(!
enablePermissionValid
)
if
(!
enablePermissionValid
)
{
return
true
;
return
true
;
}
Object
principal
=
authentication
.
getPrincipal
();
Object
principal
=
authentication
.
getPrincipal
();
if
(
ObjectUtils
.
isEmpty
(
principal
))
if
(
ObjectUtils
.
isEmpty
(
principal
))
{
return
false
;
return
false
;
}
AuthenticationUser
authenticationUser
=
(
AuthenticationUser
)
authentication
.
getPrincipal
();
AuthenticationUser
authenticationUser
=
(
AuthenticationUser
)
authentication
.
getPrincipal
();
if
(
authenticationUser
.
getSuperuser
()==
1
)
if
(
authenticationUser
.
getSuperuser
()==
1
)
{
return
true
;
return
true
;
}
String
strAction
=
String
.
valueOf
(
action
);
String
strAction
=
String
.
valueOf
(
action
);
Set
<
String
>
userAuthorities
=
getAuthorities
(
authentication
,
strAction
);
Set
<
String
>
userAuthorities
=
getAuthorities
(
authentication
,
strAction
);
if
(
userAuthorities
.
size
()==
0
)
if
(
userAuthorities
.
size
()==
0
)
{
return
false
;
return
false
;
}
if
(
isAllData
(
strAction
,
userAuthorities
)){
if
(
isAllData
(
strAction
,
userAuthorities
)){
return
true
;
return
true
;
}
}
...
@@ -102,8 +106,9 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
...
@@ -102,8 +106,9 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
*/
*/
@SneakyThrows
@SneakyThrows
private
void
setPermissionCondToSearchContext
(
EntityBase
entity
,
QueryWrapperContext
qc
,
Set
<
String
>
userAuthorities
,
AuthenticationUser
authenticationUser
){
private
void
setPermissionCondToSearchContext
(
EntityBase
entity
,
QueryWrapperContext
qc
,
Set
<
String
>
userAuthorities
,
AuthenticationUser
authenticationUser
){
if
(
entity
==
null
)
if
(
entity
==
null
)
{
return
;
return
;
}
Map
<
String
,
String
>
permissionField
=
getPermissionField
(
entity
);
//获取组织、部门预置属性
Map
<
String
,
String
>
permissionField
=
getPermissionField
(
entity
);
//获取组织、部门预置属性
String
orgField
=
permissionField
.
get
(
"orgfield"
);
String
orgField
=
permissionField
.
get
(
"orgfield"
);
String
orgDeptField
=
permissionField
.
get
(
"orgsecfield"
);
String
orgDeptField
=
permissionField
.
get
(
"orgsecfield"
);
...
@@ -185,9 +190,10 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
...
@@ -185,9 +190,10 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
Iterator
it
=
authorities
.
iterator
();
Iterator
it
=
authorities
.
iterator
();
while
(
it
.
hasNext
())
{
while
(
it
.
hasNext
())
{
GrantedAuthority
authority
=
(
GrantedAuthority
)
it
.
next
();
GrantedAuthority
authority
=
(
GrantedAuthority
)
it
.
next
();
if
(
authority
.
getAuthority
().
contains
(
action
))
if
(
authority
.
getAuthority
().
contains
(
action
))
{
userAuthorities
.
add
(
authority
.
getAuthority
());
userAuthorities
.
add
(
authority
.
getAuthority
());
}
}
}
return
userAuthorities
;
return
userAuthorities
;
}
}
...
@@ -253,23 +259,27 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
...
@@ -253,23 +259,27 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
}
}
if
(
action
.
endsWith
(
"Create"
)
||
action
.
endsWith
(
"Save"
)){
if
(
action
.
endsWith
(
"Create"
)
||
action
.
endsWith
(
"Save"
)){
if
(!
ObjectUtils
.
isEmpty
(
orgFieldValue
)
&&
!
userOrg
.
contains
(
orgFieldValue
))
if
(!
ObjectUtils
.
isEmpty
(
orgFieldValue
)
&&
!
userOrg
.
contains
(
orgFieldValue
))
{
return
false
;
return
false
;
if
(!
ObjectUtils
.
isEmpty
(
orgDeptFieldValue
)
&&
!
userOrgDept
.
contains
(
orgDeptFieldValue
))
}
if
(!
ObjectUtils
.
isEmpty
(
orgDeptFieldValue
)
&&
!
userOrgDept
.
contains
(
orgDeptFieldValue
)){
return
false
;
return
false
;
if
(!
ObjectUtils
.
isEmpty
(
crateManFieldValue
)
&&
!
authenticationUser
.
getUserid
().
equals
(
crateManFieldValue
))
}
if
(!
ObjectUtils
.
isEmpty
(
crateManFieldValue
)
&&
!
authenticationUser
.
getUserid
().
equals
(
crateManFieldValue
)){
return
false
;
return
false
;
}
return
true
;
return
true
;
}
}
else
{
else
{
if
(!
ObjectUtils
.
isEmpty
(
orgFieldValue
)
&&
userOrg
.
contains
(
orgFieldValue
))
if
(!
ObjectUtils
.
isEmpty
(
orgFieldValue
)
&&
userOrg
.
contains
(
orgFieldValue
))
{
return
true
;
return
true
;
if
(!
ObjectUtils
.
isEmpty
(
orgDeptFieldValue
)
&&
userOrgDept
.
contains
(
orgDeptFieldValue
))
}
if
(!
ObjectUtils
.
isEmpty
(
orgDeptFieldValue
)
&&
userOrgDept
.
contains
(
orgDeptFieldValue
)){
return
true
;
return
true
;
if
(!
ObjectUtils
.
isEmpty
(
crateManFieldValue
)
&&
authenticationUser
.
getUserid
().
equals
(
crateManFieldValue
))
}
if
(!
ObjectUtils
.
isEmpty
(
crateManFieldValue
)
&&
authenticationUser
.
getUserid
().
equals
(
crateManFieldValue
)){
return
true
;
return
true
;
}
return
false
;
return
false
;
}
}
}
}
...
@@ -293,13 +303,19 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
...
@@ -293,13 +303,19 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
String
fieldName
=
entry
.
getKey
();
//获取注解字段
String
fieldName
=
entry
.
getKey
();
//获取注解字段
DEField
fieldAnnotation
=
entry
.
getValue
();
//获取注解值
DEField
fieldAnnotation
=
entry
.
getValue
();
//获取注解值
DEPredefinedFieldType
prefieldType
=
fieldAnnotation
.
preType
();
DEPredefinedFieldType
prefieldType
=
fieldAnnotation
.
preType
();
if
(
prefieldType
==
prefieldType
.
ORGID
)
//用户配置系统预置属性-组织机构标识
//用户配置系统预置属性-组织机构标识
if
(
prefieldType
==
prefieldType
.
ORGID
){
orgField
=
fieldName
;
orgField
=
fieldName
;
if
(
prefieldType
==
prefieldType
.
ORGSECTORID
)
//用户配置系统预置属性-部门标识
}
//用户配置系统预置属性-部门标识
if
(
prefieldType
==
prefieldType
.
ORGSECTORID
){
orgDeptField
=
fieldName
;
orgDeptField
=
fieldName
;
if
(
prefieldType
==
prefieldType
.
CREATEMAN
)
//用户配置系统预置属性-部门标识
}
//用户配置系统预置属性-部门标识
if
(
prefieldType
==
prefieldType
.
CREATEMAN
){
createManField
=
fieldName
;
createManField
=
fieldName
;
}
}
}
permissionFiled
.
put
(
"orgfield"
,
orgField
);
permissionFiled
.
put
(
"orgfield"
,
orgField
);
permissionFiled
.
put
(
"orgsecfield"
,
orgDeptField
);
permissionFiled
.
put
(
"orgsecfield"
,
orgDeptField
);
permissionFiled
.
put
(
"createmanfield"
,
createManField
);
permissionFiled
.
put
(
"createmanfield"
,
createManField
);
...
...
ibzdict-util/src/main/java/cn/ibizlab/util/security/AuthenticationUser.java
浏览文件 @
d66e47b7
...
@@ -260,11 +260,13 @@ public class AuthenticationUser implements UserDetails
...
@@ -260,11 +260,13 @@ public class AuthenticationUser implements UserDetails
return
this
.
sessionParams
;
return
this
.
sessionParams
;
}
}
private
Map
<
String
,
Object
>
getUserSessionParam
()
{
private
Map
<
String
,
Object
>
getUserSessionParam
()
{
if
(
userSessionParam
!=
null
)
if
(
userSessionParam
!=
null
)
{
return
userSessionParam
;
return
userSessionParam
;
else
}
else
{
return
new
HashMap
<>();
return
new
HashMap
<>();
}
}
}
public
void
setOrgInfo
(
Map
<
String
,
Set
<
String
>>
orgInfo
)
{
public
void
setOrgInfo
(
Map
<
String
,
Set
<
String
>>
orgInfo
)
{
this
.
orgInfo
=
orgInfo
;
this
.
orgInfo
=
orgInfo
;
...
...
ibzdict-util/src/main/java/cn/ibizlab/util/service/IBZConfigService.java
浏览文件 @
d66e47b7
...
@@ -29,8 +29,9 @@ public class IBZConfigService extends ServiceImpl<IBZConfigMapper, IBZConfig> im
...
@@ -29,8 +29,9 @@ public class IBZConfigService extends ServiceImpl<IBZConfigMapper, IBZConfig> im
@Cacheable
(
value
=
"ibzrt_configs"
,
key
=
"'cfgid:'+#p0+'||'+#p1+'||'+#p2"
)
@Cacheable
(
value
=
"ibzrt_configs"
,
key
=
"'cfgid:'+#p0+'||'+#p1+'||'+#p2"
)
public
JSONObject
getConfig
(
String
cfgType
,
String
targetType
,
String
userId
)
public
JSONObject
getConfig
(
String
cfgType
,
String
targetType
,
String
userId
)
{
{
if
(
StringUtils
.
isEmpty
(
userId
)||
StringUtils
.
isEmpty
(
cfgType
)||
StringUtils
.
isEmpty
(
targetType
))
if
(
StringUtils
.
isEmpty
(
userId
)||
StringUtils
.
isEmpty
(
cfgType
)||
StringUtils
.
isEmpty
(
targetType
))
{
throw
new
BadRequestAlertException
(
"获取配置失败,参数缺失"
,
"IBZConfig"
,
cfgType
);
throw
new
BadRequestAlertException
(
"获取配置失败,参数缺失"
,
"IBZConfig"
,
cfgType
);
}
IBZConfig
config
=
this
.
getOne
(
Wrappers
.
query
(
IBZConfig
.
builder
().
systemId
(
systemId
).
cfgType
(
cfgType
).
targetType
(
targetType
).
userId
(
userId
).
build
()),
false
);
IBZConfig
config
=
this
.
getOne
(
Wrappers
.
query
(
IBZConfig
.
builder
().
systemId
(
systemId
).
cfgType
(
cfgType
).
targetType
(
targetType
).
userId
(
userId
).
build
()),
false
);
if
(
config
==
null
)
{
if
(
config
==
null
)
{
config
=
this
.
getOne
(
Wrappers
.
query
(
IBZConfig
.
builder
().
systemId
(
systemId
).
cfgType
(
cfgType
).
targetType
(
targetType
).
userId
(
adminuserid
).
build
()),
false
);
config
=
this
.
getOne
(
Wrappers
.
query
(
IBZConfig
.
builder
().
systemId
(
systemId
).
cfgType
(
cfgType
).
targetType
(
targetType
).
userId
(
adminuserid
).
build
()),
false
);
...
@@ -44,19 +45,22 @@ public class IBZConfigService extends ServiceImpl<IBZConfigMapper, IBZConfig> im
...
@@ -44,19 +45,22 @@ public class IBZConfigService extends ServiceImpl<IBZConfigMapper, IBZConfig> im
@CacheEvict
(
value
=
"ibzrt_configs"
,
key
=
"'cfgid:'+#p0+'||'+#p1+'||'+#p2"
)
@CacheEvict
(
value
=
"ibzrt_configs"
,
key
=
"'cfgid:'+#p0+'||'+#p1+'||'+#p2"
)
public
boolean
saveConfig
(
String
cfgType
,
String
targetType
,
String
userId
,
JSONObject
config
)
public
boolean
saveConfig
(
String
cfgType
,
String
targetType
,
String
userId
,
JSONObject
config
)
{
{
if
(
StringUtils
.
isEmpty
(
userId
)||
StringUtils
.
isEmpty
(
cfgType
)||
StringUtils
.
isEmpty
(
targetType
))
if
(
StringUtils
.
isEmpty
(
userId
)||
StringUtils
.
isEmpty
(
cfgType
)||
StringUtils
.
isEmpty
(
targetType
))
{
throw
new
BadRequestAlertException
(
"保存配置失败,参数缺失"
,
"IBZConfig"
,
cfgType
);
throw
new
BadRequestAlertException
(
"保存配置失败,参数缺失"
,
"IBZConfig"
,
cfgType
);
}
String
cfg
=
"{}"
;
String
cfg
=
"{}"
;
if
(
config
!=
null
)
if
(
config
!=
null
)
{
cfg
=
JSONObject
.
toJSONString
(
config
);
cfg
=
JSONObject
.
toJSONString
(
config
);
}
return
this
.
saveOrUpdate
(
IBZConfig
.
builder
().
systemId
(
systemId
).
cfgType
(
cfgType
).
targetType
(
targetType
).
userId
(
userId
).
cfg
(
cfg
).
updateDate
(
DataObject
.
getNow
()).
build
());
return
this
.
saveOrUpdate
(
IBZConfig
.
builder
().
systemId
(
systemId
).
cfgType
(
cfgType
).
targetType
(
targetType
).
userId
(
userId
).
cfg
(
cfg
).
updateDate
(
DataObject
.
getNow
()).
build
());
}
}
@CacheEvict
(
value
=
"ibzrt_configs"
,
key
=
"'cfgid:'+#p0+'||'+#p1+'||'+#p2"
)
@CacheEvict
(
value
=
"ibzrt_configs"
,
key
=
"'cfgid:'+#p0+'||'+#p1+'||'+#p2"
)
public
void
resetConfig
(
String
cfgType
,
String
targetType
,
String
userId
)
public
void
resetConfig
(
String
cfgType
,
String
targetType
,
String
userId
)
{
{
if
(
StringUtils
.
isEmpty
(
userId
)||
StringUtils
.
isEmpty
(
cfgType
)||
StringUtils
.
isEmpty
(
targetType
))
if
(
StringUtils
.
isEmpty
(
userId
)||
StringUtils
.
isEmpty
(
cfgType
)||
StringUtils
.
isEmpty
(
targetType
))
{
throw
new
BadRequestAlertException
(
"重置配置失败,参数缺失"
,
"IBZConfig"
,
cfgType
);
throw
new
BadRequestAlertException
(
"重置配置失败,参数缺失"
,
"IBZConfig"
,
cfgType
);
}
this
.
remove
(
Wrappers
.
query
(
IBZConfig
.
builder
().
systemId
(
systemId
).
cfgType
(
cfgType
).
targetType
(
targetType
).
userId
(
userId
).
build
()));
this
.
remove
(
Wrappers
.
query
(
IBZConfig
.
builder
().
systemId
(
systemId
).
cfgType
(
cfgType
).
targetType
(
targetType
).
userId
(
userId
).
build
()));
}
}
...
...
ibzdict-util/src/main/java/cn/ibizlab/util/service/IBZUAAUserService.java
浏览文件 @
d66e47b7
...
@@ -26,10 +26,10 @@ public class IBZUAAUserService implements AuthenticationUserService{
...
@@ -26,10 +26,10 @@ public class IBZUAAUserService implements AuthenticationUserService{
@Override
@Override
public
AuthenticationUser
loadUserByUsername
(
String
username
)
{
public
AuthenticationUser
loadUserByUsername
(
String
username
)
{
AuthenticationUser
user
=
uaaFeignClient
.
loginByUsername
(
username
);
AuthenticationUser
user
=
uaaFeignClient
.
loginByUsername
(
username
);
if
(
user
==
null
)
if
(
user
==
null
)
{
throw
new
BadRequestAlertException
(
"登录失败"
,
"IBZUAAUser"
,
username
);
throw
new
BadRequestAlertException
(
"登录失败"
,
"IBZUAAUser"
,
username
);
}
return
user
;
return
user
;
}
}
...
@@ -48,8 +48,9 @@ public class IBZUAAUserService implements AuthenticationUserService{
...
@@ -48,8 +48,9 @@ public class IBZUAAUserService implements AuthenticationUserService{
logininfo
.
setLoginname
(
loginname
);
logininfo
.
setLoginname
(
loginname
);
logininfo
.
setPassword
(
password
);
logininfo
.
setPassword
(
password
);
AuthenticationUser
user
=
uaaFeignClient
.
login
(
logininfo
);
AuthenticationUser
user
=
uaaFeignClient
.
login
(
logininfo
);
if
(
user
==
null
)
if
(
user
==
null
)
{
throw
new
BadRequestAlertException
(
"登录失败"
,
"IBZUAAUser"
,
username
);
throw
new
BadRequestAlertException
(
"登录失败"
,
"IBZUAAUser"
,
username
);
}
return
user
;
return
user
;
}
}
...
...
ibzdict-util/src/main/java/cn/ibizlab/util/service/IBZUSERServiceImpl.java
浏览文件 @
d66e47b7
...
@@ -34,14 +34,18 @@ public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> impl
...
@@ -34,14 +34,18 @@ public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> impl
String
[]
data
=
username
.
split
(
"[|]"
);
String
[]
data
=
username
.
split
(
"[|]"
);
String
loginname
=
""
;
String
loginname
=
""
;
String
domains
=
""
;
String
domains
=
""
;
if
(
data
.
length
>
0
)
if
(
data
.
length
>
0
)
{
loginname
=
data
[
0
].
trim
();
loginname
=
data
[
0
].
trim
();
if
(
data
.
length
>
1
)
}
if
(
data
.
length
>
1
){
domains
=
data
[
1
].
trim
();
domains
=
data
[
1
].
trim
();
if
(!
StringUtils
.
isEmpty
(
loginname
))
}
if
(!
StringUtils
.
isEmpty
(
loginname
)){
conds
.
eq
(
"loginname"
,
loginname
);
conds
.
eq
(
"loginname"
,
loginname
);
if
(!
StringUtils
.
isEmpty
(
domains
))
}
if
(!
StringUtils
.
isEmpty
(
domains
)){
conds
.
eq
(
"domains"
,
domains
);
conds
.
eq
(
"domains"
,
domains
);
}
IBZUSER
user
=
this
.
getOne
(
conds
);
IBZUSER
user
=
this
.
getOne
(
conds
);
if
(
user
==
null
)
{
if
(
user
==
null
)
{
throw
new
UsernameNotFoundException
(
"用户"
+
username
+
"未找到"
);
throw
new
UsernameNotFoundException
(
"用户"
+
username
+
"未找到"
);
...
@@ -55,10 +59,12 @@ public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> impl
...
@@ -55,10 +59,12 @@ public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> impl
@Override
@Override
public
AuthenticationUser
loadUserByLogin
(
String
username
,
String
password
){
public
AuthenticationUser
loadUserByLogin
(
String
username
,
String
password
){
AuthenticationUser
authuserdetail
=
loadUserByUsername
(
username
);
AuthenticationUser
authuserdetail
=
loadUserByUsername
(
username
);
if
(
pwencrymode
==
1
)
if
(
pwencrymode
==
1
)
{
password
=
DigestUtils
.
md5DigestAsHex
(
password
.
getBytes
());
password
=
DigestUtils
.
md5DigestAsHex
(
password
.
getBytes
());
else
if
(
pwencrymode
==
2
)
}
else
if
(
pwencrymode
==
2
){
password
=
DigestUtils
.
md5DigestAsHex
(
String
.
format
(
"%1$s||%2$s"
,
username
,
password
).
getBytes
());
password
=
DigestUtils
.
md5DigestAsHex
(
String
.
format
(
"%1$s||%2$s"
,
username
,
password
).
getBytes
());
}
if
(!
authuserdetail
.
getPassword
().
equals
(
password
)){
if
(!
authuserdetail
.
getPassword
().
equals
(
password
)){
throw
new
BadRequestAlertException
(
"用户名密码错误"
,
"IBZUSER"
,
username
);
throw
new
BadRequestAlertException
(
"用户名密码错误"
,
"IBZUSER"
,
username
);
}
}
...
...
ibzdict-util/src/main/java/cn/ibizlab/util/service/SimpleAuditService.java
浏览文件 @
d66e47b7
此差异已折叠。
点击以展开。
ibzdict-util/src/main/java/cn/ibizlab/util/service/SimpleFileService.java
浏览文件 @
d66e47b7
...
@@ -23,20 +23,21 @@ public class SimpleFileService implements FileService {
...
@@ -23,20 +23,21 @@ public class SimpleFileService implements FileService {
@Override
@Override
public
FileItem
saveFile
(
MultipartFile
multipartFile
)
{
public
FileItem
saveFile
(
MultipartFile
multipartFile
)
{
FileItem
item
=
null
;
FileItem
item
=
null
;
// 获取文件名
// 获取文件名
String
fileName
=
multipartFile
.
getOriginalFilename
();
String
fileName
=
multipartFile
.
getOriginalFilename
();
// 获取文件后缀
// 获取文件后缀
String
extname
=
"."
+
getExtensionName
(
fileName
);
String
extname
=
"."
+
getExtensionName
(
fileName
);
try
{
try
{
String
fileid
=
DigestUtils
.
md5DigestAsHex
(
multipartFile
.
getInputStream
());
String
fileid
=
DigestUtils
.
md5DigestAsHex
(
multipartFile
.
getInputStream
());
String
fileFullPath
=
this
.
fileRoot
+
"ibizutil"
+
File
.
separator
+
fileid
+
File
.
separator
+
fileName
;
String
fileFullPath
=
this
.
fileRoot
+
"ibizutil"
+
File
.
separator
+
fileid
+
File
.
separator
+
fileName
;
File
file
=
new
File
(
fileFullPath
);
File
file
=
new
File
(
fileFullPath
);
File
parent
=
new
File
(
file
.
getParent
());
File
parent
=
new
File
(
file
.
getParent
());
if
(!
parent
.
exists
())
if
(!
parent
.
exists
())
{
parent
.
mkdirs
();
parent
.
mkdirs
();
FileCopyUtils
.
copy
(
multipartFile
.
getInputStream
(),
Files
.
newOutputStream
(
file
.
toPath
()));
}
item
=
new
FileItem
(
fileid
,
fileName
,
fileid
,
fileName
,(
int
)
multipartFile
.
getSize
(),
extname
);
FileCopyUtils
.
copy
(
multipartFile
.
getInputStream
(),
Files
.
newOutputStream
(
file
.
toPath
()));
item
=
new
FileItem
(
fileid
,
fileName
,
fileid
,
fileName
,
(
int
)
multipartFile
.
getSize
(),
extname
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
new
InternalServerErrorException
(
"文件上传失败,"
+
e
);
throw
new
InternalServerErrorException
(
"文件上传失败,"
+
e
);
}
}
...
...
ibzdict-util/src/main/java/cn/ibizlab/util/service/SimpleUserService.java
浏览文件 @
d66e47b7
...
@@ -19,19 +19,19 @@ import org.springframework.security.core.authority.AuthorityUtils;
...
@@ -19,19 +19,19 @@ import org.springframework.security.core.authority.AuthorityUtils;
@Primary
@Primary
@Service
(
"SimpleUserService"
)
@Service
(
"SimpleUserService"
)
@ConditionalOnExpression
(
"(!${ibiz.enablePermissionValid:false})&&'${ibiz.auth.service:IBZUAAUserService}'.equals('SimpleUserService')"
)
@ConditionalOnExpression
(
"(!${ibiz.enablePermissionValid:false})&&'${ibiz.auth.service:IBZUAAUserService}'.equals('SimpleUserService')"
)
public
class
SimpleUserService
implements
AuthenticationUserService
{
public
class
SimpleUserService
implements
AuthenticationUserService
{
@Override
@Override
public
AuthenticationUser
loadUserByUsername
(
String
username
)
{
public
AuthenticationUser
loadUserByUsername
(
String
username
)
{
AuthenticationUser
user
=
new
AuthenticationUser
();
AuthenticationUser
user
=
new
AuthenticationUser
();
String
[]
data
=
username
.
split
(
"[|]"
);
String
[]
data
=
username
.
split
(
"[|]"
);
String
loginname
=
username
;
String
loginname
=
username
;
String
domains
=
""
;
String
domains
=
""
;
String
password
=
""
;
String
password
=
""
;
if
(
data
.
length
==
2
)
{
if
(
data
.
length
==
2
)
{
loginname
=
data
[
0
].
trim
();
loginname
=
data
[
0
].
trim
();
domains
=
data
[
1
].
trim
();
domains
=
data
[
1
].
trim
();
}
}
user
.
setUserid
(
username
);
user
.
setUserid
(
username
);
...
...
ibzdict-util/src/main/java/cn/ibizlab/util/web/FeignRequestInterceptor.java
浏览文件 @
d66e47b7
...
@@ -29,8 +29,9 @@ public class FeignRequestInterceptor implements RequestInterceptor {
...
@@ -29,8 +29,9 @@ public class FeignRequestInterceptor implements RequestInterceptor {
if
(
headerNames
!=
null
)
{
if
(
headerNames
!=
null
)
{
while
(
headerNames
.
hasMoreElements
())
{
while
(
headerNames
.
hasMoreElements
())
{
String
name
=
headerNames
.
nextElement
();
String
name
=
headerNames
.
nextElement
();
if
(
name
.
equalsIgnoreCase
(
"transfer-encoding"
))
if
(
name
.
equalsIgnoreCase
(
"transfer-encoding"
))
{
continue
;
continue
;
}
String
values
=
request
.
getHeader
(
name
);
String
values
=
request
.
getHeader
(
name
);
requestTemplate
.
header
(
name
,
values
);
requestTemplate
.
header
(
name
,
values
);
}
}
...
...
ibzdict-util/src/main/java/cn/ibizlab/util/web/IBZOperationParameterReader.java
浏览文件 @
d66e47b7
ibzdict-util/src/main/java/cn/ibizlab/util/web/SearchContextHandlerMethodArgumentResolver.java
浏览文件 @
d66e47b7
...
@@ -41,7 +41,4 @@ public class SearchContextHandlerMethodArgumentResolver implements HandlerMethod
...
@@ -41,7 +41,4 @@ public class SearchContextHandlerMethodArgumentResolver implements HandlerMethod
String
json
=
objectMapper
.
writeValueAsString
(
set
);
String
json
=
objectMapper
.
writeValueAsString
(
set
);
return
objectMapper
.
readValue
(
json
,
parameter
.
getParameterType
());
return
objectMapper
.
readValue
(
json
,
parameter
.
getParameterType
());
}
}
}
}
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录