update 对接第三方平台

This commit is contained in:
2024-03-26 17:13:00 +08:00
parent 7db83ee738
commit 79caa6f0bb
24 changed files with 750 additions and 544 deletions

View File

@@ -21,8 +21,8 @@ import com.jsowell.thirdparty.lianlian.util.Encodes;
import com.jsowell.thirdparty.lianlian.util.GBSignUtils;
import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO;
import com.jsowell.thirdparty.lianlian.vo.LianLianResultVO;
import com.jsowell.thirdparty.zhongdianlian.domain.ZDLConnectorInfo;
import com.jsowell.thirdparty.zhongdianlian.domain.ZDLEquipmentInfo;
import com.jsowell.pile.thirdparty.ZDLConnectorInfo;
import com.jsowell.pile.thirdparty.ZDLEquipmentInfo;
import com.jsowell.thirdparty.zhongdianlian.service.ZDLService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@@ -0,0 +1,372 @@
package com.jsowell.thirdparty.platform;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSON;
import com.jsowell.common.util.DateUtils;
import com.jsowell.pile.dto.*;
import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO;
import com.jsowell.thirdparty.lianlian.util.Cryptos;
import com.jsowell.thirdparty.lianlian.util.Encodes;
import com.jsowell.thirdparty.lianlian.util.GBSignUtils;
import com.jsowell.thirdparty.lianlian.vo.LianLianResultVO;
import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
public interface ThirdPartyPlatformService {
// =================================================================================== //
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 由我方平台实现此接口,对方平台调用的查询接口 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ //
// =================================================================================== //
/**
* 查询运营商信息 query_operator_info
* supervise_query_operator_info
*
* @param dto 查询运营商信息DTO
* @throws UnsupportedOperationException 未实现异常
*/
default Map<String, String> queryOperatorInfo(QueryOperatorInfoDTO dto) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 查询充电站信息 query_stations_info
* 此接口用于查询对接平台的充电站的信息
*
* @param dto 查询站点信息dto
* @throws UnsupportedOperationException 未实现异常
*/
default Map<String, String> queryStationsInfo(QueryStationInfoDTO dto){
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 设备接口状态查询 query_station_status
*
* @param dto 查询站点信息dto
* @throws UnsupportedOperationException 未实现异常
*/
default Map<String, String> queryStationStatus(QueryStationInfoDTO dto) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 查询统计信息 query_station_stats
*
* @param dto 查询站点信息dto
* @throws UnsupportedOperationException 未实现异常
*/
default Map<String, String> queryStationStats(QueryStationInfoDTO dto) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 查询充电电量信息 query_order_info
*
* @throws UnsupportedOperationException 未实现异常
*/
default Map<String, String> queryOrderInfo(String orderCode) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 请求设备认证 query_equip_auth
* 业务信息交换
*
* @param dto 联联平台请求设备认证
* @throws UnsupportedOperationException 未实现异常
*/
default Map<String, String> queryEquipAuth(QueryEquipmentDTO dto) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 请求启动充电 query_start_charge
*
* @param dto 请求启动充电DTO
* @throws UnsupportedOperationException 未实现异常
*/
default Map<String, String> queryStartCharge(QueryStartChargeDTO dto) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 查询充电状态 query_equip_charge_status
*
* @param dto 查询充电状态DTO
* @throws UnsupportedOperationException 未实现异常
*/
default Map<String, String> queryEquipChargeStatus(QueryEquipChargeStatusDTO dto) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 请求停止充电 query_stop_charge
*
* @param dto 请求启动充电DTO
* @throws UnsupportedOperationException 未实现异常
*/
default Map<String, String> queryStopCharge(QueryStartChargeDTO dto) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 充电站内充电桩空闲状态查询 query_free_pile_number
*
* @throws UnsupportedOperationException 未实现异常
*/
default Map<String, String> queryFreePileNumber(NXJTQueryStationInfoDTO dto) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 某车牌号消费记录查询 query_orders_info_by_Plate_number
*
* @throws UnsupportedOperationException 未实现异常
*/
default Map<String, String> queryOrdersInfoByPlateNumber(NXJTQueryStationInfoDTO dto) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 某段时间内消费记录查询 query_orders_info
*
* @throws UnsupportedOperationException 未实现异常
*/
default Map<String, String> queryOrdersInfo(NXJTQueryStationInfoDTO dto) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 查询业务策略信息结果
* 请求计费策略 request_equip_business_policy
*
* @param dto 请求启动充电DTO
* @throws UnsupportedOperationException 未实现异常
*/
default Map<String, String> queryEquipBusinessPolicy(QueryStartChargeDTO dto) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* VIN码充电 insert_start_charge
* 华为平台
*
* @throws UnsupportedOperationException 未实现异常
*/
default Map<String, String> insertStartCharge(QueryStationInfoDTO dto) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 下发计费策略响应 notification_deliver_equip_business_policy_result
* 华为平台
*
* @throws UnsupportedOperationException 未实现异常
*/
default Map<String, String> notificationDeliverEquipBusinessPolicyResult(QueryStationInfoDTO dto) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
// =================================================================================== //
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 由对方平台实现此接口,我方平台调用的通知接口 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ //
// =================================================================================== //
/**
* 充电站信息变化推送 notification_stationInfo
* 新站需要推送。当站点信息发生变化时,推送新的信息通知到市级平台
*
* @param stationId 充电站id
* @throws UnsupportedOperationException 未实现异常
*/
default String notificationStationInfo(String stationId) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 设备状态变化推送 notification_stationStatus
* 推送充电设备接口状态信息 supervise_notification_station_status
*
* @param pileConnectorCode 充电枪口编号
* @param status 枪口状态
* @throws UnsupportedOperationException 未实现异常
*/
default String notificationStationStatus(String pileConnectorCode, String status) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 设备充电中状态变化推送 notification_connector_charge_status
*
* @param orderCode 订单编号
* @throws UnsupportedOperationException 未实现异常
*/
default String notificationConnectorChargeStatus(String orderCode) {
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
*
* @throws UnsupportedOperationException 未实现异常
*/
default String notificationStationFee(String stationId) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 充电订单推送 notification_charge_order_info
* TODO 海南一张网文档中的接口检查一下是否和订单信息推送notification_orderInfo一致
* TODO 甬城泊车平台文档中的接口检查一下是否和订单信息推送notification_orderInfo一致
* TODO 华为平台文档中的接口检查一下是否和订单信息推送notification_orderInfo一致
* TODO 内蒙古平台文档中的接口检查一下是否和订单信息推送notification_orderInfo一致
*
* @param orderCode 订单编号
* @throws UnsupportedOperationException 未实现异常
*/
default String notificationChargeOrderInfo(String orderCode) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 告警信息推送 notification_alarmInfo
*
* @throws UnsupportedOperationException 未实现异常
*/
default String notificationAlarmInfo() {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 推送启动充电结果 notification_start_charge_result
*
* @param orderCode 订单编号
* @throws UnsupportedOperationException 未实现异常
*/
default String notificationStartChargeResult(String orderCode) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 推送充电状态 notification_equip_charge_status
* 推送充电状态信息 supervise_notification_equip_charge_status
*
* @param orderCode 订单编号
* @throws UnsupportedOperationException 未实现异常
*/
default String notificationEquipChargeStatus(String orderCode) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 推送停止充电结果 notification_stop_charge_result
*
* @param orderCode 订单编号
* @throws UnsupportedOperationException 未实现异常
*/
default String notificationStopChargeResult(String orderCode) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 华为平台
* 平台充电设备编码同步 notification_operation_system_info
*
* @throws UnsupportedOperationException 未实现异常
*/
default String notificationOperationSystemInfo(String orderCode) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 推送充换电站用能统计信息 supervise_notification_operation_stats_info
*
* @throws UnsupportedOperationException 未实现异常
*/
default String notificationOperationStatsInfo(String stationId) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 推送充电站历史充电订单信息 supervise_notification_charge_order_info_history
*
* @throws UnsupportedOperationException 未实现异常
*/
default String notificationChargeOrderInfoHistory(String stationId) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
// -------------------------------------- 以下是公用方法 --------------------------------------- //
/**
* 从联联平台获取令牌
*
* @param operatorId 运营商id
* @param operatorSecret
* @return
*/
default String getToken(String urlAddress, String operatorId, String operatorSecret,
String dataSecretIv, String signSecret, String dataSecret) {
String token = "";
try {
// 请求地址
String requestUrl = urlAddress + "query_token";
// 请求data
Map<String, String> data = new HashMap<>();
data.put("OperatorID", operatorId);
data.put("OperatorSecret", operatorSecret);
data.put("DataSecretIV", dataSecretIv);
String dataJson = JSONUtil.toJsonStr(data);
// 加密
byte[] encryptText = Cryptos.aesEncrypt(dataJson.getBytes(StandardCharsets.UTF_8),
dataSecret.getBytes(), dataSecretIv.getBytes());
String strData = Encodes.encodeBase64(encryptText);
Map<String, String> request = new LinkedHashMap<>();
request.put("OperatorID", operatorId);
request.put("Data", strData);
request.put("TimeStamp", DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSS, new Date()));
request.put("Seq", "0001");
// 生成签名
String sig = GBSignUtils.sign(request, signSecret);
request.put("Sig", sig);
String tokenRequest = JSONUtil.toJsonStr(request);
String response = HttpUtil.post(requestUrl, tokenRequest);
LianLianResultVO result = JSON.parseObject(response, LianLianResultVO.class);
// logger.info("获取令牌 result:{}", result);
if (result.getRet() == 0) {
// 解密data
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64((String) result.getData()),
dataSecret.getBytes(), dataSecretIv.getBytes());
String dataStr = new String(plainText, StandardCharsets.UTF_8);
Map<String, String> resultMap = (Map<String, String>) JSON.parse(dataStr);
token = resultMap.get("AccessToken");
// logger.info("token: {}", token);
}
// logger.info("获取令牌 result:{}, token: {}", result, token);
} catch (Exception e) {
return token;
}
return token;
}
}

View File

@@ -1,7 +1,7 @@
package com.jsowell.thirdparty.platform.hainan.domain;
import com.alibaba.fastjson2.annotation.JSONField;
import com.jsowell.thirdparty.zhongdianlian.domain.ZDLStationInfo;
import com.jsowell.pile.thirdparty.ZDLStationInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

View File

@@ -20,7 +20,7 @@ import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.*;
import com.jsowell.pile.domain.ykcCommond.StartChargingCommand;
import com.jsowell.pile.dto.*;
import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO;
import com.jsowell.pile.service.*;
import com.jsowell.pile.vo.base.ConnectorInfoVO;
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
@@ -40,13 +40,17 @@ import com.jsowell.thirdparty.lianlian.vo.EquipmentAuthVO;
import com.jsowell.thirdparty.lianlian.vo.QueryChargingStatusVO;
import com.jsowell.thirdparty.lianlian.vo.QueryStartChargeVO;
import com.jsowell.thirdparty.lianlian.vo.QueryStopChargeVO;
import com.jsowell.thirdparty.platform.AbsInterfaceWithPlatformLogic;
import com.jsowell.thirdparty.platform.InterfaceWithPlatformLogicFactory;
import com.jsowell.thirdparty.platform.ThirdPartyPlatformService;
import com.jsowell.thirdparty.platform.hainan.domain.HNStationInfo;
import com.jsowell.thirdparty.zhongdianlian.domain.ZDLEquipmentInfo;
import com.jsowell.pile.thirdparty.ZDLEquipmentInfo;
import com.jsowell.thirdparty.zhongdianlian.service.ZDLService;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.nio.charset.StandardCharsets;
@@ -63,30 +67,61 @@ import java.util.stream.Collectors;
* @Date 2024/1/18 10:05:23
*/
@Service
public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
@Override
public void afterPropertiesSet() throws Exception {
InterfaceWithPlatformLogicFactory.register(ThirdPlatformTypeEnum.HAI_NAN_1.getCode(), this);
}
public class HaiNanPlatformLogic implements ThirdPartyPlatformService {
Logger logger = LoggerFactory.getLogger(HaiNanPlatformLogic.class);
// 平台类型
private final String platformType = ThirdPlatformTypeEnum.HAI_NAN_1.getTypeCode();
@Autowired
private PileMerchantInfoService pileMerchantInfoService;
@Autowired
private PileStationInfoService pileStationInfoService;
@Autowired
private PileBasicInfoService pileBasicInfoService;
@Autowired
private PileConnectorInfoService pileConnectorInfoService;
@Autowired
private PileBillingTemplateService pileBillingTemplateService;
@Autowired
private OrderBasicInfoService orderBasicInfoService;
@Autowired
private ThirdPartyPlatformConfigService thirdPartyPlatformConfigService;
@Autowired
private ThirdPartySettingInfoService thirdPartySettingInfoService;
@Resource
private ThirdPartyStationRelationService thirdPartyStationRelationService;
@Autowired
private YKCPushCommandService ykcPushCommandService;
@Autowired
private PileRemoteService pileRemoteService;
@Autowired
private ZDLService zdlService;
// @Override
// public void afterPropertiesSet() throws Exception {
// InterfaceWithPlatformLogicFactory.register(platformType, this);
// }
public String pushStationInfoV2(PushStationInfoDTO dto) {
return zdlService.pushStationInfoV2(dto);
}
/**
* 查询运营商信息
*
* @param dto 查询运营商信息DTO
*/
@Override
public Map<String, String> queryOperatorInfo(QueryOperatorInfoDTO dto) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 6.2 查询充电站信息
*/
@Override
public Map<String, String> queryStationsInfo(QueryStationInfoDTO dto) {
// 查询出要查询的充电站id并set进 dto 的stationIds
if (StringUtils.isNotBlank(dto.getThirdPlatformType())) {
@@ -154,7 +189,7 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
stationInfo.setPictures(Lists.newArrayList());
}
List<ZDLEquipmentInfo> pileList = getPileList(pileStationInfo);
List<ZDLEquipmentInfo> pileList = pileBasicInfoService.getPileListForZDL(stationId);
if (CollectionUtils.isNotEmpty(pileList)) {
stationInfo.setEquipmentInfos(pileList); // 充电设备信息列表
}
@@ -278,40 +313,6 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
return result;
}
/**
* 设备充电中状态变化推送 notification_connector_charge_status
*
* @param pileConnectorCode 充电枪口编号
* @param status 枪口状态
*/
@Override
public String notificationConnectorChargeStatus(String orderCode) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 订单信息推送 notification_orderInfo
*
* @param orderCode
*/
@Override
public String notificationOrderInfo(String orderCode) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 站点费率变化推送 notification_stationFee
*
* @param stationId
*/
@Override
public String notificationStationFee(String stationId) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 6.4 充电订单推送
*
@@ -360,15 +361,6 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
return result;
}
/**
* 告警信息推送 notification_alarmInfo
*/
@Override
public String notificationAlarmInfo() {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 6.5 设备接口状态查询
*
@@ -559,29 +551,6 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
return resultMap;
}
/**
* 查询充电电量信息 query_order_info
*
* @param orderCode
*/
@Override
public Map<String, String> queryOrderInfo(String orderCode) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 充电站信息变化推送 notification_stationInfo
* 新站需要推送。当站点信息发生变化时,推送新的信息通知到市级平台
*
* @param stationId 充电站id
*/
@Override
public String notificationStationInfo(String stationId) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 请求设备认证
*
@@ -700,29 +669,6 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
return resultMap;
}
/**
* VIN码充电 insert_start_charge
* 华为平台
*
* @param dto
*/
@Override
public Map<String, String> insertStartCharge(QueryStationInfoDTO dto) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 下发计费策略响应 notification_deliver_equip_business_policy_result
* 华为平台
*
* @param dto
*/
@Override
public Map<String, String> notificationDeliverEquipBusinessPolicyResult(QueryStationInfoDTO dto) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 推送启动充电结果
@@ -827,7 +773,7 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
.build();
String type = ThirdPartyOperatorIdEnum.getTypeByOperatorId(dto.getOperatorId());
if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), type)) {
if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), type)) {
// 如果是新电途平台,则将 startChargeSeqStat 改为 1-启动中
vo.setStartChargeSeqStat(1);
}
@@ -855,7 +801,7 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
public Map<String, String> queryEquipChargeStatus(QueryEquipChargeStatusDTO dto) {
String operatorID = dto.getOperatorID();
String type = ThirdPartyOperatorIdEnum.getTypeByOperatorId(operatorID);
String operatorName = ThirdPlatformTypeEnum.getLabelByCode(type);
String operatorName = ThirdPlatformTypeEnum.getTypeLabelByTypeCode(type);
// 通过订单号查询订单信息
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(dto.getStartChargeSeq());
// logger.info(operatorName + "查询订单信息 orderInfo:{}", orderInfo);
@@ -1017,7 +963,7 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
vo.setFailReason(0);
String type = ThirdPartyOperatorIdEnum.getTypeByOperatorId(dto.getOperatorId());
if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), type)) {
if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), type)) {
// 如果是新电途平台,则将 startChargeSeqStat 改为 3-停止中
vo.setStartChargeSeqStat(3);
}
@@ -1035,39 +981,6 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
return resultMap;
}
/**
* 充电站内充电桩空闲状态查询 query_free_pile_number
*
* @param dto
*/
@Override
public Map<String, String> queryFreePileNumber(NXJTQueryStationInfoDTO dto) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 某车牌号消费记录查询 query_orders_info_by_Plate_number
*
* @param dto
*/
@Override
public Map<String, String> queryOrdersInfoByPlateNumber(NXJTQueryStationInfoDTO dto) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 某段时间内消费记录查询 query_orders_info
*
* @param dto
*/
@Override
public Map<String, String> queryOrdersInfo(NXJTQueryStationInfoDTO dto) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 推送停止充电结果
*
@@ -1114,38 +1027,4 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
return result;
}
/**
* 华为平台
* 平台充电设备编码同步 notification_operation_system_info
*
* @param orderCode
*/
@Override
public String notificationOperationSystemInfo(String orderCode) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 推送充换电站用能统计信息 supervise_notification_operation_stats_info
*
* @param stationId
*/
@Override
public String notificationOperationStatsInfo(String stationId) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 推送充电站历史充电订单信息 supervise_notification_charge_order_info_history
*
* @param stationId
*/
@Override
public String notificationChargeOrderInfoHistory(String stationId) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
}

View File

@@ -18,8 +18,8 @@ import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.PageUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.*;
import com.jsowell.pile.dto.*;
import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO;
import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.pile.service.*;
import com.jsowell.pile.thirdparty.EquipmentInfo;
import com.jsowell.pile.vo.base.*;
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
@@ -31,10 +31,12 @@ import com.jsowell.thirdparty.lianlian.util.Cryptos;
import com.jsowell.thirdparty.lianlian.util.Encodes;
import com.jsowell.thirdparty.lianlian.util.GBSignUtils;
import com.jsowell.thirdparty.lianlian.util.HttpRequestUtil;
import com.jsowell.thirdparty.platform.AbsInterfaceWithPlatformLogic;
import com.jsowell.thirdparty.platform.InterfaceWithPlatformLogicFactory;
import com.jsowell.thirdparty.platform.ThirdPartyPlatformService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.LinkedHashMap;
@@ -42,27 +44,43 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic {
@Service
public class LianLianPlatformLogic implements ThirdPartyPlatformService {
// 平台类型
private final String platformType = ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode();
private final String platformType = ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode();
@Override
public void afterPropertiesSet() throws Exception {
InterfaceWithPlatformLogicFactory.register(platformType, this);
}
@Autowired
private PileMerchantInfoService pileMerchantInfoService;
/**
* 查询运营商信息 query_operator_info
* supervise_query_operator_info
*
* @param dto 查询运营商信息DTO
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public Map<String, String> queryOperatorInfo(QueryOperatorInfoDTO dto) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
@Autowired
private PileStationInfoService pileStationInfoService;
@Autowired
private PileBasicInfoService pileBasicInfoService;
@Autowired
private PileConnectorInfoService pileConnectorInfoService;
@Autowired
private PileBillingTemplateService pileBillingTemplateService;
@Autowired
private OrderBasicInfoService orderBasicInfoService;
@Autowired
private ThirdPartyPlatformConfigService thirdPartyPlatformConfigService;
@Autowired
private ThirdPartySettingInfoService thirdPartySettingInfoService;
@Resource
private ThirdPartyStationRelationService thirdPartyStationRelationService;
// @Override
// public void afterPropertiesSet() throws Exception {
// InterfaceWithPlatformLogicFactory.register(platformType, this);
// }
/**
* 查询充电站信息 query_stations_info
@@ -90,7 +108,8 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic {
PageInfo<ThirdPartyStationInfoVO> pageInfo = new PageInfo<>(stationInfos);
for (ThirdPartyStationInfoVO pileStationInfo : pageInfo.getList()) {
StationInfo stationInfo = new StationInfo();
stationInfo.setStationID(String.valueOf(pileStationInfo.getId()));
String stationId = String.valueOf(pileStationInfo.getId());
stationInfo.setStationID(stationId);
// MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfo(String.valueOf(pileStationInfo.getMerchantId()));
stationInfo.setOperatorID(Constants.OPERATORID_LIANLIAN); // 组织机构代码
stationInfo.setEquipmentOwnerID(String.valueOf(pileStationInfo.getMerchantId()));
@@ -123,7 +142,7 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic {
stationInfo.setBarrierFlag(Integer.valueOf(pileStationInfo.getBarrierFlag()));
stationInfo.setParkingLockFlag(Integer.valueOf(pileStationInfo.getParkingLockFlag()));
List<EquipmentInfo> pileList = pileBasicInfoService.getPileList(pileStationInfo);
List<EquipmentInfo> pileList = pileBasicInfoService.getPileListForLianLian(stationId);
if (CollectionUtils.isNotEmpty(pileList)) {
stationInfo.setEquipmentInfos(pileList); // 充电设备信息列表
}
@@ -168,7 +187,7 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic {
}
ConnectorStatusInfo connectorStatusInfo;
for (String stationId : stationIds) {
StationStatusInfo stationStatusInfo= new StationStatusInfo();
StationStatusInfo stationStatusInfo = new StationStatusInfo();
stationStatusInfo.setStationId(stationId);
// 根据站点id查询
List<ConnectorInfoVO> list = pileConnectorInfoService.getConnectorListForLianLian(Long.parseLong(stationId));
@@ -183,7 +202,7 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic {
continue;
}
List<RealTimeMonitorData> chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderBasicInfo.getTransactionCode());
if(CollectionUtils.isNotEmpty(chargingRealTimeData)) {
if (CollectionUtils.isNotEmpty(chargingRealTimeData)) {
RealTimeMonitorData realTimeMonitorData = chargingRealTimeData.get(0);
info.setStartChargeSeq(orderBasicInfo.getOrderCode());
@@ -342,141 +361,6 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic {
return resultMap;
}
/**
* 查询充电电量信息 query_order_info
*
* @param orderCode
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public Map<String, String> queryOrderInfo(String orderCode) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 请求设备认证 query_equip_auth
* 业务信息交换
*
* @param dto 联联平台请求设备认证
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public Map<String, String> queryEquipAuth(QueryEquipmentDTO dto) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 请求启动充电 query_start_charge
*
* @param dto 请求启动充电DTO
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public Map<String, String> queryStartCharge(QueryStartChargeDTO dto) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 查询充电状态 query_equip_charge_status
*
* @param dto 查询充电状态DTO
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public Map<String, String> queryEquipChargeStatus(QueryEquipChargeStatusDTO dto) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 请求停止充电 query_stop_charge
*
* @param dto 请求启动充电DTO
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public Map<String, String> queryStopCharge(QueryStartChargeDTO dto) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 充电站内充电桩空闲状态查询 query_free_pile_number
*
* @param dto
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public Map<String, String> queryFreePileNumber(NXJTQueryStationInfoDTO dto) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 某车牌号消费记录查询 query_orders_info_by_Plate_number
*
* @param dto
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public Map<String, String> queryOrdersInfoByPlateNumber(NXJTQueryStationInfoDTO dto) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 某段时间内消费记录查询 query_orders_info
*
* @param dto
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public Map<String, String> queryOrdersInfo(NXJTQueryStationInfoDTO dto) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 查询业务策略信息结果
* 请求计费策略 request_equip_business_policy
*
* @param dto 请求启动充电DTO
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public Map<String, String> queryEquipBusinessPolicy(QueryStartChargeDTO dto) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* VIN码充电 insert_start_charge
* 华为平台
*
* @param dto
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public Map<String, String> insertStartCharge(QueryStationInfoDTO dto) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 下发计费策略响应 notification_deliver_equip_business_policy_result
* 华为平台
*
* @param dto
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public Map<String, String> notificationDeliverEquipBusinessPolicyResult(QueryStationInfoDTO dto) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 充电站信息变化推送 notification_stationInfo
@@ -541,11 +425,11 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic {
info.setAreaCode(subAreaCode);
// 截取运营商组织机构代码(去除最后一位后的最后九位)
String organizationCode = "";
if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), platformType)) {
if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), platformType)) {
// 联联平台先使用自己运营商的组织机构代码
organizationCode = Constants.OPERATORID_LIANLIAN;
info.setEquipmentOwnerID(organizationCode);
}else {
} else {
MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfoVO(String.valueOf(pileStationInfo.getMerchantId()));
organizationCode = merchantInfo.getOrganizationCode();
if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) {
@@ -576,7 +460,7 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic {
if (StringUtils.isNotBlank(String.valueOf(pileStationInfo.getCapacity()))) {
info.setCapacity(pileStationInfo.getCapacity().setScale(4, BigDecimal.ROUND_HALF_UP));
}
List<EquipmentInfo> pileList = pileBasicInfoService.getPileList(pileStationInfo);
List<EquipmentInfo> pileList = pileBasicInfoService.getPileListForLianLian(stationId);
if (CollectionUtils.isNotEmpty(pileList)) {
info.setEquipmentInfos(pileList); // 充电设备信息列表
}
@@ -884,105 +768,5 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic {
return result;
}
/**
* 充电订单推送 notification_charge_order_info
* TODO 海南一张网文档中的接口检查一下是否和订单信息推送notification_orderInfo一致
* TODO 甬城泊车平台文档中的接口检查一下是否和订单信息推送notification_orderInfo一致
* TODO 华为平台文档中的接口检查一下是否和订单信息推送notification_orderInfo一致
* TODO 内蒙古平台文档中的接口检查一下是否和订单信息推送notification_orderInfo一致
*
* @param orderCode 订单编号
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public String notificationChargeOrderInfo(String orderCode) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 告警信息推送 notification_alarmInfo
*
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public String notificationAlarmInfo() {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 推送启动充电结果 notification_start_charge_result
*
* @param orderCode 订单编号
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public String notificationStartChargeResult(String orderCode) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 推送充电状态 notification_equip_charge_status
* 推送充电状态信息 supervise_notification_equip_charge_status
*
* @param orderCode 订单编号
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public String notificationEquipChargeStatus(String orderCode) throws UnsupportedOperationException {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 推送停止充电结果 notification_stop_charge_result
*
* @param orderCode 订单编号
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public String notificationStopChargeResult(String orderCode) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 华为平台
* 平台充电设备编码同步 notification_operation_system_info
*
* @param orderCode
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public String notificationOperationSystemInfo(String orderCode) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 推送充换电站用能统计信息 supervise_notification_operation_stats_info
*
* @param stationId
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public String notificationOperationStatsInfo(String stationId) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 推送充电站历史充电订单信息 supervise_notification_charge_order_info_history
*
* @param stationId
* @throws UnsupportedOperationException 未实现异常
*/
@Override
public String notificationChargeOrderInfoHistory(String stationId) {
//方法未实现,抛出异常
throw new UnsupportedOperationException("This method is not yet implemented");
}
}

View File

@@ -5,17 +5,21 @@ import com.jsowell.pile.dto.*;
import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO;
import com.jsowell.thirdparty.platform.AbsInterfaceWithPlatformLogic;
import com.jsowell.thirdparty.platform.InterfaceWithPlatformLogicFactory;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* 内蒙古监测平台逻辑
*/
@Service
public class NeiMengGuPlatformLogic extends AbsInterfaceWithPlatformLogic {
// 平台类型
private final String platformType = ThirdPlatformTypeEnum.NEI_MENG_GU_PLATFORM.getTypeCode();
@Override
public void afterPropertiesSet() throws Exception {
InterfaceWithPlatformLogicFactory.register(ThirdPlatformTypeEnum.NEI_MENG_GU_PLATFORM.getCode(), this);
InterfaceWithPlatformLogicFactory.register(platformType, this);
}
/**