| | |
| | | //查询符合商品类型的商品数据 |
| | | List<ShoppingCart> list = this.list(new LambdaQueryWrapper<ShoppingCart>().eq(ShoppingCart::getAppUserId, userid) |
| | | .in(ShoppingCart::getGoodsId, goodsIds).eq(ShoppingCart::getStatus, 1)); |
| | | //删除过期的秒杀活动商品 |
| | | List<ShoppingCart> list1 = new ArrayList<>(); |
| | | for (ShoppingCart shoppingCart : list) { |
| | | if(shoppingCart.getType() == 2){ |
| | | GetSeckillActivityInfo info = new GetSeckillActivityInfo(); |
| | | info.setGoodsId(shoppingCart.getGoodsId()); |
| | | info.setVip(appUser.getVipId()); |
| | | GoodsSeckill data1 = seckillActivityInfoClient.getSeckillActivityInfo(info).getData(); |
| | | if(null != data1){ |
| | | SeckillActivityInfo seckillActivityInfo = seckillActivityInfoClient.getSeckillActivityInfoById(data1.getSeckillActivityInfoId()).getData(); |
| | | if(null != seckillActivityInfo && (seckillActivityInfo.getIsShelves() == 1 && |
| | | seckillActivityInfo.getStartTime().isBefore(LocalDateTime.now()) && seckillActivityInfo.getEndTime().isAfter(LocalDateTime.now()))){ |
| | | |
| | | list1.add(shoppingCart); |
| | | continue; |
| | | } |
| | | } |
| | | this.removeById(shoppingCart.getId()); |
| | | }else{ |
| | | list1.add(shoppingCart); |
| | | } |
| | | } |
| | | |
| | | //构建返回数据 |
| | | List<MyShoppingCartVo> page = buildDetail(appUser, shopId, list, null); |
| | | List<MyShoppingCartVo> page = buildDetail(appUser, shopId, list1, null); |
| | | return page; |
| | | } |
| | | |
| | |
| | | confirmOrderVo.setDiscountAmount(activityAmount); |
| | | int earnPoint = goodsList.stream().mapToInt(MyShoppingCartVo::getEarnSpendingPoints).sum(); |
| | | confirmOrderVo.setEarnPoint(earnPoint); |
| | | if(BigDecimal.ZERO.compareTo(paymentMoney) > 0){ |
| | | if(null != paymentMoney && BigDecimal.ZERO.compareTo(paymentMoney) > 0){ |
| | | paymentMoney = BigDecimal.ZERO; |
| | | } |
| | | |
| | |
| | | UserAddress userAddress = userAddressClient.getDefaultUserAddress(userid).getData(); |
| | | if(null != userAddress){ |
| | | userAddress.setIdStr(userAddress.getId().toString()); |
| | | userAddress.setRecieveAddress(userAddress.getProvince() + userAddress.getCity() + userAddress.getDistrict() + userAddress.getRecieveAddress()); |
| | | confirmOrderVo.setUserAddress(userAddress); |
| | | } |
| | | confirmOrderVo.setPaymentType(confirmOrder.getPaymentType()); |
| | |
| | | order.setGoodName(goodName.substring(0, goodName.length() - 1)); |
| | | Goods goods = goodsClient.getGoodsById(goodsList.get(0).getGoodsId()).getData(); |
| | | order.setOrderType(goods.getType()); |
| | | order.setOrderStatus(goods.getType() == 1 ? 3 : 1); |
| | | order.setOrderStatus(goods.getType() == 1 ? 3 : (shoppingCartPayment.getDistributionMode() == 2 ? 1 : 2)); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | order.setOrderNumber("QJS" + getNumber(3) + sdf.format(new Date())); |
| | | order.setTotalAmount(orderMoney.setScale(2, RoundingMode.HALF_EVEN)); |
| | |
| | | if(null != orderActivityInfo1){ |
| | | order.setActivityJson(JSON.toJSONString(orderActivityInfo1)); |
| | | } |
| | | if(null != shoppingCartPayment.getUserAddressId()){ |
| | | if(2 == shoppingCartPayment.getDistributionMode()){ |
| | | UserAddress address = userAddressClient.getUserAddressById(shoppingCartPayment.getUserAddressId()).getData(); |
| | | order.setExpressAmount(expressFee); |
| | | order.setAddressJson(JSON.toJSONString(address)); |
| | |
| | | order.setDelFlag(0); |
| | | order.setCreateTime(LocalDateTime.now()); |
| | | order.setExpressPayMethod(shoppingCartPayment.getFreightPaymentType()); |
| | | order.setDistributionMode(shoppingCartPayment.getDistributionMode()); |
| | | |
| | | if(2 == shoppingCartPayment.getPaymentType()){ |
| | | BigDecimal balance = appUser.getBalance(); |
| | |
| | | //构建余额明细变动记录 |
| | | BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord(); |
| | | balanceChangeRecord.setAppUserId(appUser.getId()); |
| | | balanceChangeRecord.setVipId(appUser.getVipId()); |
| | | balanceChangeRecord.setOrderId(order.getId()); |
| | | balanceChangeRecord.setChangeType(5); |
| | | balanceChangeRecord.setBeforeAmount(balance.add(paymentMoney)); |
| | |
| | | //构建余额明细变动记录 |
| | | BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord(); |
| | | balanceChangeRecord.setAppUserId(appUser.getId()); |
| | | balanceChangeRecord.setVipId(appUser.getVipId()); |
| | | balanceChangeRecord.setOrderId(order.getId()); |
| | | balanceChangeRecord.setChangeType(5); |
| | | balanceChangeRecord.setBeforeAmount(balance.add(expressFee)); |
| | |
| | | } |
| | | |
| | | //删除购物车数据 |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | Long userid = order.getAppUserId(); |
| | | List<OrderGood> list = orderGoodService.list(new LambdaQueryWrapper<OrderGood>().eq(OrderGood::getOrderId, order.getId())); |
| | | List<Integer> goodsIds = list.stream().map(OrderGood::getGoodsId).collect(Collectors.toList()); |
| | | this.remove(new LambdaQueryWrapper<ShoppingCart>().eq(ShoppingCart::getAppUserId, userid).in(ShoppingCart::getGoodsId, goodsIds)); |
| | | |
| | | //商品销量增加 |
| | | for (Integer goodsId : goodsIds) { |
| | | goodsClient.editGoodsNum(goodsId, 1); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |