This commit is contained in:
YAS\29473
2024-12-02 15:05:52 +08:00
parent 8c371f3cb2
commit abe12c12c0
5 changed files with 133 additions and 80 deletions

View File

@@ -114,6 +114,13 @@ public class EquipmentInfo {
@JSONField(name = "SupConnectorInfos") @JSONField(name = "SupConnectorInfos")
private List<ConnectorInfo> supconnectorInfos; private List<ConnectorInfo> supconnectorInfos;
/**
* 充电设备接口列表 Y
* 该充电设备所有的充电设备接口的信息对象集合
*/
@JSONField(name = "ConnectorInfos")
private List<ConnectorInfo> connectorInfos;
/** /**
* 充电设备经度 N * 充电设备经度 N
* GCJ-02坐标系 * GCJ-02坐标系

View File

@@ -33,6 +33,14 @@ public class ConnectorStatusInfo {
@JSONField(name = "Status") @JSONField(name = "Status")
private Integer status; private Integer status;
/**
* 设备接口分类
* 1车辆充电设备接口
* 2换电站内的电池箱 充电设备接口
*/
@JSONField(name = "EquipmentClassification")
private int equipmentClassification;
/** /**
* 车位状态(0-未知10-空闲50-占用) N * 车位状态(0-未知10-空闲50-占用) N
*/ */
@@ -60,4 +68,11 @@ public class ConnectorStatusInfo {
@JSONField(name = "EquipmentID") @JSONField(name = "EquipmentID")
private String equipmentId; private String equipmentId;
/**
* 状态更新时间
* 本次状态变化的时间格式“yyyy-MM-dd HH:mm:ss”
*/
@JSONField(name = "UpdateTime")
private String updateTime;
} }

View File

@@ -30,7 +30,7 @@ public class SupStationInfo extends StationInfo {
* 2换电站内的电池箱充电设备接口 * 2换电站内的电池箱充电设备接口
*/ */
@JSONField(name = "EquipmentClassification") @JSONField(name = "EquipmentClassification")
private Integer equipmentClassification; private String equipmentClassification;
/** /**
* 充换电站所在县以下行政区划代码 * 充换电站所在县以下行政区划代码

View File

@@ -456,7 +456,7 @@ public interface ThirdPartyPlatformService extends InitializingBean {
String response = HttpUtil.post(requestUrl, tokenRequest); String response = HttpUtil.post(requestUrl, tokenRequest);
LianLianResultVO result = JSON.parseObject(response, LianLianResultVO.class); LianLianResultVO result = JSON.parseObject(response, LianLianResultVO.class);
// logger.info("获取令牌 result:{}", result); // logger.info("获取令牌 result:{}", result);
if (result.getRet() == 0) { if (result.getRet() == 0) {
// 解密data // 解密data

View File

@@ -11,7 +11,6 @@ import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData; import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
import com.jsowell.common.core.redis.RedisCache; import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.lianlian.StationPaymentEnum; import com.jsowell.common.enums.lianlian.StationPaymentEnum;
import com.jsowell.common.enums.thirdparty.BusinessInformationExchangeEnum;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
import com.jsowell.common.enums.ykc.BillingTimeTypeEnum; import com.jsowell.common.enums.ykc.BillingTimeTypeEnum;
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum; import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
@@ -19,7 +18,6 @@ import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException; import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.*; import com.jsowell.common.util.*;
import com.jsowell.pile.domain.*; import com.jsowell.pile.domain.*;
import com.jsowell.pile.dto.PushRealTimeInfoDTO;
import com.jsowell.pile.dto.QueryConnectorListDTO; import com.jsowell.pile.dto.QueryConnectorListDTO;
import com.jsowell.pile.dto.QueryOperatorInfoDTO; import com.jsowell.pile.dto.QueryOperatorInfoDTO;
import com.jsowell.pile.dto.QueryStationInfoDTO; import com.jsowell.pile.dto.QueryStationInfoDTO;
@@ -32,10 +30,11 @@ import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
import com.jsowell.pile.vo.base.ConnectorInfoVO; import com.jsowell.pile.vo.base.ConnectorInfoVO;
import com.jsowell.pile.vo.base.MerchantInfoVO; import com.jsowell.pile.vo.base.MerchantInfoVO;
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO; import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
import com.jsowell.pile.vo.uniapp.customer.BillingPriceVO; import com.jsowell.pile.vo.uniapp.customer.BillingPriceVO;
import com.jsowell.pile.vo.uniapp.customer.OrderVO;
import com.jsowell.pile.vo.web.PileConnectorInfoVO; import com.jsowell.pile.vo.web.PileConnectorInfoVO;
import com.jsowell.pile.vo.web.PileMerchantInfoVO; import com.jsowell.pile.vo.web.PileMerchantInfoVO;
import com.jsowell.pile.vo.web.PileStationVO;
import com.jsowell.thirdparty.lianlian.domain.ConnectorChargeStatusInfo; import com.jsowell.thirdparty.lianlian.domain.ConnectorChargeStatusInfo;
import com.jsowell.thirdparty.lianlian.domain.ConnectorStatusInfo; import com.jsowell.thirdparty.lianlian.domain.ConnectorStatusInfo;
import com.jsowell.thirdparty.lianlian.domain.StationStatusInfo; import com.jsowell.thirdparty.lianlian.domain.StationStatusInfo;
@@ -297,13 +296,18 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
.stationID(stationId) .stationID(stationId)
.operatorID(operatorId) .operatorID(operatorId)
.stationName(pileStationInfo.getStationName()) .stationName(pileStationInfo.getStationName())
.equipmentClassification(Constants.ONE)
.periodFee(1) // 峰谷分时 0-否1-是
.parkType("255") // 255-参考场地实际收费标准
.roundTheClock(Constants.ONE)
.electricityType(1) // 用电类型 1-商业用电
.videoMonitor(0) // 视频监控配套情况 0-无1-有
.isAloneApply(Integer.valueOf(pileStationInfo.getAloneApply())) .isAloneApply(Integer.valueOf(pileStationInfo.getAloneApply()))
.isPublicParkingLot(Integer.valueOf(pileStationInfo.getPublicParking())) .isPublicParkingLot(Integer.valueOf(pileStationInfo.getPublicParking()))
.countryCode(pileStationInfo.getCountryCode()) .countryCode(pileStationInfo.getCountryCode())
.address(pileStationInfo.getAddress()) .address(pileStationInfo.getAddress())
.serviceTel(pileStationInfo.getStationTel()) .serviceTel(pileStationInfo.getStationTel())
.swapMatchCars(pileStationInfo.getSwapMatchCars()) .stationClassification(1)
.generalApplicationType(pileStationInfo.getGeneralApplicationType())
.stationType(Integer.valueOf(pileStationInfo.getStationType())) .stationType(Integer.valueOf(pileStationInfo.getStationType()))
.stationStatus(Integer.valueOf(pileStationInfo.getStationStatus())) .stationStatus(Integer.valueOf(pileStationInfo.getStationStatus()))
.parkNums(Integer.valueOf(pileStationInfo.getParkNums())) .parkNums(Integer.valueOf(pileStationInfo.getParkNums()))
@@ -317,9 +321,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
.parkFree(Integer.valueOf(pileStationInfo.getParkFree())) .parkFree(Integer.valueOf(pileStationInfo.getParkFree()))
.supportOrder(Integer.valueOf(pileStationInfo.getSupportOrder())) .supportOrder(Integer.valueOf(pileStationInfo.getSupportOrder()))
.parkFeeType(0) .parkFeeType(0)
.periodFee(1) // 峰谷分时 0-否1-是
.equipmentClassification(1)
.businessExpandType(0)
.toiletFlag(Integer.valueOf(pileStationInfo.getToiletFlag())) .toiletFlag(Integer.valueOf(pileStationInfo.getToiletFlag()))
.storeFlag(Integer.valueOf(pileStationInfo.getStoreFlag())) .storeFlag(Integer.valueOf(pileStationInfo.getStoreFlag()))
.restaurantFlag(Integer.valueOf(pileStationInfo.getRestaurantFlag())) .restaurantFlag(Integer.valueOf(pileStationInfo.getRestaurantFlag()))
@@ -367,7 +369,6 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
List<EquipmentInfo> pileList = pileBasicInfoService.getPileListForLianLian(stationId); List<EquipmentInfo> pileList = pileBasicInfoService.getPileListForLianLian(stationId);
if (CollectionUtils.isNotEmpty(pileList)) { if (CollectionUtils.isNotEmpty(pileList)) {
info.setEquipmentInfos(pileList); // 充电设备信息列表 info.setEquipmentInfos(pileList); // 充电设备信息列表
info.setEquipmentClassification(0);
} }
// areaCodeCountryside // areaCodeCountryside
@@ -477,40 +478,47 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
} }
/** /**
* 设备状态变化推送 notification_stationStatus * 推送充电设备接口状态信息
* 推送充电设备接口状态信息 supervise_notification_station_status * supervise_notification_connector_status
*
* @param dto
* @throws UnsupportedOperationException 未实现异常
*/ */
@Override @Override
public String notificationStationStatus(PushRealTimeInfoDTO dto) { public String notificationStationStatus(String stationId, String pileConnectorCode, String status, ThirdPartySecretInfoVO secretInfoVO) {
String status = dto.getStatus(); // 查询充电枪口状态
String pileConnectorCode = dto.getPileConnectorCode(); PileConnectorInfoVO connectorInfo = pileConnectorInfoService.getPileConnectorInfoByConnectorCode(pileConnectorCode);
if (Objects.isNull(connectorInfo)) {
throw new BusinessException(ReturnCodeEnum.CODE_CONNECTOR_INFO_NULL_ERROR);
}
// 查出该桩所属哪个站点 String merchantId = connectorInfo.getMerchantId();
// String pileSn = StringUtils.substring(pileConnectorCode, 0, 14); MerchantInfoVO merchantInfoVO = pileMerchantInfoService.getMerchantInfoVO(merchantId);
String pileSn = YKCUtils.getPileSn(pileConnectorCode); if (Objects.isNull(merchantInfoVO)) {
PileStationVO stationVO = pileStationInfoService.getStationInfoByPileSn(pileSn); throw new BusinessException(ReturnCodeEnum.CODE_CONNECTOR_INFO_NULL_ERROR);
// 通过站点id查询相关配置信息 }
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getGuiZhouPlatformSecretInfo();
String operatorId = thirdPartySecretInfoVO.getOurOperatorId(); SupConnectorStatusInfo info = SupConnectorStatusInfo.builder()
String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret(); .operatorID(Constants.OPERATORID_JIANG_SU)
String signSecret = thirdPartySecretInfoVO.getTheirSigSecret(); .equipmentOwnerID(MerchantUtils.getOperatorID(merchantInfoVO.getOrganizationCode()))
String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret(); .stationID(connectorInfo.getStationId())
String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv(); .equipmentID(connectorInfo.getPileSn())
String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix();
String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_STATION_STATUS.getValue();
ConnectorStatusInfo info = ConnectorStatusInfo.builder()
.connectorID(pileConnectorCode) .connectorID(pileConnectorCode)
.status(Integer.parseInt(status)) .status(Integer.parseInt(status))
.statusDesc(PileConnectorDataBaseStatusEnum.getStatusDescription(status))
.parkStatus(Constants.zero)
.lockStatus(Constants.zero)
.updateTime(DateUtils.getDateTime())
.equipmentClassification(Constants.ONE)
.build(); .build();
// 调用联联平台接口 // 调用联联平台接口
JSONObject json = new JSONObject(); String operatorId = Constants.OPERATORID_JIANG_SU;
json.put("ConnectorStatusInfo", info); String operatorSecret = secretInfoVO.getTheirOperatorSecret();
String jsonString = JSON.toJSONString(json); String signSecret = secretInfoVO.getTheirSigSecret();
String dataSecret = secretInfoVO.getTheirDataSecret();
String dataSecretIv = secretInfoVO.getTheirDataSecretIv();
String urlAddress = secretInfoVO.getTheirUrlPrefix();
String url = urlAddress + "supervise_notification_connector_status";
String jsonString = JSON.toJSONString(info);
// 获取令牌 // 获取令牌
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret); String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
@@ -589,64 +597,87 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
* supervise_notification_charge_order_info * supervise_notification_charge_order_info
*/ */
@Override @Override
public String notificationChargeOrderInfo(String orderCode, ThirdPartySecretInfoVO secretInfoVO) { public String notificationChargeOrderInfo(String orderCode) {
// 根据订单号查询信息 // 通过订单号查询订单信息
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode); OrderVO orderVO = orderBasicInfoService.getChargeOrderInfoByOrderCode(orderCode);
if (orderBasicInfo == null) { BigDecimal startSoc = orderVO.getStartSoc() == null ? BigDecimal.ZERO : new BigDecimal(orderVO.getStartSoc());
return null; BigDecimal endSoc = orderVO.getEndSoc() == null ? BigDecimal.ZERO : new BigDecimal(orderVO.getEndSoc());
}
String operatorId = Constants.OPERATORID_JIANG_SU; com.jsowell.thirdparty.platform.common.ChargeOrderInfo chargeOrderInfo = com.jsowell.thirdparty.platform.common.ChargeOrderInfo.builder()
String operatorSecret = secretInfoVO.getTheirOperatorSecret(); .operatorId(Constants.OPERATORID_JIANG_SU)
String signSecret = secretInfoVO.getTheirSigSecret(); // .equipmentId()
String dataSecret = secretInfoVO.getTheirDataSecret(); .stationId(orderVO.getStationId())
String dataSecretIv = secretInfoVO.getTheirDataSecretIv(); .equipmentId(orderVO.getPileSn())
String urlAddress = secretInfoVO.getTheirUrlPrefix(); .equipmentClassification(Constants.one)
.connectorId(orderVO.getPileConnectorCode())
.startChargeSeq(orderVO.getOrderCode())
.startSoc(startSoc)
.endSoc(endSoc)
.totalMoney(orderVO.getOrderAmount())
.totalElecMoney(orderVO.getTotalElectricityAmount())
.totalSeviceMoney(orderVO.getTotalServiceAmount())
.totalPower(new BigDecimal(orderVO.getTotalPower()))
.startTime(orderVO.getStartTime())
.endTime(orderVO.getEndTime())
.paymentAmount(orderVO.getPayAmount())
.payTime(orderVO.getPayTime())
// .payWay(orderVO.getPayMode())
.stopReason(Constants.two) // 2-BMS 停止充电
.startMeterNum(BigDecimal.ZERO) // 电表起止值(暂时给0)
.endMeterNum(BigDecimal.ZERO)
// 根据订单号查询订单详情 .build();
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode); // 设备产权所属单位ID
if (orderDetail == null) { String organizationCode = orderVO.getOrganizationCode();
return null; if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) {
} String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1);
chargeOrderInfo.setEquipmentOwnerId(equipmentOwnerId);
// 推送地址
String url = urlAddress + "supervise_notification_charge_order_info";
// 拼装成平台所需格式对象
ChargeOrderInfo orderInfo = transformChargeOrderInfo(orderBasicInfo, orderDetail);
orderInfo.setOperatorID(operatorId);
String equipmentOwnerID;
if (MerchantUtils.isXiXiaoMerchant(orderBasicInfo.getMerchantId())) {
equipmentOwnerID = Constants.OPERATORID_XI_XIAO;
} else { } else {
PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(orderInfo.getStationID()); chargeOrderInfo.setEquipmentOwnerId(Constants.OPERATORID_JIANG_SU);
String organizationCode = pileMerchantInfoVO.getOrganizationCode(); }
if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { // 支付方式
equipmentOwnerID = ThirdPartyPlatformUtils.extractEquipmentOwnerID(pileMerchantInfoVO.getOrganizationCode()); String payMode = orderVO.getPayMode();
} else { if (StringUtils.equals("4", payMode)) {
equipmentOwnerID = Constants.OPERATORID_JIANG_SU; // 微信支付
} chargeOrderInfo.setPayWay(2);
} else {
chargeOrderInfo.setPayWay(6);
} }
orderInfo.setEquipmentOwnerID(equipmentOwnerID);
List<BillingPriceVO> billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId()); // 获取推送配置密钥信息
// 先将list按照 尖、峰、平、谷 时段排序 ThirdPartyStationRelationVO settingInfo = getGuiZhouSettingInfo();
// List<BillingPriceVO> collect = billingList.stream().sorted(Comparator.comparing(BillingPriceVO::getTimeType)).collect(Collectors.toList()); if (settingInfo == null) {
// 再循环该list拼装对应的充电价格、费率 return null;
List<SupChargeDetails> chargeDetails = transformSupChargeDetails(orderDetail, billingList); }
orderInfo.setChargeDetails(chargeDetails); String operatorId = settingInfo.getOperatorId();
String operatorSecret = settingInfo.getOperatorSecret();
String signSecret = settingInfo.getSignSecret();
String dataSecret = settingInfo.getDataSecret();
String dataSecretIv = settingInfo.getDataSecretIv();
String urlAddress = settingInfo.getUrlAddress();
String url = urlAddress + "notification_charge_order_info";
// 获取令牌 // 获取令牌
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret); String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
if (StringUtils.isBlank(token)) { if (StringUtils.isBlank(token)) {
return null; return null;
} }
// 调用联联平台接口 // 封装参数
String jsonString = JSON.toJSONString(orderInfo); String jsonString = JSON.toJSONString(chargeOrderInfo);
// 发送请求
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
return result; return result;
} }
// 获取青海平台配置密钥信息
private ThirdPartyStationRelationVO getGuiZhouSettingInfo() {
// 通过第三方平台类型查询相关配置信息
ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
relation.setThirdPartyType(ThirdPlatformTypeEnum.QING_HAI_PLATFORM.getTypeCode());
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
return relationInfo;
}
/** /**
* 推送充电站历史充电订单信息 supervise_notification_charge_order_info_history * 推送充电站历史充电订单信息 supervise_notification_charge_order_info_history
* *