全所统计

This commit is contained in:
zhangqinlin
2021-09-18 10:45:11 +08:00
parent 2e9a63f4da
commit b4fba29e03
34 changed files with 818 additions and 152 deletions
@@ -0,0 +1,42 @@
package com.jero.util;
import cn.hutool.crypto.asymmetric.KeyType;
import cn.hutool.crypto.asymmetric.RSA;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import com.jero.common.exception.JeroBootException;
import com.jero.common.util.RestUtil;
import org.springframework.beans.factory.annotation.Value;
/**
* @author liJiaRao
* @date 2021-09-10 9:58
*/
public class standardsUtil {
@Value("${standards.url}")
private static String url;
@Value("${standards.token}")
private static String token;
public static String getRSAPublicKey(){
JSONObject jsonObject = RestUtil.get(url + "/sys/getRSAPublicKey");
if (jsonObject.getBoolean("success")) {
return jsonObject.getString("result");
}else {
throw new JeroBootException("调用会员系统出错");
}
}
/**
* RSA 使用公钥加密token
* @param RSAPublicKey 公钥
* @return String 加密后的字符串
*/
public static String encryptByRsaPriKey(String RSAPublicKey) {
RSA rsa = new RSA(null, RSAPublicKey);
byte[] encrypt = rsa.encrypt(token, KeyType.PublicKey);
return new String(encrypt);
}
}