mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-06 02:50:13 +08:00
update
This commit is contained in:
@@ -50,10 +50,10 @@ public class YCBCController extends BaseController {
|
||||
try {
|
||||
Map<String, String> map = ycbcService.generateToken(dto);
|
||||
logger.info("甬城泊车平台请求令牌 result:{}", JSONObject.toJSONString(map));
|
||||
return CommonResult.YCBCSuccess(0, "请求令牌成功!", map.get("Data"), map.get("Sig"));
|
||||
return CommonResult.success(0, "请求令牌成功!", map.get("Data"), map.get("Sig"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
logger.error("甬城泊车平台 请求令牌接口 异常");
|
||||
return CommonResult.YCBCFailed("获取token发生异常");
|
||||
return CommonResult.failed("获取token发生异常");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,13 +72,13 @@ public class YCBCController extends BaseController {
|
||||
String token = request.getHeader("Authorization");
|
||||
if (!JWTUtils.checkThirdPartyToken(token)) {
|
||||
// 校验失败
|
||||
return CommonResult.YCBCFailed("令牌校验错误");
|
||||
return CommonResult.failed("令牌校验错误");
|
||||
}
|
||||
// 校验签名
|
||||
Map<String, String> resultMap = lianLianService.checkoutSign(dto);
|
||||
if (resultMap == null) {
|
||||
// 签名错误
|
||||
return CommonResult.YCBCFailed("签名校验错误");
|
||||
return CommonResult.failed("签名校验错误");
|
||||
}
|
||||
String operatorSecret = resultMap.get("OperatorSecret");
|
||||
String dataString = resultMap.get("Data");
|
||||
@@ -92,12 +92,12 @@ public class YCBCController extends BaseController {
|
||||
queryStationInfoDTO.setOperatorId(dto.getOperatorID());
|
||||
Map<String, String> map = ycbcService.queryStationsInfo(queryStationInfoDTO);
|
||||
|
||||
return CommonResult.YCBCSuccess(0, "查询充电站信息成功!", map.get("Data"), map.get("Sig"));
|
||||
return CommonResult.success(0, "查询充电站信息成功!", map.get("Data"), map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.info("甬城泊车平台查询充电站信息 error:", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return CommonResult.YCBCFailed("查询充电站信息发生异常");
|
||||
return CommonResult.failed("查询充电站信息发生异常");
|
||||
}
|
||||
|
||||
|
||||
@@ -115,13 +115,13 @@ public class YCBCController extends BaseController {
|
||||
String token = request.getHeader("Authorization");
|
||||
if (!JWTUtils.checkThirdPartyToken(token)) {
|
||||
// 校验失败
|
||||
return CommonResult.YCBCFailed("令牌校验错误");
|
||||
return CommonResult.failed("令牌校验错误");
|
||||
}
|
||||
// 校验签名
|
||||
Map<String, String> resultMap = lianLianService.checkoutSign(dto);
|
||||
if (resultMap == null) {
|
||||
// 签名错误
|
||||
return CommonResult.YCBCFailed("签名校验错误");
|
||||
return CommonResult.failed("签名校验错误");
|
||||
}
|
||||
String operatorSecret = resultMap.get("OperatorSecret");
|
||||
String dataString = resultMap.get("Data");
|
||||
@@ -135,12 +135,12 @@ public class YCBCController extends BaseController {
|
||||
queryStationInfoDTO.setOperatorId(dto.getOperatorID());
|
||||
Map<String, String> map = ycbcService.queryStationStatus(queryStationInfoDTO);
|
||||
|
||||
return CommonResult.YCBCSuccess(0, "查询充电站状态信息成功!", map.get("Data"), map.get("Sig"));
|
||||
return CommonResult.success(0, "查询充电站状态信息成功!", map.get("Data"), map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.info("甬城泊车平台查询充电站状态信息 error:", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return CommonResult.YCBCFailed("查询充电站状态信息发生异常");
|
||||
return CommonResult.failed("查询充电站状态信息发生异常");
|
||||
}
|
||||
|
||||
|
||||
@@ -210,13 +210,13 @@ public class YCBCController extends BaseController {
|
||||
String token = request.getHeader("Authorization");
|
||||
if (!JWTUtils.checkThirdPartyToken(token)) {
|
||||
// 校验失败
|
||||
return CommonResult.YCBCFailed("令牌校验错误");
|
||||
return CommonResult.failed("令牌校验错误");
|
||||
}
|
||||
// 校验签名
|
||||
Map<String, String> resultMap = lianLianService.checkoutSign(dto);
|
||||
if (resultMap == null) {
|
||||
// 签名错误
|
||||
return CommonResult.YCBCFailed("签名校验错误");
|
||||
return CommonResult.failed("签名校验错误");
|
||||
}
|
||||
String operatorSecret = resultMap.get("OperatorSecret");
|
||||
String dataString = resultMap.get("Data");
|
||||
@@ -230,12 +230,12 @@ public class YCBCController extends BaseController {
|
||||
queryEquipmentDTO.setOperatorID(dto.getOperatorID());
|
||||
Map<String, String> map = ycbcService.queryEquipAuth(queryEquipmentDTO);
|
||||
|
||||
return CommonResult.YCBCSuccess(0, "请求设备认证成功!", map.get("Data"), map.get("Sig"));
|
||||
return CommonResult.success(0, "请求设备认证成功!", map.get("Data"), map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.info("甬城泊车平台请求设备认证 error:", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return CommonResult.YCBCFailed("请求设备认证发生异常");
|
||||
return CommonResult.failed("请求设备认证发生异常");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -252,13 +252,13 @@ public class YCBCController extends BaseController {
|
||||
String token = request.getHeader("Authorization");
|
||||
if (!JWTUtils.checkThirdPartyToken(token)) {
|
||||
// 校验失败
|
||||
return CommonResult.YCBCFailed("令牌校验错误");
|
||||
return CommonResult.failed("令牌校验错误");
|
||||
}
|
||||
// 校验签名
|
||||
Map<String, String> resultMap = lianLianService.checkoutSign(dto);
|
||||
if (resultMap == null) {
|
||||
// 签名错误
|
||||
return CommonResult.YCBCFailed("签名校验错误");
|
||||
return CommonResult.failed("签名校验错误");
|
||||
}
|
||||
String operatorSecret = resultMap.get("OperatorSecret");
|
||||
String dataString = resultMap.get("Data");
|
||||
@@ -272,11 +272,11 @@ public class YCBCController extends BaseController {
|
||||
queryStartChargeDTO.setOperatorId(dto.getOperatorID());
|
||||
Map<String, String> map = ycbcService.queryStartCharge(queryStartChargeDTO);
|
||||
|
||||
return CommonResult.YCBCSuccess(0, "请求启动充电成功!", map.get("Data"), map.get("Sig"));
|
||||
return CommonResult.success(0, "请求启动充电成功!", map.get("Data"), map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.error("甬城泊车平台请求启动充电 error", e);
|
||||
}
|
||||
return CommonResult.YCBCFailed("请求启动充电发生异常");
|
||||
return CommonResult.failed("请求启动充电发生异常");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -293,13 +293,13 @@ public class YCBCController extends BaseController {
|
||||
String token = request.getHeader("Authorization");
|
||||
if (!JWTUtils.checkThirdPartyToken(token)) {
|
||||
// 校验失败
|
||||
return CommonResult.YCBCFailed("令牌校验错误");
|
||||
return CommonResult.failed("令牌校验错误");
|
||||
}
|
||||
// 校验签名
|
||||
Map<String, String> resultMap = lianLianService.checkoutSign(dto);
|
||||
if (resultMap == null) {
|
||||
// 签名错误
|
||||
return CommonResult.YCBCFailed("签名校验错误");
|
||||
return CommonResult.failed("签名校验错误");
|
||||
}
|
||||
String operatorSecret = resultMap.get("OperatorSecret");
|
||||
String dataString = resultMap.get("Data");
|
||||
@@ -313,11 +313,11 @@ public class YCBCController extends BaseController {
|
||||
queryEquipChargeStatusDTO.setOperatorID(dto.getOperatorID());
|
||||
Map<String, String> map = ycbcService.queryEquipChargeStatus(queryEquipChargeStatusDTO);
|
||||
|
||||
return CommonResult.YCBCSuccess(0, "查询充电状态成功!", map.get("Data"), map.get("Sig"));
|
||||
return CommonResult.success(0, "查询充电状态成功!", map.get("Data"), map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.error("甬城泊车平台查询充电状态 error", e);
|
||||
}
|
||||
return CommonResult.YCBCFailed("甬城泊车平台查询充电状态发生异常");
|
||||
return CommonResult.failed("甬城泊车平台查询充电状态发生异常");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -358,13 +358,13 @@ public class YCBCController extends BaseController {
|
||||
String token = request.getHeader("Authorization");
|
||||
if (!JWTUtils.checkThirdPartyToken(token)) {
|
||||
// 校验失败
|
||||
return CommonResult.YCBCFailed("令牌校验错误");
|
||||
return CommonResult.failed("令牌校验错误");
|
||||
}
|
||||
// 校验签名
|
||||
Map<String, String> resultMap = lianLianService.checkoutSign(dto);
|
||||
if (resultMap == null) {
|
||||
// 签名错误
|
||||
return CommonResult.YCBCFailed("签名校验错误");
|
||||
return CommonResult.failed("签名校验错误");
|
||||
}
|
||||
String operatorSecret = resultMap.get("OperatorSecret");
|
||||
String dataString = resultMap.get("Data");
|
||||
@@ -378,11 +378,11 @@ public class YCBCController extends BaseController {
|
||||
queryStartChargeDTO.setOperatorId(dto.getOperatorID());
|
||||
Map<String, String> map = ycbcService.queryStopCharge(queryStartChargeDTO);
|
||||
|
||||
return CommonResult.YCBCSuccess(0, "请求停止充电成功!", map.get("Data"), map.get("Sig"));
|
||||
return CommonResult.success(0, "请求停止充电成功!", map.get("Data"), map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.error("甬城泊车平台请求停止充电 error", e);
|
||||
}
|
||||
return CommonResult.YCBCFailed("甬城泊车平台请求停止充电发生异常");
|
||||
return CommonResult.failed("甬城泊车平台请求停止充电发生异常");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -700,12 +700,13 @@ public class TransactionRecordsRequestHandler extends AbstractHandler {
|
||||
nrService.pushOrderInfo(orderBasicInfo.getOrderCode());
|
||||
}
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) {
|
||||
// 中电联
|
||||
ycbcService.pushChargeOrderInfo(orderBasicInfo.getOrderCode());
|
||||
// 甬城泊车
|
||||
String result = ycbcService.pushChargeOrderInfo(orderBasicInfo.getOrderCode());
|
||||
log.info("甬城泊车平台 推送充电订单信息 result:{}", result);
|
||||
}
|
||||
// 调用相关接口
|
||||
} catch (Exception e) {
|
||||
log.error("联联平台 推送订单信息发生异常", e);
|
||||
log.error("第三方平台 推送订单信息发生异常", e);
|
||||
}
|
||||
} else {
|
||||
// 平台没有查到订单
|
||||
|
||||
@@ -353,9 +353,10 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
|
||||
// 甬城泊车
|
||||
log.info("推送甬城泊车平台实时数据 params: orderBasicInfo:{}", JSON.toJSONString(orderInfo));
|
||||
// 设备状态变化推送 notification_stationStatus
|
||||
ycbcService.notificationStationStatus(pileConnectorCode, connectorStatus);
|
||||
String result1 = ycbcService.notificationStationStatus(pileConnectorCode, connectorStatus);
|
||||
// 推送充电状态
|
||||
ycbcService.pushChargeStatus(orderInfo.getOrderCode());
|
||||
String result2 = ycbcService.pushChargeStatus(orderInfo.getOrderCode());
|
||||
log.info("推送甬城泊车平台实时数据 result1:{}\n result2:{}", result1, result2);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("推送第三方平台 实时数据 异常", e);
|
||||
|
||||
@@ -27,8 +27,6 @@ public class CommonResult<T> {
|
||||
|
||||
private String sig;
|
||||
|
||||
private String portName;
|
||||
|
||||
protected CommonResult() {
|
||||
|
||||
}
|
||||
@@ -40,14 +38,6 @@ public class CommonResult<T> {
|
||||
this.sig = sig;
|
||||
}
|
||||
|
||||
protected CommonResult(long ret, String msg, T data, String sig, String portName) {
|
||||
this.ret = ret;
|
||||
this.msg = msg;
|
||||
this.data = data;
|
||||
this.sig = sig;
|
||||
this.portName = portName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功返回结果
|
||||
*
|
||||
@@ -59,15 +49,6 @@ public class CommonResult<T> {
|
||||
return new CommonResult<T>(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMsg(), data, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 甬城泊车成功返回结果
|
||||
* @param data
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> CommonResult<T> YCBCSuccess(T data) {
|
||||
return new CommonResult<T>(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMsg(), data, null, "wcc-pro");
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功返回结果
|
||||
@@ -80,21 +61,11 @@ public class CommonResult<T> {
|
||||
public static <T> CommonResult<T> success(T data, String message) {
|
||||
return new CommonResult<T>(ResultCode.SUCCESS.getCode(), message, data, null);
|
||||
}
|
||||
// 甬城泊车成功返回结果
|
||||
public static <T> CommonResult<T> YCBCSuccess(T data, String message) {
|
||||
return new CommonResult<T>(ResultCode.SUCCESS.getCode(), message, data, null, "wcc-pro");
|
||||
}
|
||||
|
||||
|
||||
public static <T> CommonResult<T> success(Integer ret, String msg, T data, String sig) {
|
||||
return new CommonResult<T>(ret, msg, data, sig);
|
||||
}
|
||||
|
||||
// 甬城泊车成功返回结果
|
||||
public static <T> CommonResult<T> YCBCSuccess(Integer ret, String msg, T data, String sig) {
|
||||
return new CommonResult<T>(ret, msg, data, sig, "wcc-pro");
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败返回结果
|
||||
*
|
||||
@@ -106,10 +77,6 @@ public class CommonResult<T> {
|
||||
return new CommonResult<T>(resultCode.getCode(), resultCode.getMsg(), null, null);
|
||||
}
|
||||
|
||||
public static <T> CommonResult<T> YCBCFailed(ResultCode resultCode) {
|
||||
return new CommonResult<T>(resultCode.getCode(), resultCode.getMsg(), null, null, "wcc-pro");
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败返回
|
||||
*
|
||||
@@ -122,10 +89,6 @@ public class CommonResult<T> {
|
||||
return new CommonResult<T>(code, msg, null, null);
|
||||
}
|
||||
|
||||
public static <T> CommonResult<T> YCBCFailed(long code, String msg, String portName) {
|
||||
return new CommonResult<T>(code, msg, null, null, portName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败返回结果
|
||||
*
|
||||
@@ -137,10 +100,6 @@ public class CommonResult<T> {
|
||||
return failed(ResultCode.ERROR.getCode(), msg);
|
||||
}
|
||||
|
||||
public static <T> CommonResult<T> YCBCFailed(String msg) {
|
||||
return YCBCFailed(ResultCode.ERROR.getCode(), msg, "wcc-pro");
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败返回结果
|
||||
*
|
||||
@@ -151,11 +110,6 @@ public class CommonResult<T> {
|
||||
return failed(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
public static <T> CommonResult<T> YCBCFailed() {
|
||||
return YCBCFailed(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
@@ -187,12 +141,4 @@ public class CommonResult<T> {
|
||||
public void setSig(String sig) {
|
||||
this.sig = sig;
|
||||
}
|
||||
|
||||
public String getPortName() {
|
||||
return portName;
|
||||
}
|
||||
|
||||
public void setPortName(String portName) {
|
||||
this.portName = portName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
import com.jsowell.common.enums.lianlian.LianLianPileStatusEnum;
|
||||
import com.jsowell.common.enums.lianlian.PayChannelEnum;
|
||||
import com.jsowell.common.enums.lianlian.StationPaymentEnum;
|
||||
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
||||
import com.jsowell.common.enums.ykc.OrderPayModeEnum;
|
||||
import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
|
||||
@@ -871,8 +872,12 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("ConnectorStatusInfo", info);
|
||||
String jsonString = JSONObject.toJSONString(json);
|
||||
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
String result = "";
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), relationInfo.getThirdPartyType())) {
|
||||
result = HttpRequestUtil.YCBCSendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
}else {
|
||||
result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1060,8 +1065,12 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
|
||||
String jsonString = JSONObject.toJSONString(json);
|
||||
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
String result = "";
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), relationInfo.getThirdPartyType())) {
|
||||
result = HttpRequestUtil.YCBCSendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
}else {
|
||||
result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1113,8 +1122,12 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
// 调用联联平台接口
|
||||
String jsonString = JSONObject.toJSONString(queryEquipChargeStatusDTO);
|
||||
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
String result = "";
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), relationInfo.getThirdPartyType())) {
|
||||
result = HttpRequestUtil.YCBCSendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
}else {
|
||||
result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1178,8 +1191,12 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
String jsonString = JSONObject.toJSONString(json);
|
||||
|
||||
// 发送请求
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
String result = "";
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), relationInfo.getThirdPartyType())) {
|
||||
result = HttpRequestUtil.YCBCSendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
}else {
|
||||
result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1229,8 +1246,12 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
return null;
|
||||
}
|
||||
// 发送请求
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
String result = "";
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), relationInfo.getThirdPartyType())) {
|
||||
result = HttpRequestUtil.YCBCSendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
}else {
|
||||
result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -227,4 +227,61 @@ public class HttpRequestUtil {
|
||||
// System.out.println("解密数据:" + plainData);
|
||||
return resultMsg;
|
||||
}
|
||||
|
||||
public static String YCBCSendPost(String token, String data, String url, String dataSecret,
|
||||
String dataSecretIV, String operatorId, String sigSecret){
|
||||
log.info("甬城泊车平台发送请求 data:{}", data);
|
||||
//加密
|
||||
byte[] encryptText = Cryptos.aesEncrypt(data.getBytes(),
|
||||
dataSecret.getBytes(), dataSecretIV.getBytes());
|
||||
String encryptData = Encodes.encodeBase64(encryptText);
|
||||
log.info("甬城泊车平台发送请求 加密数据:" + encryptData);
|
||||
|
||||
Map<String, String> params = Maps.newLinkedHashMap();
|
||||
params.put("OperatorID", operatorId);
|
||||
params.put("Data", encryptData);
|
||||
params.put("TimeStamp", DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSS, new Date()));
|
||||
params.put("Seq", "001");
|
||||
String sign = GBSignUtils.sign(params, sigSecret);
|
||||
params.put("Portname", "wcc-pro");
|
||||
params.put("Sig", sign);
|
||||
|
||||
String postData = JSON.toJSONString(params);
|
||||
log.info("甬城泊车平台发送请求 最终提交数据:{}, 加密数据:{}", params, postData);
|
||||
// System.out.println("最终提交数据:" + postData);
|
||||
|
||||
String hutoolRequest = HttpRequest.post(url).header("Authorization", "Bearer " + token).body(postData).execute().body();
|
||||
|
||||
log.info("甬城泊车平台发送请求 接收到返回数据:{}", hutoolRequest);
|
||||
// System.out.println("接收到返回数据:" + hutoolRequest);
|
||||
|
||||
if (StringUtils.isBlank(hutoolRequest)) {
|
||||
return "返回数据为空";
|
||||
}
|
||||
Map<String, Object> map = (Map<String, Object>) JSON.parse(hutoolRequest);
|
||||
|
||||
log.info("甬城泊车平台发送请求 返回数据map:{}", JSON.toJSONString(map));
|
||||
|
||||
int ret = (int) map.get("Ret");
|
||||
String resultMsg = (String) map.get("Msg");
|
||||
if (ret != 0) {
|
||||
// 表示请求有异常
|
||||
log.error("甬城泊车平台发送请求 error:{}, 源数据:{}", resultMsg, data);
|
||||
return resultMsg;
|
||||
}
|
||||
String rData = (String) map.get("Data");
|
||||
|
||||
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(rData),
|
||||
dataSecret.getBytes(), dataSecretIV.getBytes());
|
||||
String plainData = "";
|
||||
try {
|
||||
plainData = new String(plainText, "UTF-8");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
log.info("甬城泊车平台发送请求 解密数据:{}", plainData);
|
||||
// System.out.println("解密数据:" + plainData);
|
||||
return resultMsg;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ import lombok.Data;
|
||||
@Data
|
||||
public class YCCommonParamsDTO extends CommonParamsDTO {
|
||||
|
||||
@JsonProperty(value = "AccessName")
|
||||
private String accessName;
|
||||
@JsonProperty(value = "Portname")
|
||||
private String portName;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSONObject;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
||||
import com.jsowell.common.util.PageUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.*;
|
||||
@@ -159,8 +160,12 @@ public class ZDLServiceImpl implements ZDLService {
|
||||
.signSecret(signSecret)
|
||||
.build();
|
||||
String token = ZDLGetToken(tokenDTO);
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret
|
||||
, dataSecretIv, operatorId, signSecret);
|
||||
String result = "";
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), relationInfo.getThirdPartyType())) {
|
||||
result = HttpRequestUtil.YCBCSendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
}else {
|
||||
result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
}
|
||||
|
||||
// System.out.println(result);
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user