提交 af624763 authored 作者:  狄熙卜's avatar 狄熙卜

主逻辑增加异常捕获逻辑

狄熙卜
上级 b94b1525
...@@ -57,12 +57,23 @@ public class EncryptInterceptor implements Interceptor { ...@@ -57,12 +57,23 @@ public class EncryptInterceptor implements Interceptor {
@Override @Override
public Object intercept(Invocation invocation) throws Throwable { public Object intercept(Invocation invocation) throws Throwable {
if (this.cryptEnable) { if (this.cryptEnable) {
String mapid = ((MappedStatement) invocation.getArgs()[0]).getId(); CryptAdapterMatadata cryptAdapterMatadata = null;
Object[] args = invocation.getArgs(); String mapid = "";
CryptAdapterMatadata cryptAdapterMatadata = getEncryptAdapter(args); try {
args[1] = cryptAdapterMatadata.encrypt(args[1],mapid); mapid = ((MappedStatement) invocation.getArgs()[0]).getId();
Object[] args = invocation.getArgs();
cryptAdapterMatadata = getEncryptAdapter(args);
args[1] = cryptAdapterMatadata.encrypt(args[1], mapid);
}catch (Exception e){
LOGGER.error("encrypt error:{}",e);
}
Object returnValue = invocation.proceed(); Object returnValue = invocation.proceed();
return cryptAdapterMatadata.decrypt(returnValue,mapid); try {
return cryptAdapterMatadata.decrypt(returnValue, mapid);
}catch (Exception e){
LOGGER.error("decrypt error:{}",e);
return returnValue;
}
}else{ }else{
return invocation.proceed(); return invocation.proceed();
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论