Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pseer
gxpt_ht
Commits
410c54df
Commit
410c54df
authored
Jan 06, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
验卷AOP增加异步
parent
82361745
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
QPServiceImplAspect.java
...ain/java/share/framework/aspectj/QPServiceImplAspect.java
+21
-2
No files found.
share-framework/src/main/java/share/framework/aspectj/QPServiceImplAspect.java
View file @
410c54df
...
@@ -16,6 +16,7 @@ import share.common.enums.YesNoEnum;
...
@@ -16,6 +16,7 @@ import share.common.enums.YesNoEnum;
import
share.system.domain.CouponLog
;
import
share.system.domain.CouponLog
;
import
share.system.domain.SConsumerCoupon
;
import
share.system.domain.SConsumerCoupon
;
import
share.system.domain.SStore
;
import
share.system.domain.SStore
;
import
share.system.domain.vo.MqttxVo
;
import
share.system.service.CouponLogService
;
import
share.system.service.CouponLogService
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.ISStoreService
;
import
share.system.service.ISStoreService
;
...
@@ -23,6 +24,7 @@ import share.system.service.ISStoreService;
...
@@ -23,6 +24,7 @@ import share.system.service.ISStoreService;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.CompletableFuture
;
@Aspect
@Aspect
...
@@ -37,6 +39,7 @@ public class QPServiceImplAspect {
...
@@ -37,6 +39,7 @@ public class QPServiceImplAspect {
@Autowired
@Autowired
private
ISStoreService
sStoreService
;
private
ISStoreService
sStoreService
;
/**
/**
* 切点函数,用于标识需要记录操作日志的方法。
* 切点函数,用于标识需要记录操作日志的方法。
* 切点表达式为:execution(* share.system.service.impl.QPServiceImpl.*(..)),表示匹配所有在share.system.service.impl.QPServiceImpl类中定义的方法。
* 切点表达式为:execution(* share.system.service.impl.QPServiceImpl.*(..)),表示匹配所有在share.system.service.impl.QPServiceImpl类中定义的方法。
...
@@ -89,7 +92,15 @@ public class QPServiceImplAspect {
...
@@ -89,7 +92,15 @@ public class QPServiceImplAspect {
couponLog
.
setStatus
(
YesNoEnum
.
yes
.
getDisplay_3
());
couponLog
.
setStatus
(
YesNoEnum
.
yes
.
getDisplay_3
());
couponLog
.
setMessage
(
outParams
);
couponLog
.
setMessage
(
outParams
);
couponLog
.
setCreateTime
(
new
Date
());
couponLog
.
setCreateTime
(
new
Date
());
couponLogService
.
insertCouponLog
(
couponLog
);
// 异步执行
CompletableFuture
.
supplyAsync
(()
->
{
int
i
=
couponLogService
.
insertCouponLog
(
couponLog
);
if
(
i
>
0
)
{
return
true
;
}
else
{
return
false
;
}
});
// }
// }
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -119,7 +130,15 @@ public class QPServiceImplAspect {
...
@@ -119,7 +130,15 @@ public class QPServiceImplAspect {
couponLog
.
setStatus
(
YesNoEnum
.
no
.
getDisplay_3
());
couponLog
.
setStatus
(
YesNoEnum
.
no
.
getDisplay_3
());
couponLog
.
setMessage
(
stackTraceToString
(
e
.
getClass
().
getName
(),
e
.
getMessage
(),
e
.
getStackTrace
()));
couponLog
.
setMessage
(
stackTraceToString
(
e
.
getClass
().
getName
(),
e
.
getMessage
(),
e
.
getStackTrace
()));
couponLog
.
setCreateTime
(
new
Date
());
couponLog
.
setCreateTime
(
new
Date
());
couponLogService
.
insertCouponLog
(
couponLog
);
// 异步执行
CompletableFuture
.
supplyAsync
(()
->
{
int
i
=
couponLogService
.
insertCouponLog
(
couponLog
);
if
(
i
>
0
)
{
return
true
;
}
else
{
return
false
;
}
});
// }
// }
}
catch
(
Exception
e2
)
{
}
catch
(
Exception
e2
)
{
e2
.
printStackTrace
();
e2
.
printStackTrace
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment