This commit is contained in:
YAS\29473
2025-04-29 09:40:34 +08:00
parent a775c6c71c
commit 02baf5f2f6
5 changed files with 207 additions and 7 deletions

View File

@@ -593,4 +593,40 @@ public class LianLianController extends ThirdPartyBaseController {
return response; return response;
} }
/**
* 查询订单结算信息
* @param request
* @param dto
* @return
*/
@PostMapping("/v1/query_order_settlement_info")
public CommonResult<?> query_order_settlement_info(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
try {
// 校验令牌
if (!verifyToken(request.getHeader("Authorization"))) {
// 校验失败
return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR);
}
// 校验签名
if (!verifySignature(dto)) {
// 签名错误
return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR);
}
// 解析入参
PushOrderSettlementDTO pushOrderSettlementDTO = parseParamsDTO(dto, PushOrderSettlementDTO.class);
// 执行逻辑
Map<String, String> map = platformLogic.queryOrderSettlementInfo(pushOrderSettlementDTO);
logger.info("查询订单结算信息 result:{}", JSON.toJSONString(map));
return CommonResult.success(0, "查询订单结算信息成功!", map.get("Data"), map.get("Sig"));
} catch (Exception e) {
logger.error("查询订单结算信息 error:", e);
}
return CommonResult.failed("查询订单结算信息发生异常");
}
} }

View File

@@ -0,0 +1,62 @@
package com.jsowell.thirdparty.lianlian.vo;
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.Builder;
import lombok.Data;
import java.math.BigDecimal;
@Data
@Builder
public class OrderSettlementVO {
/**
* 充电订单号
*/
@JSONField(name = "StartChargeSeq")
private String startChargeSeq;
/**
* 充电设备接口编码
*/
@JSONField(name = "ConnectorID")
private String connectorID;
/**
* 累计充电量
*/
@JSONField(name = "TotalPower")
private BigDecimal totalPower;
/**
* 累计总金额
*/
@JSONField(name = "TotalMoney")
private BigDecimal totalMoney;
/**
* 是否出租车订单
*/
@JSONField(name = "TaxiOrder")
private int taxiOrder;
/**
* 结算金额
*/
@JSONField(name = "SettlementMoney")
private BigDecimal settlementMoney;
/**
* 优惠类型
*/
@JSONField(name = "DiscountType")
private int discountType;
/**
* 优惠金额
*/
@JSONField(name = "DiscountMoney")
private BigDecimal discountMoney;
}

View File

@@ -188,6 +188,14 @@ public class OrderInfo {
@JSONField(name = "SumPeriod") @JSONField(name = "SumPeriod")
private Integer sumPeriod; private Integer sumPeriod;
/**
* 订单类型 Y
* 1,充电订单
* 2,放电订单
*/
@JSONField(name = "OrderType")
private Integer orderType;
/** /**
* 充电明细信息 Y * 充电明细信息 Y
*/ */

View File

@@ -251,6 +251,15 @@ public interface ThirdPartyPlatformService extends InitializingBean {
throw new UnsupportedOperationException("This method is not yet implemented"); throw new UnsupportedOperationException("This method is not yet implemented");
} }
/**
* 查询订单结算信息 query_order_settlement_info
* @param dto
* @return
*/
default Map<String, String> queryOrderSettlementInfo(PushOrderSettlementDTO dto) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
// =================================================================================== // // =================================================================================== //
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 由对方平台实现此接口,我方平台调用的通知接口 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ // // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 由对方平台实现此接口,我方平台调用的通知接口 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ //

View File

@@ -915,21 +915,21 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
* @throws UnsupportedOperationException 未实现异常 * @throws UnsupportedOperationException 未实现异常
*/ */
@Override @Override
public String notificationChargeOrderInfo(String orderCode, ThirdPartySecretInfoVO secretInfoVO) { public String notificationChargeOrderInfo(String orderCode) {
// 根据订单号查询出信息 // 根据订单号查询出信息
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode); OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode); OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
// 通过站点id查询相关配置信息 // 通过站点id查询相关配置信息
// ThirdPartySecretInfoVO thirdPartySecretInfoVO = getLianLianPlatformSecretInfo(); ThirdPartySecretInfoVO thirdPartySecretInfoVO = getLianLianPlatformSecretInfo();
String operatorId = Constants.OPERATORID_LIANLIAN; String operatorId = Constants.OPERATORID_LIANLIAN;
String operatorSecret = secretInfoVO.getTheirOperatorSecret(); String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret();
String signSecret = secretInfoVO.getTheirSigSecret(); String signSecret = thirdPartySecretInfoVO.getTheirSigSecret();
String dataSecret = secretInfoVO.getTheirDataSecret(); String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret();
String dataSecretIv = secretInfoVO.getTheirDataSecretIv(); String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv();
String urlAddress = secretInfoVO.getTheirUrlPrefix(); String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix();
String url = urlAddress + "notification_orderInfo"; String url = urlAddress + "notification_orderInfo";
@@ -949,6 +949,7 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
.startTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeStartTime())) .startTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeStartTime()))
.endTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeEndTime())) .endTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeEndTime()))
.paymentAmount(orderBasicInfo.getPayAmount()) .paymentAmount(orderBasicInfo.getPayAmount())
.orderType(Constants.one)
// .payChannel() // .payChannel()
.stopReason(0) .stopReason(0)
// .chargeDetails() // .chargeDetails()
@@ -1040,6 +1041,52 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
return result; return result;
} }
/**
* 6.9 推送充电订单信息
* @param orderCode
* @param thirdPartySecretInfoVO
* @return
*/
public String notificationChargeOrderInfo(String orderCode, ThirdPartySecretInfoVO thirdPartySecretInfoVO) {
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
String operatorId = Constants.OPERATORID_LIANLIAN;
String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret();
String signSecret = thirdPartySecretInfoVO.getTheirSigSecret();
String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret();
String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv();
String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix();
String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_CHARGE_ORDER_INFO.getValue();
Date chargeStartTime = orderBasicInfo.getChargeStartTime();
if (chargeStartTime == null) {
chargeStartTime = orderBasicInfo.getCreateTime();
}
Date chargeEndTime = orderBasicInfo.getChargeEndTime();
if (chargeEndTime == null) {
chargeEndTime = orderBasicInfo.getCreateTime();
}
JSONObject json = new JSONObject();
json.put("StartChargeSeq", orderCode);
json.put("ConnectorID", orderBasicInfo.getPileConnectorCode());
json.put("StartTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, chargeStartTime));
json.put("EndTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, chargeEndTime));
json.put("TotalPower", orderDetail.getTotalUsedElectricity().setScale(2, BigDecimal.ROUND_HALF_UP));
json.put("TotalElecMoney", orderDetail.getTotalElectricityAmount().setScale(2, BigDecimal.ROUND_HALF_UP));
json.put("TotalSeviceMoney", orderDetail.getTotalServiceAmount().setScale(2, BigDecimal.ROUND_HALF_UP));
json.put("TotalMoney", orderDetail.getTotalOrderAmount().setScale(2, BigDecimal.ROUND_HALF_UP));
json.put("StopReason", 2); // 2BMS 停止充电
String jsonString = JSON.toJSONString(json);
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;
}
// @Override // @Override
// public String notificationChargeOrderInfo(String orderCode, ThirdPartySecretInfoVO secretInfoVO) { // public String notificationChargeOrderInfo(String orderCode, ThirdPartySecretInfoVO secretInfoVO) {
// //
@@ -1155,6 +1202,9 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
// return result; // return result;
// } // }
//TODO 5.10 推送站点累计电量接口( notification_station_electStatsInfo
/** /**
* 站点费率变化推送 notification_stationFee * 站点费率变化推送 notification_stationFee
* *
@@ -1279,6 +1329,41 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
return result; return result;
} }
/**
* 查询订单结算信息 query_order_settlement_info
* @param dto
* @return
*/
@Override
public Map<String, String> queryOrderSettlementInfo(PushOrderSettlementDTO dto) {
String orderCode = dto.getStartChargeSeq();
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
if (orderInfo == null || orderDetail == null) {
return null;
}
ThirdPartySecretInfoVO lianLianPlatformSecretInfo = getLianLianPlatformSecretInfo();
// 封装数据
OrderSettlementVO vo = OrderSettlementVO.builder()
.startChargeSeq(orderCode)
.connectorID(orderInfo.getPileConnectorCode())
.totalPower(orderDetail.getTotalUsedElectricity()) //累计电量
.totalMoney(orderDetail.getTotalOrderAmount()) //累计金额
.taxiOrder(Constants.zero) //是否为出租车,默认0不是
.settlementMoney(orderInfo.getSettleAmount()) //结算金额
.discountType(Constants.zero) // 优惠类型
.discountMoney(BigDecimal.ZERO) // 优惠金额
.build();
// 加密数据
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(vo, lianLianPlatformSecretInfo.getOurDataSecret(),
lianLianPlatformSecretInfo.getOurDataSecretIv(), lianLianPlatformSecretInfo.getTheirSigSecret());
return resultMap;
}
/** /**
* 推送订单结算信息 notification_order_settlement_info * 推送订单结算信息 notification_order_settlement_info
*/ */