新增常畅充对接扩展接口

This commit is contained in:
YAS\29473
2025-06-27 10:23:51 +08:00
parent ee733ff8e0
commit f10b01a884
7 changed files with 239 additions and 12 deletions

View File

@@ -0,0 +1,59 @@
package com.jsowell.thirdparty.platform.domain;
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class PayOrderInfo {
/**
* 充电订单号
*/
@JSONField(name = "StartChargeSeq")
private String startChargeSeq;
/**
* 总电费(优惠前) 保2
*/
@JSONField(name = "ElecTotal")
private BigDecimal elecTotal;
/**
* 总服务费(优惠前) 保2
*/
@JSONField(name = "ServiceTotal")
private BigDecimal serviceTotal;
/**
* 累计总金额(优惠前) 保2
*/
@JSONField(name = "Total")
private BigDecimal total;
/**
* 总电费(实际支付)
*/
@JSONField(name = "ElecPaid")
private BigDecimal elecPaid;
/**
* 总服务费(实际支付)
*/
@JSONField(name = "ServicePaid")
private BigDecimal servicePaid;
/**
* 累计总金额(实际支付)
*/
@JSONField(name = "Paid")
private BigDecimal paid;
}

View File

@@ -0,0 +1,20 @@
package com.jsowell.thirdparty.platform.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class RetryOrderDTO {
/**
* 充电订单号
*/
@JsonProperty(value = "StartChargeSeqs")
private String startChargeSeqs;
}

View File

@@ -271,6 +271,15 @@ public interface ThirdPartyPlatformService extends InitializingBean {
}
/**
* 获取充电订单信息
* retry_notification_order_info
*/
default Map<String, String> retryNotificationOrderInfo(String orderCode) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
// =================================================================================== //
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 由对方平台实现此接口,我方平台调用的通知接口 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ //
// =================================================================================== //
@@ -474,6 +483,14 @@ public interface ThirdPartyPlatformService extends InitializingBean {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 推送充电账单信息
* notification_pay_order_info
*/
default String notificationPayOrderInfo(String orderCode) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
// -------------------------------------- 以下是公用方法 --------------------------------------- //
/**

View File

@@ -33,6 +33,7 @@ import com.jsowell.thirdparty.lianlian.domain.ConnectorStatusInfo;
import com.jsowell.thirdparty.lianlian.domain.StationStatusInfo;
import com.jsowell.thirdparty.lianlian.vo.*;
import com.jsowell.thirdparty.platform.common.ChargeDetail;
import com.jsowell.thirdparty.platform.domain.PayOrderInfo;
import com.jsowell.thirdparty.platform.domain.SupChargeDetails;
import com.jsowell.thirdparty.platform.domain.SupStationInfo;
import com.jsowell.thirdparty.platform.factory.ThirdPartyPlatformFactory;
@@ -789,6 +790,99 @@ public class ChangZhouPlatformServiceImpl implements ThirdPartyPlatformService {
}
/**
* 推送充电账单信息
* notification_pay_order_info
* @param orderCode
* @return
*/
@Override
public String notificationPayOrderInfo(String orderCode){
//获取订单信息
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
if (orderBasicInfo == null) {
return "没有此订单信息";
}
//获取订单详情信息
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getChangZhouSecretInfo();
String operatorId = Constants.OPERATORID_JIANG_SU;
String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret();
String signSecret = thirdPartySecretInfoVO.getTheirSigSecret();
String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret();
String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv();
String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix();
//《***优惠前***》
//电费
BigDecimal electricityAmount = orderDetail.getTotalElectricityAmount();
//服务费
BigDecimal serviceAmount = orderDetail.getTotalServiceAmount();
//订单金额
BigDecimal orderAmount = orderDetail.getTotalOrderAmount();
//《***优惠金额***》
//优惠电费
BigDecimal discountElectricityAmount = orderDetail.getDiscountElectricityAmount();
//优惠服务费
BigDecimal discountServiceAmount = orderDetail.getDiscountServiceAmount();
//《***优惠后***》
//电费
BigDecimal afterDiscountElectricityAmount = electricityAmount.subtract(discountElectricityAmount);
//服务费
BigDecimal afterDiscountServiceAmount = serviceAmount.subtract(discountServiceAmount);
//订单金额
BigDecimal afterDiscountOrderAmount = orderAmount.subtract(discountElectricityAmount).subtract(discountServiceAmount);
PayOrderInfo payOrderInfo = PayOrderInfo.builder()
.startChargeSeq(orderCode)
.elecTotal(electricityAmount)
.serviceTotal(serviceAmount)
.total(orderAmount)
.elecPaid(afterDiscountElectricityAmount)
.servicePaid(afterDiscountServiceAmount)
.paid(afterDiscountOrderAmount)
.build();
String url = urlAddress + "notification_pay_order_info";
String jsonString = JSON.toJSONString(payOrderInfo);
log.info("请求参数:{}", jsonString);
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
return result;
}
/**
* 获取充电订单信息 retry_notification_order_info
* @param orderCode
* @return
*/
@Override
public Map<String ,String> retryNotificationOrderInfo(String orderCode) {
Map<String, Object> map = new LinkedHashMap<>();
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getChangZhouSecretInfo();
int Success = 0;
//查询订单信息
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
if (orderBasicInfo == null) {
Success = 1;
}
map.put("Success", Success);
return ThirdPartyPlatformUtils.generateResultMap(map, thirdPartySecretInfoVO);
}
/**
* 转换时段充电明细
*