|
|
@@ -83,7 +83,7 @@ public class PlatformApiServiceImpl implements PlatformApiService {
|
|
|
if (0 == response.getRet()) {
|
|
|
return response;
|
|
|
} else {
|
|
|
- log.error(":url:{}\n params:{}\ntoken:{}\n返回信息:{}", url, params, token, response);
|
|
|
+ log.error(":url:{}, params:{},token:{},返回信息:{}", url, params, token, response);
|
|
|
if (4002 == response.getRet()) {
|
|
|
// 如果返回Ret=4002,token错误的情况下,删除redis中的token,如果是预约订单则将此订单设置为延迟启动
|
|
|
redisTemplate.delete(RedisKeys.EN_PLUS_TOKEN + platformName);
|
|
|
@@ -101,7 +101,8 @@ public class PlatformApiServiceImpl implements PlatformApiService {
|
|
|
* @return
|
|
|
*/
|
|
|
JSONObject parsePlatformResponseData(PlatformResponse response, String platformName) {
|
|
|
- return JSONObject.parseObject(PlatformAesUtil.decrypt(PlatformCache.INSTANCE.getPlatformByName(platformName), response.getData()));
|
|
|
+ var platform = PlatformCache.INSTANCE.getPlatformByName(platformName);
|
|
|
+ return JSONObject.parseObject(PlatformAesUtil.decrypt(platform.getDataSecret(), platform.getDataSecretIv(), response.getData()));
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -125,7 +126,7 @@ public class PlatformApiServiceImpl implements PlatformApiService {
|
|
|
"OperatorID":"%s",
|
|
|
"OperatorSecret":"%s"
|
|
|
}
|
|
|
- """.formatted(PlatformCache.INSTANCE.getPlatformByName(platformName).getOperatorId(), PlatformCache.INSTANCE.getPlatformByName(platformName).getOperatorSecret());
|
|
|
+ """.formatted(PlatformCache.INSTANCE.getPlatformByName(platformName).getUserOperatorId(), PlatformCache.INSTANCE.getPlatformByName(platformName).getOperatorSecret());
|
|
|
|
|
|
var requestParams = buildPlatformParams(platformName, data);
|
|
|
|
|
|
@@ -158,7 +159,7 @@ public class PlatformApiServiceImpl implements PlatformApiService {
|
|
|
if (response != null && 0 == response.getRet()) {
|
|
|
return response;
|
|
|
} else {
|
|
|
- log.error("互联互通接口数据异常:url:{}\n params:{}\n返回信息:{}", url, params, response);
|
|
|
+ log.error("互联互通接口数据异常:url:{}, params:{},返回信息:{}", url, params, response);
|
|
|
throw new BusinessException(ResponseEnum.EN_PLUS_API_EXCEPTION);
|
|
|
}
|
|
|
}
|
|
|
@@ -181,7 +182,7 @@ public class PlatformApiServiceImpl implements PlatformApiService {
|
|
|
// 自增序列
|
|
|
var seq = timeStamp.substring(timeStamp.length() - 4);
|
|
|
// 使用SigSecret以HMAC-MD5算法对消息体签名(签名顺序:OperatorId、Data、TimeStamp、Seq)
|
|
|
- var signString = platform.getOperatorId() + dataStr + timeStamp + seq;
|
|
|
+ var signString = platform.getUserOperatorId() + dataStr + timeStamp + seq;
|
|
|
HMac mac = new HMac(HmacAlgorithm.HmacMD5, platform.getSigSecret().getBytes());
|
|
|
// 签名(转为大写)
|
|
|
var sign = mac.digestHex(signString).toUpperCase();
|
|
|
@@ -213,12 +214,12 @@ public class PlatformApiServiceImpl implements PlatformApiService {
|
|
|
var Seq = json.getString("Seq");
|
|
|
var Sig = json.getString("Sig");
|
|
|
var signString = OperatorID + Data + TimeStamp + Seq;
|
|
|
- HMac mac = new HMac(HmacAlgorithm.HmacMD5, platform.getSigSecret().getBytes());
|
|
|
+ HMac mac = new HMac(HmacAlgorithm.HmacMD5, platform.getUserSigSecret().getBytes());
|
|
|
// 签名(转为大写)
|
|
|
var sign = mac.digestHex(signString).toUpperCase();
|
|
|
if (sign.equals(Sig)) {
|
|
|
// 解密数据
|
|
|
- return PlatformAesUtil.decrypt(platform, Data);
|
|
|
+ return PlatformAesUtil.decrypt(platform.getUserDataSecret(), platform.getUserDataSecretIv(), Data);
|
|
|
} else {
|
|
|
// 验签失败
|
|
|
PlatformResponse enResponse = new PlatformResponse();
|