mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-22 20:15:06 +08:00
55 lines
1.9 KiB
Java
55 lines
1.9 KiB
Java
|
|
package com.jsowell.service;
|
|||
|
|
|
|||
|
|
import com.jsowell.common.constant.Constants;
|
|||
|
|
import com.jsowell.pile.domain.OrderSplitRecord;
|
|||
|
|
import com.jsowell.pile.dto.DebugOrderDTO;
|
|||
|
|
import com.jsowell.pile.dto.QueryOrderSplitRecordDTO;
|
|||
|
|
import com.jsowell.pile.service.OrderBasicInfoService;
|
|||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|||
|
|
import org.springframework.stereotype.Service;
|
|||
|
|
|
|||
|
|
import java.util.ArrayList;
|
|||
|
|
import java.util.HashSet;
|
|||
|
|
import java.util.List;
|
|||
|
|
import java.util.Set;
|
|||
|
|
import java.util.stream.Collectors;
|
|||
|
|
|
|||
|
|
@Service
|
|||
|
|
public class SplitBillService {
|
|||
|
|
|
|||
|
|
@Autowired
|
|||
|
|
private OrderBasicInfoService orderBasicInfoService;
|
|||
|
|
|
|||
|
|
@Autowired
|
|||
|
|
private TempService tempService;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 重试运营商分账
|
|||
|
|
* @param dto
|
|||
|
|
*/
|
|||
|
|
public void retryMerchantSplit(QueryOrderSplitRecordDTO dto) {
|
|||
|
|
// 首先根据 merchantId、startTime、endTime 查出日期区间内所有订单信息(包括 paymentId)
|
|||
|
|
List<OrderSplitRecord> recordList = orderBasicInfoService.getSplitOrders(dto);
|
|||
|
|
// 判断订单是否已经成功分账
|
|||
|
|
// adapayService.checkOrderSplitStatus(list);
|
|||
|
|
// 将未分账的订单进行筛选、汇总
|
|||
|
|
List<String> paymenIdList = new ArrayList<>();
|
|||
|
|
// 将 paymentIdList 与 recordList 进行匹配,筛选出 orderCodeList
|
|||
|
|
Set<String> paymentIdSet = new HashSet<>(paymenIdList);
|
|||
|
|
List<String> orderCodeList = recordList.stream()
|
|||
|
|
.filter(record -> paymentIdSet.contains(record.getPaymentId()))
|
|||
|
|
.map(OrderSplitRecord::getOrderCode)
|
|||
|
|
.collect(Collectors.toList());
|
|||
|
|
|
|||
|
|
// 调用 debugOrder 接口进行重新分账
|
|||
|
|
for (String orderCode : orderCodeList) {
|
|||
|
|
DebugOrderDTO debugOrderDTO = new DebugOrderDTO();
|
|||
|
|
debugOrderDTO.setOrderCode(orderCode);
|
|||
|
|
debugOrderDTO.setReSplitFlag(Constants.ONE);
|
|||
|
|
|
|||
|
|
tempService.debugOrder(debugOrderDTO);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|