打印日志

This commit is contained in:
xiang2lin 2024-07-05 11:30:18 +08:00
parent 4df2832c59
commit 4f3ad2e410
2 changed files with 7 additions and 1 deletions

View File

@ -284,11 +284,14 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService {
* @return
*/
private Map<String, String> headersValueOf(String sign, long timestamp) {
logger.info("开始组装请求头参数:{},{}",sign,timestamp);
Map<String, String> header = new HashMap();
header.put(CBSUtil.SIGN_HEADER_NAME, sign);
header.put(CBSUtil.TIMESTAMP_HEADER, Long.toString(timestamp));
header.put(HTTP.CONTENT_TYPE, CBSUtil.TARGET_CONTENT_TYPE);
logger.info("准备获取token");
header.put(CBSUtil.AUTHORIZATION, CBSUtil.BEARER + CbsAccessToken.getToken());
logger.info("组装后的header参数:{}",JSONObject.toJSONString(header));
return header;
}
@ -309,5 +312,6 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService {
header.put("hzyaExtData", requestData);
entity.setByteBodys(encryptedData);
entity.setHeaders(header);
logger.info("加密,签名方法执行完毕");
}
}

View File

@ -55,6 +55,7 @@ public class CbsAccessToken {
public static CbsAccessToken getInstance() {
logger.info("开始获取token");
if (null == cbsAccessToken.token){
initToken();
}else {
@ -65,6 +66,7 @@ public class CbsAccessToken {
refreshToken();
}
}
logger.info("取到的token:{}",cbsAccessToken);
return cbsAccessToken;
}
@ -75,8 +77,8 @@ public class CbsAccessToken {
* 获取token
*/
private static void initToken(){
CbsAccessToken ct = (CbsAccessToken) ApplicationContextUtil.getBeanByName("cbsAccessToken");
logger.info("开始获取cbstoken");
CbsAccessToken ct = (CbsAccessToken) ApplicationContextUtil.getBeanByName("cbsAccessToken");
Map<String,String> param = new HashMap<>();
param.put("app_id",ct.appId);
param.put("app_secret",ct.appSecret);