diff --git a/jsowell-admin/src/main/java/com/jsowell/service/SplitBillService.java b/jsowell-admin/src/main/java/com/jsowell/service/SplitBillService.java index 1f75aa1bc..79c1cfd70 100644 --- a/jsowell-admin/src/main/java/com/jsowell/service/SplitBillService.java +++ b/jsowell-admin/src/main/java/com/jsowell/service/SplitBillService.java @@ -2,6 +2,7 @@ package com.jsowell.service; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import com.google.common.collect.Sets; import com.huifu.adapay.core.exception.BaseAdaPayException; import com.jsowell.adapay.service.AdapayService; import com.jsowell.common.constant.Constants; @@ -22,7 +23,7 @@ import org.springframework.stereotype.Service; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; +import java.util.Set; @Service public class SplitBillService { @@ -58,17 +59,14 @@ public class SplitBillService { return; } - // 获取 paymentIdList - // List paymentIdList = recordList.stream() - // .map(OrderPaymentDetailVO::getPaymentId) - // .collect(Collectors.toList()); - // 循环一次,获得paymentIdList 与 Map List paymentIdList = Lists.newArrayList(); Map paymentIdMap = Maps.newHashMap(); + Set stationIdSet = Sets.newHashSet(); for (OrderPaymentDetailVO orderPaymentDetailVO : recordList) { paymentIdList.add(orderPaymentDetailVO.getPaymentId()); paymentIdMap.put(orderPaymentDetailVO.getPaymentId(), orderPaymentDetailVO); + stationIdSet.add(orderPaymentDetailVO.getStationId()); } // 判断订单是否已经成功分账, 将未分账的订单进行筛选、汇总 @@ -80,11 +78,6 @@ public class SplitBillService { // 将 paymentIdList 与 recordList 进行匹配,筛选出 orderCodeList List orderCodeList = Lists.newArrayList(); - // Set paymentIdSet = new HashSet<>(unSplitPaymentIdList); - // List orderCodeList = recordList.stream() - // .filter(record -> paymentIdSet.contains(record.getPaymentId())) - // .map(OrderPaymentDetailVO::getOrderCode) - // .collect(Collectors.toList()); for (String unSplitPaymentId : unSplitPaymentIdList) { OrderPaymentDetailVO orderPaymentDetailVO = paymentIdMap.get(unSplitPaymentId); if (orderPaymentDetailVO != null) { @@ -109,14 +102,7 @@ public class SplitBillService { // 重新计算站点日报和运营商日报 // 获取日期区间内所有日期 List dateList = DateUtils.getAllDatesInTheDateRange(startTime, endTime); - // 根据 merchantId 获取所有 stationId - List pileStationInfos = pileStationInfoService.selectStationListByMerchantId(Long.parseLong(dto.getMerchantId())); - List stationIdList = pileStationInfos.stream() - .map(PileStationInfo::getId) - .map(String::valueOf) - .collect(Collectors.toList()); - - stationIdList.parallelStream().forEach(stationId -> { + stationIdSet.parallelStream().forEach(stationId -> { PileStationVO stationInfo = pileStationInfoService.getStationInfo(stationId); for (String tradeDate : dateList) { try {