| | |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.mapper.ShoppingCartMapper; |
| | | import com.ruoyi.order.model.Order; |
| | | import com.ruoyi.order.model.OrderBalancePayment; |
| | | import com.ruoyi.order.model.OrderGood; |
| | | import com.ruoyi.order.model.ShoppingCart; |
| | | import com.ruoyi.order.service.CommissionService; |
| | | import com.ruoyi.order.service.OrderGoodService; |
| | | import com.ruoyi.order.service.OrderService; |
| | | import com.ruoyi.order.service.ShoppingCartService; |
| | | import com.ruoyi.order.service.*; |
| | | import com.ruoyi.order.vo.*; |
| | | import com.ruoyi.other.api.domain.*; |
| | | import com.ruoyi.other.api.feignClient.*; |
| | | import com.ruoyi.other.api.vo.GetGoodsBargainPrice; |
| | | import com.ruoyi.other.api.vo.GetGoodsShopByGoodsIds; |
| | | import com.ruoyi.other.api.vo.GetSeckillActivityInfo; |
| | | import lombok.Data; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, ShoppingCart> implements ShoppingCartService { |
| | | |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | @Resource |
| | | private GoodsClient goodsClient; |
| | | |
| | | |
| | | @Resource |
| | | private GoodsShopClient goodsShopClient; |
| | | |
| | | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | |
| | | @Resource |
| | | private GoodsAreaClient goodsAreaClient; |
| | | |
| | | |
| | | @Resource |
| | | private GoodsVipClient goodsVipClient; |
| | | |
| | | |
| | | @Resource |
| | | private SeckillActivityInfoClient seckillActivityInfoClient; |
| | | |
| | | |
| | | @Resource |
| | | private GoodsBargainPriceClient goodsBargainPriceClient; |
| | | |
| | | |
| | | @Resource |
| | | private OrderService orderService; |
| | | |
| | | |
| | | @Resource |
| | | private OrderGoodService orderGoodService; |
| | | |
| | | |
| | | @Resource |
| | | private ShopClient shopClient; |
| | | |
| | | |
| | | @Resource |
| | | private OrderActivityInfoClient orderActivityInfoClient; |
| | | |
| | | |
| | | @Resource |
| | | private BaseSettingClient baseSettingClient; |
| | | |
| | | |
| | | @Resource |
| | | private UserAddressClient userAddressClient; |
| | | |
| | | |
| | | @Resource |
| | | private UserCouponClient userCouponClient; |
| | | |
| | | |
| | | @Resource |
| | | private SystemConfigClient systemConfigClient; |
| | | |
| | | |
| | | @Resource |
| | | private UserPointClient userPointClient; |
| | | |
| | | |
| | | @Resource |
| | | private BalanceChangeRecordClient balanceChangeRecordClient; |
| | | |
| | | |
| | | @Resource |
| | | private CommissionService commissionService; |
| | | |
| | | |
| | | @Resource |
| | | private VipSettingClient vipSettingClient; |
| | | |
| | | |
| | | @Resource |
| | | private UserChangeLogClient userChangeLogClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private PointSettingClient pointSettingClient; |
| | | |
| | | @Resource |
| | | private OrderBalancePaymentService orderBalancePaymentService; |
| | | |
| | | |
| | | |
| | |
| | | List<MyShoppingCartVo> page = buildDetail(appUser, shopId, list, null); |
| | | return page; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取支付价格 |
| | | * @param appUser |
| | |
| | | GetGoodsBargainPrice goodsBargainPrice = new GetGoodsBargainPrice(); |
| | | goodsBargainPrice.setGoodsId(goodsId); |
| | | goodsBargainPrice.setVip(appUser.getVipId()); |
| | | goodsBargainPrice.setShopId(shopId); |
| | | GoodsBargainPriceDetail bargainPriceDetail = goodsBargainPriceClient.getGoodsBargainPrice(goodsBargainPrice).getData(); |
| | | GoodsBargainPriceDetail bargainPriceDetail = null; |
| | | if (shopId != null){ |
| | | goodsBargainPrice.setShopId(shopId); |
| | | bargainPriceDetail = goodsBargainPriceClient.getGoodsBargainPrice(goodsBargainPrice).getData(); |
| | | } |
| | | if(null == bargainPriceDetail){ |
| | | //没有门店特价,判断地区价格配置 |
| | | GoodsArea area = new GoodsArea(); |
| | |
| | | }else{ |
| | | price.setCash(goodsVip.getSellingPrice()); |
| | | price.setPoint(goodsVip.getIntegral()); |
| | | price.setCashPayment(goodsVip.getCashPayment() == 1 ? true : false); |
| | | price.setPointPayment(goodsVip.getPointPayment() == 1 ? true : false); |
| | | price.setCashPayment(goodsVip.getCashPayment() == 1); |
| | | price.setPointPayment(goodsVip.getPointPayment() == 1); |
| | | price.setEarnSpendingPoints(goodsVip.getEarnSpendingPoints()); |
| | | price.setSuperiorSubcommission(goodsVip.getSuperiorSubcommission()); |
| | | price.setSuperiorRebatePoints(goodsVip.getSuperiorRebatePoints()); |
| | |
| | | }else{ |
| | | price.setCash(goodsArea.getSellingPrice()); |
| | | price.setPoint(goodsArea.getIntegral()); |
| | | price.setCashPayment(goodsArea.getCashPayment() == 1 ? true : false); |
| | | price.setPointPayment(goodsArea.getPointPayment() == 1 ? true : false); |
| | | price.setCashPayment(goodsArea.getCashPayment() == 1); |
| | | price.setPointPayment(goodsArea.getPointPayment() == 1); |
| | | price.setEarnSpendingPoints(goodsArea.getEarnSpendingPoints()); |
| | | price.setSuperiorSubcommission(goodsArea.getSuperiorSubcommission()); |
| | | price.setSuperiorRebatePoints(goodsArea.getSuperiorRebatePoints()); |
| | |
| | | }else{ |
| | | price.setCash(bargainPriceDetail.getSellingPrice()); |
| | | price.setPoint(bargainPriceDetail.getIntegral()); |
| | | price.setCashPayment(bargainPriceDetail.getSellingPrice() != null ? true : false); |
| | | price.setPointPayment(bargainPriceDetail.getIntegral() != null ? true : false); |
| | | price.setCashPayment(bargainPriceDetail.getSellingPrice() != null); |
| | | price.setPointPayment(bargainPriceDetail.getIntegral() != null); |
| | | //门店特价,消费积分使用会员等级的消费积分 |
| | | GoodsArea area = new GoodsArea(); |
| | | area.setDistrictsCode(appUser.getDistrictCode()); |
| | |
| | | if(goodsSeckill.getCashPayment() == 0 && goodsSeckill.getPointPayment() == 1){ |
| | | price.setPoint(goodsSeckill.getIntegral()); |
| | | } |
| | | price.setCashPayment(goodsSeckill.getCashPayment() == 1 ? true : false); |
| | | price.setPointPayment(goodsSeckill.getPointPayment() == 1 ? true : false); |
| | | price.setCashPayment(goodsSeckill.getCashPayment() == 1); |
| | | price.setPointPayment(goodsSeckill.getPointPayment() == 1); |
| | | price.setEndTime(goodsSeckill.getEndTime()); |
| | | price.setEarnSpendingPoints(goodsSeckill.getEarnSpendingPoints()); |
| | | price.setSuperiorSubcommission(goodsSeckill.getSuperiorSubcommission()); |
| | | price.setSuperiorRebatePoints(goodsSeckill.getSuperiorRebatePoints()); |
| | | price.setSuperiorType(goodsSeckill.getSuperiorType()); |
| | | price.setSuperiorType(String.valueOf(goodsSeckill.getSuperiorType())); |
| | | price.setServuceShopCharges(goodsSeckill.getServuceShopCharges()); |
| | | price.setServuceShopPoints(goodsSeckill.getServuceShopPoints()); |
| | | price.setTechnicianPoints(goodsSeckill.getTechnicianPoints()); |
| | |
| | | } |
| | | return price; |
| | | } |
| | | |
| | | |
| | | @Data |
| | | class Price { |
| | | /** |
| | | * 现金 |
| | | */ |
| | | private BigDecimal cash; |
| | | /** |
| | | * 积分 |
| | | */ |
| | | private Integer point; |
| | | /** |
| | | * 获取结束时间 |
| | | */ |
| | | private Long endTime; |
| | | /** |
| | | * 现金支付 |
| | | */ |
| | | private Boolean cashPayment; |
| | | /** |
| | | * 积分支付 |
| | | */ |
| | | private Boolean pointPayment; |
| | | /** |
| | | * 可获得消费积分 |
| | | */ |
| | | private Integer earnSpendingPoints; |
| | | /** |
| | | * 上级获得分佣金额 |
| | | */ |
| | | private BigDecimal superiorSubcommission; |
| | | /** |
| | | * 上级获得返佣积分 |
| | | */ |
| | | private Integer superiorRebatePoints; |
| | | /** |
| | | * 获取返佣积分上级类型(1=直推上级,2=直帮上级) |
| | | */ |
| | | private Integer superiorType; |
| | | /** |
| | | * 核销门店可获得服务费 |
| | | */ |
| | | private BigDecimal servuceShopCharges; |
| | | /** |
| | | * 核销门店可获得服务积分 |
| | | */ |
| | | private Integer servuceShopPoints; |
| | | /** |
| | | * 技师可获得服务积分 |
| | | */ |
| | | private Integer technicianPoints; |
| | | /** |
| | | * 绑定门店可获得分佣金额 |
| | | */ |
| | | private BigDecimal boundShopCharges; |
| | | /** |
| | | * 绑定门店可获得返佣积分 |
| | | */ |
| | | private Integer boundShopPoints; |
| | | /** |
| | | * 绑定门店上级门店可获得分佣金额 |
| | | */ |
| | | private BigDecimal boundShopSuperiorsCharges; |
| | | /** |
| | | * 绑定门店上级门店可获得返佣积分 |
| | | */ |
| | | private Integer boundShopSuperiorsPoints; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public Long addGoods(ShoppingCart shoppingCart) { |
| | |
| | | this.save(shoppingCart); |
| | | return shoppingCart.getId(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 修改购物车数量 |
| | | * @param setGoodsNumber |
| | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 确认购物车订单 |
| | | * @param confirmOrder |
| | |
| | | } |
| | | return confirmOrderVo; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 构建购物车商品列表 |
| | | * @param appUser |
| | |
| | | //使用商品的基础价格 |
| | | price.setCash(1 == goods.getCashPayment() ? goods.getSellingPrice() : null); |
| | | price.setPoint(1 == goods.getPointPayment() ? goods.getIntegral() : null); |
| | | price.setCashPayment(goods.getCashPayment() == 1 ? true : false); |
| | | price.setPointPayment(goods.getPointPayment() == 1 ? true : false); |
| | | price.setCashPayment(goods.getCashPayment() == 1); |
| | | price.setPointPayment(goods.getPointPayment() == 1); |
| | | } |
| | | vo.setCash(price.getCash()); |
| | | vo.setPoint(price.getPoint()); |
| | |
| | | goodsShop.setGoodsId(shoppingCart.getGoodsId()); |
| | | goodsShop.setShopId(shopId); |
| | | GoodsShop goodsShop1 = goodsShopClient.getGoodsShop(goodsShop).getData(); |
| | | vo.setVerifiable(goods.getAppointStore() == 1 && null == goodsShop1 ? false : true); |
| | | vo.setVerifiable(goods.getAppointStore() != 1 || null != goodsShop1); |
| | | //判断当前数量是否已经超出限购数量(需要计算已经购买的数量) |
| | | if(null == goods.getPurchaseLimit() || -1 == goods.getPurchaseLimit()){ |
| | | vo.setPurchaseLimit(false); |
| | |
| | | List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().eq(Order::getAppUserId, appUser.getId()).eq(Order::getDelFlag, 0).in(Order::getOrderStatus, Arrays.asList(4, 8))); |
| | | List<Long> orderIds = orders.stream().map(Order::getId).collect(Collectors.toList()); |
| | | int sum = 0; |
| | | if(orderIds.size() > 0){ |
| | | if(!orderIds.isEmpty()){ |
| | | List<OrderGood> orderGoodList = orderGoodService.list(new LambdaQueryWrapper<OrderGood>().in(OrderGood::getOrderId, orderIds) |
| | | .eq(OrderGood::getGoodsId, shoppingCart.getGoodsId()).eq(OrderGood::getDelFlag, 0)); |
| | | sum = orderGoodList.stream().mapToInt(OrderGood::getNum).sum(); |
| | | } |
| | | vo.setPurchaseLimit((num + sum) > goods.getPurchaseLimit() ? true : false); |
| | | vo.setPurchaseLimit((num + sum) > goods.getPurchaseLimit()); |
| | | } |
| | | vo.setDistributionMode(goods.getDistributionMode()); |
| | | vo.setEarnSpendingPoints(price.getEarnSpendingPoints()); |
| | |
| | | } |
| | | return page; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 购物车支付操作 |
| | | * @param shoppingCartPayment |
| | |
| | | } |
| | | ids.add(id); |
| | | } |
| | | |
| | | |
| | | List<ShoppingCart> list = this.listByIds(ids); |
| | | //构建商品明细列表 |
| | | List<MyShoppingCartVo> goodsList = buildDetail(appUser, shopId, list, objects); |
| | |
| | | BigDecimal discountAmount = BigDecimal.ZERO; |
| | | //活动优惠金额 |
| | | BigDecimal activityAmount = BigDecimal.ZERO; |
| | | |
| | | |
| | | //减去优惠券优惠金额 |
| | | CouponInfoVo couponInfoVo = null; |
| | | if(null != shoppingCartPayment.getUserCouponId() && 3 != shoppingCartPayment.getPaymentType()){ |
| | |
| | | paymentMoney = paymentMoney.add(cash); |
| | | } |
| | | } |
| | | |
| | | |
| | | //满减 |
| | | if(1 == couponInfoVo.getCouponType() && couponInfoVo.getConditionAmount().compareTo(goodsMoney) <= 0){ |
| | | goodsMoney = goodsMoney.subtract(couponInfoVo.getDiscountAmount()); |
| | |
| | | paymentMoney = paymentMoney.add(goodsMoney); |
| | | } |
| | | } |
| | | |
| | | |
| | | //查询当前是否有订单活动 |
| | | OrderActivityInfo orderActivityInfo = orderActivityInfoClient.getNowOrderActivityInfo(appUser.getVipId()).getData(); |
| | | BaseSetting baseSetting = baseSettingClient.getBaseSetting(4).getData(); |
| | | //系统活动设置(优惠券和活动能否同时使用) |
| | | boolean useSimultaneously = baseSetting.getContent().equals("1") ? true : false; |
| | | boolean useSimultaneously = baseSetting.getContent().equals("1"); |
| | | //满XX才打折,只有现金才能优惠 |
| | | //如果使用优惠券,则需要判断是否可以和同时使用,且活动满足使用条件。 |
| | | //没有使用优惠券,只需要判断是都满足使用条件 |
| | | if(((useSimultaneously && null != shoppingCartPayment.getUserCouponId()) || null == shoppingCartPayment.getUserCouponId()) && |
| | | if((useSimultaneously || null == shoppingCartPayment.getUserCouponId()) && |
| | | null != orderActivityInfo && shoppingCartPayment.getPaymentType() != 3 && orderActivityInfo.getConditionAmount().compareTo(paymentMoney) <= 0){ |
| | | BigDecimal paymentMoney1 = orderActivityInfo.getDiscount().divide(new BigDecimal(10)).multiply(paymentMoney); |
| | | BigDecimal bigDecimal = paymentMoney.subtract(paymentMoney1).setScale(2, RoundingMode.HALF_EVEN); |
| | |
| | | paymentMoney = paymentMoney1; |
| | | activityAmount = activityAmount.add(bigDecimal); |
| | | } |
| | | |
| | | |
| | | //可获得的消费积分 |
| | | int earnPoint = 0; |
| | | for (MyShoppingCartVo myShoppingCartVo : goodsList) { |
| | |
| | | if(null != shoppingCartPayment.getUserAddressId()){ |
| | | userAddressClient.getUserAddressById(shoppingCartPayment.getUserAddressId()).getData(); |
| | | } |
| | | |
| | | |
| | | //获取快递策略,计算快递费 |
| | | BigDecimal expressFee = BigDecimal.ZERO; |
| | | if(null != shoppingCartPayment.getUserAddressId()){ |
| | |
| | | order.setDelFlag(0); |
| | | order.setCreateTime(LocalDateTime.now()); |
| | | order.setExpressPayMethod(shoppingCartPayment.getFreightPaymentType()); |
| | | |
| | | |
| | | if(2 == shoppingCartPayment.getPaymentType()){ |
| | | BigDecimal balance = appUser.getBalance(); |
| | | if(balance.compareTo(paymentMoney) < 0){ |
| | |
| | | return R.fail("账户余额不足"); |
| | | } |
| | | } |
| | | |
| | | |
| | | orderService.save(order); |
| | | //构建订单明细数据 |
| | | for (MyShoppingCartVo myShoppingCartVo : goodsList) { |
| | |
| | | orderGood.setBoundShopSuperiorsPoints(myShoppingCartVo.getBoundShopSuperiorsPoints()); |
| | | orderGoodService.save(orderGood); |
| | | } |
| | | |
| | | |
| | | //开始构建支付数据 |
| | | //现金支付 |
| | | paymentMoney = paymentMoney.add(expressFee).setScale(2, RoundingMode.HALF_EVEN); |
| | | if(1 == shoppingCartPayment.getPaymentType()){ |
| | | //调起微信支付 TODO 待完善 |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | //账户余额 |
| | | BigDecimal redPacketAmount = BigDecimal.ZERO; |
| | | BigDecimal distributionAmount = BigDecimal.ZERO; |
| | | if(2 == shoppingCartPayment.getPaymentType()){ |
| | | BigDecimal totalRedPacketAmount = appUser.getTotalRedPacketAmount(); |
| | | BigDecimal totalDistributionAmount = appUser.getTotalDistributionAmount(); |
| | | BigDecimal balance = appUser.getBalance(); |
| | | //红包金额满足支付 |
| | | if(paymentMoney.compareTo(totalRedPacketAmount) <= 0){ |
| | | totalRedPacketAmount = totalRedPacketAmount.subtract(paymentMoney); |
| | | balance = balance.subtract(paymentMoney); |
| | | appUser.setTotalRedPacketAmount(totalRedPacketAmount); |
| | | appUser.setBalance(balance); |
| | | redPacketAmount = paymentMoney; |
| | | }else{ |
| | | paymentMoney = paymentMoney.subtract(totalRedPacketAmount); |
| | | redPacketAmount = totalRedPacketAmount; |
| | | totalRedPacketAmount = BigDecimal.ZERO; |
| | | if(paymentMoney.compareTo(totalDistributionAmount) <= 0){ |
| | | totalDistributionAmount = totalDistributionAmount.subtract(paymentMoney); |
| | |
| | | appUser.setTotalRedPacketAmount(totalRedPacketAmount); |
| | | appUser.setTotalDistributionAmount(totalDistributionAmount); |
| | | appUser.setBalance(balance); |
| | | distributionAmount = paymentMoney; |
| | | }else{ |
| | | paymentMoney = paymentMoney.subtract(totalDistributionAmount); |
| | | totalDistributionAmount = BigDecimal.ZERO; |
| | |
| | | appUser.setTotalRedPacketAmount(totalRedPacketAmount); |
| | | appUser.setTotalDistributionAmount(totalDistributionAmount); |
| | | appUser.setBalance(balance); |
| | | distributionAmount = totalDistributionAmount; |
| | | } |
| | | } |
| | | //构建积分流水记录 |
| | |
| | | appUser.setShopPoint(appUser.getShopPoint() + earnPoint); |
| | | appUser.setLavePoint(appUser.getLavePoint() + earnPoint1); |
| | | appUser.setTotalPoint(appUser.getTotalPoint() + earnPoint); |
| | | |
| | | |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(1); |
| | | userPoint.setHistoricalPoint(appUser.getLavePoint() - earnPoint1); |
| | |
| | | balanceChangeRecordClient.saveBalanceChangeRecord(balanceChangeRecord); |
| | | //修改订支付状态 |
| | | order.setPayStatus(2); |
| | | if(goods.getType() == 2 && null == shoppingCartPayment.getUserAddressId()){ |
| | | order.setOrderStatus(2); |
| | | } |
| | | orderService.updateById(order); |
| | | //删除购物车数据 |
| | | this.removeBatchByIds(ids); |
| | |
| | | appUser.setShopPoint(appUser.getShopPoint() + earnPoint); |
| | | appUser.setLavePoint(appUser.getLavePoint() + earnPoint1); |
| | | appUser.setTotalPoint(appUser.getTotalPoint() + earnPoint); |
| | | appUser.setShopAmount(appUser.getShopAmount().add(paymentMoney).setScale(2, RoundingMode.HALF_EVEN)); |
| | | appUser.setLastShopTime(LocalDateTime.now()); |
| | | appUserClient.editAppUserById(appUser); |
| | | //检查消费积分满足后升级会员 |
| | | vipUpgrade(appUser); |
| | | |
| | | |
| | | //构建积分流水记录 |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(1); |
| | | userPoint.setHistoricalPoint(lavePoint); |
| | | userPoint.setVariablePoint(orderPoint); |
| | | Integer point = appUser.getLavePoint() - lavePoint; |
| | | userPoint.setVariablePoint(point >= 0 ? point : point * -1); |
| | | userPoint.setBalance(appUser.getLavePoint()); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUser.getId()); |
| | |
| | | balance = balance.subtract(expressFee); |
| | | appUser.setTotalRedPacketAmount(totalRedPacketAmount); |
| | | appUser.setBalance(balance); |
| | | redPacketAmount = expressFee; |
| | | }else{ |
| | | expressFee = expressFee.subtract(totalRedPacketAmount); |
| | | redPacketAmount = totalRedPacketAmount; |
| | | totalRedPacketAmount = BigDecimal.ZERO; |
| | | if(expressFee.compareTo(totalDistributionAmount) <= 0){ |
| | | totalDistributionAmount = totalDistributionAmount.subtract(expressFee); |
| | |
| | | appUser.setTotalRedPacketAmount(totalRedPacketAmount); |
| | | appUser.setTotalDistributionAmount(totalDistributionAmount); |
| | | appUser.setBalance(balance); |
| | | distributionAmount = expressFee; |
| | | }else{ |
| | | expressFee = expressFee.subtract(totalDistributionAmount); |
| | | totalDistributionAmount = BigDecimal.ZERO; |
| | |
| | | appUser.setTotalRedPacketAmount(totalRedPacketAmount); |
| | | appUser.setTotalDistributionAmount(totalDistributionAmount); |
| | | appUser.setBalance(balance); |
| | | distributionAmount = totalDistributionAmount; |
| | | } |
| | | } |
| | | |
| | | |
| | | appUserClient.editAppUserById(appUser); |
| | | //构建余额明细变动记录 |
| | | BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord(); |
| | |
| | | balanceChangeRecordClient.saveBalanceChangeRecord(balanceChangeRecord); |
| | | //修改订支付状态 |
| | | order.setPayStatus(2); |
| | | if(goods.getType() == 2 && null == shoppingCartPayment.getUserAddressId()){ |
| | | order.setOrderStatus(2); |
| | | } |
| | | orderService.updateById(order); |
| | | //删除购物车数据 |
| | | this.removeBatchByIds(ids); |
| | |
| | | }else{ |
| | | //修改订支付状态 |
| | | order.setPayStatus(2); |
| | | if(goods.getType() == 2 && null == shoppingCartPayment.getUserAddressId()){ |
| | | order.setOrderStatus(2); |
| | | } |
| | | orderService.updateById(order); |
| | | //删除购物车数据 |
| | | this.removeBatchByIds(ids); |
| | | } |
| | | } |
| | | //添加账户余额支付明细 |
| | | if(redPacketAmount.compareTo(BigDecimal.ZERO) > 0 || distributionAmount.compareTo(BigDecimal.ZERO) > 0){ |
| | | OrderBalancePayment orderBalancePayment = new OrderBalancePayment(); |
| | | orderBalancePayment.setOrderId(order.getId()); |
| | | orderBalancePayment.setRedPacketAmount(redPacketAmount); |
| | | orderBalancePayment.setDistributionAmount(distributionAmount); |
| | | orderBalancePaymentService.save(orderBalancePayment); |
| | | } |
| | | return R.ok(order.getId().toString()); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public String getNumber(Integer size){ |
| | | String str = ""; |
| | | for (Integer i = 0; i < size; i++) { |
| | |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 会员等级变化 |
| | | * @param appUser |
| | |
| | | VipSetting vipSetting3 = vipSettingClient.getVipSetting(3).getData(); |
| | | Integer vipLevelUpShopRole = vipSetting3.getVipLevelUpShopRole(); |
| | | Integer vipLevelUpShop = vipSetting3.getVipLevelUpShop(); |
| | | if(1 == vipLevelUpShopRole && appUser.getVipId() < 3 && shopPoint >= vipLevelUpShop){ |
| | | if(null != vipLevelUpShopRole && 1 == vipLevelUpShopRole && appUser.getVipId() < 3 && shopPoint >= vipLevelUpShop){ |
| | | appUser.setVipId(3); |
| | | appUserClient.editAppUserById(appUser); |
| | | //添加等级变化记录 |
| | |
| | | VipSetting vipSetting2 = vipSettingClient.getVipSetting(2).getData(); |
| | | vipLevelUpShopRole = vipSetting2.getVipLevelUpShopRole(); |
| | | vipLevelUpShop = vipSetting2.getVipLevelUpShop(); |
| | | if(1 == vipLevelUpShopRole && appUser.getVipId() < 2 && shopPoint >= vipLevelUpShop){ |
| | | if(null != vipLevelUpShopRole && 1 == vipLevelUpShopRole && appUser.getVipId() < 2 && shopPoint >= vipLevelUpShop){ |
| | | appUser.setVipId(2); |
| | | appUserClient.editAppUserById(appUser); |
| | | //添加等级变化记录 |