| | |
| | | public void queryOtherInfo(List<TBranchOfficeResp> tBranchOfficeRespList) { |
| | | List<TOrder> orders = tOrderMapper.selectList(new EntityWrapper<TOrder>()); |
| | | |
| | | |
| | | for (TBranchOfficeResp tBranchOfficeResp : tBranchOfficeRespList) { |
| | | |
| | | List<TOrder> orderList = orders.stream().filter(t -> tBranchOfficeResp.getId().equals(t.getBranchOfficeId())).collect(Collectors.toList()); |
| | | |
| | | List<TUserToCoupon> tUserToCoupons = tUserToCouponMapper.selectList(new EntityWrapper<TUserToCoupon>().eq("objectId", tBranchOfficeResp.getId()) |
| | | .eq("roleType",2)); |
| | | |
| | | if(!CollectionUtils.isEmpty(orderList)){ |
| | | |
| | |
| | | |
| | | // 优惠券数据,,,通过订单找到该区域的下单人,找出优惠券信息 |
| | | List<Integer> userIds = orderList.stream().map(TOrder::getUserId).collect(Collectors.toList()); |
| | | List<TUserToCoupon> tUserToCoupons = tUserToCouponMapper.selectList(new EntityWrapper<TUserToCoupon>().eq("objectId", tBranchOfficeResp.getId()) |
| | | .eq("roleType",2)); |
| | | } |
| | | |
| | | // 优惠券有效数量 |
| | | int validCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getValidCount).sum(); |
| | | // 过期数量 |
| | |
| | | tBranchOfficeResp.setTotalCount(totalCount); |
| | | |
| | | BigDecimal orderPriceCount = new BigDecimal("0"); |
| | | |
| | | // 累计优惠券金额 |
| | | for (TUserToCoupon tUserToCoupon : tUserToCoupons) { |
| | | TCoupon tCoupon = tCouponMapper.selectById(tUserToCoupon.getCouponId()); |
| | |
| | | orderPriceCount = orderPriceCount.add(price); |
| | | } |
| | | tBranchOfficeResp.setOrderPriceCount(orderPriceCount); |
| | | } |
| | | |
| | | // 司机数量 |
| | | Integer driverCount = tDriverMapper.selectCount(new EntityWrapper<TDriver>().eq("branchOfficeId", tBranchOfficeResp.getId())); |
| | | tBranchOfficeResp.setDriverCount(driverCount); |