| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | List<TActivityStatisticslVO> list = this.baseMapper.activityStatistics(pageInfo,dto); |
| | | List<TActivityStatisticslVO> list1 = this.baseMapper.activityStatistics(pageInfo1,dto); |
| | | |
| | | list.sort((o1, o2) -> o2.getCreateTime().compareTo(o1.getCreateTime())); |
| | | // 优惠券金额 |
| | | BigDecimal coupon = new BigDecimal("0"); |
| | | // 会员抵扣金额 |
| | |
| | | break; |
| | | case 3: |
| | | // 会员订单 优惠金额大于0 |
| | | if (tActivityStatisticslVO.getVipDiscountAmount()!=null |
| | | && |
| | | (tActivityStatisticslVO.getCouponDiscountAmount().compareTo(BigDecimal.ZERO)>0)){ |
| | | if (tActivityStatisticslVO.getVipDiscountAmount()!=null){ |
| | | vipActivity = vipActivity.add(tActivityStatisticslVO.getVipDiscountAmount()); |
| | | } |
| | | tActivityStatisticslVO.setType("会员活动"); |
| | |
| | | break; |
| | | } |
| | | } |
| | | |
| | | List<Long> appUserIds = list.stream().map(TActivityStatisticslVO::getAppUserId).collect(Collectors.toList()); |
| | | List<TAppUser> appUsers = appUserClient.getUserByIds(appUserIds).getData(); |
| | | |
| | | for (TActivityStatisticslVO tActivityStatisticslVO : list) { |
| | | TAppUser appUser = appUsers.stream().filter(user -> user.getId().equals(tActivityStatisticslVO.getAppUserId())).findFirst().orElse(null); |
| | | if(Objects.nonNull(appUser)){ |
| | | tActivityStatisticslVO.setPhone(appUser.getPhone()); |
| | | } |
| | | // 判断享有了哪些类型 |
| | | switch (tActivityStatisticslVO.getOrderType()){ |
| | | case 1: |
| | |
| | | // 充电订单 优惠券金额大于0 |
| | | if (tActivityStatisticslVO.getCouponDiscountAmount()!=null |
| | | && |
| | | (tActivityStatisticslVO.getCouponDiscountAmount().compareTo(BigDecimal.ZERO)>0)){ |
| | | stringBuilder.append("优惠券抵扣").append("+"); |
| | | } |
| | | (tActivityStatisticslVO.getCouponDiscountAmount().compareTo(BigDecimal.ZERO)>0)){ |
| | | stringBuilder.append("优惠券抵扣").append("+"); |
| | | } |
| | | if (tActivityStatisticslVO.getVipDiscountAmount()!=null &&(tActivityStatisticslVO.getVipDiscountAmount().compareTo(BigDecimal.ZERO)>0)){ |
| | | discount = discount.add(tActivityStatisticslVO.getVipDiscountAmount()); |
| | | stringBuilder.append("会员抵扣").append("+"); |
| | | } |
| | | if (stringBuilder.length()>0){ |
| | |
| | | MyShoppingOrderInfo info = new MyShoppingOrderInfo(); |
| | | info.setId(id); |
| | | info.setStatus(shoppingOrder.getStatus()); |
| | | TAppUserAddress userAddress = appUserAddressClient.getAppUserAddressById(shoppingOrder.getAppUserAddressId()).getData(); |
| | | TAppUserAddress userAddress = JSON.parseObject(shoppingOrder.getAddressJson(), TAppUserAddress.class); |
| | | info.setConsignee(userAddress.getName()); |
| | | info.setPhone(userAddress.getPhone()); |
| | | info.setAddress(userAddress.getProvince() + userAddress.getCity() + userAddress.getDistrict() + userAddress.getAddress() + userAddress.getHouseNumber()); |