| | |
| | | import com.google.common.collect.Lists; |
| | | import com.ruoyi.common.core.constant.CacheConstants; |
| | | import com.ruoyi.common.core.constant.SecurityConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.enums.AuctionOrderTypeEnum; |
| | | import com.ruoyi.common.core.enums.AuditStatusEnum; |
| | | import com.ruoyi.common.core.enums.BondStatusEnum; |
| | |
| | | import com.ruoyi.order.util.OrderUtil; |
| | | import com.ruoyi.order.util.SinataUtil; |
| | | import com.ruoyi.system.api.constants.DelayTaskEnum; |
| | | import com.ruoyi.system.api.domain.*; |
| | | import com.ruoyi.system.api.domain.AuctionSalesroom; |
| | | import com.ruoyi.system.api.domain.CouponMember; |
| | | import com.ruoyi.system.api.domain.CustomConfig; |
| | | import com.ruoyi.system.api.domain.DelayTask; |
| | | import com.ruoyi.system.api.domain.GoodsGroupPurchase; |
| | | import com.ruoyi.system.api.domain.GoodsGroupPurchaseInfo; |
| | | import com.ruoyi.system.api.domain.GoodsSeckill; |
| | | import com.ruoyi.system.api.domain.GoodsSku; |
| | | import com.ruoyi.system.api.domain.Member; |
| | | import com.ruoyi.system.api.domain.MemberAddress; |
| | | import com.ruoyi.system.api.domain.Order; |
| | | import com.ruoyi.system.api.domain.OrderAuctionBond; |
| | | import com.ruoyi.system.api.domain.dto.CouponMemberDTO; |
| | | import com.ruoyi.system.api.domain.dto.GoodsStockUpdDTO; |
| | | import com.ruoyi.system.api.domain.dto.HomeGoodsSkuDTO; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.function.Function; |
| | | import java.util.regex.Matcher; |
| | |
| | | import org.redisson.api.RLock; |
| | | import org.redisson.api.RedissonClient; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | order.setSkuName(OrderDTO.getSkuName()); |
| | | order.setPrice(OrderDTO.getPrice()); |
| | | order.setCoverPic(OrderDTO.getCoverPic()); |
| | | order.setOrderTimeSx(OrderDTO.getOrderTimeSx()); |
| | | this.save(order); |
| | | |
| | | if (OrderDTO.getOrderFrom().getCode()==4){ |
| | |
| | | |
| | | |
| | | GoodsSku goodsSku = goodsSkuClient.getGoodsSkuOne(data.getGoodsSkuId(), SecurityConstants.INNER).getData(); |
| | | if (data.getLimitNumber()<num1) { |
| | | throw new ServiceException("该商品已售罄,暂无库存"); |
| | | if (data.getLimitNumber()!=0){ |
| | | if (data.getLimitNumber()<num1) { |
| | | throw new ServiceException("对不起,大于商品购买数"); |
| | | } |
| | | } |
| | | |
| | | |
| | | order.setOrderFrom(OrderFromEnum.SNAP_ORDERS); |
| | | memberOrderVO.setGoodsSkuId(memberOrderDTO.getGoodsSkuId()); |
| | |
| | | memberOrderDTO1.setGoodsSkuId(order.getGoodsSkuId()); |
| | | Integer num=baseMapper.getSeckillMembers1(memberOrderDTO1); |
| | | Integer num1=0; |
| | | if (num!=null){ |
| | | num1 =num+order.getGoodsQuantity(); |
| | | if(num!=order.getGoodsQuantity()){ |
| | | if (num!=null){ |
| | | num1 =num+order.getGoodsQuantity(); |
| | | }else{ |
| | | num1=order.getGoodsQuantity(); |
| | | } |
| | | }else{ |
| | | num1=order.getGoodsQuantity(); |
| | | num1=num; |
| | | } |
| | | |
| | | |
| | | GoodsSeckill data = goodsSkuClient.getGoodsSeckillOne(order.getGoodsSkuId(), SecurityConstants.INNER).getData(); |
| | | GoodsSku goodsSku = goodsSkuClient.getGoodsSkuOne(data.getGoodsSkuId(), SecurityConstants.INNER).getData(); |
| | | |
| | | if (num1!=order.getGoodsQuantity()){ |
| | | if (data.getLimitNumber()<num1){ |
| | | if (data.getLimitNumber()!=0||data.getLimitNumber()<num1){ |
| | | throw new ServiceException("对不起,大于商品购买数"); |
| | | }else{ |
| | | |
| | |
| | | pice=pice.subtract(data.getReductionAmount()); |
| | | order.setDiscountMoney(data.getReductionAmount()); |
| | | }else{ |
| | | order.setDiscountMoney(pice); |
| | | pice=new BigDecimal(0); |
| | | |
| | | } |
| | |
| | | if (data.getCouponType().getCode()==2){ |
| | | pice= order.getTotalAmount(); |
| | | if(pice.compareTo(data.getVoucherAmount())<0){ |
| | | throw new ServiceException("优惠卷抵扣金额不能大于实际支付金额"); |
| | | order.setDiscountMoney(pice); |
| | | pice=new BigDecimal(0); |
| | | }else{ |
| | | pice=pice.subtract(data.getVoucherAmount()); |
| | | order.setDiscountMoney(data.getVoucherAmount()); |
| | | } |
| | | pice=pice.subtract(data.getVoucherAmount()); |
| | | order.setDiscountMoney(data.getVoucherAmount()); |
| | | |
| | | } |
| | | if (data.getCouponType().getCode()==3){ |
| | | pice= order.getTotalAmount(); |
| | |
| | | pice3=new BigDecimal(data.getMaxDiscount().doubleValue()); |
| | | } |
| | | if(pice.compareTo(pice3)<0){ |
| | | throw new ServiceException("优惠卷抵扣金额不能大于实际支付金额"); |
| | | BigDecimal pice4= pice.subtract(pice3); |
| | | if (pice4.doubleValue()>data.getMaxDiscount().doubleValue()){ |
| | | pice=pice.subtract(data.getMaxDiscount()); |
| | | order.setDiscountMoney(data.getMaxDiscount()); |
| | | }else{ |
| | | order.setDiscountMoney(pice4); |
| | | pice=pice3; |
| | | } |
| | | }else{ |
| | | order.setDiscountMoney(pice); |
| | | pice=new BigDecimal(0); |
| | | } |
| | | |
| | | BigDecimal pice4= pice.subtract(pice3); |
| | | if (pice4.doubleValue()>data.getMaxDiscount().doubleValue()){ |
| | | pice=pice.subtract(data.getMaxDiscount()); |
| | | order.setDiscountMoney(data.getMaxDiscount()); |
| | | }else{ |
| | | order.setDiscountMoney(pice4); |
| | | pice=pice3; |
| | | } |
| | | |
| | | |
| | | } |
| | | order.setCouponId(memberOrderDTO.getCouponId()); |
| | |
| | | }else { |
| | | MemberOrderList.setIsAuctionBond(1); |
| | | } |
| | | |
| | | CustomConfig memberPointsPoints = sysUserClient.getconfig("MALL_ORDER_DESCRIPTION").getData(); |
| | | MemberOrderList.setOrderShuoMin(memberPointsPoints.getConfigValue()); |
| | | CustomConfig ReturnCycle = sysUserClient.getconfig("RETURN_CYCLE").getData(); |
| | | MemberOrderList.setOrderZq(Integer.valueOf(ReturnCycle.getConfigValue())); |
| | | } |
| | | |
| | | |
| | |
| | | pageVO = PageDTO.empty(page); |
| | | } |
| | | pageVO = PageDTO.of(page, MgtOrderVO.class); |
| | | List<MgtOrderVO> voList = pageVO.getList(); |
| | | if (query.getOrderFrom() == OrderFromEnum.AUCTION_ORDERS) { |
| | | List<MgtOrderVO> list = pageVO.getList(); |
| | | List<MgtOrderVO> list = voList; |
| | | // 封装参数查询拍卖会 |
| | | Set<Long> auctionSalesroomGoodsIdSet = list.stream() |
| | | .filter(order -> order.getAuctionType() == AuctionOrderTypeEnum.AUCTION_ITEMS) |
| | |
| | | } |
| | | }); |
| | | } |
| | | Set<Long> memberVoIdSet = voList.stream().map(MgtOrderVO::getMemberId) |
| | | .collect(Collectors.toSet()); |
| | | List<Member> data = memberClient.getMemberListByIds(memberVoIdSet, SecurityConstants.INNER) |
| | | .getData(); |
| | | Map<Long, Member> memberMap = data.stream() |
| | | .collect(Collectors.toMap(Member::getId, e -> e)); |
| | | voList = voList.stream().peek(order -> { |
| | | Member member = memberMap.get(order.getMemberId()); |
| | | if (StringUtils.isNotNull(member)) { |
| | | order.setNickname(member.getNickname()); |
| | | order.setPhone(member.getPhone()); |
| | | } |
| | | }).collect(Collectors.toList()); |
| | | return pageVO; |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | // 查询售后信息 |
| | | if (order.getOrderStatus() == OrderStatusEnum.AFTER_SALE) { |
| | | if (order.getIsRequest() == 2) { |
| | | OrderReturnRequest orderReturnRequest = orderReturnRequestService.getOne( |
| | | Wrappers.lambdaQuery(OrderReturnRequest.class) |
| | | .eq(OrderReturnRequest::getOrderId, |
| | |
| | | * @param id 订单id |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void refund(Long id) { |
| | | Order order = getOrder(id); |
| | | String orderNo = order.getOrderNo(); |
| | |
| | | orderReturnRequest.setAuditStatus(AuditStatusEnum.PASSED); |
| | | orderReturnRequestService.save(orderReturnRequest); |
| | | } |
| | | order.setIsRequest(2); |
| | | this.updateById(order); |
| | | } |
| | | |
| | | private boolean handleRefund(PaymentMethodEnum paymentMethod, Paylog paylog, String orderNo) { |
| | |
| | | Order order = getOrder(id); |
| | | if (order.getOrderStatus() == OrderStatusEnum.FINISHED) { |
| | | OrderReturnRequest orderReturnRequest = new OrderReturnRequest(); |
| | | order.setOrderStatus(OrderStatusEnum.AFTER_SALE); |
| | | order.setIsRequest(2); |
| | | this.updateById(order); |
| | | MgtAfterSaleSettingDTO data = sysUserClient.getAfterSaleSetting().getData(); |
| | | if (StringUtils.isNull(data)) { |
| | |
| | | public List<Order> getStaticsOrderList(LocalDateTime startTime, LocalDateTime endTime) { |
| | | return baseMapper.getStaticsOrderList(startTime, endTime); |
| | | } |
| | | |
| | | @Override |
| | | public List<Order> getOrderListByMubres(List<String> mubres) { |
| | | return this.lambdaQuery().in(Order::getGroupNo, mubres).list(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateOrderStatusByMubres(List<String> formedGroupMubres) { |
| | | this.lambdaUpdate().set(Order::getIsOrder, 1).in(Order::getGroupNo, formedGroupMubres) |
| | | .update(); |
| | | } |
| | | } |