From cf1d0fdbdbfe969500508ae9c0fa51cc37d06577 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期二, 06 六月 2023 12:08:17 +0800 Subject: [PATCH] 代理商修改,分公司修改列表 --- management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TAgentServiceImpl.java | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TAgentServiceImpl.java b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TAgentServiceImpl.java index 6bb9d6e..cdb6518 100644 --- a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TAgentServiceImpl.java +++ b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TAgentServiceImpl.java @@ -145,8 +145,9 @@ model.addAttribute("driverCount",drivers.size()); // 司机充值计算 List<Integer> driverIds = drivers.stream().map(TDriver::getId).collect(Collectors.toList()); - List<TRechargeRecord> tRechargeRecords = tRechargeRecordMapper.selectList(new EntityWrapper<TRechargeRecord>().in("userId", driverIds) - .eq("type", UserTypeEnum.DRIVER.getCode()) + List<TRechargeRecord> tRechargeRecords = tRechargeRecordMapper.selectList(new EntityWrapper<TRechargeRecord>() + .in("userId", driverIds) + .eq("type", UserTypeEnum.AGENT.getCode()) .eq("payStatus", PayStatusEnum.FINISH.getCode())); if(CollectionUtils.isEmpty(tRechargeRecords)){ model.addAttribute("driverRecharge",BigDecimal.ZERO); @@ -209,7 +210,9 @@ BigDecimal couponPriceSum = BigDecimal.ZERO; for (TUserToCoupon userToCoupon : userToCoupons) { TCoupon tCoupons1 = tCouponMapper.selectById(userToCoupon.getCouponId()); - couponPriceSum = couponPriceSum.add(tCoupons1.getCouponPreferentialAmount().multiply(new BigDecimal(userToCoupon.getCouponTotal()))); + if(Objects.nonNull(tCoupons1)){ + couponPriceSum = couponPriceSum.add(tCoupons1.getCouponPreferentialAmount().multiply(new BigDecimal(userToCoupon.getCouponTotal()))); + } } tAgentResp.setCouponPriceSum(couponPriceSum); } @@ -220,8 +223,9 @@ tAgentResp.setDriverCount(drivers.size()); // 司机充值计算 List<Integer> driverIds = drivers.stream().map(TDriver::getId).collect(Collectors.toList()); - List<TRechargeRecord> tRechargeRecords = tRechargeRecordMapper.selectList(new EntityWrapper<TRechargeRecord>().in("userId", driverIds) - .eq("type", UserTypeEnum.DRIVER.getCode()) + List<TRechargeRecord> tRechargeRecords = tRechargeRecordMapper.selectList(new EntityWrapper<TRechargeRecord>() + .eq("agentId", tAgent.getId()) + .eq("type", UserTypeEnum.AGENT.getCode()) .eq("payStatus", PayStatusEnum.FINISH.getCode())); tRechargeRecords.stream().map(TRechargeRecord::getAmount).reduce(BigDecimal::add).ifPresent(tAgentResp::setDriverRecharge); } -- Gitblit v1.7.1