记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
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
董敬伟
liquidnet-bus-v1
Commits
0fdf2daf
Commit
0fdf2daf
authored
Jul 30, 2021
by
anjiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下单请求加密增加日志
parent
b2f289ac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
DecryptAndVerifyAspect.java
...net/service/base/codec/aspect/DecryptAndVerifyAspect.java
+5
-4
DecryptAndVerifyException.java
...rvice/base/codec/exception/DecryptAndVerifyException.java
+5
-3
No files found.
liquidnet-bus-common/liquidnet-common-service-base/src/main/java/com/liquidnet/service/base/codec/aspect/DecryptAndVerifyAspect.java
View file @
0fdf2daf
package
com
.
liquidnet
.
service
.
base
.
codec
.
aspect
;
package
com
.
liquidnet
.
service
.
base
.
codec
.
aspect
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.liquidnet.common.exception.constant.ErrorCode
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.service.base.codec.annotation.DecryptAndVerify
;
import
com.liquidnet.service.base.codec.annotation.DecryptAndVerify
;
import
com.liquidnet.service.base.codec.exception.DecryptAndVerifyException
;
import
com.liquidnet.service.base.codec.exception.DecryptAndVerifyException
;
...
@@ -31,7 +32,7 @@ public class DecryptAndVerifyAspect {
...
@@ -31,7 +32,7 @@ public class DecryptAndVerifyAspect {
public
Object
around
(
ProceedingJoinPoint
joinPoint
)
throws
Throwable
{
public
Object
around
(
ProceedingJoinPoint
joinPoint
)
throws
Throwable
{
Object
[]
args
=
joinPoint
.
getArgs
();
Object
[]
args
=
joinPoint
.
getArgs
();
if
(
args
==
null
||
args
.
length
==
0
)
{
if
(
args
==
null
||
args
.
length
==
0
)
{
throw
new
DecryptAndVerifyException
(
joinPoint
.
getSignature
().
getName
()
+
",参数为空"
);
throw
new
DecryptAndVerifyException
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
joinPoint
.
getSignature
().
getName
()
+
",参数为空"
);
}
}
EncryptedReq
encryptedReq
=
null
;
EncryptedReq
encryptedReq
=
null
;
for
(
Object
obj
:
args
)
{
for
(
Object
obj
:
args
)
{
...
@@ -41,7 +42,7 @@ public class DecryptAndVerifyAspect {
...
@@ -41,7 +42,7 @@ public class DecryptAndVerifyAspect {
}
}
}
}
if
(
encryptedReq
==
null
)
{
if
(
encryptedReq
==
null
)
{
throw
new
DecryptAndVerifyException
(
joinPoint
.
getSignature
().
getName
()
+
",参数中无待解密类"
);
throw
new
DecryptAndVerifyException
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
joinPoint
.
getSignature
().
getName
()
+
",参数中无待解密类"
);
}
}
log
.
info
(
"DecryptAndVerifyAspect 解密前 下单request:{}"
,
JsonUtils
.
toJson
(
encryptedReq
));
log
.
info
(
"DecryptAndVerifyAspect 解密前 下单request:{}"
,
JsonUtils
.
toJson
(
encryptedReq
));
String
decryptedData
=
decryptAndVerify
(
encryptedReq
);
String
decryptedData
=
decryptAndVerify
(
encryptedReq
);
...
@@ -49,7 +50,7 @@ public class DecryptAndVerifyAspect {
...
@@ -49,7 +50,7 @@ public class DecryptAndVerifyAspect {
MethodSignature
methodSignature
=
(
MethodSignature
)
joinPoint
.
getSignature
();
MethodSignature
methodSignature
=
(
MethodSignature
)
joinPoint
.
getSignature
();
DecryptAndVerify
annotation
=
methodSignature
.
getMethod
().
getAnnotation
(
DecryptAndVerify
.
class
);
DecryptAndVerify
annotation
=
methodSignature
.
getMethod
().
getAnnotation
(
DecryptAndVerify
.
class
);
if
(
annotation
==
null
||
annotation
.
decryptedClass
()
==
null
)
{
if
(
annotation
==
null
||
annotation
.
decryptedClass
()
==
null
)
{
throw
new
DecryptAndVerifyException
(
joinPoint
.
getSignature
().
getName
()
+
",未指定解密类型"
);
throw
new
DecryptAndVerifyException
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
joinPoint
.
getSignature
().
getName
()
+
",未指定解密类型"
);
}
}
encryptedReq
.
setData
(
JSON
.
parseObject
(
decryptedData
,
annotation
.
decryptedClass
()));
encryptedReq
.
setData
(
JSON
.
parseObject
(
decryptedData
,
annotation
.
decryptedClass
()));
return
joinPoint
.
proceed
();
return
joinPoint
.
proceed
();
...
@@ -60,7 +61,7 @@ public class DecryptAndVerifyAspect {
...
@@ -60,7 +61,7 @@ public class DecryptAndVerifyAspect {
if
(
sign
.
equals
(
encryptedReq
.
getSign
()))
{
if
(
sign
.
equals
(
encryptedReq
.
getSign
()))
{
return
CodecUtil
.
aesDecrypt
(
encryptedReq
.
getEncryptedData
());
return
CodecUtil
.
aesDecrypt
(
encryptedReq
.
getEncryptedData
());
}
else
{
}
else
{
throw
new
DecryptAndVerifyException
(
"验签失败:"
+
JSON
.
toJSONString
(
encryptedReq
)
);
throw
new
DecryptAndVerifyException
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"验签失败:"
);
}
}
}
}
}
}
liquidnet-bus-common/liquidnet-common-service-base/src/main/java/com/liquidnet/service/base/codec/exception/DecryptAndVerifyException.java
View file @
0fdf2daf
package
com
.
liquidnet
.
service
.
base
.
codec
.
exception
;
package
com
.
liquidnet
.
service
.
base
.
codec
.
exception
;
import
com.liquidnet.common.exception.LiquidnetServiceException
;
/**
/**
* @description: 解密验证异常
* @description: 解密验证异常
* @author: DFY
* @author: DFY
* @time: 2020/3/30 13:58
* @time: 2020/3/30 13:58
*/
*/
public
class
DecryptAndVerifyException
extends
Runtim
eException
{
public
class
DecryptAndVerifyException
extends
LiquidnetServic
eException
{
public
DecryptAndVerifyException
(
String
message
)
{
public
DecryptAndVerifyException
(
String
code
,
String
message
)
{
super
(
message
);
super
(
code
,
message
);
}
}
}
}
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