Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz4j Spring R7
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7后台标准模板
iBiz4j Spring R7
提交
a204cd87
提交
a204cd87
编写于
11月 11, 2020
作者:
zhouweidong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
代码规范检查
上级
941741f5
变更
30
展开全部
隐藏空白字符变更
内嵌
并排
正在显示
30 个修改的文件
包含
448 行增加
和
272 行删除
+448
-272
AuditAspect.java.ftl
.../main/java/%SYS_PKGPATH%/util/aspect/AuditAspect.java.ftl
+14
-8
DEFieldDefaultValueAspect.java.ftl
...S_PKGPATH%/util/aspect/DEFieldDefaultValueAspect.java.ftl
+9
-7
DupCheckAspect.java.ftl
...in/java/%SYS_PKGPATH%/util/aspect/DupCheckAspect.java.ftl
+4
-2
ESAspect.java.ftl
...src/main/java/%SYS_PKGPATH%/util/aspect/ESAspect.java.ftl
+2
-1
RocketMQAspect.java.ftl
...in/java/%SYS_PKGPATH%/util/aspect/RocketMQAspect.java.ftl
+6
-4
VersionCheckAspect.java.ftl
...ava/%SYS_PKGPATH%/util/aspect/VersionCheckAspect.java.ftl
+14
-7
DTOBase.java.ftl
.../src/main/java/%SYS_PKGPATH%/util/domain/DTOBase.java.ftl
+12
-6
EntityBase.java.ftl
...c/main/java/%SYS_PKGPATH%/util/domain/EntityBase.java.ftl
+15
-11
EntityMP.java.ftl
...src/main/java/%SYS_PKGPATH%/util/domain/EntityMP.java.ftl
+6
-6
EntityMongo.java.ftl
.../main/java/%SYS_PKGPATH%/util/domain/EntityMongo.java.ftl
+0
-2
QueryBuildContext.java.ftl
...java/%SYS_PKGPATH%/util/filter/QueryBuildContext.java.ftl
+4
-3
QueryFilter.java.ftl
.../main/java/%SYS_PKGPATH%/util/filter/QueryFilter.java.ftl
+8
-5
QueryWrapperContext.java.ftl
...va/%SYS_PKGPATH%/util/filter/QueryWrapperContext.java.ftl
+14
-12
SearchContextBase.java.ftl
...java/%SYS_PKGPATH%/util/filter/SearchContextBase.java.ftl
+6
-4
CachedBeanCopier.java.ftl
.../java/%SYS_PKGPATH%/util/helper/CachedBeanCopier.java.ftl
+2
-3
DEFieldCacheMap.java.ftl
...n/java/%SYS_PKGPATH%/util/helper/DEFieldCacheMap.java.ftl
+52
-31
DataObject.java.ftl
...c/main/java/%SYS_PKGPATH%/util/helper/DataObject.java.ftl
+62
-38
RuleUtils.java.ftl
...rc/main/java/%SYS_PKGPATH%/util/helper/RuleUtils.java.ftl
+102
-54
AppController.java.ftl
.../main/java/%SYS_PKGPATH%/util/rest/AppController.java.ftl
+12
-6
AuthenticationController.java.ftl
...%SYS_PKGPATH%/util/rest/AuthenticationController.java.ftl
+1
-1
AuthPermissionEvaluator.java.ftl
...S_PKGPATH%/util/security/AuthPermissionEvaluator.java.ftl
+33
-17
AuthenticationUser.java.ftl
...a/%SYS_PKGPATH%/util/security/AuthenticationUser.java.ftl
+4
-2
IBZConfigService.java.ftl
...java/%SYS_PKGPATH%/util/service/IBZConfigService.java.ftl
+8
-4
IBZUAAUserService.java.ftl
...ava/%SYS_PKGPATH%/util/service/IBZUAAUserService.java.ftl
+4
-3
IBZUSERServiceImpl.java.ftl
...va/%SYS_PKGPATH%/util/service/IBZUSERServiceImpl.java.ftl
+12
-6
SimpleAuditService.java.ftl
...va/%SYS_PKGPATH%/util/service/SimpleAuditService.java.ftl
+33
-19
SimpleFileService.java.ftl
...ava/%SYS_PKGPATH%/util/service/SimpleFileService.java.ftl
+2
-1
FeignRequestInterceptor.java.ftl
...a/%SYS_PKGPATH%/util/web/FeignRequestInterceptor.java.ftl
+2
-1
IBZOperationParameterReader.java.ftl
...YS_PKGPATH%/util/web/IBZOperationParameterReader.java.ftl
+5
-5
SearchContextHandlerMethodArgumentResolver.java.ftl
...l/web/SearchContextHandlerMethodArgumentResolver.java.ftl
+0
-3
未找到文件。
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/aspect/AuditAspect.java.ftl
浏览文件 @
a204cd87
...
...
@@ -60,15 +60,17 @@ public class AuditAspect
request
=((
ServletRequestAttributes
)
requestAttributes
).
getRequest
();
}
Object
[]
args
=
point
.
getArgs
();
if
(
ObjectUtils
.
isEmpty
(
args
)
||
args
.
length
==
0
)
if
(
ObjectUtils
.
isEmpty
(
args
)
||
args
.
length
==
0
)
{
return
;
}
Object
serviceParam
=
args
[
0
];
if
(
serviceParam
instanceof
EntityBase
){
EntityBase
entity
=(
EntityBase
)
serviceParam
;
//
创建数据
EntityBase
entity
=(
EntityBase
)
serviceParam
;
Map
<
String
,
Audit
>
auditFields
=
DEFieldCacheMap
.
getAuditFields
(
entity
.
getClass
());
if
(
auditFields
.
size
()==
0
)//
是否有审计属性
//
是否有审计属性
if
(
auditFields
.
size
()==
0
)
{
return
;
}
String
idField
=
DEFieldCacheMap
.
getDEKeyField
(
entity
.
getClass
());
Object
idValue
=
""
;
...
...
@@ -95,8 +97,9 @@ public class AuditAspect
Object
serviceObj
=
point
.
getTarget
();
Object
args
[]=
point
.
getArgs
();
if
(
ObjectUtils
.
isEmpty
(
args
)
||
args
.
length
==
0
)
if
(
ObjectUtils
.
isEmpty
(
args
)
||
args
.
length
==
0
)
{
return
point
.
proceed
();
}
Object
arg
=
args
[
0
];
if
(
arg
instanceof
EntityBase
){
...
...
@@ -104,15 +107,17 @@ public class AuditAspect
Map
<
String
,
Audit
>
auditFields
=
DEFieldCacheMap
.
getAuditFields
(
entity
.
getClass
());
//
是否有审计属性
if
(
auditFields
.
size
()==
0
)
if
(
auditFields
.
size
()==
0
)
{
return
point
.
proceed
();
}
String
idField
=
DEFieldCacheMap
.
getDEKeyField
(
entity
.
getClass
());
Object
idValue
=
""
;
if
(
!StringUtils.isEmpty(idField)){
idValue
=
entity
.
get
(
idField
);
}
if
(
ObjectUtils
.
isEmpty
(
idValue
))
if
(
ObjectUtils
.
isEmpty
(
idValue
))
{
return
point
.
proceed
();
}
//
获取更新前实体
EntityBase
beforeEntity
=
getEntity
(
serviceObj
,
idValue
);
...
...
@@ -142,8 +147,9 @@ public class AuditAspect
Object
serviceObj
=
point
.
getTarget
();
Object
args
[]=
point
.
getArgs
();
if
(
ObjectUtils
.
isEmpty
(
args
)
||
args
.
length
==
0
)
if
(
ObjectUtils
.
isEmpty
(
args
)
||
args
.
length
==
0
)
{
return
point
.
proceed
();
}
Object
idValue
=
args
[
0
];
EntityBase
entity
=
getEntity
(
serviceObj
,
idValue
);
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/aspect/DEFieldDefaultValueAspect.java.ftl
浏览文件 @
a204cd87
...
...
@@ -87,8 +87,9 @@ public class DEFieldDefaultValueAspect
Map
<
String
,
DEField
>
deFields
=
DEFieldCacheMap
.
getDEFields
(
obj
.
getClass
());
AuthenticationUser
curUser
=
AuthenticationUser
.
getAuthenticationUser
();
String
keyField
=
DEFieldCacheMap
.
getDEKeyField
(
obj
.
getClass
());
if
(
StringUtils
.
isEmpty
(
keyField
))
if
(
StringUtils
.
isEmpty
(
keyField
))
{
return
true
;
}
fillDEField
((
EntityBase
)
obj
,
deFields
,
actionName
,
curUser
,
keyField
);
}
else
if
(
obj
instanceof
List
)
{
...
...
@@ -101,8 +102,9 @@ public class DEFieldDefaultValueAspect
deFields
=
DEFieldCacheMap
.
getDEFields
(
item
.
getClass
());
curUser
=
AuthenticationUser
.
getAuthenticationUser
();
keyField
=
DEFieldCacheMap
.
getDEKeyField
(
item
.
getClass
());
if
(
StringUtils
.
isEmpty
(
keyField
))
if
(
StringUtils
.
isEmpty
(
keyField
))
{
return
true
;
}
}
fillDEField
((
EntityBase
)
item
,
deFields
,
actionName
,
curUser
,
keyField
);
}
...
...
@@ -119,14 +121,14 @@ public class DEFieldDefaultValueAspect
*
@
param
et
当前实体对象
*/
private
void
fillDEField
(
EntityBase
et
,
Map
<
String
,
DEField
>
deFields
,
String
actionName
,
AuthenticationUser
curUser
,
String
keyField
)
throws
Exception
{
if
(
deFields
.
size
()==
0
)
return
;
if
(
deFields
.
size
()==
0
)
{
return
;
}
if
(
actionName
.
toLowerCase
().
startsWith
(
"save"
))
{
if
(
ObjectUtils
.
isEmpty
(
et
.
get
(
keyField
)))
if
(
ObjectUtils
.
isEmpty
(
et
.
get
(
keyField
)))
{
actionName
=
"create"
;
}
}
for
(
Map
.
Entry
<
String
,
DEField
>
entry
:
deFields
.
entrySet
())
{
String
fieldname
=
entry
.
getKey
();
//
获取注解
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/aspect/DupCheckAspect.java.ftl
浏览文件 @
a204cd87
...
...
@@ -127,10 +127,12 @@ public class DupCheckAspect {
*
@
param
value
*/
private
void
setValue
(
Object
entity
,
QueryFilter
filter
,
String
fieldName
,
Object
value
){
if
(
ObjectUtils
.
isEmpty
(
value
))
if
(
ObjectUtils
.
isEmpty
(
value
))
{
filter
.
isnull
(
DEFieldCacheMap
.
getFieldColumnName
(
entity
.
getClass
(),
fieldName
));
else
}
else
{
filter
.
eq
(
DEFieldCacheMap
.
getFieldColumnName
(
entity
.
getClass
(),
fieldName
),
value
);
}
}
}
</#
if
>
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/aspect/ESAspect.java.ftl
浏览文件 @
a204cd87
...
...
@@ -61,8 +61,9 @@ public class ESAspect
Object
service
=
point
.
getTarget
();
String
action
=
point
.
getSignature
().
getName
();
Object
[]
args
=
point
.
getArgs
();
if
(
ObjectUtils
.
isEmpty
(
args
)
||
args
.
length
==
0
||
StringUtils
.
isEmpty
(
action
))
if
(
ObjectUtils
.
isEmpty
(
args
)
||
args
.
length
==
0
||
StringUtils
.
isEmpty
(
action
))
{
return
;
}
EvaluationContext
exServiceCtx
=
new
StandardEvaluationContext
();
exServiceCtx
.
setVariable
(
"service"
,
service
);
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/aspect/RocketMQAspect.java.ftl
浏览文件 @
a204cd87
...
...
@@ -98,14 +98,16 @@ public class RocketMQAspect
Object
entity
=
null
;
String
action
=
point
.
getSignature
().
getName
();
Object
[]
args
=
point
.
getArgs
();
if
(
ObjectUtils
.
isEmpty
(
args
)
||
args
.
length
==
0
||
StringUtils
.
isEmpty
(
action
))
if
(
ObjectUtils
.
isEmpty
(
args
)
||
args
.
length
==
0
||
StringUtils
.
isEmpty
(
action
))
{
return
entity
;
}
Object
arg
=
args
[
0
];
if
(
arg
instanceof
EntityBase
||
arg
instanceof
List
)
if
(
arg
instanceof
EntityBase
||
arg
instanceof
List
)
{
return
arg
;
else
}
else
{
return
null
;
}
}
/**
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/aspect/VersionCheckAspect.java.ftl
浏览文件 @
a204cd87
...
...
@@ -43,11 +43,13 @@ public class VersionCheckAspect
Object
[]
args
=
point
.
getArgs
();
Object
id
=
args
[
0
];
Object
dto
=
args
[
1
];
if
(
ObjectUtils
.
isEmpty
(
id
)
||
ObjectUtils
.
isEmpty
(
dto
))
if
(
ObjectUtils
.
isEmpty
(
id
)
||
ObjectUtils
.
isEmpty
(
dto
))
{
return
;
}
String
versionField
=
versionCheck
.
versionfield
();
if
(
StringUtils
.
isEmpty
(
versionField
))
if
(
StringUtils
.
isEmpty
(
versionField
))
{
return
;
}
versionCheck
(
versionCheck
,
point
.
getTarget
(),
dto
,
id
);
}
...
...
@@ -58,11 +60,13 @@ public class VersionCheckAspect
if
(
args
.
length
>=
2
){
Object
id
=
args
[
args
.
length
-
2
];
Object
dto
=
args
[
args
.
length
-
1
];
if
(
ObjectUtils
.
isEmpty
(
id
)
||
ObjectUtils
.
isEmpty
(
dto
))
if
(
ObjectUtils
.
isEmpty
(
id
)
||
ObjectUtils
.
isEmpty
(
dto
))
{
return
;
}
String
versionField
=
versionCheck
.
versionfield
();
if
(
StringUtils
.
isEmpty
(
versionField
))
if
(
StringUtils
.
isEmpty
(
versionField
))
{
return
;
}
versionCheck
(
versionCheck
,
point
.
getTarget
(),
dto
,
id
);
}
}
...
...
@@ -73,17 +77,20 @@ public class VersionCheckAspect
//
忽略版本检查
Expression
dtoParamsExp
=
parser
.
parseExpression
(
"#dto.extensionparams"
);
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
;
}
Expression
newExp
=
parser
.
parseExpression
(
String
.
format
(
"#dto.%s"
,
versionCheck
.
versionfield
()));
Object
newVersion
=
newExp
.
getValue
(
context
);
if
(
ObjectUtils
.
isEmpty
(
newVersion
))
if
(
ObjectUtils
.
isEmpty
(
newVersion
))
{
return
;
}
//
进行版本检查
Object
oldVersion
=
getDBVersion
(
versionCheck
,
getService
(
resource
,
versionCheck
.
entity
()),
id
);
if
(
!ObjectUtils.isEmpty(oldVersion)){
if
(
RuleUtils
.
gt
(
newVersion
,
oldVersion
))
if
(
RuleUtils
.
gt
(
newVersion
,
oldVersion
))
{
throw
new
BadRequestAlertException
(
"数据已变更,可能后台数据已被修改,请重新加载数据"
,
"VersionCheckAspect"
,
"versionCheck"
);
}
}
}
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/domain/DTOBase.java.ftl
浏览文件 @
a204cd87
...
...
@@ -24,33 +24,39 @@ public class DTOBase implements Serializable {
public
void
modify
(
String
field
,
Object
val
)
{
if
(
val
==
null
)
if
(
val
==
null
)
{
this
.
getFocusNull
(
true
).
add
(
field
.
toLowerCase
());
else
}
else
{
this
.
getFocusNull
(
true
).
remove
(
field
.
toLowerCase
());
}
}
public
Set
<
String
>
getFocusNull
()
{
if
(
focusNull
==
null
)
if
(
focusNull
==
null
)
{
focusNull
=
new
HashSet
<>();
}
if
(
focusNull
.
size
()>
0
&&
extensionparams
.
containsKey
(
"dirtyflagenable"
))
{
Set
<
String
>
nocheck
=
new
HashSet
<>();
for
(
String
key
:
focusNull
)
{
if
(
!extensionparams.containsKey(key+"dirtyflag"))
if
(
!extensionparams.containsKey(key+"dirtyflag"))
{
nocheck
.
add
(
key
);
}
}
for
(
String
key
:
nocheck
)
for
(
String
key
:
nocheck
)
{
focusNull
.
remove
(
key
);
}
}
return
focusNull
;
}
private
Set
<
String
>
getFocusNull
(
boolean
newflag
)
{
if
(
focusNull
==
null
)
if
(
focusNull
==
null
)
{
focusNull
=
new
HashSet
<>();
}
return
focusNull
;
}
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/domain/EntityBase.java.ftl
浏览文件 @
a204cd87
...
...
@@ -27,8 +27,9 @@ public class EntityBase implements Serializable {
private
Set
<
String
>
focusNull
;
public
Set
<
String
>
getFocusNull
()
{
if
(
focusNull
==
null
)
if
(
focusNull
==
null
)
{
focusNull
=
new
HashSet
<>();
}
return
focusNull
;
}
...
...
@@ -53,8 +54,9 @@ public class EntityBase implements Serializable {
private
BeanMap
getMap
()
{
if
(
map
==
null
)
map
=
BeanMap
.
create
(
this
);
if
(
map
==
null
)
{
map
=
BeanMap
.
create
(
this
);
}
return
map
;
}
...
...
@@ -71,17 +73,16 @@ public class EntityBase implements Serializable {
this
.
extensionparams
=
extensionparams
;
}
public
Object
get
(
String
field
)
{
String
fieldRealName
=
DEFieldCacheMap
.
getFieldRealName
(
this
.
getClass
(),
field
);
if
(
!StringUtils.isEmpty(fieldRealName))
if
(
!StringUtils.isEmpty(fieldRealName))
{
return
getMap
().
get
(
fieldRealName
);
else
}
else
{
return
this
.
extensionparams
.
get
(
field
.
toLowerCase
());
}
}
@
JsonAnyGetter
public
Map
<
String
,
Object
>
any
()
{
return
extensionparams
;
...
...
@@ -92,13 +93,16 @@ public class EntityBase implements Serializable {
field
=
field
.
toLowerCase
();
String
fieldRealName
=
DEFieldCacheMap
.
getFieldRealName
(
this
.
getClass
(),
field
);
if
(
!StringUtils.isEmpty(fieldRealName)) {
if
(
value
==
null
)
if
(
value
==
null
)
{
getMap
().
put
(
fieldRealName
,
null
);
else
}
else
{
getMap
().
put
(
fieldRealName
,
DEFieldCacheMap
.
fieldValueOf
(
this
.
getClass
(),
fieldRealName
,
value
));
}
}
else
else
{
this
.
extensionparams
.
put
(
field
.
toLowerCase
(),
value
);
}
}
/**
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/domain/EntityMP.java.ftl
浏览文件 @
a204cd87
...
...
@@ -8,24 +8,25 @@ import org.springframework.util.StringUtils;
public
class
EntityMP
extends
EntityBase
{
public
UpdateWrapper
getUpdateWrapper
(
boolean
clean
)
{
UpdateWrapper
wrapper
=
new
UpdateWrapper
();
for
(
String
nullField
:
getFocusNull
())
{
wrapper
.
set
(
nullField
,
null
);
}
if
(
clean
)
if
(
clean
)
{
getFocusNull
().
clear
();
}
return
wrapper
;
}
@
Override
public
void
modify
(
String
field
,
Object
val
)
{
if
(
val
==
null
)
if
(
val
==
null
)
{
this
.
getFocusNull
().
add
(
field
.
toLowerCase
());
else
}
else
{
this
.
getFocusNull
().
remove
(
field
.
toLowerCase
());
}
}
@
Override
...
...
@@ -36,6 +37,5 @@ public class EntityMP extends EntityBase {
getFocusNull
().
remove
(
resetField
);
}
}
}
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/domain/EntityMongo.java.ftl
浏览文件 @
a204cd87
...
...
@@ -5,7 +5,5 @@ package ${pub.getPKGCodeName()}.util.domain;
public
class
EntityMongo
extends
EntityBase
{
}
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/filter/QueryBuildContext.java.ftl
浏览文件 @
a204cd87
...
...
@@ -47,9 +47,9 @@ public class QueryBuildContext extends SearchContextBase implements ISearchConte
*/
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
;
}
QueryBuilder
rsBuilder
=
QueryBuilder
.
start
();
QueryBuilder
fieldBuilder
=
parseFieldMap
(
queryFilter
.
any
());
QueryBuilder
orBuilder
=
parseOrQueryFilter
(
queryFilter
.
get
$
or
());
...
...
@@ -110,8 +110,9 @@ public class QueryBuildContext extends SearchContextBase implements ISearchConte
*
@
return
*/
private
QueryBuilder
parseFieldMap
(
Map
<
String
,
QueryFilter
.
SegmentCond
>
fieldMap
)
{
if
(
fieldMap
.
size
()==
0
)
if
(
fieldMap
.
size
()==
0
)
{
return
null
;
}
QueryBuilder
fieldBuilders
=
QueryBuilder
.
start
();
for
(
Map
.
Entry
<
String
,
QueryFilter
.
SegmentCond
>
entry
:
fieldMap
.
entrySet
()){
getSegmentCondSql
(
entry
.
getKey
(),
entry
.
getValue
(),
fieldBuilders
);
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/filter/QueryFilter.java.ftl
浏览文件 @
a204cd87
...
...
@@ -66,8 +66,9 @@ public class QueryFilter {
private
Map
<
String
,
SegmentCond
>
getMap
()
{
if
(
map
==
null
)
if
(
map
==
null
)
{
map
=
new
LinkedHashMap
<>();
}
return
map
;
}
...
...
@@ -135,11 +136,12 @@ public class QueryFilter {
}
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
());
else
}
else
{
this
.
getMap
().
put
(
column
,
segmentCond
);
}
return
this
;
}
...
...
@@ -158,8 +160,9 @@ public class QueryFilter {
private
Map
<
String
,
Object
>
getMap
()
{
if
(
map
==
null
)
if
(
map
==
null
)
{
map
=
new
LinkedHashMap
<>();
}
return
map
;
}
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/filter/QueryWrapperContext.java.ftl
浏览文件 @
a204cd87
...
...
@@ -40,17 +40,20 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
int
pageSize
=
getPageable
().
getPageSize
();
//
构造
mybatis
-
plus
分页
if
(
StringUtils
.
isEmpty
(
currentPage
)
||
StringUtils
.
isEmpty
(
pageSize
))
if
(
StringUtils
.
isEmpty
(
currentPage
)
||
StringUtils
.
isEmpty
(
pageSize
))
{
page
=
new
Page
(
1
,
Short
.
MAX_VALUE
);
else
}
else
{
page
=
new
Page
(
currentPage
+
1
,
pageSize
);
}
//
构造
mybatis
-
plus
排序
Sort
sort
=
getPageable
().
getSort
();
Iterator
<
Sort
.
Order
>
it_sort
=
sort
.
iterator
();
if
(
ObjectUtils
.
isEmpty
(
it_sort
))
if
(
ObjectUtils
.
isEmpty
(
it_sort
))
{
return
page
;
}
ParameterizedType
parameterizedType
=
(
ParameterizedType
)
getClass
().
getGenericSuperclass
();
Class
<
T
>
type
=
(
Class
<
T
>)
parameterizedType
.
getActualTypeArguments
()[
0
];
...
...
@@ -98,9 +101,9 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
*
@
return
*/
private
Consumer
<
QueryWrapper
<
T
>>
parseQueryFilter
(
QueryFilter
queryFilter
){
if
(
queryFilter
.
any
().
size
()==
0
&&
queryFilter
.
get
$
or
()==
null
&&
queryFilter
.
get
$
and
()==
null
)
return
null
;
if
(
queryFilter
.
any
().
size
()==
0
&&
queryFilter
.
get
$
or
()==
null
&&
queryFilter
.
get
$
and
()==
null
)
{
return
null
;
}
Consumer
<
QueryWrapper
<
T
>>
consumer
=
queryWrapper
->
{
Consumer
fieldConsumer
=
parseFieldMap
(
queryFilter
.
any
());
Consumer
orConsumer
=
parseOrQueryFilter
(
queryFilter
.
get
$
or
());
...
...
@@ -124,7 +127,6 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
*
@
return
*/
private
Consumer
<
QueryWrapper
<
T
>>
parseOrQueryFilter
(
List
<
QueryFilter
>
queryFilters
)
{
if
(
queryFilters
==
null
||
queryFilters
.
size
()==
0
)
return
null
;
Consumer
<
QueryWrapper
<
T
>>
consumer
=
queryWrapper
->
{
...
...
@@ -142,10 +144,10 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
*
@
return
*/
private
Consumer
<
QueryWrapper
<
T
>>
parseAndQueryFilter
(
List
<
QueryFilter
>
queryFilters
)
{
if
(
queryFilters
==
null
||
queryFilters
.
size
()==
0
)
if
(
queryFilters
==
null
||
queryFilters
.
size
()==
0
)
{
return
null
;
Consumer
<
QueryWrapper
<
T
>>
consumer
=
queryWrapper
->
{
}
Consumer
<
QueryWrapper
<
T
>>
consumer
=
queryWrapper
->
{
for
(
QueryFilter
queryFilter
:
queryFilters
){
Consumer
tempQueryWrapper
=
parseQueryFilter
(
queryFilter
);
queryWrapper
.
and
(
tempQueryWrapper
);
...
...
@@ -160,9 +162,9 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
*
@
return
*/
private
Consumer
<
QueryWrapper
<
T
>>
parseFieldMap
(
Map
<
String
,
QueryFilter
.
SegmentCond
>
fieldMap
)
{
if
(
fieldMap
.
size
()==
0
)
if
(
fieldMap
.
size
()==
0
)
{
return
null
;
}
Consumer
<
QueryWrapper
<
T
>>
consumer
=
queryWrapper
->
{
for
(
Map
.
Entry
<
String
,
QueryFilter
.
SegmentCond
>
field
:
fieldMap
.
entrySet
()){
String
fieldName
=
field
.
getKey
();
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/filter/SearchContextBase.java.ftl
浏览文件 @
a204cd87
...
...
@@ -117,10 +117,12 @@ public class SearchContextBase implements ISearchContext{
*
@
return
*/
public
Pageable
getPageable
()
{
if
(
ObjectUtils
.
isEmpty
(
pageSort
))
return
PageRequest
.
of
(
page
,
size
);
else
return
PageRequest
.
of
(
page
,
size
,
pageSort
);
if
(
ObjectUtils
.
isEmpty
(
pageSort
))
{
return
PageRequest
.
of
(
page
,
size
);
}
else
{
return
PageRequest
.
of
(
page
,
size
,
pageSort
);
}
}
/**
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/helper/CachedBeanCopier.java.ftl
浏览文件 @
a204cd87
...
...
@@ -16,8 +16,9 @@ public class CachedBeanCopier {
}
public
static
void
copy
(
Object
srcObj
,
Object
destObj
,
boolean
useConverter
)
{
if
(
srcObj
==
null
||
destObj
==
null
)
if
(
srcObj
==
null
||
destObj
==
null
)
{
return
;
}
getCopier
(
srcObj
,
destObj
,
useConverter
).
copy
(
srcObj
,
destObj
,
null
);
}
...
...
@@ -32,6 +33,4 @@ public class CachedBeanCopier {
}
return
copier
;
}
}
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/helper/DEFieldCacheMap.java.ftl
浏览文件 @
a204cd87
...
...
@@ -39,13 +39,16 @@ public class DEFieldCacheMap {
*/
public
static
<
T
>
Hashtable
<
String
,
Field
>
getFieldMap
(
Class
<
T
>
clazz
)
{
String
className
=
clazz
.
getName
();
if
(
className
.
indexOf
(
"_$"
)>
0
)
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
if
(
cacheMap
.
containsKey
(
className
))
return
cacheMap
.
get
(
className
);
if
(
className
.
indexOf
(
"_$"
)>
0
)
{
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
}
if
(
cacheMap
.
containsKey
(
className
))
{
return
cacheMap
.
get
(
className
);
}
synchronized
(
objLock1
)
{
if
(
cacheMap
.
containsKey
(
className
))
return
cacheMap
.
get
(
className
);
if
(
cacheMap
.
containsKey
(
className
))
{
return
cacheMap
.
get
(
className
);
}
Hashtable
<
String
,
Field
>
result
=
new
Hashtable
<
String
,
Field
>();
List
<
Field
>
list
=
new
ArrayList
<
Field
>();
Hashtable
<
String
,
String
>
keys
=
new
Hashtable
<
String
,
String
>();
...
...
@@ -61,8 +64,9 @@ public class DEFieldCacheMap {
Audit
auditField
=
field
.
getAnnotation
(
Audit
.
class
);
if
(
!ObjectUtils.isEmpty(deField)) {
defields
.
put
(
field
.
getName
(),
deField
);
if
(
deField
.
isKeyField
())
cacheDEKeyField
.
put
(
className
,
field
.
getName
());
if
(
deField
.
isKeyField
())
{
cacheDEKeyField
.
put
(
className
,
field
.
getName
());
}
}
if
(
!ObjectUtils.isEmpty(auditField)) {
auditfields
.
put
(
field
.
getName
(),
auditField
);
...
...
@@ -77,10 +81,12 @@ public class DEFieldCacheMap {
}
}
public
static
Hashtable
<
String
,
Field
>
getFieldMap
(
String
className
)
{
if
(
className
.
indexOf
(
"_$"
)>
0
)
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
if
(
cacheMap
.
containsKey
(
className
))
return
cacheMap
.
get
(
className
);
if
(
className
.
indexOf
(
"_$"
)>
0
)
{
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
}
if
(
cacheMap
.
containsKey
(
className
))
{
return
cacheMap
.
get
(
className
);
}
Class
clazz
=
null
;
try
{
clazz
=
Class
.
forName
(
className
);
...
...
@@ -99,10 +105,12 @@ public class DEFieldCacheMap {
*/
public
static
<
T
>
Hashtable
<
String
,
DEField
>
getDEFields
(
Class
<
T
>
clazz
)
{
String
className
=
clazz
.
getName
();
if
(
className
.
indexOf
(
"_$"
)>
0
)
if
(
className
.
indexOf
(
"_$"
)>
0
)
{
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
if
(
cacheDEField
.
containsKey
(
className
))
}
if
(
cacheDEField
.
containsKey
(
className
))
{
return
cacheDEField
.
get
(
className
);
}
else
{
DEFieldCacheMap
.
getFieldMap
(
className
);
return
cacheDEField
.
get
(
className
);
...
...
@@ -116,10 +124,12 @@ public class DEFieldCacheMap {
*/
public
static
<
T
>
Hashtable
<
String
,
Audit
>
getAuditFields
(
Class
<
T
>
clazz
)
{
String
className
=
clazz
.
getName
();
if
(
className
.
indexOf
(
"_$"
)>
0
)
if
(
className
.
indexOf
(
"_$"
)>
0
)
{
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
if
(
cacheAuditField
.
containsKey
(
className
))
}
if
(
cacheAuditField
.
containsKey
(
className
))
{
return
cacheAuditField
.
get
(
className
);
}
else
{
DEFieldCacheMap
.
getFieldMap
(
className
);
return
cacheAuditField
.
get
(
className
);
...
...
@@ -133,10 +143,12 @@ public class DEFieldCacheMap {
*/
public
static
<
T
>
String
getDEKeyField
(
Class
<
T
>
clazz
)
{
String
className
=
clazz
.
getName
();
if
(
className
.
indexOf
(
"_$"
)>
0
)
if
(
className
.
indexOf
(
"_$"
)>
0
)
{
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
if
(
cacheDEKeyField
.
containsKey
(
className
))
}
if
(
cacheDEKeyField
.
containsKey
(
className
))
{
return
cacheDEKeyField
.
get
(
className
);
}
else
{
DEFieldCacheMap
.
getFieldMap
(
className
);
return
cacheDEKeyField
.
get
(
className
);
...
...
@@ -151,10 +163,12 @@ public class DEFieldCacheMap {
*/
public
static
<
T
>
List
<
Field
>
getFields
(
Class
<
T
>
clazz
)
{
String
className
=
clazz
.
getName
();
if
(
className
.
indexOf
(
"_$"
)>
0
)
if
(
className
.
indexOf
(
"_$"
)>
0
)
{
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
if
(
cacheList
.
containsKey
(
className
))
}
if
(
cacheList
.
containsKey
(
className
))
{
return
cacheList
.
get
(
className
);
}
else
{
DEFieldCacheMap
.
getFieldMap
(
className
);
return
cacheList
.
get
(
className
);
...
...
@@ -162,10 +176,12 @@ public class DEFieldCacheMap {
}
public
static
List
<
Field
>
getFields
(
String
className
)
{
if
(
className
.
indexOf
(
"_$"
)>
0
)
if
(
className
.
indexOf
(
"_$"
)>
0
)
{
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
if
(
cacheList
.
containsKey
(
className
))
}
if
(
cacheList
.
containsKey
(
className
))
{
return
cacheList
.
get
(
className
);
}
else
{
DEFieldCacheMap
.
getFieldMap
(
className
);
return
cacheList
.
get
(
className
);
...
...
@@ -179,10 +195,12 @@ public class DEFieldCacheMap {
*/
public
static
<
T
>
Hashtable
<
String
,
String
>
getFieldKeys
(
Class
<
T
>
clazz
)
{
String
className
=
clazz
.
getName
();
if
(
className
.
indexOf
(
"_$"
)>
0
)
if
(
className
.
indexOf
(
"_$"
)>
0
)
{
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
if
(
cacheKey
.
containsKey
(
className
))
}
if
(
cacheKey
.
containsKey
(
className
))
{
return
cacheKey
.
get
(
className
);
}
else
{
DEFieldCacheMap
.
getFieldMap
(
className
);
return
cacheKey
.
get
(
className
);
...
...
@@ -192,20 +210,25 @@ public class DEFieldCacheMap {
public
static
<
T
>
String
getFieldRealName
(
Class
<
T
>
clazz
,
String
fieldname
)
{
fieldname
=
fieldname
.
toLowerCase
();
Hashtable
<
String
,
String
>
keys
=
DEFieldCacheMap
.
getFieldKeys
(
clazz
);
if
(
keys
.
containsKey
(
fieldname
))
if
(
keys
.
containsKey
(
fieldname
))
{
return
keys
.
get
(
fieldname
);
else
if
(
keys
.
containsKey
(
fieldname
.
replace
(
"_"
,
""
)))
}
else
if
(
keys
.
containsKey
(
fieldname
.
replace
(
"_"
,
""
)))
{
return
keys
.
get
(
fieldname
.
replace
(
"_"
,
""
));
else
}
else
{
return
""
;
}
}
public
static
<
T
>
Field
getField
(
Class
<
T
>
clazz
,
String
fieldname
)
{
String
fieldRealName
=
DEFieldCacheMap
.
getFieldRealName
(
clazz
,
fieldname
);
if
(
!StringUtils.isEmpty(fieldRealName))
if
(
!StringUtils.isEmpty(fieldRealName))
{
return
DEFieldCacheMap
.
getFieldMap
(
clazz
).
get
(
fieldRealName
);
else
}
else
{
return
null
;
}
}
public
static
<
T
>
String
getFieldColumnName
(
Class
<
T
>
clazz
,
String
fieldname
)
{
...
...
@@ -229,6 +252,4 @@ public class DEFieldCacheMap {
}
return
resultValue
;
}
}
\ No newline at end of file
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/helper/DataObject.java.ftl
浏览文件 @
a204cd87
...
...
@@ -22,30 +22,34 @@ public class DataObject {
final
static
public
DateFormat
dayFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
final
static
public
String
getStringValue
(
Object
objValue
,
String
strDefault
)
{
if
(
objValue
==
null
)
return
strDefault
;
if
(
objValue
instanceof
String
)
return
(
String
)
objValue
;
if
(
objValue
==
null
)
{
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
)
{
String
rt
=
datetimeFormat
.
format
(
objValue
);
if
(
rt
.
endsWith
(
" 00:00:00"
))
if
(
rt
.
endsWith
(
" 00:00:00"
))
{
rt
=
dayFormat
.
format
(
objValue
);
else
if
(
rt
.
endsWith
(
":00"
))
}
else
if
(
rt
.
endsWith
(
":00"
))
{
rt
=
datetimeFormat2
.
format
(
objValue
);
}
return
rt
;
}
return
objValue
.
toString
();
}
public
static
<
T
>
Object
objectValueOf
(
Class
<
T
>
type
,
Object
fieldValue
)
{
if
(
fieldValue
==
null
)
if
(
fieldValue
==
null
)
{
return
null
;
}
Object
resultValue
=
fieldValue
;
String
targetType
=
type
.
getSimpleName
();
if
(
targetType
.
equalsIgnoreCase
(
fieldValue
.
getClass
().
getSimpleName
()))
if
(
targetType
.
equalsIgnoreCase
(
fieldValue
.
getClass
().
getSimpleName
()))
{
return
resultValue
;
}
if
(
targetType
.
equals
(
"Boolean"
)){
resultValue
=
getBooleanValue
(
fieldValue
,
false
);
}
...
...
@@ -82,10 +86,9 @@ public class DataObject {
else
if
(
targetType
.
equals
(
"String"
))
{
resultValue
=
getStringValue
(
fieldValue
,
null
);
}
if
(
resultValue
==
null
)
if
(
resultValue
==
null
)
{
return
null
;
}
return
resultValue
;
}
...
...
@@ -98,8 +101,9 @@ public class DataObject {
if
(
objValue
==
null
)
{
return
jDefault
;
}
if
(
objValue
instanceof
JSONObject
)
if
(
objValue
instanceof
JSONObject
)
{
return
(
JSONObject
)
objValue
;
}
String
strValue
=
objValue
.
toString
();
try
{
return
JSONObject
.
parseObject
(
strValue
);
...
...
@@ -114,8 +118,9 @@ public class DataObject {
if
(
objValue
==
null
)
{
return
jDefault
;
}
if
(
objValue
instanceof
JSONArray
)
if
(
objValue
instanceof
JSONArray
)
{
return
(
JSONArray
)
objValue
;
}
String
strValue
=
objValue
.
toString
();
try
{
return
JSONArray
.
parseArray
(
strValue
);
...
...
@@ -136,8 +141,9 @@ public class DataObject {
List
<
String
>
chk1
=
new
ArrayList
<>();
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
));
}
}
return
chk1
;
}
...
...
@@ -149,8 +155,9 @@ public class DataObject {
}
final
static
public
Boolean
getBooleanValue
(
Object
objValue
,
Boolean
bDefault
)
{
if
(
objValue
==
null
)
return
bDefault
;
if
(
objValue
==
null
)
{
return
bDefault
;
}
if
(
objValue
instanceof
Boolean
)
{
return
(
Boolean
)
objValue
;
}
...
...
@@ -158,20 +165,24 @@ public class DataObject {
}
final
static
public
char
[]
getCharacterValue
(
Object
objValue
,
char
[]
cDefault
)
{
if
(
objValue
==
null
)
return
cDefault
;
if
(
objValue
==
null
)
{
return
cDefault
;
}
return
objValue
.
toString
().
toCharArray
();
}
final
static
public
Double
getDoubleValue
(
Object
objValue
,
Double
dDefault
)
{
if
(
objValue
==
null
)
return
dDefault
;
if
(
objValue
==
null
)
{
return
dDefault
;
}
if
(
objValue
instanceof
Double
)
{
return
(
Double
)
objValue
;
}
String
strValue
=
objValue
.
toString
();
if
(
StringUtils
.
isEmpty
(
strValue
))
return
null
;
if
(
StringUtils
.
isEmpty
(
strValue
))
{
return
null
;
}
strValue
=
strValue
.
replace
(
","
,
""
);
return
Double
.
parseDouble
(
strValue
);
}
...
...
@@ -182,8 +193,9 @@ public class DataObject {
return
nDefault
;
}
if
(
objValue
instanceof
Integer
)
if
(
objValue
instanceof
Integer
)
{
return
(
Integer
)
objValue
;
}
if
(
objValue
instanceof
Double
)
{
return
((
Double
)
objValue
).
intValue
();
...
...
@@ -194,8 +206,9 @@ public class DataObject {
}
String
strValue
=
objValue
.
toString
();
if
(
StringUtils
.
isEmpty
(
strValue
))
if
(
StringUtils
.
isEmpty
(
strValue
))
{
return
nDefault
;
}
strValue
=
strValue
.
replace
(
","
,
""
);
return
Integer
.
parseInt
(
strValue
);
}
...
...
@@ -207,12 +220,13 @@ public class DataObject {
}
try
{
if
(
objValue
instanceof
Float
)
if
(
objValue
instanceof
Float
)
{
return
(
Float
)
objValue
;
}
String
strValue
=
objValue
.
toString
();
if
(
StringUtils
.
isEmpty
(
strValue
))
if
(
StringUtils
.
isEmpty
(
strValue
))
{
return
fDefault
;
}
strValue
=
strValue
.
replace
(
","
,
""
);
return
Float
.
parseFloat
(
strValue
);
}
catch
(
Exception
ex
)
{
...
...
@@ -236,8 +250,9 @@ public class DataObject {
return
BigDecimal
.
valueOf
((
Long
)
objValue
);
}
String
strValue
=
objValue
.
toString
();
if
(
StringUtils
.
isEmpty
(
strValue
))
if
(
StringUtils
.
isEmpty
(
strValue
))
{
return
fDefault
;
}
strValue
=
strValue
.
replace
(
","
,
""
);
return
BigDecimal
.
valueOf
(
Double
.
parseDouble
(
strValue
));
}
catch
(
Exception
ex
)
{
...
...
@@ -256,8 +271,9 @@ public class DataObject {
}
else
{
Long
l
=
getLongValue
(
objValue
,
null
);
if
(
l
!=null)
if
(
l
!=null)
{
return
BigInteger
.
valueOf
(
l
);
}
}
}
catch
(
Exception
ex
)
{
...
...
@@ -286,8 +302,9 @@ public class DataObject {
}
String
strValue
=
objValue
.
toString
();
if
(
StringUtils
.
isEmpty
(
strValue
))
if
(
StringUtils
.
isEmpty
(
strValue
))
{
return
nDefault
;
}
strValue
=
strValue
.
replace
(
","
,
""
);
return
Long
.
parseLong
(
strValue
);
}
catch
(
Exception
ex
)
{
...
...
@@ -297,7 +314,9 @@ public class DataObject {
final
static
public
byte
[]
getBinaryValue
(
Object
objValue
,
byte
[]
def
)
{
if
(
objValue
==
null
)
return
def
;
if
(
objValue
==
null
)
{
return
def
;
}
if
(
objValue
instanceof
byte
[]){
return
(
byte
[])
objValue
;
}
...
...
@@ -315,7 +334,9 @@ public class DataObject {
*
@
*/
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
)
{
java
.
sql
.
Timestamp
ti
=
(
java
.
sql
.
Timestamp
)
objValue
;
...
...
@@ -335,7 +356,9 @@ public class DataObject {
if
(
objValue
instanceof
String
)
{
String
strValue
=
(
String
)
objValue
;
strValue
=
strValue
.
trim
();
if
(
StringUtils
.
isEmpty
(
strValue
))
return
null
;
if
(
StringUtils
.
isEmpty
(
strValue
))
{
return
null
;
}
try
{
java
.
util
.
Date
date
=
parse
((
String
)
objValue
);
...
...
@@ -376,7 +399,9 @@ public class DataObject {
*
@
*/
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
);
java
.
sql
.
Timestamp
retDate
=
new
java
.
sql
.
Timestamp
(
dtDate
.
getTime
());
return
retDate
;
...
...
@@ -428,8 +453,9 @@ public class DataObject {
if
(
strTimeString
.
indexOf
(
"T"
)
!=-1){
strPart
=
strTimeString
.
split
(
"[T]"
);
}
else
else
{
strPart
=
strTimeString
.
split
(
" "
);
}
if
(
strPart
.
length
==
2
)
{
//
两个部分
String
strDate
=
""
;
...
...
@@ -592,6 +618,4 @@ public class DataObject {
return
new
Timestamp
(
cl
.
getTime
().
getTime
());
}
}
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/helper/RuleUtils.java.ftl
浏览文件 @
a204cd87
此差异已折叠。
点击以展开。
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/rest/AppController.java.ftl
浏览文件 @
a204cd87
...
...
@@ -45,10 +45,12 @@ public class AppController {
while
(
it
.
hasNext
())
{
GrantedAuthority
authority
=
(
GrantedAuthority
)
it
.
next
();
String
strAuthority
=
authority
.
getAuthority
();
if
(
strAuthority
.
startsWith
(
"UNIRES_"
+
systemId
))
if
(
strAuthority
.
startsWith
(
"UNIRES_"
+
systemId
))
{
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
));
}
}
}
Map
<
String
,
Object
>
context
=
new
HashMap
<>();
...
...
@@ -58,10 +60,12 @@ public class AppController {
appData
.
put
(
"unires"
,
uniRes
);
appData
.
put
(
"appmenu"
,
appMenu
);
appData
.
put
(
"enablepermissionvalid"
,
enablePermissionValid
);
if
(
curUser
.
getSuperuser
()==
1
)
if
(
curUser
.
getSuperuser
()==
1
)
{
appData
.
put
(
"enablepermissionvalid"
,
false
);
else
}
else
{
appData
.
put
(
"enablepermissionvalid"
,
enablePermissionValid
);
}
fillAppData
(
appData
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
appData
);
}
...
...
@@ -79,16 +83,18 @@ public class AppController {
@
RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/configs/{configType}/{targetType}"
)
public
ResponseEntity
<
Boolean
>
saveConfig
(@
PathVariable
(
"configType"
)
String
configType
,
@
PathVariable
(
"targetType"
)
String
targetType
,
@
RequestBody
JSONObject
config
)
{
String
userId
=
AuthenticationUser
.
getAuthenticationUser
().
getUserid
();
if
(
StringUtils
.
isEmpty
(
userId
))
if
(
StringUtils
.
isEmpty
(
userId
))
{
throw
new
BadRequestAlertException
(
"保存配置失败,参数缺失"
,
"IBZConfig"
,
configType
);
}
return
ResponseEntity
.
ok
(
ibzConfigService
.
saveConfig
(
configType
,
targetType
,
userId
,
config
));
}
@
RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/configs/{configType}/{targetType}"
)
public
ResponseEntity
<
JSONObject
>
getConfig
(@
PathVariable
(
"configType"
)
String
configType
,
@
PathVariable
(
"targetType"
)
String
targetType
)
{
String
userId
=
AuthenticationUser
.
getAuthenticationUser
().
getUserid
();
if
(
StringUtils
.
isEmpty
(
userId
))
if
(
StringUtils
.
isEmpty
(
userId
))
{
throw
new
BadRequestAlertException
(
"获取配置失败,参数缺失"
,
"IBZConfig"
,
configType
);
}
return
ResponseEntity
.
ok
(
ibzConfigService
.
getConfig
(
configType
,
targetType
,
userId
));
}
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/rest/AuthenticationController.java.ftl
浏览文件 @
a204cd87
...
...
@@ -59,5 +59,5 @@ public class AuthenticationController
authuserdetail
=
userDetailsService
.
loadUserByUsername
(
userDetails
.
getUsername
());
}
return
ResponseEntity
.
ok
().
body
(
authuserdetail
);
}
}
}
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/security/AuthPermissionEvaluator.java.ftl
浏览文件 @
a204cd87
...
...
@@ -41,18 +41,22 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
@
Override
@
SneakyThrows
public
boolean
hasPermission
(
Authentication
authentication
,
Object
entity
,
Object
action
)
{
if
(
!enablePermissionValid)
if
(
!enablePermissionValid)
{
return
true
;
}
Object
principal
=
authentication
.
getPrincipal
();
if
(
ObjectUtils
.
isEmpty
(
principal
))
if
(
ObjectUtils
.
isEmpty
(
principal
))
{
return
false
;
}
AuthenticationUser
authenticationUser
=
(
AuthenticationUser
)
authentication
.
getPrincipal
();
if
(
authenticationUser
.
getSuperuser
()==
1
)
if
(
authenticationUser
.
getSuperuser
()==
1
)
{
return
true
;
}
String
strAction
=
String
.
valueOf
(
action
);
Set
<
String
>
userAuthorities
=
getAuthorities
(
authentication
,
strAction
);
if
(
userAuthorities
.
size
()==
0
)
if
(
userAuthorities
.
size
()==
0
)
{
return
false
;
}
if
(
isAllData
(
strAction
,
userAuthorities
)){
return
true
;
}
...
...
@@ -105,8 +109,9 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
*/
@
SneakyThrows
private
void
setPermissionCondToSearchContext
(
EntityBase
entity
,
QueryWrapperContext
qc
,
Set
<
String
>
userAuthorities
,
AuthenticationUser
authenticationUser
){
if
(
entity
==
null
)
if
(
entity
==
null
)
{
return
;
}
Map
<
String
,
String
>
permissionField
=
getPermissionField
(
entity
);//
获取组织、部门预置属性
String
orgField
=
permissionField
.
get
(
"orgfield"
);
String
orgDeptField
=
permissionField
.
get
(
"orgsecfield"
);
...
...
@@ -188,8 +193,9 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
Iterator
it
=
authorities
.
iterator
();
while
(
it
.
hasNext
())
{
GrantedAuthority
authority
=
(
GrantedAuthority
)
it
.
next
();
if
(
authority
.
getAuthority
().
contains
(
action
))
if
(
authority
.
getAuthority
().
contains
(
action
))
{
userAuthorities
.
add
(
authority
.
getAuthority
());
}
}
return
userAuthorities
;
}
...
...
@@ -256,23 +262,27 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
}
if
(
action
.
endsWith
(
"Create"
)
||
action
.
endsWith
(
"Save"
)){
if
(
!ObjectUtils.isEmpty(orgFieldValue) && !userOrg.contains(orgFieldValue))
if
(
!ObjectUtils.isEmpty(orgFieldValue) && !userOrg.contains(orgFieldValue))
{
return
false
;
if
(
!ObjectUtils.isEmpty(orgDeptFieldValue) && !userOrgDept.contains(orgDeptFieldValue))
}
if
(
!ObjectUtils.isEmpty(orgDeptFieldValue) && !userOrgDept.contains(orgDeptFieldValue)){
return
false
;
if
(
!ObjectUtils.isEmpty(crateManFieldValue) && !authenticationUser.getUserid().equals(crateManFieldValue))
}
if
(
!ObjectUtils.isEmpty(crateManFieldValue) && !authenticationUser.getUserid().equals(crateManFieldValue)){
return
false
;
}
return
true
;
}
else
{
if
(
!ObjectUtils.isEmpty(orgFieldValue) && userOrg.contains(orgFieldValue))
if
(
!ObjectUtils.isEmpty(orgFieldValue) && userOrg.contains(orgFieldValue))
{
return
true
;
if
(
!ObjectUtils.isEmpty(orgDeptFieldValue) && userOrgDept.contains(orgDeptFieldValue))
}
if
(
!ObjectUtils.isEmpty(orgDeptFieldValue) && userOrgDept.contains(orgDeptFieldValue)){
return
true
;
if
(
!ObjectUtils.isEmpty(crateManFieldValue) && authenticationUser.getUserid().equals(crateManFieldValue))
}
if
(
!ObjectUtils.isEmpty(crateManFieldValue) && authenticationUser.getUserid().equals(crateManFieldValue)){
return
true
;
}
return
false
;
}
}
...
...
@@ -296,12 +306,18 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
String
fieldName
=
entry
.
getKey
();//
获取注解字段
DEField
fieldAnnotation
=
entry
.
getValue
();//
获取注解值
DEPredefinedFieldType
prefieldType
=
fieldAnnotation
.
preType
();
if
(
prefieldType
==
prefieldType
.
ORGID
)//
用户配置系统预置属性
-
组织机构标识
//
用户配置系统预置属性
-
组织机构标识
if
(
prefieldType
==
prefieldType
.
ORGID
){
orgField
=
fieldName
;
if
(
prefieldType
==
prefieldType
.
ORGSECTORID
)//
用户配置系统预置属性
-
部门标识
}
//
用户配置系统预置属性
-
部门标识
if
(
prefieldType
==
prefieldType
.
ORGSECTORID
){
orgDeptField
=
fieldName
;
if
(
prefieldType
==
prefieldType
.
CREATEMAN
)//
用户配置系统预置属性
-
部门标识
}
//
用户配置系统预置属性
-
部门标识
if
(
prefieldType
==
prefieldType
.
CREATEMAN
){
createManField
=
fieldName
;
}
}
permissionFiled
.
put
(
"orgfield"
,
orgField
);
permissionFiled
.
put
(
"orgsecfield"
,
orgDeptField
);
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/security/AuthenticationUser.java.ftl
浏览文件 @
a204cd87
...
...
@@ -263,10 +263,12 @@ public class AuthenticationUser implements UserDetails
return
this
.
sessionParams
;
}
private
Map
<
String
,
Object
>
getUserSessionParam
()
{
if
(
userSessionParam
!=null)
if
(
userSessionParam
!=null)
{
return
userSessionParam
;
else
}
else
{
return
new
HashMap
<>();
}
}
public
void
setOrgInfo
(
Map
<
String
,
Set
<
String
>>
orgInfo
)
{
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/service/IBZConfigService.java.ftl
浏览文件 @
a204cd87
...
...
@@ -37,8 +37,9 @@ public class IBZConfigService extends ServiceImpl<IBZConfigMapper, IBZConfig> im
@
Cacheable
(
value
=
"${cachename}"
,
key
=
"'cfgid:'+#p0+'||'+#p1+'||'+#p2"
)
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
);
}
IBZConfig
config
=
this
.
getOne
(
Wrappers
.
query
(
IBZConfig
.
builder
().
systemId
(
systemId
).
cfgType
(
cfgType
).
targetType
(
targetType
).
userId
(
userId
).
build
()),
false
);
if
(
config
==
null
)
{
config
=
this
.
getOne
(
Wrappers
.
query
(
IBZConfig
.
builder
().
systemId
(
systemId
).
cfgType
(
cfgType
).
targetType
(
targetType
).
userId
(
adminuserid
).
build
()),
false
);
...
...
@@ -52,19 +53,22 @@ public class IBZConfigService extends ServiceImpl<IBZConfigMapper, IBZConfig> im
@
CacheEvict
(
value
=
"${cachename}"
,
key
=
"'cfgid:'+#p0+'||'+#p1+'||'+#p2"
)
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
);
}
String
cfg
=
"{}"
;
if
(
config
!=null)
if
(
config
!=null)
{
cfg
=
JSONObject
.
toJSONString
(
config
);
}
return
this
.
saveOrUpdate
(
IBZConfig
.
builder
().
systemId
(
systemId
).
cfgType
(
cfgType
).
targetType
(
targetType
).
userId
(
userId
).
cfg
(
cfg
).
updateDate
(
DataObject
.
getNow
()).
build
());
}
@
CacheEvict
(
value
=
"${cachename}"
,
key
=
"'cfgid:'+#p0+'||'+#p1+'||'+#p2"
)
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
);
}
this
.
remove
(
Wrappers
.
query
(
IBZConfig
.
builder
().
systemId
(
systemId
).
cfgType
(
cfgType
).
targetType
(
targetType
).
userId
(
userId
).
build
()));
}
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/service/IBZUAAUserService.java.ftl
浏览文件 @
a204cd87
...
...
@@ -29,10 +29,10 @@ public class IBZUAAUserService implements AuthenticationUserService{
@
Override
public
AuthenticationUser
loadUserByUsername
(
String
username
)
{
AuthenticationUser
user
=
uaaFeignClient
.
loginByUsername
(
username
);
if
(
user
==
null
)
if
(
user
==
null
)
{
throw
new
BadRequestAlertException
(
"登录失败"
,
"IBZUAAUser"
,
username
);
}
return
user
;
}
...
...
@@ -51,8 +51,9 @@ public class IBZUAAUserService implements AuthenticationUserService{
logininfo
.
setLoginname
(
loginname
);
logininfo
.
setPassword
(
password
);
AuthenticationUser
user
=
uaaFeignClient
.
login
(
logininfo
);
if
(
user
==
null
)
if
(
user
==
null
)
{
throw
new
BadRequestAlertException
(
"登录失败"
,
"IBZUAAUser"
,
username
);
}
return
user
;
}
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/service/IBZUSERServiceImpl.java.ftl
浏览文件 @
a204cd87
...
...
@@ -37,14 +37,18 @@ public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> impl
String
[]
data
=
username
.
split
(
"[|]"
);
String
loginname
=
""
;
String
domains
=
""
;
if
(
data
.
length
>
0
)
if
(
data
.
length
>
0
)
{
loginname
=
data
[
0
].
trim
();
if
(
data
.
length
>
1
)
}
if
(
data
.
length
>
1
){
domains
=
data
[
1
].
trim
();
if
(
!StringUtils.isEmpty(loginname))
}
if
(
!StringUtils.isEmpty(loginname)){
conds
.
eq
(
"loginname"
,
loginname
);
if
(
!StringUtils.isEmpty(domains))
}
if
(
!StringUtils.isEmpty(domains)){
conds
.
eq
(
"domains"
,
domains
);
}
IBZUSER
user
=
this
.
getOne
(
conds
);
if
(
user
==
null
)
{
throw
new
UsernameNotFoundException
(
"用户"
+
username
+
"未找到"
);
...
...
@@ -58,10 +62,12 @@ public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> impl
@
Override
public
AuthenticationUser
loadUserByLogin
(
String
username
,
String
password
){
AuthenticationUser
authuserdetail
=
loadUserByUsername
(
username
);
if
(
pwencrymode
==
1
)
if
(
pwencrymode
==
1
)
{
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
());
}
if
(
!authuserdetail.getPassword().equals( password )){
throw
new
BadRequestAlertException
(
"用户名密码错误"
,
"IBZUSER"
,
username
);
}
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/service/SimpleAuditService.java.ftl
浏览文件 @
a204cd87
...
...
@@ -48,10 +48,12 @@ public class SimpleAuditService extends ServiceImpl<IBZDataAuditMapper, IBZDataA
if
(
cacheMap
.
size
()>
0
){
log
.
info
(
String
.
format
(
"正在保存审计数据,当前审计集合数量为[%s]"
,
cacheMap
.
size
()));
List
temp
=
new
ArrayList
();
if
(
cacheMap
.
size
()<
500
)
if
(
cacheMap
.
size
()<
500
)
{
temp
.
addAll
(
cacheMap
);
else
}
else
{
temp
.
addAll
(
cacheMap
.
subList
(
0
,
500
));
}
this
.
saveBatch
(
temp
);
cacheMap
.
removeAll
(
temp
);
log
.
info
(
String
.
format
(
"保存完成,当前审计集合数量为[%s]"
,
cacheMap
.
size
()));
...
...
@@ -74,8 +76,9 @@ public class SimpleAuditService extends ServiceImpl<IBZDataAuditMapper, IBZDataA
dataAudit
.
setAuditobject
(
entity
.
getClass
().
getSimpleName
());
dataAudit
.
setAuditobjectdata
(
idValue
);
dataAudit
.
setOptime
(
new
Timestamp
(
new
Date
().
getTime
()));
if
(
request
!=null)
if
(
request
!=null)
{
dataAudit
.
setIpaddress
(
getIpAddress
(
request
,
AuthenticationUser
.
getAuthenticationUser
()));
}
dataAudit
.
setAuditinfo
(
getAuditInfo
(
entity
,
auditFields
));
dataAudit
.
setIsdatachanged
(
1
);
cacheMap
.
add
(
dataAudit
);
...
...
@@ -96,9 +99,10 @@ public class SimpleAuditService extends ServiceImpl<IBZDataAuditMapper, IBZDataA
//
获取更新后的审计内容
String
auditInfo
=
getUpdateAuditInfo
(
beforeEntity
,
afterEntity
,
auditFields
);//
比较更新前后差异内容
int
isDataChanged
=
1
;
if
(
StringUtils
.
isEmpty
(
auditInfo
))//
审计内容是否发生变化
//
审计内容是否发生变化
if
(
StringUtils
.
isEmpty
(
auditInfo
)){
isDataChanged
=
0
;
}
IBZDataAudit
dataAudit
=
new
IBZDataAudit
();
dataAudit
.
setOppersonid
(
AuthenticationUser
.
getAuthenticationUser
().
getUserid
());
dataAudit
.
setOppersonname
(
String
.
format
(
"%s[%s]"
,
AuthenticationUser
.
getAuthenticationUser
().
getPersonname
(),
AuthenticationUser
.
getAuthenticationUser
().
getOrgname
()));
...
...
@@ -106,8 +110,9 @@ public class SimpleAuditService extends ServiceImpl<IBZDataAuditMapper, IBZDataA
dataAudit
.
setAuditobject
(
afterEntity
.
getClass
().
getSimpleName
());
dataAudit
.
setAuditobjectdata
(
idValue
);
dataAudit
.
setOptime
(
new
Timestamp
(
new
Date
().
getTime
()));
if
(
request
!=null)
if
(
request
!=null)
{
dataAudit
.
setIpaddress
(
getIpAddress
(
request
,
AuthenticationUser
.
getAuthenticationUser
()));
}
dataAudit
.
setAuditinfo
(
auditInfo
);
dataAudit
.
setIsdatachanged
(
isDataChanged
);
cacheMap
.
add
(
dataAudit
);
...
...
@@ -128,8 +133,9 @@ public class SimpleAuditService extends ServiceImpl<IBZDataAuditMapper, IBZDataA
dataAudit
.
setAuditobject
(
entity
.
getClass
().
getSimpleName
());
dataAudit
.
setAuditobjectdata
(
idValue
);
dataAudit
.
setOptime
(
new
Timestamp
(
new
Date
().
getTime
()));
if
(
request
!=null)
if
(
request
!=null)
{
dataAudit
.
setIpaddress
(
getIpAddress
(
request
,
AuthenticationUser
.
getAuthenticationUser
()));
}
dataAudit
.
setAuditinfo
(
getAuditInfo
(
entity
,
auditFields
));
dataAudit
.
setIsdatachanged
(
1
);
cacheMap
.
add
(
dataAudit
);
...
...
@@ -137,13 +143,13 @@ public class SimpleAuditService extends ServiceImpl<IBZDataAuditMapper, IBZDataA
private
String
getAuditInfo
(
EntityBase
entity
,
Map
<
String
,
Audit
>
auditFields
){
String
auditResult
=
""
;
if
(
auditFields
.
size
()==
0
)
if
(
auditFields
.
size
()==
0
)
{
return
auditResult
;
}
Map
<
String
,
DEField
>
deFields
=
DEFieldCacheMap
.
getDEFields
(
entity
.
getClass
());
if
(
deFields
.
size
()==
0
)
if
(
deFields
.
size
()==
0
)
{
return
auditResult
;
}
JSONArray
auditFieldArray
=
new
JSONArray
();
for
(
Map
.
Entry
<
String
,
Audit
>
auditField
:
auditFields
.
entrySet
())
{
Object
objFieldName
=
auditField
.
getKey
();
...
...
@@ -152,8 +158,9 @@ public class SimpleAuditService extends ServiceImpl<IBZDataAuditMapper, IBZDataA
if
(
deFields
.
containsKey
(
fieldName
)){
deField
=
deFields
.
get
(
fieldName
);
}
if
(
ObjectUtils
.
isEmpty
(
deField
))
if
(
ObjectUtils
.
isEmpty
(
deField
))
{
continue
;
}
Object
value
=
dataTransfer
(
entity
.
get
(
fieldName
),
deField
.
fieldType
(),
deField
.
format
());
if
(
!StringUtils.isEmpty(value)){
JSONObject
auditFieldObj
=
new
JSONObject
();
...
...
@@ -181,12 +188,14 @@ public class SimpleAuditService extends ServiceImpl<IBZDataAuditMapper, IBZDataA
private
String
getUpdateAuditInfo
(
EntityBase
oldData
,
EntityBase
newData
,
Map
<
String
,
Audit
>
auditFields
){
String
auditResult
=
""
;
JSONArray
auditFieldArray
=
new
JSONArray
();
if
(
auditFields
.
size
()==
0
)
if
(
auditFields
.
size
()==
0
)
{
return
auditResult
;
}
Map
<
String
,
DEField
>
deFields
=
DEFieldCacheMap
.
getDEFields
(
oldData
.
getClass
());
if
(
deFields
.
size
()==
0
)
if
(
deFields
.
size
()==
0
)
{
return
auditResult
;
}
for
(
Map
.
Entry
<
String
,
Audit
>
auditField
:
auditFields
.
entrySet
())
{
Object
objFieldName
=
auditField
.
getKey
();//
获取注解字段
...
...
@@ -195,8 +204,9 @@ public class SimpleAuditService extends ServiceImpl<IBZDataAuditMapper, IBZDataA
if
(
deFields
.
containsKey
(
fieldName
)){
deField
=
deFields
.
get
(
fieldName
);
}
if
(
ObjectUtils
.
isEmpty
(
deField
))
if
(
ObjectUtils
.
isEmpty
(
deField
))
{
continue
;
}
Object
oldValue
=
oldData
.
get
(
fieldName
);//
老属性值
Object
newValue
=
newData
.
get
(
fieldName
);//
新属性值
if
(
!compare(oldValue,newValue)){
...
...
@@ -226,8 +236,9 @@ public class SimpleAuditService extends ServiceImpl<IBZDataAuditMapper, IBZDataA
*
@
return
*/
private
String
dataTransfer
(
Object
value
,
String
dataType
,
String
strFormat
){
if
(
value
==
null
)
if
(
value
==
null
)
{
return
""
;
}
String
transResult
=
value
.
toString
();
if
((
dataType
.
equals
(
"DATE"
)
||
dataType
.
equals
(
"DATETIME"
)
||
dataType
.
equals
(
"TIME"
))
&&
(
!StringUtils.isEmpty(strFormat))){ //时间类型转换
Timestamp
timestamp
=(
Timestamp
)
value
;
...
...
@@ -245,10 +256,12 @@ public class SimpleAuditService extends ServiceImpl<IBZDataAuditMapper, IBZDataA
*
@
return
*/
private
boolean
compare
(
Object
sourceObj
,
Object
targetObj
){
if
(
sourceObj
==
null
&&
targetObj
==
null
)
if
(
sourceObj
==
null
&&
targetObj
==
null
)
{
return
true
;
if
(
sourceObj
==
null
&&
targetObj
!=null)
}
if
(
sourceObj
==
null
&&
targetObj
!=null){
return
false
;
}
return
sourceObj
.
equals
(
targetObj
);
}
...
...
@@ -281,8 +294,9 @@ public class SimpleAuditService extends ServiceImpl<IBZDataAuditMapper, IBZDataA
if
(
authenticationUser
!= null && !StringUtils.isEmpty(authenticationUser.getAddr())){
return
authenticationUser
.
getAddr
();
}
if
(
request
==
null
)
if
(
request
==
null
)
{
return
""
;
}
String
Xip
=
request
.
getHeader
(
"X-Real-IP"
);
String
XFor
=
request
.
getHeader
(
"X-Forwarded-For"
);
if
(
!StringUtils.isEmpty(XFor) && !"unKnown".equalsIgnoreCase(XFor)){
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/service/SimpleFileService.java.ftl
浏览文件 @
a204cd87
...
...
@@ -36,8 +36,9 @@ public class SimpleFileService implements FileService {
String
fileFullPath
=
this
.
fileRoot
+
"ibizutil"
+
File
.
separator
+
fileid
+
File
.
separator
+
fileName
;
File
file
=
new
File
(
fileFullPath
);
File
parent
=
new
File
(
file
.
getParent
());
if
(
!parent.exists())
if
(
!parent.exists())
{
parent
.
mkdirs
();
}
FileCopyUtils
.
copy
(
multipartFile
.
getInputStream
(),
Files
.
newOutputStream
(
file
.
toPath
()));
item
=
new
FileItem
(
fileid
,
fileName
,
fileid
,
fileName
,(
int
)
multipartFile
.
getSize
(),
extname
);
}
catch
(
IOException
e
)
{
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/web/FeignRequestInterceptor.java.ftl
浏览文件 @
a204cd87
...
...
@@ -32,8 +32,9 @@ public class FeignRequestInterceptor implements RequestInterceptor {
if
(
headerNames
!= null) {
while
(
headerNames
.
hasMoreElements
())
{
String
name
=
headerNames
.
nextElement
();
if
(
name
.
equalsIgnoreCase
(
"transfer-encoding"
))
if
(
name
.
equalsIgnoreCase
(
"transfer-encoding"
))
{
continue
;
}
String
values
=
request
.
getHeader
(
name
);
requestTemplate
.
header
(
name
,
values
);
}
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/web/IBZOperationParameterReader.java.ftl
浏览文件 @
a204cd87
...
...
@@ -52,19 +52,19 @@ public class IBZOperationParameterReader implements OperationBuilderPlugin {
public
IBZOperationParameterReader
(
ModelAttributeParameterExpander
expander
,
EnumTypeDeterminer
enumTypeDeterminer
)
{
this
.
expander
=
expander
;
this
.
enumTypeDeterminer
=
enumTypeDeterminer
;
this
.
expander
=
expander
;
this
.
enumTypeDeterminer
=
enumTypeDeterminer
;
}
@
Override
public
void
apply
(
OperationContext
context
)
{
context
.
operationBuilder
().
parameters
(
context
.
getGlobalOperationParameters
());
context
.
operationBuilder
().
parameters
(
readParameters
(
context
));
context
.
operationBuilder
().
parameters
(
context
.
getGlobalOperationParameters
());
context
.
operationBuilder
().
parameters
(
readParameters
(
context
));
}
@
Override
public
boolean
supports
(
DocumentationType
delimiter
)
{
return
true
;
return
true
;
}
private
List
<
Parameter
>
readParameters
(
final
OperationContext
context
)
{
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/web/SearchContextHandlerMethodArgumentResolver.java.ftl
浏览文件 @
a204cd87
...
...
@@ -44,7 +44,4 @@ public class SearchContextHandlerMethodArgumentResolver implements HandlerMethod
String
json
=
objectMapper
.
writeValueAsString
(
set
);
return
objectMapper
.
readValue
(
json
,
parameter
.
getParameterType
());
}
}
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录