mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-17 00:08:35 +08:00
update 重试运营商分账
This commit is contained in:
@@ -2,13 +2,18 @@ package com.jsowell.service;
|
|||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||||
import com.jsowell.adapay.service.AdapayService;
|
import com.jsowell.adapay.service.AdapayService;
|
||||||
import com.jsowell.common.constant.Constants;
|
import com.jsowell.common.constant.Constants;
|
||||||
|
import com.jsowell.common.util.DateUtils;
|
||||||
import com.jsowell.pile.dto.DebugOrderDTO;
|
import com.jsowell.pile.dto.DebugOrderDTO;
|
||||||
import com.jsowell.pile.dto.QueryOrderSplitRecordDTO;
|
import com.jsowell.pile.dto.QueryOrderSplitRecordDTO;
|
||||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||||
|
import com.jsowell.pile.service.PileStationInfoService;
|
||||||
|
import com.jsowell.pile.service.SettleOrderReportService;
|
||||||
import com.jsowell.pile.vo.web.OrderPaymentDetailVO;
|
import com.jsowell.pile.vo.web.OrderPaymentDetailVO;
|
||||||
|
import com.jsowell.pile.vo.web.PileStationVO;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -17,6 +22,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class SplitBillService {
|
public class SplitBillService {
|
||||||
@@ -26,6 +32,12 @@ public class SplitBillService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private OrderBasicInfoService orderBasicInfoService;
|
private OrderBasicInfoService orderBasicInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PileStationInfoService pileStationInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SettleOrderReportService settleOrderReportService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TempService tempService;
|
private TempService tempService;
|
||||||
|
|
||||||
@@ -44,17 +56,14 @@ public class SplitBillService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取 paymentIdList
|
|
||||||
// List<String> paymentIdList = recordList.stream()
|
|
||||||
// .map(OrderPaymentDetailVO::getPaymentId)
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
|
|
||||||
// 循环一次,获得paymentIdList 与 Map
|
// 循环一次,获得paymentIdList 与 Map
|
||||||
List<String> paymentIdList = Lists.newArrayList();
|
List<String> paymentIdList = Lists.newArrayList();
|
||||||
Map<String, OrderPaymentDetailVO> paymentIdMap = Maps.newHashMap();
|
Map<String, OrderPaymentDetailVO> paymentIdMap = Maps.newHashMap();
|
||||||
|
Set<String> stationIdSet = Sets.newHashSet();
|
||||||
for (OrderPaymentDetailVO orderPaymentDetailVO : recordList) {
|
for (OrderPaymentDetailVO orderPaymentDetailVO : recordList) {
|
||||||
paymentIdList.add(orderPaymentDetailVO.getPaymentId());
|
paymentIdList.add(orderPaymentDetailVO.getPaymentId());
|
||||||
paymentIdMap.put(orderPaymentDetailVO.getPaymentId(), orderPaymentDetailVO);
|
paymentIdMap.put(orderPaymentDetailVO.getPaymentId(), orderPaymentDetailVO);
|
||||||
|
stationIdSet.add(orderPaymentDetailVO.getStationId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断订单是否已经成功分账, 将未分账的订单进行筛选、汇总
|
// 判断订单是否已经成功分账, 将未分账的订单进行筛选、汇总
|
||||||
@@ -66,11 +75,6 @@ public class SplitBillService {
|
|||||||
|
|
||||||
// 将 paymentIdList 与 recordList 进行匹配,筛选出 orderCodeList
|
// 将 paymentIdList 与 recordList 进行匹配,筛选出 orderCodeList
|
||||||
List<String> orderCodeList = Lists.newArrayList();
|
List<String> orderCodeList = Lists.newArrayList();
|
||||||
// Set<String> paymentIdSet = new HashSet<>(unSplitPaymentIdList);
|
|
||||||
// List<String> orderCodeList = recordList.stream()
|
|
||||||
// .filter(record -> paymentIdSet.contains(record.getPaymentId()))
|
|
||||||
// .map(OrderPaymentDetailVO::getOrderCode)
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
for (String unSplitPaymentId : unSplitPaymentIdList) {
|
for (String unSplitPaymentId : unSplitPaymentIdList) {
|
||||||
OrderPaymentDetailVO orderPaymentDetailVO = paymentIdMap.get(unSplitPaymentId);
|
OrderPaymentDetailVO orderPaymentDetailVO = paymentIdMap.get(unSplitPaymentId);
|
||||||
if (orderPaymentDetailVO != null) {
|
if (orderPaymentDetailVO != null) {
|
||||||
@@ -92,5 +96,19 @@ public class SplitBillService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取日期区间内所有日期
|
||||||
|
List<String> dateList = DateUtils.getAllDatesInTheDateRange(dto.getStartTime(), dto.getEndTime());
|
||||||
|
// 重新计算站点订单日报
|
||||||
|
stationIdSet.parallelStream().forEach(stationId -> {
|
||||||
|
PileStationVO stationInfo = pileStationInfoService.getStationInfo(stationId);
|
||||||
|
for (String tradeDate : dateList) {
|
||||||
|
settleOrderReportService.generateDailyOrderReports(stationInfo, tradeDate);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 重新计算运营商日报
|
||||||
|
for (String tradeDate : dateList) {
|
||||||
|
orderBasicInfoService.generateMerchantBill(dto.getMerchantId(), tradeDate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user