This commit is contained in:
Lemon
2024-04-09 10:16:56 +08:00
15 changed files with 390 additions and 102 deletions

View File

@@ -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());
}

View File

@@ -41,6 +41,7 @@ import com.jsowell.thirdparty.common.CommonService;
import com.jsowell.thirdparty.lianlian.domain.*;
import com.jsowell.pile.thirdparty.CommonParamsDTO;
import com.jsowell.thirdparty.lianlian.service.LianLianService;
import com.jsowell.thirdparty.platform.common.StationInfo;
import com.jsowell.thirdparty.platform.util.Cryptos;
import com.jsowell.thirdparty.platform.util.Encodes;
import com.jsowell.thirdparty.platform.util.GBSignUtils;

View File

@@ -13,6 +13,9 @@ public class AccessTokenVO {
@JsonProperty(value = "OperatorID")
private String operatorID;
@JsonProperty(value = "PlatformID")
private String platformId;
/**
* 整型
* 0:成功;

View File

@@ -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");
// }
// =================================================================================== //
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 由我方平台实现此接口,对方平台调用的查询接口 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ //
@@ -234,15 +234,6 @@ public interface ThirdPartyPlatformService {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 订单信息推送 notification_orderInfo
*
* @throws UnsupportedOperationException 未实现异常
*/
default String notificationOrderInfo(String orderCode) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 站点费率变化推送 notification_stationFee
*
@@ -253,11 +244,7 @@ public interface ThirdPartyPlatformService {
}
/**
* 充电订单推送 notification_charge_order_info
* TODO 海南一张网文档中的接口检查一下是否和订单信息推送notification_orderInfo一致
* TODO 甬城泊车平台文档中的接口检查一下是否和订单信息推送notification_orderInfo一致
* TODO 华为平台文档中的接口检查一下是否和订单信息推送notification_orderInfo一致
* TODO 内蒙古平台文档中的接口检查一下是否和订单信息推送notification_orderInfo一致
* 充电订单推送 notification_charge_order_info/notification_orderInfo
*
* @param orderCode 订单编号
* @throws UnsupportedOperationException 未实现异常

View File

@@ -1,4 +1,4 @@
package com.jsowell.thirdparty.lianlian.domain;
package com.jsowell.thirdparty.platform.common;
import com.alibaba.fastjson2.annotation.JSONField;
@@ -168,7 +168,7 @@ public class StationInfo {
* 站点引导 N
* 描述性文字用于引导车主找到充电车位
*/
// private String SiteGuide;
private String SiteGuide;
/**
* 建设场所 Y
@@ -196,19 +196,19 @@ public class StationInfo {
* 站点照片 N
* 充电设备照片充电车位照片停车场入口照片
*/
// private List<String> Pictures;
private List<String> Pictures;
/**
* 使用车型描述 N
* 描述该站点接受的车大小以及类型如大巴物流车私家乘用车出租车等
*/
// private String MatchCars;
private String MatchCars;
/**
* 车位楼层及数量描述 N
* 车位楼层以及数量信息
*/
// private String ParkInfo;
private String ParkInfo;
/**
* 停车场产权方 N

View File

@@ -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;

View File

@@ -36,6 +36,7 @@ import com.jsowell.thirdparty.lianlian.domain.*;
import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO;
import com.jsowell.thirdparty.lianlian.vo.EquipmentAuthVO;
import com.jsowell.thirdparty.platform.ThirdPartyPlatformService;
import com.jsowell.thirdparty.platform.common.StationInfo;
import com.jsowell.thirdparty.platform.util.Cryptos;
import com.jsowell.thirdparty.platform.util.Encodes;
import com.jsowell.thirdparty.platform.util.GBSignUtils;
@@ -682,7 +683,7 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public String notificationOrderInfo(String orderCode) {
public String notificationChargeOrderInfo(String orderCode) {
// 根据订单号查询出信息
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);

View File

@@ -0,0 +1,32 @@
package com.jsowell.thirdparty.platform.neimenggu.domain;
import com.alibaba.fastjson2.annotation.JSONField;
import com.jsowell.thirdparty.platform.common.StationInfo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 内蒙古平台站点信息
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class SupStationInfo extends StationInfo {
/**
* 充换电站唯一编码
* 行政区划代码区县地区码6位+运营商ID9位+充换电站ID
*/
@JSONField(name = "StationUniqueNumber")
private String stationUniqueNumber;
/**
* 充换电站所在县以下行政区划代码
* 填写内容为12位行政区划代码1-6位为县及以上行政区划代码7-12位为县以下区划代码
* 参考地址http://www.stats.gov.cn/sj/tjbz/tjyqhdmhcxhfdm/2022/
*/
@JSONField(name = "AreaCodeCountryside")
private String areaCodeCountryside;
}

View File

@@ -1,15 +1,193 @@
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;
/**
* 内蒙古监测平台逻辑
*/
@Service
public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService {
// 平台类型
private final String platformType = ThirdPlatformTypeEnum.NEI_MENG_GU_PLATFORM.getTypeCode();
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
*
* @param dto 查询运营商信息DTO
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public Map<String, String> queryOperatorInfo(QueryOperatorInfoDTO dto) {
Map<String, String> resultMap = Maps.newHashMap();
// TODO 查询接入内蒙古平台的站点信息
List<ThirdPartyStationRelation> thirdPartyStationRelations =
thirdPartyStationRelationService.selectThirdPartyStationRelationList(thirdPlatformType);
return resultMap;
}
/**
* 查询充电站信息 query_stations_info
* 此接口用于查询对接平台的充电站的信息
*
* @param dto 查询站点信息dto
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public Map<String, String> queryStationsInfo(QueryStationInfoDTO dto) {
return ThirdPartyPlatformService.super.queryStationsInfo(dto);
}
/**
* 设备接口状态查询 query_station_status
*
* @param dto 查询站点信息dto
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public Map<String, String> queryStationStatus(QueryStationInfoDTO dto) {
return ThirdPartyPlatformService.super.queryStationStatus(dto);
}
/**
* 设备状态变化推送 notification_stationStatus
* 推送充电设备接口状态信息 supervise_notification_station_status
*
* @param pileConnectorCode 充电枪口编号
* @param status 枪口状态
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public String notificationStationStatus(String pileConnectorCode, String status) {
return ThirdPartyPlatformService.super.notificationStationStatus(pileConnectorCode, status);
}
/**
* 充电订单推送 notification_charge_order_info
*
* @param orderCode 订单编号
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public String notificationChargeOrderInfo(String orderCode) {
return ThirdPartyPlatformService.super.notificationChargeOrderInfo(orderCode);
}
/**
* 推送充电状态 notification_equip_charge_status
* 推送充电状态信息 supervise_notification_equip_charge_status
*
* @param orderCode 订单编号
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public String notificationEquipChargeStatus(String orderCode) {
return ThirdPartyPlatformService.super.notificationEquipChargeStatus(orderCode);
}
/**
* 推送充换电站用能统计信息 supervise_notification_operation_stats_info
*
* @param stationId
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public String notificationOperationStatsInfo(String stationId) {
return ThirdPartyPlatformService.super.notificationOperationStatsInfo(stationId);
}
/**
* 推送充电站历史充电订单信息 supervise_notification_charge_order_info_history
*
* @param stationId
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public String notificationChargeOrderInfoHistory(String stationId) {
return ThirdPartyPlatformService.super.notificationChargeOrderInfoHistory(stationId);
}
}