“mitao”
2025-12-23 9ff0db3f0cca9eab06d04a9773d725a1acc831d8
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TAppUserServiceImpl.java
@@ -10,8 +10,10 @@
import com.ruoyi.system.model.*;
import com.ruoyi.system.query.AppUserListQuery;
import com.ruoyi.system.query.PromotionPageListQuery;
import com.ruoyi.system.query.UserPromotionPageListQuery;
import com.ruoyi.system.service.*;
import com.ruoyi.system.vo.PromotionPageListVo;
import com.ruoyi.system.vo.UserPromotionPageListVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -108,7 +110,68 @@
                BigDecimal totalOne = giftPackageOrders.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).map(TBigGiftPackageOrder::getPaymentPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
                promotionPageListVo.setTotalConsume(totalOne);
                Integer totalIncome = flows.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).mapToInt(TCommissionTransactionFlow::getCommissionAmount).sum();
                BigDecimal totalIncome = flows.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).map(TCommissionTransactionFlow::getCommissionAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
                promotionPageListVo.setTotalIncome(totalIncome);
                Integer totalSettledIncome = settlements.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).mapToInt(TIntegralSettlement::getTotalSettlementIntegral).sum();
                promotionPageListVo.setTotalSettledIncome(totalSettledIncome);
            }
        }
        return list;
    }
    @Override
    public List<UserPromotionPageListVo> userPromotionPageList(Page<UserPromotionPageListVo> page, UserPromotionPageListQuery query) {
        List<UserPromotionPageListVo> list = this.baseMapper.userPromotionPageList(page,query);
        if (!list.isEmpty()) {
            List<Integer> userIds = list.stream().map(UserPromotionPageListVo::getUserId).collect(Collectors.toList());
//            List<TPhysicalGoodsOrder> physicalGoodsOrders = tPhysicalGoodsOrderService.list(new LambdaQueryWrapper<TPhysicalGoodsOrder>().in(TPhysicalGoodsOrder::getAppUserId, userIds).notIn(TPhysicalGoodsOrder::getStatus,Arrays.asList(1,4)));
            List<TBigGiftPackageOrder> giftPackageOrders = tBigGiftPackageOrderService.list(new LambdaQueryWrapper<TBigGiftPackageOrder>().in(TBigGiftPackageOrder::getAppUserId, userIds).notIn(TBigGiftPackageOrder::getStatus,Arrays.asList(1,5)));
            List<TCommissionTransactionFlow> flows = tCommissionTransactionFlowService.list(new LambdaQueryWrapper<TCommissionTransactionFlow>().in(TCommissionTransactionFlow::getAppUserId, userIds));
            List<TIntegralSettlement> settlements = tIntegralSettlementService.list(new LambdaQueryWrapper<TIntegralSettlement>().in(TIntegralSettlement::getAppUserId, userIds));
            for (UserPromotionPageListVo promotionPageListVo : list) {
//                BigDecimal total = physicalGoodsOrders.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).map(TPhysicalGoodsOrder::getPaymentPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
                BigDecimal totalOne = giftPackageOrders.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).map(TBigGiftPackageOrder::getPaymentPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
                promotionPageListVo.setTotalConsume(totalOne);
                BigDecimal totalIncome = flows.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).map(TCommissionTransactionFlow::getCommissionAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
                promotionPageListVo.setTotalIncome(totalIncome);
                Integer totalSettledIncome = settlements.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).mapToInt(TIntegralSettlement::getTotalSettlementIntegral).sum();
                promotionPageListVo.setTotalSettledIncome(totalSettledIncome);
            }
        }
        return list;
    }
    @Override
    public List<UserPromotionPageListVo> userPromotionPageListExport(UserPromotionPageListQuery query) {
        List<UserPromotionPageListVo> list = this.baseMapper.userPromotionPageListExport(query);
        if (!list.isEmpty()) {
            List<Integer> userIds = list.stream().map(UserPromotionPageListVo::getUserId).collect(Collectors.toList());
//            List<TPhysicalGoodsOrder> physicalGoodsOrders = tPhysicalGoodsOrderService.list(new LambdaQueryWrapper<TPhysicalGoodsOrder>().in(TPhysicalGoodsOrder::getAppUserId, userIds).notIn(TPhysicalGoodsOrder::getStatus,Arrays.asList(1,4)));
            List<TBigGiftPackageOrder> giftPackageOrders = tBigGiftPackageOrderService.list(new LambdaQueryWrapper<TBigGiftPackageOrder>().in(TBigGiftPackageOrder::getAppUserId, userIds).notIn(TBigGiftPackageOrder::getStatus,Arrays.asList(1,5)));
            List<TCommissionTransactionFlow> flows = tCommissionTransactionFlowService.list(new LambdaQueryWrapper<TCommissionTransactionFlow>().in(TCommissionTransactionFlow::getAppUserId, userIds));
            List<TIntegralSettlement> settlements = tIntegralSettlementService.list(new LambdaQueryWrapper<TIntegralSettlement>().in(TIntegralSettlement::getAppUserId, userIds));
            for (UserPromotionPageListVo promotionPageListVo : list) {
//                BigDecimal total = physicalGoodsOrders.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).map(TPhysicalGoodsOrder::getPaymentPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
                BigDecimal totalOne = giftPackageOrders.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).map(TBigGiftPackageOrder::getPaymentPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
                promotionPageListVo.setTotalConsume(totalOne);
                BigDecimal totalIncome = flows.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).map(TCommissionTransactionFlow::getCommissionAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
                promotionPageListVo.setTotalIncome(totalIncome);
                Integer totalSettledIncome = settlements.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).mapToInt(TIntegralSettlement::getTotalSettlementIntegral).sum();
@@ -139,7 +202,7 @@
                BigDecimal totalOne = giftPackageOrders.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).map(TBigGiftPackageOrder::getPaymentPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
                promotionPageListVo.setTotalConsume(totalOne);
                Integer totalIncome = flows.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).mapToInt(TCommissionTransactionFlow::getCommissionAmount).sum();
                BigDecimal totalIncome = flows.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).map(TCommissionTransactionFlow::getCommissionAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
                promotionPageListVo.setTotalIncome(totalIncome);
                Integer totalSettledIncome = settlements.stream().filter(e -> e.getAppUserId().equals(promotionPageListVo.getUserId())).mapToInt(TIntegralSettlement::getTotalSettlementIntegral).sum();