update 第三方平台推送方法 由通过站点id查询配置密钥改为通过对应第三方平台类型查询

This commit is contained in:
Lemon
2024-04-19 15:22:31 +08:00
parent 646e88b057
commit 000b824398
25 changed files with 171 additions and 106 deletions

View File

@@ -84,11 +84,10 @@ public interface LianLianService {
/**
* 推送联联平台 设备状态变化推送
* @param pileConnectorCode
* @param status
* @param dto
* @return
*/
String pushConnectorStatus(String pileConnectorCode, String status);
String pushConnectorStatus(PushRealTimeInfoDTO dto);
/**
* 推送订单信息

View File

@@ -252,11 +252,11 @@ public class LianLianServiceImpl implements LianLianService {
public static void main(String[] args) throws UnsupportedEncodingException {
String dataSecret = "NHsBDtTanA60vTIu"; // SPBNJ1Z5EQNmpK08 VTAEKDPVN9CUS7WO huawei: zd4NrLWJ38XCTaqP E6gnWuz0QzBW75CR 正式NHsBDtTanA60vTIu pJahbxk8wG79CMDB
String dataSecretIV = "2uyE2Cgu4nVf6egc"; // peRoTcb2C7zqKeII 83UZFFRRZDYNF5CR huawei: RJJecvNTJ48SGMG7 SXejaSUx5yud8UHm 正式2uyE2Cgu4nVf6egc y259VRq7h8RyFXmT
String dataSecret = "YPFVz1OvAS4nSwLW"; // SPBNJ1Z5EQNmpK08 VTAEKDPVN9CUS7WO huawei: zd4NrLWJ38XCTaqP E6gnWuz0QzBW75CR 正式NHsBDtTanA60vTIu pJahbxk8wG79CMDB
String dataSecretIV = "5tLoP60aR9QUB5Mx"; // peRoTcb2C7zqKeII 83UZFFRRZDYNF5CR huawei: RJJecvNTJ48SGMG7 SXejaSUx5yud8UHm 正式2uyE2Cgu4nVf6egc y259VRq7h8RyFXmT
String signSecret = "sRjCDeokckFGpYpA"; // sRjCDeokckFGpYpA
String dataString = "R4Z4/rHpm2PgVGuP77+mIm9DZlTITfUjBZt4yrwd6AxKF2WbKv4BWaXc9CXd/pYWn0eC0U21ej28u/QUtGfH0Q7WFLvyojDdaIda6TpQ2etI16+MtUAu/1Eoj7Fr2pTK9GpYOxzx7uS+Ou5K3WI\n" +
"Y4gWdC6z0Hi12xEWYlBE4DfOxcJXbQ81//o7GbMAI73XeiOaewroA/VOrZ9e1WwMznWpR8rqywoIqM+51bMBFVo6K6M7WPpp5mY/2be62EgEJNoFiCBP0fCrsBLePpolACYn0lYPEq7C6AKI3Ggf1JilacE4oQ6BaleV3+5UKmcnOrwPb06h/u78FaalIU/kn2E9eWfTvAfa5h7D3bCW2OijPTzJzYTc18TewjNi/OOWE4mQDJ/R2LBDj0Uq1C72h2lYFC27xXVMl5Qqq8uI+M6pYNJn0hcm1Nrswuumv9rATFyAF4fVA2tae130IwRKtBh0zuMUbsD3Px2mc8zsw9gX59GFuZDH+n7uMLWpfg2DwWBgDF6MI0lq/KD4sJOlodEGBkqH2l4nQngYzPmGo7Ycqozi6wRljOOuXpWKDumb+Vu85byhyvfxUFGr32LacG7/s1khpEHrZWacnvBU4DYU=";
String dataString = "5TCGlD23wkxgJDWft077y212tE2U5XyR6iMpVesNoIiNiPG6n1sRKSDss\n" +
"QcezP+Zfzl1GnHbyTu7tm3IRvYoOg==";
// 解密data
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
@@ -907,18 +907,21 @@ public class LianLianServiceImpl implements LianLianService {
/**
* 联联平台推送 设备状态变化推送 notification_stationStatus
*
* @param pileConnectorCode
* @param status
* @param dto
* @return
*/
@Override
public String pushConnectorStatus(String pileConnectorCode, String status) {
public String pushConnectorStatus(PushRealTimeInfoDTO dto) {
String pileConnectorCode = dto.getPileConnectorCode();
String status = dto.getStatus();
String thirdPartyType = dto.getThirdPartyType();
// 查出该桩所属哪个站点
String pileSn = StringUtils.substring(pileConnectorCode, 0, 14);
PileStationVO stationVO = pileStationInfoService.getStationInfoByPileSn(pileSn);
// 通过站点id查询相关配置信息
ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
relation.setStationId(Long.parseLong(stationVO.getId()));
relation.setThirdPartyType(thirdPartyType);
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
// ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(stationVO.getId()));
if (relationInfo == null) {
@@ -930,7 +933,6 @@ public class LianLianServiceImpl implements LianLianService {
String dataSecret = relationInfo.getDataSecret();
String dataSecretIv = relationInfo.getDataSecretIv();
String urlAddress = relationInfo.getUrlAddress();
String thirdPartyType = relationInfo.getThirdPartyType();
String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_STATION_STATUS.getValue();
ConnectorStatusInfo info = ConnectorStatusInfo.builder()
@@ -945,15 +947,15 @@ public class LianLianServiceImpl implements LianLianService {
String result = "";
String token = "";
if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) {
YCBCGetTokenDTO dto = new YCBCGetTokenDTO();
dto.setOperatorId(operatorId);
dto.setDataSecret(dataSecret);
dto.setSignSecret(signSecret);
dto.setUrlAddress(urlAddress);
dto.setDataSecretIv(dataSecretIv);
dto.setOperatorSecret(operatorSecret);
YCBCGetTokenDTO ycbcGetTokenDTO = new YCBCGetTokenDTO();
ycbcGetTokenDTO.setOperatorId(operatorId);
ycbcGetTokenDTO.setDataSecret(dataSecret);
ycbcGetTokenDTO.setSignSecret(signSecret);
ycbcGetTokenDTO.setUrlAddress(urlAddress);
ycbcGetTokenDTO.setDataSecretIv(dataSecretIv);
ycbcGetTokenDTO.setOperatorSecret(operatorSecret);
token = ycbcService.YCBCGetToken(dto);
token = ycbcService.YCBCGetToken(ycbcGetTokenDTO);
result = HttpRequestUtil.YCBCSendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
}else {
token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
@@ -975,9 +977,9 @@ public class LianLianServiceImpl implements LianLianService {
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
// 通过站点id查询相关配置信息
// 通过第三方平台类型查询相关配置信息
ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
relation.setStationId(Long.parseLong(orderBasicInfo.getStationId()));
relation.setThirdPartyType(orderBasicInfo.getThirdPartyType());
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
// ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderBasicInfo.getStationId()));
if (relationInfo == null) {
@@ -1107,7 +1109,7 @@ public class LianLianServiceImpl implements LianLianService {
}
// 通过站点id查询相关配置信息
ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
relation.setStationId(Long.parseLong(orderInfo.getStationId()));
relation.setThirdPartyType(orderInfo.getThirdPartyType());
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
// ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderBasicInfo.getStationId()));
if (relationInfo == null) {
@@ -1175,9 +1177,9 @@ public class LianLianServiceImpl implements LianLianService {
public String pushChargeStatus(String orderCode) throws UnsupportedEncodingException {
// 根据订单号查询订单信息
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
// 通过站点id查询相关配置信息
// 通过三方平台类型查询相关配置信息
ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
relation.setStationId(Long.parseLong(orderInfo.getStationId()));
relation.setThirdPartyType(orderInfo.getThirdPartyType());
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
// ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId()));
if (relationInfo == null) {
@@ -1251,7 +1253,7 @@ public class LianLianServiceImpl implements LianLianService {
}
// 通过站点id查询相关配置信息
ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
relation.setStationId(Long.parseLong(orderInfo.getStationId()));
relation.setThirdPartyType(orderInfo.getThirdPartyType());
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
// ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId()));
if (relationInfo == null) {
@@ -1323,9 +1325,9 @@ public class LianLianServiceImpl implements LianLianService {
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
// 通过站点id查询相关配置信息
// 通过三方平台类型查询相关配置信息
ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
relation.setStationId(Long.parseLong(orderBasicInfo.getStationId()));
relation.setThirdPartyType(orderBasicInfo.getThirdPartyType());
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
// ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderBasicInfo.getStationId()));
if (relationInfo == null) {
@@ -1448,9 +1450,9 @@ public class LianLianServiceImpl implements LianLianService {
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
// 通过站点id查询相关配置信息
// 通过三方平台类型查询相关配置信息
ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
relation.setStationId(Long.parseLong(orderBasicInfo.getStationId()));
relation.setThirdPartyType(orderBasicInfo.getThirdPartyType());
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
// ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderBasicInfo.getStationId()));
if (relationInfo == null) {
@@ -1494,8 +1496,9 @@ public class LianLianServiceImpl implements LianLianService {
}
// 通过站点id查询相关配置信息
// 通过三方平台类型查询相关配置信息
ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
relation.setStationId(Long.parseLong(orderInfo.getStationId()));
relation.setThirdPartyType(orderInfo.getThirdPartyType());
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
// ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId()));
if (relationInfo == null) {
@@ -1572,6 +1575,7 @@ public class LianLianServiceImpl implements LianLianService {
// 通过站点id查询相关配置信息
ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
relation.setStationId(Long.parseLong(orderInfo.getStationId()));
relation.setThirdPartyType(orderInfo.getThirdPartyType());
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
// ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderBasicInfo.getStationId()));
if (relationInfo == null) {