mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
update 新增重新分账接口
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.pile.dto.QueryOrderSplitRecordDTO;
|
||||
import com.jsowell.pile.service.OrderSplitRecordService;
|
||||
import com.jsowell.pile.vo.web.OrderCommissionSummaryVO;
|
||||
import com.jsowell.service.SplitBillService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -26,6 +27,9 @@ public class OrderSplitRecordController extends BaseController {
|
||||
@Autowired
|
||||
private OrderSplitRecordService orderSplitRecordService;
|
||||
|
||||
@Autowired
|
||||
private SplitBillService splitBillService;
|
||||
|
||||
/**
|
||||
* 后管查询引流抽成订单列表
|
||||
* @param dto
|
||||
@@ -61,4 +65,19 @@ public class OrderSplitRecordController extends BaseController {
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 重试运营商分账
|
||||
*/
|
||||
public RestApiResponse<?> retryMerchantSplit(@RequestBody QueryOrderSplitRecordDTO dto) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
splitBillService.retryMerchantSplit(dto);
|
||||
response = new RestApiResponse<>();
|
||||
} catch (Exception e) {
|
||||
logger.error("重试运营商分账 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user