| | |
| | | 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(); |
| | | // 过期数量 |
| | | int expireCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getExpireCount).sum(); |
| | | // 总数量 |
| | | int totalCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getCouponTotal).sum(); |
| | | // 已使用优惠券;总数量减去有效数量 |
| | | tBranchOfficeResp.setUsedCount(totalCount-validCount-expireCount); |
| | | } |
| | | |
| | | // 已发放优惠券 |
| | | tBranchOfficeResp.setTotalCount(totalCount); |
| | | // 优惠券有效数量 |
| | | int validCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getValidCount).sum(); |
| | | // 过期数量 |
| | | int expireCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getExpireCount).sum(); |
| | | // 总数量 |
| | | int totalCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getCouponTotal).sum(); |
| | | // 已使用优惠券;总数量减去有效数量 |
| | | tBranchOfficeResp.setUsedCount(totalCount-validCount-expireCount); |
| | | |
| | | BigDecimal orderPriceCount = new BigDecimal("0"); |
| | | // 已发放优惠券 |
| | | tBranchOfficeResp.setTotalCount(totalCount); |
| | | |
| | | // 累计优惠券金额 |
| | | for (TUserToCoupon tUserToCoupon : tUserToCoupons) { |
| | | TCoupon tCoupon = tCouponMapper.selectById(tUserToCoupon.getCouponId()); |
| | | BigDecimal orderPriceCount = BigDecimal.ZERO; |
| | | // 累计优惠券金额 |
| | | for (TUserToCoupon tUserToCoupon : tUserToCoupons) { |
| | | TCoupon tCoupon = tCouponMapper.selectById(tUserToCoupon.getCouponId()); |
| | | if(Objects.nonNull(tCoupon)){ |
| | | BigDecimal price = tCoupon.getCouponPreferentialAmount().multiply(new BigDecimal(tUserToCoupon.getCouponTotal())); |
| | | orderPriceCount = orderPriceCount.add(price); |
| | | } |
| | | tBranchOfficeResp.setOrderPriceCount(orderPriceCount); |
| | | } |
| | | tBranchOfficeResp.setOrderPriceCount(orderPriceCount); |
| | | |
| | | // 司机数量 |
| | | Integer driverCount = tDriverMapper.selectCount(new EntityWrapper<TDriver>().eq("branchOfficeId", tBranchOfficeResp.getId())); |
| | | tBranchOfficeResp.setDriverCount(driverCount); |
| | |
| | | } |
| | | tBranchOffice.setDistrictName(area.getName()); |
| | | tBranchOffice.setDistrictCode(area.getCode()); |
| | | }else { |
| | | tBranchOffice.setDistrictName(""); |
| | | tBranchOffice.setDistrictCode(""); |
| | | } |
| | | /*else { |
| | | tBranchOffice.setDistrictName(city.getName()); |
| | | tBranchOffice.setDistrictCode(city.getCode()); |
| | | }*/ |
| | | |
| | | // 通过省市查询代理商 |
| | | List<TAgent> tAgent = tAgentMapper.selectList(new EntityWrapper<TAgent>().eq("provinceCode", province.getCode()) |