| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | |
| | | appSureOrderVo.setOrderPayMoney(orderPayMoney); |
| | | // 设置订单商品列表 |
| | | appSureOrderVo.setAppSureOrderGoodsVoList(appSureOrderGoodsVoList); |
| | | appSureOrderVo.setLotteryDraw(false); |
| | | // 返回AppPlaceOrderVo对象 |
| | | List<TLotteryEvent> data = lotteryEventClient.getLotteryEventList(2).getData(); |
| | | if (data.size() > 0) { |
| | | BigDecimal finalOrderPayMoney = orderPayMoney; |
| | | List<TLotteryEvent> collect = data.stream().filter(s -> s.getPayMoney().compareTo(finalOrderPayMoney) <= 0).collect(Collectors.toList()); |
| | | if (collect.size() > 0) { |
| | | appSureOrderVo.setLotteryDraw(true); |
| | | appSureOrderVo.setLotteryEventId(collect.get(0).getId()); |
| | | } |
| | | } |
| | | return appSureOrderVo; |
| | | } |
| | | |
| | |
| | | appPanicBuyVo.setOrderGoodsMoney(orderGoodsMoney); |
| | | appPanicBuyVo.setOrderPayDeposit(orderPayDeposit); |
| | | appPanicBuyVo.setOrderPayMoney(orderPayMoney); |
| | | appPanicBuyVo.setLotteryDraw(false); |
| | | // 返回AppPlaceOrderVo对象 |
| | | List<TLotteryEvent> data = lotteryEventClient.getLotteryEventList(2).getData(); |
| | | if (data.size() > 0) { |
| | | BigDecimal finalOrderPayMoney = orderPayMoney; |
| | | List<TLotteryEvent> collect = data.stream().filter(s -> s.getPayMoney().compareTo(finalOrderPayMoney) <= 0).collect(Collectors.toList()); |
| | | if (collect.size() > 0) { |
| | | appPanicBuyVo.setLotteryDraw(true); |
| | | appPanicBuyVo.setLotteryEventId(collect.get(0).getId()); |
| | | } |
| | | } |
| | | return appPanicBuyVo; |
| | | } |
| | | |
| | |
| | | appMemberGoodsTypeDto.setUserId(userId); |
| | | appMemberGoodsTypeDto.setGoodsTypeSet(goodsTypeSet); |
| | | remoteMemberService.updateMemberGoodsType(appMemberGoodsTypeDto); |
| | | } |
| | | |
| | | appPlaceOrderVo.setLotteryDraw(false); |
| | | // 返回AppPlaceOrderVo对象 |
| | | List<TLotteryEvent> data = lotteryEventClient.getLotteryEventList(2).getData(); |
| | | if (data.size() > 0) { |
| | | BigDecimal finalOrderPayMoney = orderPayMoney; |
| | | List<TLotteryEvent> collect = data.stream().filter(s -> s.getPayMoney().compareTo(finalOrderPayMoney) <= 0).collect(Collectors.toList()); |
| | | if (collect.size() > 0) { |
| | | appPlaceOrderVo.setLotteryDraw(true); |
| | | appPlaceOrderVo.setLotteryEventId(collect.get(0).getId()); |
| | | } |
| | | } |
| | | return appPlaceOrderVo; |
| | | } |
| | |
| | | appPlaceOrderVo.setSignType(payArr[4]); |
| | | appPlaceOrderVo.setPaySign(payArr[5]); |
| | | appPlaceOrderVo.setPrepayId(orderPayment.getPrepayId()); |
| | | appPlaceOrderVo.setLotteryDraw(false); |
| | | // 返回AppPlaceOrderVo对象 |
| | | List<TLotteryEvent> data = lotteryEventClient.getLotteryEventList(2).getData(); |
| | | if (data.size() > 0) { |
| | | List<TLotteryEvent> collect = data.stream().filter(s -> s.getPayMoney().compareTo(order.getPayMoney()) >= 0).collect(Collectors.toList()); |
| | | appPlaceOrderVo.setLotteryDraw(collect.size() > 0); |
| | | List<TLotteryEvent> collect = data.stream().filter(s -> s.getPayMoney().compareTo(order.getPayMoney()) <= 0).collect(Collectors.toList()); |
| | | if (collect.size() > 0) { |
| | | appPlaceOrderVo.setLotteryDraw(true); |
| | | appPlaceOrderVo.setLotteryEventId(collect.get(0).getId()); |
| | | } |
| | | } else { |
| | | appPlaceOrderVo.setLotteryDraw(false); |
| | | } |
| | | return appPlaceOrderVo; |
| | | } |
| | |
| | | orderGoods.setOrderGoodsId(IdUtils.simpleUUID()); |
| | | orderGoods.setDelFlag(0); |
| | | orderGoods.setOrderId(order.getOrderId()); |
| | | orderGoods.setGoodsPrice(originAmount); |
| | | orderGoods.setGoodsTotalMoney(originAmount); |
| | | orderGoods.setGoodsReceivableMoney(originAmount); |
| | | orderGoods.setBuyNum(1); |
| | | |
| | | ConsumerGoods consumerGoods = new ConsumerGoods(); |
| | | if(null != timeCard){ |
| | | orderGoods.setBuyNum(timeCard.getTimesCount()); |
| | | orderGoods.setServiceNum(timeCard.getTimesCount()); |
| | | //核销一次加一次 |
| | | orderGoods.setBuyNum(1); |
| | | orderGoods.setServiceNum(1); |
| | | consumerGoods.setServiceNum(timeCard.getTimesCount()); |
| | | consumerGoods.setUsedNum(1); |
| | | consumerGoods.setUseTime(new Date()); |
| | |
| | | }else{ |
| | | //扣减剩余次数 |
| | | OrderGoods orderGoods = orderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrderId, order.getOrderId())); |
| | | //核销一次加一次数量 |
| | | orderGoods.setBuyNum(orderGoods.getBuyNum() + 1); |
| | | if(null != orderGoods.getServiceNum()){ |
| | | orderGoods.setServiceNum(orderGoods.getServiceNum() + 1); |
| | | } |
| | | orderGoodsService.updateById(orderGoods); |
| | | ConsumerGoods consumerGoods = consumerGoodsService.getOne(new LambdaQueryWrapper<ConsumerGoods>().eq(ConsumerGoods::getOrderId, order.getOrderId()).eq(ConsumerGoods::getOrderGoodsId, orderGoods.getOrderGoodsId())); |
| | | consumerGoods.setUsedNum(consumerGoods.getUsedNum() + 1); |
| | | consumerGoods.setUseTime(new Date()); |
| | |
| | | orderGoods.setDelFlag(0); |
| | | orderGoods.setOrderId(order.getOrderId()); |
| | | orderGoods.setGoodsId(sku.getSku_id()); |
| | | orderGoods.setBuyNum(sku.getTimes_count()); |
| | | orderGoods.setBuyNum(1); |
| | | orderGoods.setServiceNum(1); |
| | | orderGoods.setGoodsPrice(originAmount); |
| | | orderGoods.setGoodsTotalMoney(originAmount); |
| | | orderGoods.setGoodsReceivableMoney(originAmount); |
| | | orderGoods.setCycleNumFlag(1); |
| | | orderGoods.setServiceNum(sku.getTimes_count()); |
| | | orderGoods.setGoodsType(2); |
| | |
| | | }else{ |
| | | //扣减剩余次数 |
| | | OrderGoods orderGoods = orderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrderId, order.getOrderId())); |
| | | orderGoods.setBuyNum(orderGoods.getBuyNum() + 1); |
| | | orderGoods.setServiceNum(orderGoods.getServiceNum() + 1); |
| | | orderGoodsService.updateById(orderGoods); |
| | | |
| | | ConsumerGoods consumerGoods = consumerGoodsService.getOne(new LambdaQueryWrapper<ConsumerGoods>().eq(ConsumerGoods::getOrderId, order.getOrderId()).eq(ConsumerGoods::getOrderGoodsId, orderGoods.getOrderGoodsId())); |
| | | consumerGoods.setUsedNum(consumerGoods.getUsedNum() + 1); |
| | | consumerGoods.setUseTime(new Date()); |
| | |
| | | consumerGoodsService.sendGoodsGift(giftSendDtoList); |
| | | //抽奖奖品中的平台商品需要生成订单数据 |
| | | if (memberGiftRecord.getPrizeFrom() == 2) { |
| | | addOrder(memberGiftRecord.getShopId(), memberGiftRecord.getUserId(), goods, memberGiftRecord.getGoodsNumber(), memberGiftRecord.getGiftId()); |
| | | Order one = this.getOne(new QueryWrapper<Order>().eq("activity_id", memberGiftRecord.getGiftId()).eq("order_from", 4)); |
| | | if(null == one){ |
| | | addOrder(memberGiftRecord.getShopId(), memberGiftRecord.getUserId(), goods, null, memberGiftRecord.getGoodsNumber(), memberGiftRecord.getGiftId(), 3); |
| | | }else{ |
| | | one.setOrderStatus(3); |
| | | this.updateById(one); |
| | | } |
| | | } |
| | | break; |
| | | case 3: |
| | |
| | | |
| | | |
| | | /** |
| | | * 核销抽奖的平台商品生成订单 |
| | | * 抽奖的平台商品生成订单--待审核 |
| | | * |
| | | * @param shopId |
| | | * @param userId |
| | | * @param goods |
| | | * @param goodsNum |
| | | */ |
| | | public void addOrder(Long shopId, Long userId, Goods goods, Integer goodsNum, String giftId) { |
| | | public void addOrder(Long shopId, Long userId, Goods goods, String goodsName, Integer goodsNum, String giftId, Integer status) { |
| | | Order order = new Order(); |
| | | order.setOrderId(IdUtils.simpleUUID()); |
| | | order.setDelFlag(0); |
| | | order.setOrderStatus(3); |
| | | order.setOrderStatus(status); |
| | | order.setOrderNo(CodeFactoryUtil.getShopOrderNo()); |
| | | order.setOrderFrom(4); |
| | | order.setShopId(shopId); |
| | | order.setUserId(userId); |
| | | order.setOrderMoney(goods.getSalesPrice()); |
| | | order.setOrderMoney(null == goods ? BigDecimal.ZERO : goods.getSalesPrice()); |
| | | order.setCouponMoney(BigDecimal.ZERO); |
| | | order.setDiscountMoney(BigDecimal.ZERO); |
| | | order.setReceivableMoney(BigDecimal.ZERO); |
| | |
| | | orderGoods.setOrderGoodsId(IdUtils.simpleUUID()); |
| | | orderGoods.setDelFlag(0); |
| | | orderGoods.setOrderId(order.getOrderId()); |
| | | orderGoods.setGoodsId(goods.getGoodsId()); |
| | | orderGoods.setBuyNum(goodsNum); |
| | | orderGoods.setGoodsPrice(goods.getSalesPrice()); |
| | | orderGoods.setGoodsDeposit(goods.getSubscription()); |
| | | orderGoods.setGoodsTotalMoney(goods.getSalesPrice().multiply(new BigDecimal(goodsNum))); |
| | | orderGoods.setGoodsReceivableMoney(BigDecimal.ZERO); |
| | | orderGoods.setCycleNumFlag(goods.getCycleNumFlag()); |
| | | orderGoods.setServiceNum(goods.getServiceNum()); |
| | | orderGoods.setGoodsType(goods.getGoodsType()); |
| | | orderGoods.setGoodsName(goods.getGoodsName()); |
| | | GoodsFile goodsFile = remoteGoodsService.getGoodsFile(goods.getGoodsId()).getData(); |
| | | if (null != goodsFile) { |
| | | orderGoods.setGoodsPicture(goodsFile.getFileUrl()); |
| | | if(null != goods){ |
| | | orderGoods.setGoodsId(goods.getGoodsId()); |
| | | orderGoods.setGoodsPrice(goods.getSalesPrice()); |
| | | orderGoods.setGoodsDeposit(goods.getSubscription()); |
| | | orderGoods.setGoodsTotalMoney(goods.getSalesPrice().multiply(new BigDecimal(goodsNum))); |
| | | orderGoods.setGoodsReceivableMoney(BigDecimal.ZERO); |
| | | orderGoods.setCycleNumFlag(goods.getCycleNumFlag()); |
| | | orderGoods.setServiceNum(goods.getServiceNum()); |
| | | orderGoods.setGoodsType(goods.getGoodsType()); |
| | | orderGoods.setGoodsName(goods.getGoodsName()); |
| | | GoodsFile goodsFile = remoteGoodsService.getGoodsFile(goods.getGoodsId()).getData(); |
| | | if (null != goodsFile) { |
| | | orderGoods.setGoodsPicture(goodsFile.getFileUrl()); |
| | | } |
| | | orderGoods.setGoodsIntroduction(goods.getGoodsIntroduction()); |
| | | orderGoods.setGoodsTag(goods.getGoodsTags()); |
| | | }else{ |
| | | orderGoods.setGoodsName(goodsName); |
| | | orderGoods.setBuyNum(1); |
| | | orderGoods.setGoodsPrice(BigDecimal.ZERO); |
| | | orderGoods.setGoodsTotalMoney(BigDecimal.ZERO); |
| | | orderGoods.setGoodsReceivableMoney(BigDecimal.ZERO); |
| | | } |
| | | orderGoods.setGoodsIntroduction(goods.getGoodsIntroduction()); |
| | | orderGoods.setGoodsTag(goods.getGoodsTags()); |
| | | orderGoodsService.save(orderGoods); |
| | | } |
| | | |
| | |
| | | MgtOrderTotal mgtOrderTotalFirst = orderMapper.totalOrderFirst(mgtShopOrderPageDto); |
| | | MgtOrderTotal mgtOrderTotalSecond = orderMapper.totalOrderSecond(mgtShopOrderPageDto); |
| | | MgtOrderTotal mgtOrderTotalThird = orderMapper.totalOrderThird(mgtShopOrderPageDto); |
| | | MgtOrderTotal mgtOrderTotalFour = orderMapper.totalOrderFour(mgtShopOrderPageDto); |
| | | |
| | | mgtOrderTotal.setOrderTotal(mgtOrderTotalFirst.getOrderTotal()); |
| | | mgtOrderTotal.setOrderMoneyTotal(mgtOrderTotalFirst.getOrderMoneyTotal()); |
| | | mgtOrderTotal.setShopOrderTotal(mgtOrderTotalSecond.getShopOrderTotal()); |
| | |
| | | */ |
| | | private List<MgtMapBigTotalVo> bigListRemoveNull(List<MgtMapBigTotalVo> MgtMapIntTotalVos) { |
| | | for (int i = 0; i < MgtMapIntTotalVos.size(); i++) { |
| | | if (StringUtils.isBlank(MgtMapIntTotalVos.get(i).getMapKey())) { |
| | | if(null != MgtMapIntTotalVos.get(i).getMapKey() && MgtMapIntTotalVos.get(i).getMapKey().isEmpty()){ |
| | | MgtMapIntTotalVos.remove(i); |
| | | } |
| | | } |
| | |
| | | orderFromList.add(kauishou); |
| | | orderFromList.add(meituan); |
| | | orderFromList = bigListRemoveNull(orderFromList); |
| | | |
| | | |
| | | //排行 |
| | | List<MgtMapBigTotalVo> sortedList = orderFromList.stream() |
| | | // 按 mapValue 降序排序,处理 null 值(若 mapValue 可能为 null) |