新增 甬城泊车相关接口、controller

This commit is contained in:
Lemon
2023-11-06 15:28:34 +08:00
parent 23e52ca90c
commit f73806955d
10 changed files with 147 additions and 39 deletions

View File

@@ -50,10 +50,10 @@ public class YCBCController extends BaseController {
try { try {
Map<String, String> map = ycbcService.generateToken(dto); Map<String, String> map = ycbcService.generateToken(dto);
logger.info("甬城泊车平台请求令牌 result:{}", JSONObject.toJSONString(map)); logger.info("甬城泊车平台请求令牌 result:{}", JSONObject.toJSONString(map));
return CommonResult.success(0, "请求令牌成功!", map.get("Data"), map.get("Sig")); return CommonResult.YCBCSuccess(0, "请求令牌成功!", map.get("Data"), map.get("Sig"));
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
logger.error("甬城泊车平台 请求令牌接口 异常"); logger.error("甬城泊车平台 请求令牌接口 异常");
return CommonResult.failed("获取token发生异常"); return CommonResult.YCBCFailed("获取token发生异常");
} }
} }
@@ -72,13 +72,13 @@ public class YCBCController extends BaseController {
String token = request.getHeader("Authorization"); String token = request.getHeader("Authorization");
if (!JWTUtils.checkThirdPartyToken(token)) { if (!JWTUtils.checkThirdPartyToken(token)) {
// 校验失败 // 校验失败
return CommonResult.failed("令牌校验错误"); return CommonResult.YCBCFailed("令牌校验错误");
} }
// 校验签名 // 校验签名
Map<String, String> resultMap = lianLianService.checkoutSign(dto); Map<String, String> resultMap = lianLianService.checkoutSign(dto);
if (resultMap == null) { if (resultMap == null) {
// 签名错误 // 签名错误
return CommonResult.failed("签名校验错误"); return CommonResult.YCBCFailed("签名校验错误");
} }
String operatorSecret = resultMap.get("OperatorSecret"); String operatorSecret = resultMap.get("OperatorSecret");
String dataString = resultMap.get("Data"); String dataString = resultMap.get("Data");
@@ -92,12 +92,12 @@ public class YCBCController extends BaseController {
queryStationInfoDTO.setOperatorId(dto.getOperatorID()); queryStationInfoDTO.setOperatorId(dto.getOperatorID());
Map<String, String> map = ycbcService.queryStationsInfo(queryStationInfoDTO); Map<String, String> map = ycbcService.queryStationsInfo(queryStationInfoDTO);
return CommonResult.success(0, "查询充电站信息成功!", map.get("Data"), map.get("Sig")); return CommonResult.YCBCSuccess(0, "查询充电站信息成功!", map.get("Data"), map.get("Sig"));
} catch (Exception e) { } catch (Exception e) {
logger.info("甬城泊车平台查询充电站信息 error:", e); logger.info("甬城泊车平台查询充电站信息 error:", e);
e.printStackTrace(); e.printStackTrace();
} }
return CommonResult.failed("查询充电站信息发生异常"); return CommonResult.YCBCFailed("查询充电站信息发生异常");
} }
@@ -115,13 +115,13 @@ public class YCBCController extends BaseController {
String token = request.getHeader("Authorization"); String token = request.getHeader("Authorization");
if (!JWTUtils.checkThirdPartyToken(token)) { if (!JWTUtils.checkThirdPartyToken(token)) {
// 校验失败 // 校验失败
return CommonResult.failed("令牌校验错误"); return CommonResult.YCBCFailed("令牌校验错误");
} }
// 校验签名 // 校验签名
Map<String, String> resultMap = lianLianService.checkoutSign(dto); Map<String, String> resultMap = lianLianService.checkoutSign(dto);
if (resultMap == null) { if (resultMap == null) {
// 签名错误 // 签名错误
return CommonResult.failed("签名校验错误"); return CommonResult.YCBCFailed("签名校验错误");
} }
String operatorSecret = resultMap.get("OperatorSecret"); String operatorSecret = resultMap.get("OperatorSecret");
String dataString = resultMap.get("Data"); String dataString = resultMap.get("Data");
@@ -135,12 +135,12 @@ public class YCBCController extends BaseController {
queryStationInfoDTO.setOperatorId(dto.getOperatorID()); queryStationInfoDTO.setOperatorId(dto.getOperatorID());
Map<String, String> map = ycbcService.queryStationStatus(queryStationInfoDTO); Map<String, String> map = ycbcService.queryStationStatus(queryStationInfoDTO);
return CommonResult.success(0, "查询充电站状态信息成功!", map.get("Data"), map.get("Sig")); return CommonResult.YCBCSuccess(0, "查询充电站状态信息成功!", map.get("Data"), map.get("Sig"));
} catch (Exception e) { } catch (Exception e) {
logger.info("甬城泊车平台查询充电站状态信息 error:", e); logger.info("甬城泊车平台查询充电站状态信息 error:", e);
e.printStackTrace(); e.printStackTrace();
} }
return CommonResult.failed("查询充电站状态信息发生异常"); return CommonResult.YCBCFailed("查询充电站状态信息发生异常");
} }
@@ -210,13 +210,13 @@ public class YCBCController extends BaseController {
String token = request.getHeader("Authorization"); String token = request.getHeader("Authorization");
if (!JWTUtils.checkThirdPartyToken(token)) { if (!JWTUtils.checkThirdPartyToken(token)) {
// 校验失败 // 校验失败
return CommonResult.failed("令牌校验错误"); return CommonResult.YCBCFailed("令牌校验错误");
} }
// 校验签名 // 校验签名
Map<String, String> resultMap = lianLianService.checkoutSign(dto); Map<String, String> resultMap = lianLianService.checkoutSign(dto);
if (resultMap == null) { if (resultMap == null) {
// 签名错误 // 签名错误
return CommonResult.failed("签名校验错误"); return CommonResult.YCBCFailed("签名校验错误");
} }
String operatorSecret = resultMap.get("OperatorSecret"); String operatorSecret = resultMap.get("OperatorSecret");
String dataString = resultMap.get("Data"); String dataString = resultMap.get("Data");
@@ -230,12 +230,12 @@ public class YCBCController extends BaseController {
queryEquipmentDTO.setOperatorID(dto.getOperatorID()); queryEquipmentDTO.setOperatorID(dto.getOperatorID());
Map<String, String> map = ycbcService.queryEquipAuth(queryEquipmentDTO); Map<String, String> map = ycbcService.queryEquipAuth(queryEquipmentDTO);
return CommonResult.success(0, "请求设备认证成功!", map.get("Data"), map.get("Sig")); return CommonResult.YCBCSuccess(0, "请求设备认证成功!", map.get("Data"), map.get("Sig"));
} catch (Exception e) { } catch (Exception e) {
logger.info("甬城泊车平台请求设备认证 error:", e); logger.info("甬城泊车平台请求设备认证 error:", e);
e.printStackTrace(); e.printStackTrace();
} }
return CommonResult.failed("请求设备认证发生异常"); return CommonResult.YCBCFailed("请求设备认证发生异常");
} }
/** /**
@@ -252,13 +252,13 @@ public class YCBCController extends BaseController {
String token = request.getHeader("Authorization"); String token = request.getHeader("Authorization");
if (!JWTUtils.checkThirdPartyToken(token)) { if (!JWTUtils.checkThirdPartyToken(token)) {
// 校验失败 // 校验失败
return CommonResult.failed("令牌校验错误"); return CommonResult.YCBCFailed("令牌校验错误");
} }
// 校验签名 // 校验签名
Map<String, String> resultMap = lianLianService.checkoutSign(dto); Map<String, String> resultMap = lianLianService.checkoutSign(dto);
if (resultMap == null) { if (resultMap == null) {
// 签名错误 // 签名错误
return CommonResult.failed("签名校验错误"); return CommonResult.YCBCFailed("签名校验错误");
} }
String operatorSecret = resultMap.get("OperatorSecret"); String operatorSecret = resultMap.get("OperatorSecret");
String dataString = resultMap.get("Data"); String dataString = resultMap.get("Data");
@@ -272,11 +272,11 @@ public class YCBCController extends BaseController {
queryStartChargeDTO.setOperatorId(dto.getOperatorID()); queryStartChargeDTO.setOperatorId(dto.getOperatorID());
Map<String, String> map = ycbcService.queryStartCharge(queryStartChargeDTO); Map<String, String> map = ycbcService.queryStartCharge(queryStartChargeDTO);
return CommonResult.success(0, "请求启动充电成功!", map.get("Data"), map.get("Sig")); return CommonResult.YCBCSuccess(0, "请求启动充电成功!", map.get("Data"), map.get("Sig"));
} catch (Exception e) { } catch (Exception e) {
logger.error("甬城泊车平台请求启动充电 error", e); logger.error("甬城泊车平台请求启动充电 error", e);
} }
return CommonResult.failed("请求启动充电发生异常"); return CommonResult.YCBCFailed("请求启动充电发生异常");
} }
/** /**
@@ -293,13 +293,13 @@ public class YCBCController extends BaseController {
String token = request.getHeader("Authorization"); String token = request.getHeader("Authorization");
if (!JWTUtils.checkThirdPartyToken(token)) { if (!JWTUtils.checkThirdPartyToken(token)) {
// 校验失败 // 校验失败
return CommonResult.failed("令牌校验错误"); return CommonResult.YCBCFailed("令牌校验错误");
} }
// 校验签名 // 校验签名
Map<String, String> resultMap = lianLianService.checkoutSign(dto); Map<String, String> resultMap = lianLianService.checkoutSign(dto);
if (resultMap == null) { if (resultMap == null) {
// 签名错误 // 签名错误
return CommonResult.failed("签名校验错误"); return CommonResult.YCBCFailed("签名校验错误");
} }
String operatorSecret = resultMap.get("OperatorSecret"); String operatorSecret = resultMap.get("OperatorSecret");
String dataString = resultMap.get("Data"); String dataString = resultMap.get("Data");
@@ -313,11 +313,11 @@ public class YCBCController extends BaseController {
queryEquipChargeStatusDTO.setOperatorID(dto.getOperatorID()); queryEquipChargeStatusDTO.setOperatorID(dto.getOperatorID());
Map<String, String> map = ycbcService.queryEquipChargeStatus(queryEquipChargeStatusDTO); Map<String, String> map = ycbcService.queryEquipChargeStatus(queryEquipChargeStatusDTO);
return CommonResult.success(0, "查询充电状态成功!", map.get("Data"), map.get("Sig")); return CommonResult.YCBCSuccess(0, "查询充电状态成功!", map.get("Data"), map.get("Sig"));
} catch (Exception e) { } catch (Exception e) {
logger.error("甬城泊车平台查询充电状态 error", e); logger.error("甬城泊车平台查询充电状态 error", e);
} }
return CommonResult.failed("甬城泊车平台查询充电状态发生异常"); return CommonResult.YCBCFailed("甬城泊车平台查询充电状态发生异常");
} }
/** /**
@@ -358,13 +358,13 @@ public class YCBCController extends BaseController {
String token = request.getHeader("Authorization"); String token = request.getHeader("Authorization");
if (!JWTUtils.checkThirdPartyToken(token)) { if (!JWTUtils.checkThirdPartyToken(token)) {
// 校验失败 // 校验失败
return CommonResult.failed("令牌校验错误"); return CommonResult.YCBCFailed("令牌校验错误");
} }
// 校验签名 // 校验签名
Map<String, String> resultMap = lianLianService.checkoutSign(dto); Map<String, String> resultMap = lianLianService.checkoutSign(dto);
if (resultMap == null) { if (resultMap == null) {
// 签名错误 // 签名错误
return CommonResult.failed("签名校验错误"); return CommonResult.YCBCFailed("签名校验错误");
} }
String operatorSecret = resultMap.get("OperatorSecret"); String operatorSecret = resultMap.get("OperatorSecret");
String dataString = resultMap.get("Data"); String dataString = resultMap.get("Data");
@@ -378,11 +378,11 @@ public class YCBCController extends BaseController {
queryStartChargeDTO.setOperatorId(dto.getOperatorID()); queryStartChargeDTO.setOperatorId(dto.getOperatorID());
Map<String, String> map = ycbcService.queryStopCharge(queryStartChargeDTO); Map<String, String> map = ycbcService.queryStopCharge(queryStartChargeDTO);
return CommonResult.success(0, "请求停止充电成功!", map.get("Data"), map.get("Sig")); return CommonResult.YCBCSuccess(0, "请求停止充电成功!", map.get("Data"), map.get("Sig"));
} catch (Exception e) { } catch (Exception e) {
logger.error("甬城泊车平台请求停止充电 error", e); logger.error("甬城泊车平台请求停止充电 error", e);
} }
return CommonResult.failed("甬城泊车平台请求停止充电发生异常"); return CommonResult.YCBCFailed("甬城泊车平台请求停止充电发生异常");
} }
/** /**

View File

@@ -31,6 +31,7 @@ import com.jsowell.pile.vo.web.PileStationVO;
import com.jsowell.service.PileService; import com.jsowell.service.PileService;
import com.jsowell.thirdparty.lianlian.service.LianLianService; import com.jsowell.thirdparty.lianlian.service.LianLianService;
import com.jsowell.thirdparty.nanrui.service.NRService; import com.jsowell.thirdparty.nanrui.service.NRService;
import com.jsowell.thirdparty.yongchengboche.service.YCBCService;
import com.jsowell.thirdparty.zhongdianlian.service.ZDLService; import com.jsowell.thirdparty.zhongdianlian.service.ZDLService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
@@ -66,6 +67,9 @@ public class PileStationInfoController extends BaseController {
@Autowired @Autowired
private NRService nrService; private NRService nrService;
@Autowired
private YCBCService ycbcService;
@Autowired @Autowired
private IThirdPartyStationRelationService thirdPartyStationRelationService; private IThirdPartyStationRelationService thirdPartyStationRelationService;
@@ -299,6 +303,10 @@ public class PileStationInfoController extends BaseController {
// 江苏省平台 // 江苏省平台
result = nrService.pushStationInfo(dto); result = nrService.pushStationInfo(dto);
} }
if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), dto.getThirdPartyType())) {
// 甬城泊车平台
result = ycbcService.pushStationInfo(dto);
}
response = new RestApiResponse<>(result); response = new RestApiResponse<>(result);
}catch (BusinessException e) { }catch (BusinessException e) {
logger.error("推送第三方平台充电站信息 error",e); logger.error("推送第三方平台充电站信息 error",e);

View File

@@ -13,6 +13,7 @@ public enum ThirdPlatformTypeEnum {
LIAN_LIAN_PLATFORM("1", "联联平台"), LIAN_LIAN_PLATFORM("1", "联联平台"),
ZHONG_DIAN_LIAN_PLATFORM("2", "中电联平台"), ZHONG_DIAN_LIAN_PLATFORM("2", "中电联平台"),
JIANG_SU_PLATFORM("3", "江苏省平台"), JIANG_SU_PLATFORM("3", "江苏省平台"),
YONG_CHENG_BO_CHE("4", "甬城泊车平台"),
; ;
private String code; private String code;

View File

@@ -3,6 +3,7 @@ package com.jsowell.netty.handler;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.jsowell.common.core.domain.ykc.YKCDataProtocol; import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode; import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
import com.jsowell.common.enums.ykc.OrderStatusEnum; import com.jsowell.common.enums.ykc.OrderStatusEnum;
import com.jsowell.common.util.BytesUtil; import com.jsowell.common.util.BytesUtil;
import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.StringUtils;
@@ -15,6 +16,7 @@ import com.jsowell.pile.service.IThirdPartyStationRelationService;
import com.jsowell.pile.service.IThirdPartySettingInfoService; import com.jsowell.pile.service.IThirdPartySettingInfoService;
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO; import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
import com.jsowell.thirdparty.lianlian.service.LianLianService; import com.jsowell.thirdparty.lianlian.service.LianLianService;
import com.jsowell.thirdparty.yongchengboche.service.YCBCService;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -44,6 +46,9 @@ public class ChargeEndHandler extends AbstractHandler{
@Autowired @Autowired
private LianLianService lianLianService; private LianLianService lianLianService;
@Autowired
private YCBCService ycbcService;
@Autowired @Autowired
private IThirdPartyStationRelationService thirdPartyStationRelationService; private IThirdPartyStationRelationService thirdPartyStationRelationService;
@@ -137,10 +142,19 @@ public class ChargeEndHandler extends AbstractHandler{
relation.setStationId(Long.parseLong(orderInfo.getStationId())); relation.setStationId(Long.parseLong(orderInfo.getStationId()));
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation); ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
// ThirdPartySettingInfo info = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId())); // ThirdPartySettingInfo info = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId()));
if (Objects.nonNull(relationInfo)) { if (Objects.isNull(relationInfo)) {
return null;
}
// 联联平台
if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), relationInfo.getThirdPartyType())) {
// 推送停止充电结果 // 推送停止充电结果
lianLianService.pushStopChargeResult(orderInfo.getOrderCode()); lianLianService.pushStopChargeResult(orderInfo.getOrderCode());
} }
// 甬城泊车平台
if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), relationInfo.getThirdPartyType())) {
ycbcService.pushStopChargeResult(orderInfo.getOrderCode());
}
} catch (Exception e) { } catch (Exception e) {
log.error("联联平台推送停止充电结果异常", e); log.error("联联平台推送停止充电结果异常", e);
} }

View File

@@ -34,6 +34,7 @@ import com.jsowell.thirdparty.lianlian.service.LianLianService;
import com.jsowell.thirdparty.lutongyunting.service.LTYTService; import com.jsowell.thirdparty.lutongyunting.service.LTYTService;
import com.jsowell.thirdparty.nanrui.service.NRService; import com.jsowell.thirdparty.nanrui.service.NRService;
import com.jsowell.thirdparty.ruanjie.service.RJService; import com.jsowell.thirdparty.ruanjie.service.RJService;
import com.jsowell.thirdparty.yongchengboche.service.YCBCService;
import com.jsowell.thirdparty.zhongdianlian.service.ZDLService; import com.jsowell.thirdparty.zhongdianlian.service.ZDLService;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -87,6 +88,9 @@ public class TransactionRecordsRequestHandler extends AbstractHandler {
@Autowired @Autowired
private NRService nrService; private NRService nrService;
@Autowired
private YCBCService ycbcService;
@Autowired @Autowired
private IThirdPartyStationRelationService thirdPartyStationRelationService; private IThirdPartyStationRelationService thirdPartyStationRelationService;
@@ -695,6 +699,10 @@ public class TransactionRecordsRequestHandler extends AbstractHandler {
// 推送订单信息 // 推送订单信息
nrService.pushOrderInfo(orderBasicInfo.getOrderCode()); nrService.pushOrderInfo(orderBasicInfo.getOrderCode());
} }
if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) {
// 中电联
ycbcService.pushChargeOrderInfo(orderBasicInfo.getOrderCode());
}
// 调用相关接口 // 调用相关接口
} catch (Exception e) { } catch (Exception e) {
log.error("联联平台 推送订单信息发生异常", e); log.error("联联平台 推送订单信息发生异常", e);

View File

@@ -21,6 +21,7 @@ import com.jsowell.pile.service.*;
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO; import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
import com.jsowell.thirdparty.lianlian.service.LianLianService; import com.jsowell.thirdparty.lianlian.service.LianLianService;
import com.jsowell.thirdparty.nanrui.service.NRService; import com.jsowell.thirdparty.nanrui.service.NRService;
import com.jsowell.thirdparty.yongchengboche.service.YCBCService;
import com.jsowell.thirdparty.zhongdianlian.service.ZDLService; import com.jsowell.thirdparty.zhongdianlian.service.ZDLService;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -62,6 +63,9 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
@Autowired @Autowired
private LianLianService lianLianService; private LianLianService lianLianService;
@Autowired
private YCBCService ycbcService;
@Autowired @Autowired
private IThirdPartyStationRelationService thirdPartyStationRelationService; private IThirdPartyStationRelationService thirdPartyStationRelationService;
@@ -345,6 +349,14 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
String result = nrService.pushPileStatus(realTimeMonitorData); String result = nrService.pushPileStatus(realTimeMonitorData);
log.info("推送江苏省平台实时数据 result:{}", result); log.info("推送江苏省平台实时数据 result:{}", result);
} }
if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), relationInfo.getThirdPartyType())) {
// 甬城泊车
log.info("推送甬城泊车平台实时数据 params: orderBasicInfo:{}", JSON.toJSONString(orderInfo));
// 设备状态变化推送 notification_stationStatus
ycbcService.notificationStationStatus(pileConnectorCode, connectorStatus);
// 推送充电状态
ycbcService.pushChargeStatus(orderInfo.getOrderCode());
}
} catch (Exception e) { } catch (Exception e) {
log.error("推送第三方平台 实时数据 异常", e); log.error("推送第三方平台 实时数据 异常", e);
} }

View File

@@ -27,6 +27,8 @@ public class CommonResult<T> {
private String sig; private String sig;
private String portName;
protected CommonResult() { protected CommonResult() {
} }
@@ -38,6 +40,14 @@ public class CommonResult<T> {
this.sig = sig; 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;
}
/** /**
* 成功返回结果 * 成功返回结果
* *
@@ -49,6 +59,16 @@ public class CommonResult<T> {
return new CommonResult<T>(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMsg(), data, null); 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");
}
/** /**
* 成功返回结果 * 成功返回结果
* *
@@ -60,11 +80,21 @@ public class CommonResult<T> {
public static <T> CommonResult<T> success(T data, String message) { public static <T> CommonResult<T> success(T data, String message) {
return new CommonResult<T>(ResultCode.SUCCESS.getCode(), message, data, null); 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) { public static <T> CommonResult<T> success(Integer ret, String msg, T data, String sig) {
return new CommonResult<T>(ret, msg, data, 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");
}
/** /**
* 失败返回结果 * 失败返回结果
* *
@@ -76,6 +106,10 @@ public class CommonResult<T> {
return new CommonResult<T>(resultCode.getCode(), resultCode.getMsg(), null, null); 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");
}
/** /**
* 失败返回 * 失败返回
* *
@@ -88,6 +122,10 @@ public class CommonResult<T> {
return new CommonResult<T>(code, msg, null, null); 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);
}
/** /**
* 失败返回结果 * 失败返回结果
* *
@@ -99,6 +137,10 @@ public class CommonResult<T> {
return failed(ResultCode.ERROR.getCode(), msg); return failed(ResultCode.ERROR.getCode(), msg);
} }
public static <T> CommonResult<T> YCBCFailed(String msg) {
return YCBCFailed(ResultCode.ERROR.getCode(), msg, "wcc-pro");
}
/** /**
* 失败返回结果 * 失败返回结果
* *
@@ -109,6 +151,10 @@ public class CommonResult<T> {
return failed(ResultCode.ERROR); return failed(ResultCode.ERROR);
} }
public static <T> CommonResult<T> YCBCFailed() {
return YCBCFailed(ResultCode.ERROR);
}
public String getMsg() { public String getMsg() {
return msg; return msg;
@@ -141,4 +187,12 @@ public class CommonResult<T> {
public void setSig(String sig) { public void setSig(String sig) {
this.sig = sig; this.sig = sig;
} }
public String getPortName() {
return portName;
}
public void setPortName(String portName) {
this.portName = portName;
}
} }

View File

@@ -217,10 +217,10 @@ public class LianLianServiceImpl implements LianLianService {
} }
public static void main(String[] args) throws UnsupportedEncodingException { public static void main(String[] args) throws UnsupportedEncodingException {
String dataSecret = "vj3RWNsWIxT5MC2K"; String dataSecret = "SPBNJ1Z5EQNmpK08"; // SPBNJ1Z5EQNmpK08
String dataSecretIV = "jjkySnGlM3pbOUki"; String dataSecretIV = "peRoTcb2C7zqKeII"; // peRoTcb2C7zqKeII
String signSecret = "NbELMbWtbHikNSlu"; String signSecret = "sRjCDeokckFGpYpA"; // sRjCDeokckFGpYpA
String dataString = "HcKHxaIiuG7H/PUavhtbRg2CNRSJ6X7pTgwKJNdx768+fw0WLo+h5LZEWcAMAOy+DYBQRB6GE9rybFTTTA6dIL1c3OlIBjp/1yoomTNqMlY="; String dataString = "DLYTJz/I1OkVfqHDPEyF6g==";
// 解密data // 解密data
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
String dataStr = new String(plainText, StandardCharsets.UTF_8); String dataStr = new String(plainText, StandardCharsets.UTF_8);

View File

@@ -1,9 +1,6 @@
package com.jsowell.thirdparty.yongchengboche.service; package com.jsowell.thirdparty.yongchengboche.service;
import com.jsowell.pile.dto.QueryEquipChargeStatusDTO; import com.jsowell.pile.dto.*;
import com.jsowell.pile.dto.QueryEquipmentDTO;
import com.jsowell.pile.dto.QueryStartChargeDTO;
import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO;
import com.jsowell.thirdparty.yongchengboche.dto.YCBCGetTokenDTO; import com.jsowell.thirdparty.yongchengboche.dto.YCBCGetTokenDTO;
@@ -108,4 +105,11 @@ public interface YCBCService {
* @return * @return
*/ */
String pushChargeOrderInfo(String orderCode); String pushChargeOrderInfo(String orderCode);
/**
* 推送充电站信息
* @param dto
* @return
*/
String pushStationInfo(PushStationInfoDTO dto);
} }

View File

@@ -1,9 +1,6 @@
package com.jsowell.thirdparty.yongchengboche.service.impl; package com.jsowell.thirdparty.yongchengboche.service.impl;
import com.jsowell.pile.dto.QueryEquipChargeStatusDTO; import com.jsowell.pile.dto.*;
import com.jsowell.pile.dto.QueryEquipmentDTO;
import com.jsowell.pile.dto.QueryStartChargeDTO;
import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO;
import com.jsowell.thirdparty.lianlian.service.LianLianService; import com.jsowell.thirdparty.lianlian.service.LianLianService;
import com.jsowell.thirdparty.yongchengboche.dto.YCBCGetTokenDTO; import com.jsowell.thirdparty.yongchengboche.dto.YCBCGetTokenDTO;
@@ -162,4 +159,14 @@ public class YCBCServiceImpl implements YCBCService {
return lianLianService.pushChargeOrderInfo(orderCode); return lianLianService.pushChargeOrderInfo(orderCode);
} }
/**
* 推送充电站信息
* @param dto
* @return
*/
@Override
public String pushStationInfo(PushStationInfoDTO dto) {
return zdlService.pushStationInfo(dto);
}
} }