|
|
@@ -32,6 +32,7 @@ import com.uas.platform.b2b.model.util.ApCheckAllCountSqls;
|
|
|
import com.uas.platform.b2b.model.util.ApCheckDoneCountSqls;
|
|
|
import com.uas.platform.b2b.model.util.ApCheckTodoCountSqls;
|
|
|
import com.uas.platform.b2b.publicapi.model.ApCheckAmount;
|
|
|
+import com.uas.platform.b2b.publicapi.model.ApCheckAmountDetail;
|
|
|
import com.uas.platform.b2b.service.ErpProdIODetailService;
|
|
|
import com.uas.platform.b2b.service.OrderRedDotService;
|
|
|
import com.uas.platform.b2b.service.PurchaseApCheckService;
|
|
|
@@ -75,6 +76,7 @@ import java.util.Set;
|
|
|
import java.util.concurrent.CountDownLatch;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.Executors;
|
|
|
+import java.util.stream.Collector;
|
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
@@ -687,9 +689,45 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
|
|
|
List<ApCheckAmount> thisMonthDoneTrades = getThisMonthDoneTrade(vendorUU, customerUU, checkDate, fromDate, endDate);
|
|
|
customer.setThisMonthDoneCount(thisMonthDoneTrades);
|
|
|
}
|
|
|
+ setAmountDetail(customer);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 设置对账明细数据
|
|
|
+ *
|
|
|
+ * @param customer 供应商客户信息
|
|
|
+ */
|
|
|
+ private void setAmountDetail(Vendor customer) {
|
|
|
+ // 先统计总额币别
|
|
|
+ Set<String> currencySet = customer.getTotalCount()
|
|
|
+ .parallelStream().map(ApCheckAmount::getCurrency)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ List<ApCheckAmountDetail> detailList = new ArrayList<>();
|
|
|
+ currencySet.forEach(currency -> {
|
|
|
+ List<String> totalAmount = customer.getTotalCount().stream()
|
|
|
+ .filter(count -> currency.equals(count.getCurrency()))
|
|
|
+ .map(ApCheckAmount::getAmount).collect(Collectors.toList());
|
|
|
+ List<String> thisPeriodAmount = customer.getThisMonthCount().stream()
|
|
|
+ .filter(count -> currency.equals(count.getCurrency()))
|
|
|
+ .map(ApCheckAmount::getAmount).collect(Collectors.toList());
|
|
|
+ List<String> thisPeriodTodoAmount = customer.getThisMonthTodoCount().stream()
|
|
|
+ .filter(count -> currency.equals(count.getCurrency()))
|
|
|
+ .map(ApCheckAmount::getAmount).collect(Collectors.toList());
|
|
|
+ List<String> thisPeriodDoneAmount = customer.getThisMonthDoneCount().stream()
|
|
|
+ .filter(count -> currency.equals(count.getCurrency()))
|
|
|
+ .map(ApCheckAmount::getAmount).collect(Collectors.toList());
|
|
|
+ ApCheckAmountDetail detail = new ApCheckAmountDetail();
|
|
|
+ detail.setCurrency(currency);
|
|
|
+ detail.setThisPeriodAmount(thisPeriodAmount.size() > 0 ? thisPeriodAmount.get(0) : null);
|
|
|
+ detail.setTotalAmount(totalAmount.size() > 0 ? totalAmount.get(0) : null);
|
|
|
+ detail.setThisPeriodTodoAmount(thisPeriodTodoAmount.size() > 0 ? thisPeriodTodoAmount.get(0) : null);
|
|
|
+ detail.setThisPeriodDoneAmount(thisPeriodDoneAmount.size() > 0 ? thisPeriodDoneAmount.get(0) : null);
|
|
|
+ detailList.add(detail);
|
|
|
+ });
|
|
|
+ customer.setAmountDetailList(detailList);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 设置供应商信息
|
|
|
* @param params 分页参数
|
|
|
@@ -801,21 +839,14 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
|
|
|
public List<ApCheckAmount> groupCountByCurrency(List<ApCheckAmount> totalTrades) {
|
|
|
List<ApCheckAmount> resultCounts = new ArrayList<>();
|
|
|
if (null != totalTrades && !CollectionUtils.isEmpty(totalTrades)) {
|
|
|
- Double rmbCount = totalTrades.stream().filter(tradeCount -> null != tradeCount && RMB.equals(tradeCount.getCurrency()))
|
|
|
- .mapToDouble(ApCheckAmount::getCount).sum();
|
|
|
- Double usdCount = totalTrades.stream().filter(tradeCount -> null != tradeCount && USD.equals(tradeCount.getCurrency()))
|
|
|
- .mapToDouble(ApCheckAmount::getCount).sum();
|
|
|
- Double hkdCount = totalTrades.stream().filter(tradeCount -> null != tradeCount && HKD.equals(tradeCount.getCurrency()))
|
|
|
- .mapToDouble(ApCheckAmount::getCount).sum();
|
|
|
- if (rmbCount > 0) {
|
|
|
- resultCounts.add(new ApCheckAmount(RMB, DecimalUtils.decimalPoint(rmbCount, 2)));
|
|
|
- }
|
|
|
- if (usdCount > 0) {
|
|
|
- resultCounts.add(new ApCheckAmount(USD, DecimalUtils.decimalPoint(usdCount, 2)));
|
|
|
- }
|
|
|
- if (hkdCount > 0) {
|
|
|
- resultCounts.add(new ApCheckAmount(HKD, DecimalUtils.decimalPoint(hkdCount, 2)));
|
|
|
- }
|
|
|
+ Set<String> currencySet = totalTrades.parallelStream().map(ApCheckAmount::getCurrency).collect(Collectors.toSet());
|
|
|
+ currencySet.forEach(currency -> {
|
|
|
+ Double amount = totalTrades.stream().filter(tradeCount -> null != tradeCount && currency.equals(tradeCount.getCurrency()))
|
|
|
+ .mapToDouble(ApCheckAmount::getCount).sum();
|
|
|
+ if (amount > 0) {
|
|
|
+ resultCounts.add(new ApCheckAmount(currency, DecimalUtils.decimalPoint(amount, 2)));
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
return resultCounts;
|
|
|
}
|