Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cash-loan-flow-boss
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QG
cash-loan-flow-boss
Commits
9bb15646
Commit
9bb15646
authored
Sep 25, 2019
by
suntao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into v1
* master: 操作的重复 在切面中判断
parents
a7a3715a
03b29c42
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
117 additions
and
78 deletions
+117
-78
OrderServiceImpl.java
.../cashloanflowboss/api/order/service/OrderServiceImpl.java
+9
-8
OperationAspect.java
...ntgroup/cashloanflowboss/core/aspect/OperationAspect.java
+108
-70
No files found.
src/main/java/cn/quantgroup/cashloanflowboss/api/order/service/OrderServiceImpl.java
View file @
9bb15646
...
...
@@ -309,12 +309,6 @@ public class OrderServiceImpl implements OrderService{
return
new
Tuple
<>(
false
,
"orderMapping为空或者loanId为空"
);
}
OptHistoryLog
optHistoryLogExsit
=
optHistoryLogService
.
findByChannelOrderNumberAndOptNameAndSuccess
(
channelOrderNumber
,
secondAudit
);
if
(
optHistoryLogExsit
!=
null
)
{
log
.
info
(
"secondAudit,已经操作成功,channelOrderNumber="
.
concat
(
channelOrderNumber
));
return
new
Tuple
<>(
true
,
"已经操作成功. 重复操作"
);
}
// 更新合同状态
Contract
conscont
=
xyqbCenterService
.
findContractByUserId
(
orderMapping
.
getQgUserId
());
if
(
conscont
!=
null
)
{
...
...
@@ -403,14 +397,21 @@ public class OrderServiceImpl implements OrderService{
}
else
{
// p2p
Map
data
=
this
.
xyqbCenterService
.
queryLendingRecordCount
(
Long
.
valueOf
(
orderApprove
.
getFundId
()));
Map
data
=
null
;
try
{
data
=
this
.
xyqbCenterService
.
queryLendingRecordCount
(
Long
.
valueOf
(
orderApprove
.
getFundId
()));
}
catch
(
Exception
e
)
{
log
.
error
(
"[order_lending][queryLendingRecordCount]查询待打款数量 失败,channelOrderNumber={}, data={}"
,
lendingFormModel
.
getChannelOrderNumber
(),
data
);
}
log
.
info
(
"[order_lending][queryLendingRecordCount]查询待打款数量,channelOrderNumber={}, data={}"
,
lendingFormModel
.
getChannelOrderNumber
(),
data
);
if
(
data
.
size
()
>
0
)
{
if
(
data
!=
null
&&
data
.
size
()
>
0
)
{
if
(
Objects
.
nonNull
(
data
.
get
(
"totalAmount"
))
&&
Objects
.
nonNull
(
data
.
get
(
"totalCount"
)))
{
result
=
this
.
clothoCenterService
.
lending
(
orderApprove
.
getFundId
(),
new
BigDecimal
(
String
.
valueOf
(
data
.
get
(
"totalAmount"
))),
Integer
.
valueOf
(
String
.
valueOf
(
data
.
get
(
"totalCount"
))));
log
.
info
(
"[order_lending]直投打款,channelOrderNumber={}, result={}"
,
lendingFormModel
.
getChannelOrderNumber
(),
result
);
}
}
result
=
true
;
}
if
(
result
)
{
...
...
src/main/java/cn/quantgroup/cashloanflowboss/core/aspect/OperationAspect.java
View file @
9bb15646
...
...
@@ -10,6 +10,7 @@ import cn.quantgroup.cashloanflowboss.spi.clf.entity.ClfOrderMapping;
import
cn.quantgroup.cashloanflowboss.spi.clf.service.CLFCenterService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.exception.ExceptionUtils
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Aspect
;
...
...
@@ -51,6 +52,8 @@ public class OperationAspect {
*/
@Around
(
"operationAnno()"
)
private
Object
operationAnnoAndSave
(
ProceedingJoinPoint
pjp
)
throws
Throwable
{
try
{
MethodSignature
methodSignature
=
(
MethodSignature
)
pjp
.
getSignature
();
Method
method
=
methodSignature
.
getMethod
();
OperationAnno
annotation
=
method
.
getAnnotation
(
OperationAnno
.
class
);
...
...
@@ -98,14 +101,13 @@ public class OperationAspect {
log
.
warn
(
"[operationAnnoAnnSave]channelOrderNumber is empty, channelOrderNumber={}"
,
channelOrderNumber
);
return
pjp
.
proceed
();
}
Object
proceed
=
pjp
.
proceed
();
// 是否成功SPEL 表达式解析
Expression
expressionsuccSPEL
=
null
;
if
(
StringUtils
.
isNotEmpty
(
succSPEL
))
{
try
{
if
(
succSPEL
.
startsWith
(
"#this"
))
{
//判断是否是spel表达式
Expression
expression
=
new
SpelExpressionParser
().
parseExpression
(
succSPEL
);
Boolean
isSuccess
=
expression
.
getValue
(
proceed
,
Boolean
.
class
);
optHistoryLog
.
setOptResult
(
isSuccess
);
expressionsuccSPEL
=
new
SpelExpressionParser
().
parseExpression
(
succSPEL
);
}
else
{
log
.
warn
(
"[operationAnnoAnnSave]optResult获取失败"
);
}
...
...
@@ -115,12 +117,11 @@ public class OperationAspect {
}
}
Expression
expressionMsgSPEL
=
null
;
if
(
StringUtils
.
isNotEmpty
(
optDetailSPEL
))
{
try
{
if
(
optDetailSPEL
.
startsWith
(
"#this"
))
{
//判断是否是spel表达式
Expression
expression
=
new
SpelExpressionParser
().
parseExpression
(
optDetailSPEL
);
String
optDetail
=
expression
.
getValue
(
proceed
,
String
.
class
);
optHistoryLog
.
setOptLogDetail
(
optDetail
);
expressionMsgSPEL
=
new
SpelExpressionParser
().
parseExpression
(
optDetailSPEL
);
}
else
{
log
.
warn
(
"[operationAnnoAnnSave]optDetail获取失败"
);
}
...
...
@@ -130,8 +131,45 @@ public class OperationAspect {
}
}
optHistoryLogService
.
save
(
optHistoryLog
);
if
(
StringUtils
.
isNotEmpty
(
channelOrderNumber
))
{
// 判断是否 已经请求成功过
OptHistoryLog
optHistoryLogSuccess
=
optHistoryLogService
.
findByChannelOrderNumberAndOptNameAndSuccess
(
channelOrderNumber
,
opt
);
if
(
optHistoryLogSuccess
!=
null
)
{
Class
returnType
=
((
MethodSignature
)
pjp
.
getSignature
()).
getReturnType
();
if
(
returnType
!=
null
)
{
Object
ret
=
returnType
.
newInstance
();
if
(
expressionsuccSPEL
!=
null
)
{
expressionsuccSPEL
.
setValue
(
ret
,
true
);
}
if
(
expressionMsgSPEL
!=
null
)
{
expressionMsgSPEL
.
setValue
(
ret
,
"该操作已经操作成功,无须重复操作!"
);
}
// 直接返回 重复操作结果
log
.
info
(
"[operationAnnoAnnSave]该操作已经操作成功,无须重复操作,切面返回"
);
return
ret
;
}
}
}
// 代理执行方法
Object
proceed
=
pjp
.
proceed
();
// 获取方法返回 是否成功
if
(
expressionsuccSPEL
!=
null
)
{
optHistoryLog
.
setOptResult
(
expressionsuccSPEL
.
getValue
(
proceed
,
Boolean
.
class
));
}
// 获取方法详细信息
if
(
expressionMsgSPEL
!=
null
)
{
optHistoryLog
.
setOptLogDetail
(
expressionMsgSPEL
.
getValue
(
proceed
,
String
.
class
));
}
optHistoryLogService
.
save
(
optHistoryLog
);
return
proceed
;
}
catch
(
Throwable
throwable
)
{
log
.
error
(
"[operationAnnoAnnSave]异常,直接跳过,e={}"
,
ExceptionUtils
.
getStackTrace
(
throwable
));
return
pjp
.
proceed
();
}
}
}
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