Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz4j Spring R7
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7后台标准模板
iBiz4j Spring R7
提交
3f550fc1
提交
3f550fc1
编写于
7月 09, 2020
作者:
zhouweidong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
审计
上级
eedfa55f
变更
3
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
19 行增加
和
18 行删除
+19
-18
DevBootApplication.java.ftl
...t/src/main/java/%SYS_PKGPATH%/DevBootApplication.java.ftl
+4
-0
%SYS%%API%Application.java.ftl
..._PKGPATH%/%SYSAPI_PKGPATH%/%SYS%%API%Application.java.ftl
+4
-0
SimpleAuditService.java.ftl
...va/%SYS_PKGPATH%/util/service/SimpleAuditService.java.ftl
+11
-18
未找到文件。
SLN/%PUBPRJ%-boot/src/main/java/%SYS_PKGPATH%/DevBootApplication.java.ftl
浏览文件 @
3f550fc1
...
...
@@ -14,6 +14,8 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
import
org
.
springframework
.
web
.
method
.
support
.
HandlerMethodArgumentResolver
;
import
org
.
springframework
.
web
.
servlet
.
config
.
annotation
.
WebMvcConfigurerAdapter
;
import
org
.
springframework
.
context
.
annotation
.
ComponentScan
;
import
org
.
springframework
.
scheduling
.
annotation
.
EnableAsync
;
import
org
.
springframework
.
scheduling
.
annotation
.
EnableScheduling
;
import
java
.
util
.
List
;
@
Slf4j
...
...
@@ -43,6 +45,8 @@ import java.util.List;
@
Import
({
org
.
springframework
.
cloud
.
openfeign
.
FeignClientsConfiguration
.
class
})
@
EnableAsync
@
EnableScheduling
public
class
DevBootApplication
extends
WebMvcConfigurerAdapter
{
public
static
void
main
(
String
[]
args
)
{
...
...
SLN/%PUBPRJ%-provider/%PUBPRJ%-provider-%SYSAPI_PKGPATH%/src/main/java/%SYS_PKGPATH%/%SYSAPI_PKGPATH%/%SYS%%API%Application.java.ftl
浏览文件 @
3f550fc1
...
...
@@ -16,6 +16,8 @@ import org.mybatis.spring.annotation.MapperScan;
import
org
.
springframework
.
web
.
method
.
support
.
HandlerMethodArgumentResolver
;
import
org
.
springframework
.
web
.
servlet
.
config
.
annotation
.
WebMvcConfigurerAdapter
;
import
org
.
springframework
.
cloud
.
openfeign
.
EnableFeignClients
;
import
org
.
springframework
.
scheduling
.
annotation
.
EnableAsync
;
import
org
.
springframework
.
scheduling
.
annotation
.
EnableScheduling
;
import
java
.
util
.
List
;
@
Slf4j
...
...
@@ -48,6 +50,8 @@ import java.util.List;
org
.
springframework
.
cloud
.
openfeign
.
FeignClientsConfiguration
.
class
})
@
EnableFeignClients
(
basePackages
=
{
"${pub.getPKGCodeName()}"
})
@
EnableAsync
@
EnableScheduling
public
class
${
sys
.
codeName
}${
item
.
codeName
}
Application
extends
WebMvcConfigurerAdapter
{
public
static
void
main
(
String
[]
args
)
{
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/service/SimpleAuditService.java.ftl
浏览文件 @
3f550fc1
...
...
@@ -32,19 +32,15 @@ import java.util.*;
*/
@
Service
@
Slf4j
public
class
SimpleAuditService
extends
ServiceImpl
<
IBZDataAuditMapper
,
IBZDataAudit
>
implements
IBZDataAuditService
{
public
class
SimpleAuditService
Impl
extends
ServiceImpl
<
IBZDataAuditMapper
,
IBZDataAudit
>
implements
IBZDataAuditService
{
private
final
ExpressionParser
parser
=
new
SpelExpressionParser
();
private
static
List
cacheMap
=
Collections
.
synchronizedList
(
new
ArrayList
());
@
Override
public
boolean
save
(
IBZDataAudit
entity
)
{
cacheMap
.
add
(
entity
);
log
.
info
(
String
.
format
(
"当前待保存审计集合数量为[%S]"
,
cacheMap
.
size
()));
return
false
;
}
/**
*
定时保存审计记录
*/
@
Scheduled
(
fixedRate
=
10000
)
public
void
saveAudit
()
{
if
(
cacheMap
.
size
()>
0
){
...
...
@@ -80,7 +76,7 @@ public class SimpleAuditService extends ServiceImpl<IBZDataAuditMapper, IBZDataA
dataAudit
.
setIpaddress
(
getIpAddress
(
request
,
AuthenticationUser
.
getAuthenticationUser
()));
dataAudit
.
setAuditinfo
(
getCreateAuditInfo
(
entity
,
auditFields
));
dataAudit
.
setIsdatachanged
(
1
);
save
(
dataAudit
);
cacheMap
.
add
(
dataAudit
);
}
/**
...
...
@@ -93,8 +89,6 @@ public class SimpleAuditService extends ServiceImpl<IBZDataAuditMapper, IBZDataA
*/
@
SneakyThrows
public
void
updateAudit
(
HttpServletRequest
request
,
EntityBase
beforeEntity
,
Object
serviceObj
,
Object
idValue
,
Map
<
String
,
Audit
>
auditFields
){
System
.
out
.
println
(
"updateAudit--开始休眠"
);
Thread
.
sleep
(
10000
);
//
获取更新后的实体
EntityBase
afterEntity
=
getEntity
(
serviceObj
,
idValue
);
//
获取更新后的审计内容
...
...
@@ -114,8 +108,7 @@ public class SimpleAuditService extends ServiceImpl<IBZDataAuditMapper, IBZDataA
dataAudit
.
setIpaddress
(
getIpAddress
(
request
,
AuthenticationUser
.
getAuthenticationUser
()));
dataAudit
.
setAuditinfo
(
auditInfo
);
dataAudit
.
setIsdatachanged
(
isDataChanged
);
save
(
dataAudit
);
System
.
out
.
println
(
"updateAudit--结束休眠"
);
cacheMap
.
add
(
dataAudit
);
}
/**
...
...
@@ -137,7 +130,7 @@ public class SimpleAuditService extends ServiceImpl<IBZDataAuditMapper, IBZDataA
dataAudit
.
setIpaddress
(
getIpAddress
(
request
,
AuthenticationUser
.
getAuthenticationUser
()));
dataAudit
.
setAuditinfo
(
getRemoveAuditInfo
(
entity
,
auditFields
));
dataAudit
.
setIsdatachanged
(
1
);
save
(
dataAudit
);
cacheMap
.
add
(
dataAudit
);
}
/**
...
...
@@ -198,10 +191,10 @@ public class SimpleAuditService extends ServiceImpl<IBZDataAuditMapper, IBZDataA
newValue
=
dataTransfer
(
newValue
,
auditAnnotation
.
fieldType
(),
auditAnnotation
.
format
());//
属性值转换
JSONObject
auditFieldObj
=
new
JSONObject
();
auditFieldObj
.
put
(
"field"
,
fieldLogicName
);
auditFieldObj
.
put
(
"
sourc
e"
,
oldValue
);
auditFieldObj
.
put
(
"
target
"
,
newValue
);
auditFieldObj
.
put
(
"
befor
e"
,
oldValue
);
auditFieldObj
.
put
(
"
after
"
,
newValue
);
if
(
!StringUtils.isEmpty(auditAnnotation.dictName())){
auditFieldObj
.
put
(
"dict
Name
"
,
auditAnnotation
.
dictName
());
auditFieldObj
.
put
(
"dict"
,
auditAnnotation
.
dictName
());
}
auditFieldArray
.
add
(
auditFieldObj
);
}
...
...
@@ -235,7 +228,7 @@ public class SimpleAuditService extends ServiceImpl<IBZDataAuditMapper, IBZDataA
auditFieldObj
.
put
(
"field"
,
fieldLogicName
);
auditFieldObj
.
put
(
"value"
,
value
);
if
(
!StringUtils.isEmpty(auditAnnotation.dictName())){
auditFieldObj
.
put
(
"dict
Name
"
,
auditAnnotation
.
dictName
());
auditFieldObj
.
put
(
"dict"
,
auditAnnotation
.
dictName
());
}
auditFieldArray
.
add
(
auditFieldObj
);
}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录