修改异常拦截配置.
This commit is contained in:
@@ -67,6 +67,8 @@ public enum ErrorCode implements CodeInfo {
|
||||
|
||||
VCS_OPETATOR_ERROR(714, "仓库操作执行失败"),
|
||||
|
||||
DIABLED_ERROR(715, "数据已被禁用"),
|
||||
|
||||
;
|
||||
|
||||
ErrorCode(int code, String message) {
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.orion.ops.framework.common.constant;
|
||||
|
||||
/**
|
||||
* 错误信息
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/7/7 18:51
|
||||
*/
|
||||
public interface ErrorMessage {
|
||||
|
||||
String PARAM_MISSING = "{} 不能为空";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.orion.ops.framework.common.utils;
|
||||
|
||||
import com.orion.lang.utils.crypto.symmetric.SymmetricCrypto;
|
||||
|
||||
/**
|
||||
* 加密工具类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/7/8 0:05
|
||||
*/
|
||||
public class CryptoUtils {
|
||||
|
||||
/**
|
||||
* 加密器 供 framework 赋值
|
||||
*/
|
||||
public static SymmetricCrypto delegate;
|
||||
|
||||
/**
|
||||
* 加密
|
||||
*
|
||||
* @param plain 明文
|
||||
* @return 密文
|
||||
*/
|
||||
public static byte[] encrypt(byte[] plain) {
|
||||
return delegate.encrypt(plain);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密
|
||||
*
|
||||
* @param plain 明文
|
||||
* @return 密文
|
||||
*/
|
||||
public static byte[] encrypt(String plain) {
|
||||
return delegate.encrypt(plain);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密
|
||||
*
|
||||
* @param plain 明文
|
||||
* @return 密文
|
||||
*/
|
||||
public static String encryptAsString(String plain) {
|
||||
return delegate.encryptAsString(plain);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密
|
||||
*
|
||||
* @param plain 明文
|
||||
* @return 密文
|
||||
*/
|
||||
public static String encryptAsString(byte[] plain) {
|
||||
return delegate.encryptAsString(plain);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密
|
||||
*
|
||||
* @param text 密文
|
||||
* @return 明文
|
||||
*/
|
||||
public static byte[] decrypt(byte[] text) {
|
||||
return delegate.decrypt(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密
|
||||
*
|
||||
* @param text 密文
|
||||
* @return 明文
|
||||
*/
|
||||
public static byte[] decrypt(String text) {
|
||||
return delegate.decrypt(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密
|
||||
*
|
||||
* @param text 密文
|
||||
* @return 明文
|
||||
*/
|
||||
public static String decryptAsString(String text) {
|
||||
return delegate.decryptAsString(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密
|
||||
*
|
||||
* @param text 密文
|
||||
* @return 明文
|
||||
*/
|
||||
public static String decryptAsString(byte[] text) {
|
||||
return delegate.decryptAsString(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证加密结果
|
||||
*
|
||||
* @param plain 明文
|
||||
* @param text 密文
|
||||
* @return 是否成功
|
||||
*/
|
||||
public static boolean verify(String plain, String text) {
|
||||
return delegate.verify(plain, text);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证加密结果
|
||||
*
|
||||
* @param plain 明文
|
||||
* @param text 密文
|
||||
* @return 是否成功
|
||||
*/
|
||||
public static boolean verify(byte[] plain, byte[] text) {
|
||||
return delegate.verify(plain, text);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user