mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-22 12:05:05 +08:00
update 对接内蒙古平台
This commit is contained in:
@@ -171,7 +171,7 @@ public class CommonService {
|
||||
// // 华为
|
||||
// result = huaWeiService.notificationOperationSystemInfo(dto);
|
||||
// }
|
||||
if(StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getTypeCode(), dto.getThirdPartyType())) {
|
||||
if(StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1_PLATFORM.getTypeCode(), dto.getThirdPartyType())) {
|
||||
// 海南
|
||||
result = haiNanChargeService.pushStationInfoV2(dto);
|
||||
}
|
||||
@@ -287,7 +287,7 @@ public class CommonService {
|
||||
// }
|
||||
// huaWeiService.notificationEquipChargeStatus(orderInfo.getOrderCode());
|
||||
// }
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getTypeCode(), thirdPartyType)) {
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1_PLATFORM.getTypeCode(), thirdPartyType)) {
|
||||
// 海南平台
|
||||
haiNanChargeService.notificationStationStatus(pileConnectorCode, changedStatus);
|
||||
}
|
||||
@@ -363,7 +363,7 @@ public class CommonService {
|
||||
// // 推送订单信息
|
||||
// result = huaWeiService.pushChargeOrderInfo(orderBasicInfo.getOrderCode());
|
||||
// }
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getTypeCode(), thirdPartyType)) {
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1_PLATFORM.getTypeCode(), thirdPartyType)) {
|
||||
// 海南平台
|
||||
haiNanChargeService.notificationChargeOrderInfo(orderBasicInfo.getOrderCode());
|
||||
}
|
||||
|
||||
@@ -13,6 +13,9 @@ public class AccessTokenVO {
|
||||
@JsonProperty(value = "OperatorID")
|
||||
private String operatorID;
|
||||
|
||||
@JsonProperty(value = "PlatformID")
|
||||
private String platformId;
|
||||
|
||||
/**
|
||||
* 整型
|
||||
* 0:成功;
|
||||
|
||||
@@ -38,9 +38,9 @@ public interface ThirdPartyPlatformService {
|
||||
throw new UnsupportedOperationException("This method is not yet implemented");
|
||||
}
|
||||
|
||||
default Map<String, String> queryToken(String operatorId, String operatorSecret) {
|
||||
throw new UnsupportedOperationException("This method is not yet implemented");
|
||||
}
|
||||
// default Map<String, String> queryToken(String operatorId, String operatorSecret) {
|
||||
// throw new UnsupportedOperationException("This method is not yet implemented");
|
||||
// }
|
||||
|
||||
// =================================================================================== //
|
||||
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 由我方平台实现此接口,对方平台调用的查询接口 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ //
|
||||
|
||||
@@ -70,7 +70,7 @@ import java.util.stream.Collectors;
|
||||
public class HaiNanPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
Logger logger = LoggerFactory.getLogger(HaiNanPlatformServiceImpl.class);
|
||||
// 平台类型
|
||||
private final String platformType = ThirdPlatformTypeEnum.HAI_NAN_1.getTypeCode();
|
||||
private final String platformType = ThirdPlatformTypeEnum.HAI_NAN_1_PLATFORM.getTypeCode();
|
||||
|
||||
@Autowired
|
||||
private PileMerchantInfoService pileMerchantInfoService;
|
||||
|
||||
@@ -1,10 +1,26 @@
|
||||
package com.jsowell.thirdparty.platform.neimenggu.service;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.JWTUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.ThirdPartyPlatformConfig;
|
||||
import com.jsowell.pile.domain.ThirdPartyStationRelation;
|
||||
import com.jsowell.pile.dto.QueryOperatorInfoDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.pile.service.ThirdPartyPlatformConfigService;
|
||||
import com.jsowell.pile.service.ThirdPartyStationRelationService;
|
||||
import com.jsowell.pile.thirdparty.CommonParamsDTO;
|
||||
import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO;
|
||||
import com.jsowell.thirdparty.platform.ThirdPartyPlatformService;
|
||||
import com.jsowell.thirdparty.platform.util.Cryptos;
|
||||
import com.jsowell.thirdparty.platform.util.GBSignUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -12,6 +28,71 @@ import java.util.Map;
|
||||
*/
|
||||
@Service
|
||||
public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
// 平台类型
|
||||
private final String thirdPlatformType = ThirdPlatformTypeEnum.NEI_MENG_GU_PLATFORM.getTypeCode();
|
||||
|
||||
@Autowired
|
||||
private ThirdPartyPlatformConfigService thirdPartyPlatformConfigService;
|
||||
|
||||
@Autowired
|
||||
private ThirdPartyStationRelationService thirdPartyStationRelationService;
|
||||
|
||||
/**
|
||||
* query_token 获取token,提供给第三方平台使用
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> queryToken(CommonParamsDTO dto) {
|
||||
String operatorId = dto.getPlatformID();
|
||||
// 通过operatorId 查出 operatorSecret
|
||||
ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorId);
|
||||
if (platformConfig == null) {
|
||||
throw new BusinessException("1", "无此对接平台");
|
||||
}
|
||||
|
||||
String operatorSecret = platformConfig.getOperatorSecret();
|
||||
String dataSecret = platformConfig.getDataSecret();
|
||||
String dataSecretIv = platformConfig.getDataSecretIv();
|
||||
String signSecret = platformConfig.getSignSecret();
|
||||
|
||||
// 解密data 获取参数中的OperatorSecret
|
||||
try {
|
||||
String decrypt = Cryptos.decrypt(dto.getData(), dataSecret, dataSecretIv);
|
||||
String inputOperatorSecret = null;
|
||||
if (StringUtils.isNotBlank(decrypt)) {
|
||||
inputOperatorSecret = JSON.parseObject(decrypt).getString("PlatformSecret");
|
||||
}
|
||||
if (!StringUtils.equals(operatorSecret, inputOperatorSecret)) {
|
||||
throw new RuntimeException("密钥不一致");
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
throw new BusinessException("2", "密钥错误");
|
||||
}
|
||||
|
||||
// 生成token
|
||||
String token = JWTUtils.createToken(operatorId, operatorSecret, JWTUtils.ttlMillis);
|
||||
|
||||
// 组装返回参数
|
||||
AccessTokenVO vo = new AccessTokenVO();
|
||||
vo.setAccessToken(token);
|
||||
// vo.setOperatorID(operatorId);
|
||||
vo.setPlatformId(operatorId);
|
||||
vo.setTokenAvailableTime((int) (JWTUtils.ttlMillis / 1000));
|
||||
vo.setFailReason(0);
|
||||
vo.setSuccStat(0);
|
||||
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(vo), dataSecret, dataSecretIv);
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, signSecret);
|
||||
resultMap.put("Sig", resultSign);
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询运营商信息 query_operator_info
|
||||
* supervise_query_operator_info
|
||||
@@ -21,7 +102,12 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> queryOperatorInfo(QueryOperatorInfoDTO dto) {
|
||||
return ThirdPartyPlatformService.super.queryOperatorInfo(dto);
|
||||
Map<String, String> resultMap = Maps.newHashMap();
|
||||
// TODO 查询接入内蒙古平台的站点信息
|
||||
List<ThirdPartyStationRelation> thirdPartyStationRelations =
|
||||
thirdPartyStationRelationService.selectThirdPartyStationRelationList(thirdPlatformType);
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,10 +148,6 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
|
||||
/**
|
||||
* 充电订单推送 notification_charge_order_info
|
||||
* TODO 海南一张网文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致
|
||||
* TODO 甬城泊车平台文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致
|
||||
* TODO 华为平台文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致
|
||||
* TODO 内蒙古平台文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致
|
||||
*
|
||||
* @param orderCode 订单编号
|
||||
* @throws UnsupportedOperationException 未实现异常
|
||||
|
||||
Reference in New Issue
Block a user