| | |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.page.BeanUtils; |
| | | import com.ruoyi.common.core.utils.page.CollUtils; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.order.controller.management.dto.MgtOrderConfirmShipmentDTO; |
| | |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Collection; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | import lombok.Synchronized; |
| | | import org.apache.commons.collections.map.HashedMap; |
| | | import org.redisson.api.RLock; |
| | | import org.redisson.api.RedissonClient; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | * @since 2024-05-16 |
| | | */ |
| | | @Service |
| | | @SuppressWarnings("unchecked") |
| | | public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements IOrderService { |
| | | |
| | | @Resource |
| | |
| | | */ |
| | | @Override |
| | | public List<Order> getOrderByCouponIds(Collection<Long> couponIds) { |
| | | return this.lambdaQuery().in(Order::getCouponId, couponIds) |
| | | .eq(Order::getOrderStatus, OrderStatusEnum.FINISHED).list(); |
| | | return this.lambdaQuery().in(Order::getCouponId, couponIds).list(); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | pageVO = PageDTO.of(page, MgtOrderVO.class); |
| | | List<MgtOrderVO> voList = pageVO.getList(); |
| | | if (query.getOrderFrom() == OrderFromEnum.AUCTION_ORDERS) { |
| | | if (query.getQueryType() == OrderTypeEnum.AUCTION_ORDER) { |
| | | List<MgtOrderVO> list = voList; |
| | | // 封装参数查询拍卖会 |
| | | Set<Long> auctionSalesroomGoodsIdSet = list.stream() |
| | |
| | | List<AuctionSalesroom> auctionSalesroomList = auctionClient.getAuctionSalesroomByIds( |
| | | auctionSalesroomGoodsIdSet, SecurityConstants.INNER) |
| | | .getData(); |
| | | Map<Long, String> salesroomMap = auctionSalesroomList.stream() |
| | | Map<Long, String> salesroomMap = new HashedMap(); |
| | | Set<Long> auctionSalesroomSet = new HashSet<>(); |
| | | if (CollUtils.isNotEmpty(auctionSalesroomList)) { |
| | | salesroomMap = auctionSalesroomList.stream() |
| | | .collect(Collectors.toMap(AuctionSalesroom::getId, |
| | | AuctionSalesroom::getSalesroomName)); |
| | | auctionSalesroomList.stream() |
| | | .map(AuctionSalesroom::getId) |
| | | .collect(Collectors.toSet()); |
| | | } |
| | | // 封装参数查询拍卖订单保证金 |
| | | Set<Long> auctionGoodsIdSet = list.stream() |
| | | .filter(order -> order.getAuctionOrderType() |
| | |
| | | .map(MgtOrderVO::getGoodsSkuId) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | Set<Long> auctionSalesroomSet = auctionSalesroomList.stream() |
| | | .map(AuctionSalesroom::getId) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | List<OrderAuctionBond> auctionBondList = orderAuctionBondMapper.selectList( |
| | | List<OrderAuctionBond> auctionSalesroomBondList = orderAuctionBondMapper.selectList( |
| | | Wrappers.lambdaQuery(OrderAuctionBond.class) |
| | | .in(OrderAuctionBond::getAuctionGoodsId, auctionGoodsIdSet) |
| | | .in(OrderAuctionBond::getAuctionSalesroomId, auctionSalesroomSet) |
| | | .in(CollUtils.isNotEmpty(auctionSalesroomSet), |
| | | OrderAuctionBond::getAuctionSalesroomId, auctionSalesroomSet) |
| | | .eq(OrderAuctionBond::getBoundStatus, BondStatusEnum.PAID) |
| | | .groupBy(OrderAuctionBond::getAuctionSalesroomId, |
| | | OrderAuctionBond::getMemberId)); |
| | | List<OrderAuctionBond> auctionGoodsBondList = orderAuctionBondMapper.selectList( |
| | | Wrappers.lambdaQuery(OrderAuctionBond.class) |
| | | .in(CollUtils.isNotEmpty(auctionGoodsIdSet), |
| | | OrderAuctionBond::getAuctionGoodsId, auctionGoodsIdSet) |
| | | .eq(OrderAuctionBond::getBoundStatus, |
| | | BondStatusEnum.PAID)); |
| | | Map<String, OrderAuctionBond> auctionSalesroomBondMap = auctionBondList.stream() |
| | | BondStatusEnum.PAID) |
| | | .groupBy(OrderAuctionBond::getAuctionGoodsId, |
| | | OrderAuctionBond::getMemberId)); |
| | | Map<String, OrderAuctionBond> auctionSalesroomBondMap = auctionSalesroomBondList.stream() |
| | | .filter(bond -> bond.getBondType() == AuctionOrderTypeEnum.AUCTION_ITEMS) |
| | | .collect(Collectors.toMap( |
| | | bond -> bond.getAuctionSalesroomId() + "-" + bond.getMemberId(), |
| | | Function.identity())); |
| | | Map<String, OrderAuctionBond> auctionSalesroomGoodsBondMap = auctionBondList.stream() |
| | | Map<String, OrderAuctionBond> auctionSalesroomGoodsBondMap = auctionGoodsBondList.stream() |
| | | .filter(bond -> bond.getBondType() == AuctionOrderTypeEnum.REGULAR_ITEMS) |
| | | .collect(Collectors.toMap( |
| | | bond -> bond.getAuctionGoodsId() + "-" + bond.getMemberId(), |
| | | Function.identity())); |
| | | |
| | | list.forEach(order -> { |
| | | for (MgtOrderVO order : list) { |
| | | if (order.getAuctionOrderType() == AuctionOrderTypeEnum.AUCTION_ITEMS) { |
| | | order.setSalesroomName( |
| | | StringUtils.isNotBlank(salesroomMap.get(order.getGoodsSkuId())) |
| | | StringUtils.isNotBlank(salesroomMap.get(order.getAuctionSalesroomId())) |
| | | ? salesroomMap.get(order.getAuctionSalesroomId()) : "无"); |
| | | order.setBoundStatus( |
| | | StringUtils.isNotNull(auctionSalesroomBondMap.get( |
| | | order.getAuctionSalesroomId() + "-" + order.getMemberId()) |
| | | .getBoundStatus()) |
| | | order.getAuctionSalesroomId() + "-" + order.getMemberId())) |
| | | ? auctionSalesroomBondMap.get( |
| | | order.getAuctionSalesroomId() + "-" + order.getMemberId()) |
| | | .getBoundStatus() |
| | |
| | | order.setSalesroomName("无"); |
| | | order.setBoundStatus( |
| | | StringUtils.isNotNull(auctionSalesroomGoodsBondMap.get( |
| | | order.getGoodsSkuId() + "-" + order.getMemberId()) |
| | | .getBoundStatus()) |
| | | order.getGoodsSkuId() + "-" + order.getMemberId())) |
| | | ? auctionSalesroomGoodsBondMap.get( |
| | | order.getGoodsSkuId() + "-" + order.getMemberId()) |
| | | .getBoundStatus() |
| | | : null); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | | Set<Long> memberVoIdSet = voList.stream().map(MgtOrderVO::getMemberId) |
| | | .collect(Collectors.toSet()); |
| | | List<Member> data = memberClient.getMemberListByIds(memberVoIdSet, SecurityConstants.INNER) |
| | | .getData(); |
| | | if (CollUtils.isNotEmpty(data)) { |
| | | Map<Long, Member> memberMap = data.stream() |
| | | .collect(Collectors.toMap(Member::getId, e -> e)); |
| | | voList = voList.stream().peek(order -> { |
| | |
| | | order.setPhone(member.getPhone()); |
| | | } |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | return pageVO; |
| | | } |
| | | |