use of org.jeecg.config.JeeccgBaseConfig in project jeecg-boot by jeecgboot.
the class SignUtil method getParamsSign.
/**
* @param params
* 所有的请求参数都会在这里进行排序加密
* @return 得到签名
*/
public static String getParamsSign(SortedMap<String, String> params) {
// 去掉 Url 里的时间戳
params.remove("_t");
String paramsJsonStr = JSONObject.toJSONString(params);
log.info("Param paramsJsonStr : {}", paramsJsonStr);
// 设置签名秘钥
JeeccgBaseConfig jeeccgBaseConfig = SpringContextUtils.getBean(JeeccgBaseConfig.class);
String signatureSecret = jeeccgBaseConfig.getSignatureSecret();
if (oConvertUtils.isEmpty(signatureSecret) || signatureSecret.contains("${")) {
throw new JeecgBootException("签名密钥 ${jeecg.signatureSecret} 缺少配置 !!");
}
return DigestUtils.md5DigestAsHex((paramsJsonStr + signatureSecret).getBytes()).toUpperCase();
}
Aggregations