|
@@ -19,7 +19,7 @@ import com.kym.entity.common.RedisKeys;
|
|
|
import com.kym.entity.platform.PlatformRespQueryToken;
|
|
import com.kym.entity.platform.PlatformRespQueryToken;
|
|
|
import com.kym.entity.platform.response.PlatformResponse;
|
|
import com.kym.entity.platform.response.PlatformResponse;
|
|
|
import com.kym.service.cache.PlatformCache;
|
|
import com.kym.service.cache.PlatformCache;
|
|
|
-import com.kym.service.platform.CommonApi;
|
|
|
|
|
|
|
+import com.kym.service.platform.PlatformApi;
|
|
|
import com.kym.service.platform.PlatformApiService;
|
|
import com.kym.service.platform.PlatformApiService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import okhttp3.*;
|
|
import okhttp3.*;
|
|
@@ -87,9 +87,9 @@ public class PlatformApiServiceImpl implements PlatformApiService {
|
|
|
if (4002 == response.getRet()) {
|
|
if (4002 == response.getRet()) {
|
|
|
// 如果返回Ret=4002,token错误的情况下,删除redis中的token,如果是预约订单则将此订单设置为延迟启动
|
|
// 如果返回Ret=4002,token错误的情况下,删除redis中的token,如果是预约订单则将此订单设置为延迟启动
|
|
|
redisTemplate.delete(RedisKeys.EN_PLUS_TOKEN + platformName);
|
|
redisTemplate.delete(RedisKeys.EN_PLUS_TOKEN + platformName);
|
|
|
- throw new BusinessException(ResponseEnum.EN_PLUS_TOKEN_EXCEPTION);
|
|
|
|
|
|
|
+ throw new BusinessException(ResponseEnum.PLATFORM_TOKEN_EXCEPTION);
|
|
|
}
|
|
}
|
|
|
- throw new BusinessException(ResponseEnum.EN_PLUS_API_EXCEPTION);
|
|
|
|
|
|
|
+ throw new BusinessException(ResponseEnum.PLATFORM__API_EXCEPTION);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -130,7 +130,7 @@ public class PlatformApiServiceImpl implements PlatformApiService {
|
|
|
|
|
|
|
|
var requestParams = buildPlatformParams(platformName, data);
|
|
var requestParams = buildPlatformParams(platformName, data);
|
|
|
|
|
|
|
|
- var response = platformGetToken(CommonApi.EN_PLUS_QUERY_TOKEN.getApi(platformName), requestParams);
|
|
|
|
|
|
|
+ var response = platformGetToken(PlatformApi.PLATFORM_QUERY_TOKEN.getApi(platformName), requestParams);
|
|
|
|
|
|
|
|
if (response != null && 0 == response.getRet()) {
|
|
if (response != null && 0 == response.getRet()) {
|
|
|
// 解密Data获取token
|
|
// 解密Data获取token
|
|
@@ -143,7 +143,7 @@ public class PlatformApiServiceImpl implements PlatformApiService {
|
|
|
} else {
|
|
} else {
|
|
|
// 记录错误码,返回错误信息
|
|
// 记录错误码,返回错误信息
|
|
|
log.error("{}接口错误:接口名{}:返回信息:{}", platformName, "query_token", response);
|
|
log.error("{}接口错误:接口名{}:返回信息:{}", platformName, "query_token", response);
|
|
|
- throw new BusinessException(ResponseEnum.EN_PLUS_QUERY_TOKEN_ERROR);
|
|
|
|
|
|
|
+ throw new BusinessException(ResponseEnum.PLATFORM_QUERY_TOKEN_ERROR);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -160,7 +160,7 @@ public class PlatformApiServiceImpl implements PlatformApiService {
|
|
|
return response;
|
|
return response;
|
|
|
} else {
|
|
} else {
|
|
|
log.error("互联互通接口数据异常:url:{}, params:{},返回信息:{}", url, params, response);
|
|
log.error("互联互通接口数据异常:url:{}, params:{},返回信息:{}", url, params, response);
|
|
|
- throw new BusinessException(ResponseEnum.EN_PLUS_API_EXCEPTION);
|
|
|
|
|
|
|
+ throw new BusinessException(ResponseEnum.PLATFORM__API_EXCEPTION);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -224,9 +224,9 @@ public class PlatformApiServiceImpl implements PlatformApiService {
|
|
|
// 验签失败
|
|
// 验签失败
|
|
|
PlatformResponse enResponse = new PlatformResponse();
|
|
PlatformResponse enResponse = new PlatformResponse();
|
|
|
enResponse.setRet(4001);
|
|
enResponse.setRet(4001);
|
|
|
- enResponse.setMsg(ResponseEnum.EN_PLUS_PUSH_SIGN_FAIL.getMessage());
|
|
|
|
|
|
|
+ enResponse.setMsg(ResponseEnum.PLATFORM_PUSH_SIGN_FAIL.getMessage());
|
|
|
log.error("{}推送数据验签失败,数据:{}", platformName, json);
|
|
log.error("{}推送数据验签失败,数据:{}", platformName, json);
|
|
|
- throw new EnPushException(ResponseEnum.EN_PLUS_PUSH_SIGN_FAIL, enResponse);
|
|
|
|
|
|
|
+ throw new EnPushException(ResponseEnum.PLATFORM_PUSH_SIGN_FAIL, enResponse);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -249,7 +249,7 @@ public class PlatformApiServiceImpl implements PlatformApiService {
|
|
|
"ConnectorID":"%s"
|
|
"ConnectorID":"%s"
|
|
|
}
|
|
}
|
|
|
""".formatted(equipAuthSeq, PlatformConvertUtil.convert2LongshineConnectorId(connectorId));
|
|
""".formatted(equipAuthSeq, PlatformConvertUtil.convert2LongshineConnectorId(connectorId));
|
|
|
- var response = platformPost(platformName, CommonApi.EN_PLUS_QUERY_EQUIP_AUTH.getApi(platformName), buildPlatformParams(platformName, param));
|
|
|
|
|
|
|
+ var response = platformPost(platformName, PlatformApi.PLATFORM_QUERY_EQUIP_AUTH.getApi(platformName), buildPlatformParams(platformName, param));
|
|
|
|
|
|
|
|
return parsePlatformResponseData(response, platformName);
|
|
return parsePlatformResponseData(response, platformName);
|
|
|
}
|
|
}
|
|
@@ -273,7 +273,7 @@ public class PlatformApiServiceImpl implements PlatformApiService {
|
|
|
"ConnectorID":"%s"
|
|
"ConnectorID":"%s"
|
|
|
}
|
|
}
|
|
|
""".formatted(equipBizSeq, connectorId);
|
|
""".formatted(equipBizSeq, connectorId);
|
|
|
- var response = platformPost(platformName, CommonApi.EN_PLUS_QUERY_EQUIP_BUSINESS_POLICY.getApi(platformName), buildPlatformParams(platformName, param));
|
|
|
|
|
|
|
+ var response = platformPost(platformName, PlatformApi.PLATFORM_QUERY_EQUIP_BUSINESS_POLICY.getApi(platformName), buildPlatformParams(platformName, param));
|
|
|
return parsePlatformResponseData(response, platformName);
|
|
return parsePlatformResponseData(response, platformName);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -298,7 +298,7 @@ public class PlatformApiServiceImpl implements PlatformApiService {
|
|
|
}
|
|
}
|
|
|
""".formatted(startChargeSeq, PlatformConvertUtil.convert2LongshineConnectorId(connectorId), qrCode);
|
|
""".formatted(startChargeSeq, PlatformConvertUtil.convert2LongshineConnectorId(connectorId), qrCode);
|
|
|
var completeParams = PlatformConvertUtil.queryStartChargeParamsConvert(platformName, param, amount);
|
|
var completeParams = PlatformConvertUtil.queryStartChargeParamsConvert(platformName, param, amount);
|
|
|
- var response = platformPost(platformName, CommonApi.EN_PLUS_QUERY_START_CHARGE.getApi(platformName), buildPlatformParams(platformName, completeParams));
|
|
|
|
|
|
|
+ var response = platformPost(platformName, PlatformApi.PLATFORM_QUERY_START_CHARGE.getApi(platformName), buildPlatformParams(platformName, completeParams));
|
|
|
return parsePlatformResponseData(response, platformName);
|
|
return parsePlatformResponseData(response, platformName);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -316,7 +316,7 @@ public class PlatformApiServiceImpl implements PlatformApiService {
|
|
|
"StartChargeSeq":"%s"
|
|
"StartChargeSeq":"%s"
|
|
|
}
|
|
}
|
|
|
""".formatted(startChargeSeq);
|
|
""".formatted(startChargeSeq);
|
|
|
- var response = platformPost(platformName, CommonApi.EN_PLUS_QUERY_EQUIP_CHARGE_STATUS.getApi(platformName), buildPlatformParams(platformName, param));
|
|
|
|
|
|
|
+ var response = platformPost(platformName, PlatformApi.PLATFORM_QUERY_EQUIP_CHARGE_STATUS.getApi(platformName), buildPlatformParams(platformName, param));
|
|
|
return parsePlatformResponseData(response, platformName);
|
|
return parsePlatformResponseData(response, platformName);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -336,7 +336,7 @@ public class PlatformApiServiceImpl implements PlatformApiService {
|
|
|
"amount":%d
|
|
"amount":%d
|
|
|
}
|
|
}
|
|
|
""".formatted(startChargeSeq, amount);
|
|
""".formatted(startChargeSeq, amount);
|
|
|
- var response = platformPost(platformName, CommonApi.EN_PLUS_QUERY_EQUIP_CHARGE_STATUS.getApi(platformName), buildPlatformParams(platformName, param));
|
|
|
|
|
|
|
+ var response = platformPost(platformName, PlatformApi.PLATFORM_QUERY_EQUIP_CHARGE_STATUS.getApi(platformName), buildPlatformParams(platformName, param));
|
|
|
return parsePlatformResponseData(response, platformName);
|
|
return parsePlatformResponseData(response, platformName);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -357,7 +357,7 @@ public class PlatformApiServiceImpl implements PlatformApiService {
|
|
|
"ConnectorID":"%s"
|
|
"ConnectorID":"%s"
|
|
|
}
|
|
}
|
|
|
""".formatted(startChargeSeq, connectorId);
|
|
""".formatted(startChargeSeq, connectorId);
|
|
|
- var response = platformPost(platformName, CommonApi.EN_PLUS_QUERY_STOP_CHARGE.getApi(platformName), buildPlatformParams(platformName, param));
|
|
|
|
|
|
|
+ var response = platformPost(platformName, PlatformApi.PLATFORM_QUERY_STOP_CHARGE.getApi(platformName), buildPlatformParams(platformName, param));
|
|
|
return parsePlatformResponseData(response, platformName);
|
|
return parsePlatformResponseData(response, platformName);
|
|
|
}
|
|
}
|
|
|
|
|
|