mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 11:35:12 +08:00
新增 批量推送第三方平台订单接口
This commit is contained in:
@@ -405,4 +405,13 @@ public interface OrderBasicInfoMapper {
|
||||
List<OrderVO> selectThirdPartyOrderList(@Param("dto") QueryStartChargeDTO dto);
|
||||
|
||||
LocalDateTime queryOrderCreateTimeByStationId(String id);
|
||||
|
||||
/**
|
||||
* 根据参数查询订单基本信息
|
||||
* @param stationIds
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
List<OrderBasicInfo> getOrderBasicInfoByTimeInterval(@Param("stationIds") List<String> stationIds, @Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||
}
|
||||
@@ -231,6 +231,8 @@ public interface OrderBasicInfoService{
|
||||
|
||||
OrderSplitResult verifyOrderConfirmAmount(List<String> paymentIds, String orderCode, BigDecimal settleAmount, String wechatAppId) throws BaseAdaPayException;
|
||||
|
||||
OrderSplitResult verifyOrderConfirmAmountWithCancelSplit(List<String> paymentIds, String orderCode, BigDecimal settleAmount, String wechatAppId) throws BaseAdaPayException;
|
||||
|
||||
/**
|
||||
* 批量查询订单
|
||||
* @param orderCodeList
|
||||
@@ -573,4 +575,6 @@ public interface OrderBasicInfoService{
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> verifyMergeChargeOrder(VerifyMergeChargeOrderDTO dto) throws Exception;
|
||||
|
||||
List<OrderBasicInfo> getOrderBasicInfoByTimeInterval(List<String> stationIds, String startTime, String endTime);
|
||||
}
|
||||
|
||||
@@ -2439,6 +2439,75 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验订单分账金额(其他部分与上面方法一致,此方法仅加了撤销分账部分,只给临时接口用)
|
||||
*
|
||||
* @param paymentIds 支付id集合
|
||||
* @param orderCode 订单编号
|
||||
* @param settleAmount 结算金额
|
||||
*/
|
||||
@Override
|
||||
public OrderSplitResult verifyOrderConfirmAmountWithCancelSplit(List<String> paymentIds, String orderCode, BigDecimal settleAmount, String wechatAppId) throws BaseAdaPayException {
|
||||
// 分账金额
|
||||
BigDecimal totalConfirmAmt = BigDecimal.ZERO;
|
||||
// 手续费
|
||||
BigDecimal feeAmt = BigDecimal.ZERO;
|
||||
// 通过支付id查询分账情况
|
||||
for (String paymentId : paymentIds) {
|
||||
QueryPaymentConfirmDTO dto = new QueryPaymentConfirmDTO();
|
||||
dto.setPaymentId(paymentId);
|
||||
dto.setWechatAppId(wechatAppId);
|
||||
QueryPaymentConfirmDetailResponse response = adapayService.queryPaymentConfirmList(dto);
|
||||
if (response != null) {
|
||||
List<PaymentConfirmInfo> confirms = response.getPaymentConfirms();
|
||||
if (CollectionUtils.isNotEmpty(confirms)) {
|
||||
for (PaymentConfirmInfo confirm : confirms) {
|
||||
// 校验分账是否撤销
|
||||
if (queryConfirmReverseStatus(confirm.getId(), wechatAppId)) {
|
||||
logger.info("支付确认id:" + confirm.getId() + "撤销了。。。");
|
||||
continue;
|
||||
}
|
||||
// 如果没有撤销,先撤销分账,再重新进行分账
|
||||
adapayService.createConfirmReverse(confirm.getId(), wechatAppId);
|
||||
|
||||
JSONObject jsonObject = JSON.parseObject(confirm.getDescription());
|
||||
if (StringUtils.equals(jsonObject.getString("orderCode"), orderCode)) {
|
||||
// 订单号对的上,累计分账金额
|
||||
BigDecimal confirmAmt = new BigDecimal(confirm.getConfirmAmt());
|
||||
BigDecimal confirmedAmt = new BigDecimal(confirm.getConfirmedAmt());
|
||||
BigDecimal orderConfirmedAmt = confirmedAmt.compareTo(BigDecimal.ZERO) == 0
|
||||
? confirmedAmt
|
||||
: confirmAmt;
|
||||
totalConfirmAmt = totalConfirmAmt.add(orderConfirmedAmt);
|
||||
feeAmt = feeAmt.add(new BigDecimal(confirm.getFeeAmt()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OrderSplitResult result = new OrderSplitResult();
|
||||
result.setOrderCode(orderCode);
|
||||
result.setSettleAmt(settleAmount.toString());
|
||||
result.setConfirmAmt(totalConfirmAmt.toString());
|
||||
if (totalConfirmAmt.compareTo(BigDecimal.ZERO) == 0) {
|
||||
feeAmt = BigDecimal.ZERO;
|
||||
}
|
||||
result.setFeeAmt(feeAmt.toString());
|
||||
String status;
|
||||
// 如果确认金额和结算金额相等,返回succeeded,其他情况返回PENDING
|
||||
if (settleAmount.compareTo(totalConfirmAmt) == 0) {
|
||||
// 返回succeeded 标识该笔订单已经完成了分账,不要再次执行分账
|
||||
status = AdapayStatusEnum.SUCCEEDED.getValue();
|
||||
} else {
|
||||
status = AdapayStatusEnum.PENDING.getValue();
|
||||
}
|
||||
result.setStatus(status);
|
||||
logger.info("校验订单分账金额-orderCode:{}, 分账结果:{}", orderCode, JSON.toJSONString(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询分账撤销状态
|
||||
*/
|
||||
@@ -5240,5 +5309,10 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderBasicInfo> getOrderBasicInfoByTimeInterval(List<String> stationIds, String startTime, String endTime) {
|
||||
return orderBasicInfoMapper.getOrderBasicInfoByTimeInterval(stationIds, startTime, endTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user