From b5dfb801199fb639ef7e68cb0b33c5923383c69d Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Mon, 27 Nov 2023 16:24:06 +0800
Subject: [PATCH] 匹配
---
src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java | 40 +++++++++++++++++++---------------------
1 files changed, 19 insertions(+), 21 deletions(-)
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java
index 4578086..dc5377d 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java
@@ -1200,32 +1200,30 @@
//已完成的买单
List<MallProductSellRecord> mallProductSellRecords = mallProductSellRecordMapper.selectListBySellId(sellId,ProductEnum.PRODUCT_MATE_STATE_FINISH.getValue());
- if(CollUtil.isEmpty(mallProductSellRecords)){
- return;
+ if(CollUtil.isNotEmpty(mallProductSellRecords)){
+ //实际支付总数
+ BigDecimal nftCntTotal = mallProductSellRecords.stream().map(MallProductSellRecord::getNftCnt).reduce(BigDecimal.ZERO, BigDecimal::add);
+ MallProductSell mallProductSell = mallProductSellMapper.selectById(sellId);
+ if(nftCntTotal.compareTo(mallProductSell.getNftCnt()) >= 0){
+ mallProductSell.setState(ProductEnum.PRODUCT_SELL_SUCCESS.getValue());
+ mallProductSellMapper.updateById(mallProductSell);
+ }
}
- //实际支付总数
- BigDecimal nftCntTotal = mallProductSellRecords.stream().map(MallProductSellRecord::getNftCnt).reduce(BigDecimal.ZERO, BigDecimal::add);
- MallProductSell mallProductSell = mallProductSellMapper.selectById(sellId);
- if(nftCntTotal.compareTo(mallProductSell.getNftCnt()) < 0){
- return;
- }
- mallProductSell.setState(ProductEnum.PRODUCT_SELL_SUCCESS.getValue());
- mallProductSellMapper.updateById(mallProductSell);
+
Long buyId = mallProductBuyRecord.getBuyId();
List<MallProductBuyRecord> mallProductBuyRecords = mallProductBuyRecordMapper.selectListByBuyId(buyId,ProductEnum.PRODUCT_MATE_STATE_FINISH.getValue());
- if(CollUtil.isEmpty(mallProductBuyRecords)){
- return;
+ if(CollUtil.isNotEmpty(mallProductBuyRecords)){
+ //实际支付总数
+ BigDecimal nftCntTotalBuy = mallProductBuyRecords.stream().map(MallProductBuyRecord::getPickNftCnt).reduce(BigDecimal.ZERO, BigDecimal::add);
+ MallProductBuy mallProductBuy = mallProductBuyMapper.selectById(buyId);
+ if(nftCntTotalBuy.compareTo(mallProductBuy.getNftTotal()) >= 0){
+ return;
+ }
+ mallProductBuy.setState(ProductEnum.PRODUCT_BUY_SUCCESS.getValue());
+ mallProductBuy.setPayTime(DateUtil.date());
+ mallProductBuyMapper.updateById(mallProductBuy);
}
- //实际支付总数
- BigDecimal nftCntTotalBuy = mallProductBuyRecords.stream().map(MallProductBuyRecord::getPickNftCnt).reduce(BigDecimal.ZERO, BigDecimal::add);
- MallProductBuy mallProductBuy = mallProductBuyMapper.selectById(buyId);
- if(nftCntTotalBuy.compareTo(mallProductBuy.getNftTotal()) < 0){
- return;
- }
- mallProductBuy.setState(ProductEnum.PRODUCT_BUY_SUCCESS.getValue());
- mallProductBuy.setPayTime(DateUtil.date());
- mallProductBuyMapper.updateById(mallProductBuy);
}
@Override
--
Gitblit v1.9.1