From 9aa109735b29215f9a64426300095706fd137d0b Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期三, 01 一月 2025 17:49:24 +0800 Subject: [PATCH] 修改bug --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java | 207 +++++++++++++++++++++++++++------------------------ 1 files changed, 111 insertions(+), 96 deletions(-) diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java index dc8cb2b..49c7347 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java @@ -15,12 +15,10 @@ 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.*; @@ -103,11 +101,17 @@ @Resource private UserChangeLogClient userChangeLogClient; - - - - - + @Resource + private PointSettingClient pointSettingClient; + + @Resource + private OrderBalancePaymentService orderBalancePaymentService; + + + + + + /** * 获取购物车列表 * @param type @@ -165,10 +169,11 @@ area.setCityCode(appUser.getCityCode()); area.setProvinceCode(appUser.getProvinceCode()); area.setVip(appUser.getVipId()); + area.setGoodsId(goodsId); GoodsArea goodsArea = goodsAreaClient.getGoodsArea(area).getData(); if(null == goodsArea){ //没有地区价格,则使用会员价格 - GoodsVip goodsVip = goodsVipClient.getGoodsVip(appUser.getVipId()).getData(); + GoodsVip goodsVip = goodsVipClient.getGoodsVip(goodsId, appUser.getVipId()).getData(); if(null == goodsVip){ //没有配置价格,直接使用原始基础价格 return null; @@ -181,6 +186,7 @@ price.setSuperiorSubcommission(goodsVip.getSuperiorSubcommission()); price.setSuperiorRebatePoints(goodsVip.getSuperiorRebatePoints()); price.setSuperiorType(goodsVip.getSuperiorType()); + price.setSuperiorPriceType(goodsVip.getSuperiorPriceType()); price.setServuceShopCharges(goodsVip.getServuceShopCharges()); price.setServuceShopPoints(goodsVip.getServuceShopPoints()); price.setTechnicianPoints(goodsVip.getTechnicianPoints()); @@ -198,6 +204,7 @@ price.setSuperiorSubcommission(goodsArea.getSuperiorSubcommission()); price.setSuperiorRebatePoints(goodsArea.getSuperiorRebatePoints()); price.setSuperiorType(goodsArea.getSuperiorType()); + price.setSuperiorPriceType(goodsArea.getSuperiorPriceType()); price.setServuceShopCharges(goodsArea.getServuceShopCharges()); price.setServuceShopPoints(goodsArea.getServuceShopPoints()); price.setTechnicianPoints(goodsArea.getTechnicianPoints()); @@ -222,6 +229,7 @@ price.setSuperiorSubcommission(goodsArea.getSuperiorSubcommission()); price.setSuperiorRebatePoints(goodsArea.getSuperiorRebatePoints()); price.setSuperiorType(goodsArea.getSuperiorType()); + price.setSuperiorPriceType(goodsArea.getSuperiorPriceType()); price.setServuceShopCharges(goodsArea.getServuceShopCharges()); price.setServuceShopPoints(goodsArea.getServuceShopPoints()); price.setTechnicianPoints(goodsArea.getTechnicianPoints()); @@ -249,6 +257,7 @@ price.setSuperiorSubcommission(goodsSeckill.getSuperiorSubcommission()); price.setSuperiorRebatePoints(goodsSeckill.getSuperiorRebatePoints()); price.setSuperiorType(goodsSeckill.getSuperiorType()); + price.setSuperiorPriceType(goodsSeckill.getSuperiorPriceType()); price.setServuceShopCharges(goodsSeckill.getServuceShopCharges()); price.setServuceShopPoints(goodsSeckill.getServuceShopPoints()); price.setTechnicianPoints(goodsSeckill.getTechnicianPoints()); @@ -365,8 +374,10 @@ confirmOrderVo.setResidualPoint(appUser.getLavePoint().intValue()); //获取默认收货地址 UserAddress userAddress = userAddressClient.getDefaultUserAddress(userid).getData(); - userAddress.setIdStr(userAddress.getId().toString()); - confirmOrderVo.setUserAddress(userAddress); + if(null != userAddress){ + userAddress.setIdStr(userAddress.getId().toString()); + confirmOrderVo.setUserAddress(userAddress); + } confirmOrderVo.setPaymentType(confirmOrder.getPaymentType()); //获取用户优惠券,用户全部优惠券,不能使用的需要标识出来置灰展示 PaymentUserCoupon paymentUserCoupon = new PaymentUserCoupon(); @@ -377,7 +388,7 @@ List<PaymentUserCouponVo> data = userCouponClient.getPaymentUserCoupon(paymentUserCoupon).getData(); if(null != data){ for (PaymentUserCouponVo couponInfo : data) { - List<Integer> forGoodIds = couponInfo.getForGoodIds(); + List<String> forGoodIds = couponInfo.getForGoodIds(); //全部商品适用 if(null == forGoodIds){ //满减券 @@ -414,19 +425,19 @@ //获取快递策略 SystemConfig systemConfig = systemConfigClient.getSystemConfig(3).getData(); JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); - confirmOrderVo.setExpressFee(jsonObject.getBigDecimal("expressFee")); - List<Integer> vip = jsonObject.getJSONArray("vip").toList(Integer.class); + confirmOrderVo.setExpressFee(jsonObject.getBigDecimal("freight")); + List<String> vip = Arrays.asList(jsonObject.getString("freeVip").split(",")); //包邮条件(所有会员或者满足条件的会员) - if(vip.get(0) == -1 || vip.contains(appUser.getVipId())){ + if(vip.get(0).equals("0") || vip.contains(appUser.getVipId().toString())){ if(confirmOrder.getPaymentType() == 1){ //现金支付,支付金额满足包邮条件 - BigDecimal cash = jsonObject.getBigDecimal("cash"); + BigDecimal cash = jsonObject.getBigDecimal("freeFreight"); if(confirmOrderVo.getPayMoney().compareTo(cash) >= 0){ confirmOrderVo.setExpressFee(BigDecimal.ZERO); } }else{ //积分支付,支付积分是否满足包邮条件 - Integer point = jsonObject.getInteger("point"); + Integer point = jsonObject.getInteger("freeIntegral"); if(confirmOrderVo.getOrderPoint().compareTo(point) >= 0){ confirmOrderVo.setExpressFee(BigDecimal.ZERO); } @@ -470,8 +481,8 @@ //使用商品的基础价格 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()); @@ -484,7 +495,7 @@ 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); @@ -492,18 +503,19 @@ 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()); vo.setSuperiorSubcommission(price.getSuperiorSubcommission()); vo.setSuperiorRebatePoints(price.getSuperiorRebatePoints()); vo.setSuperiorType(price.getSuperiorType()); + vo.setSuperiorPriceType(price.getSuperiorPriceType()); vo.setServuceShopCharges(price.getServuceShopCharges()); vo.setServuceShopPoints(price.getServuceShopPoints()); vo.setTechnicianPoints(price.getTechnicianPoints()); @@ -605,7 +617,6 @@ orderMoney = orderMoney.add(myShoppingCartVo.getCash().multiply(new BigDecimal(myShoppingCartVo.getNumber()))); } }else{ - orderPoint = goodsList.stream().mapToInt(MyShoppingCartVo::getPoint).sum(); for (MyShoppingCartVo myShoppingCartVo : goodsList) { orderPoint += (myShoppingCartVo.getPoint() * myShoppingCartVo.getNumber()); } @@ -629,9 +640,10 @@ if(null != shoppingCartPayment.getUserCouponId() && 3 != shoppingCartPayment.getPaymentType()){ couponInfoVo = userCouponClient.getCouponInfo(shoppingCartPayment.getUserCouponId()).getData(); String forGoodIds = couponInfoVo.getForGoodIds(); - List<Integer> parseArray = JSON.parseArray(forGoodIds, Integer.class); + String[] split = forGoodIds.split(","); + List<String> parseArray = Arrays.asList(split); //全部商品 - if(parseArray.contains(-1)){ + if("-1".equals(forGoodIds)){ //满减 if(1 == couponInfoVo.getCouponType() && couponInfoVo.getConditionAmount().compareTo(paymentMoney) <= 0){ paymentMoney = paymentMoney.subtract(couponInfoVo.getDiscountAmount()); @@ -658,7 +670,7 @@ paymentMoney = BigDecimal.ZERO; BigDecimal goodsMoney = BigDecimal.ZERO; for (MyShoppingCartVo myShoppingCartVo : goodsList) { - Integer goodsId = myShoppingCartVo.getGoodsId(); + String goodsId = myShoppingCartVo.getGoodsId().toString(); BigDecimal cash = myShoppingCartVo.getCash(); if(parseArray.contains(goodsId)){ goodsMoney = goodsMoney.add(cash); @@ -696,11 +708,11 @@ 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); @@ -724,19 +736,19 @@ SystemConfig systemConfig = systemConfigClient.getSystemConfig(3).getData(); JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); //快递费 - expressFee = jsonObject.getBigDecimal("expressFee"); - List<Integer> vip = jsonObject.getJSONArray("vip").toList(Integer.class); + expressFee = jsonObject.getBigDecimal("freight"); + List<String> vip = Arrays.asList(jsonObject.getString("freeVip").split(",")); //包邮条件(所有会员或者满足条件的会员) - if(vip.get(0) == -1 || vip.contains(appUser.getVipId())){ + if(vip.get(0).equals("0") || vip.contains(appUser.getVipId().toString())){ if(shoppingCartPayment.getPaymentType() != 3){ //现金支付,支付金额满足包邮条件 - BigDecimal cash = jsonObject.getBigDecimal("cash"); + BigDecimal cash = jsonObject.getBigDecimal("freeFreight"); if(paymentMoney.compareTo(cash) >= 0){ expressFee = BigDecimal.ZERO; } }else{ //积分支付,支付积分是否满足包邮条件 - Integer point = jsonObject.getInteger("point"); + Integer point = jsonObject.getInteger("freeIntegral"); if(orderPoint.compareTo(point) >= 0){ expressFee = BigDecimal.ZERO; } @@ -796,6 +808,12 @@ return R.fail("账户余额不足"); } } + if(3 == shoppingCartPayment.getPaymentType()){ + Integer availablePoint = appUser.getAvailablePoint(); + if(availablePoint < orderPoint){ + return R.fail("账户积分不足"); + } + } //判断运费支付是否足够 if(null != shoppingCartPayment.getFreightPaymentType() && 2 == shoppingCartPayment.getFreightPaymentType() && expressFee.compareTo(BigDecimal.ZERO) > 0){ BigDecimal balance = appUser.getBalance(); @@ -834,6 +852,7 @@ orderGood.setSuperiorSubcommission(myShoppingCartVo.getSuperiorSubcommission()); orderGood.setSuperiorRebatePoints(myShoppingCartVo.getSuperiorRebatePoints()); orderGood.setSuperiorType(myShoppingCartVo.getSuperiorType()); + orderGood.setSuperiorPriceType(myShoppingCartVo.getSuperiorPriceType()); orderGood.setServuceShopCharges(myShoppingCartVo.getServuceShopCharges()); orderGood.setServuceShopPoints(myShoppingCartVo.getServuceShopPoints()); orderGood.setTechnicianPoints(myShoppingCartVo.getTechnicianPoints()); @@ -854,17 +873,22 @@ } //账户余额 + 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); @@ -872,6 +896,7 @@ appUser.setTotalRedPacketAmount(totalRedPacketAmount); appUser.setTotalDistributionAmount(totalDistributionAmount); appUser.setBalance(balance); + distributionAmount = paymentMoney; }else{ paymentMoney = paymentMoney.subtract(totalDistributionAmount); totalDistributionAmount = BigDecimal.ZERO; @@ -879,13 +904,23 @@ appUser.setTotalRedPacketAmount(totalRedPacketAmount); appUser.setTotalDistributionAmount(totalDistributionAmount); appUser.setBalance(balance); + distributionAmount = totalDistributionAmount; } } //构建积分流水记录 if(earnPoint > 0){ + PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData(); + int earnPoint1 = 0; + if(null != pointSetting && 1 == pointSetting.getBuyPointOpen()){ + earnPoint1 = new BigDecimal(earnPoint).multiply(pointSetting.getBuyPoint().divide(new BigDecimal(100))).intValue(); + } appUser.setShopPoint(appUser.getShopPoint() + earnPoint); appUser.setLavePoint(appUser.getLavePoint() + earnPoint); appUser.setTotalPoint(appUser.getTotalPoint() + earnPoint); + appUser.setAvailablePoint(appUser.getAvailablePoint() + earnPoint1); + if(null != pointSetting && 1 == pointSetting.getBuyPointGift()){ + appUser.setTransferablePoint(appUser.getTransferablePoint() + earnPoint1); + } UserPoint userPoint = new UserPoint(); userPoint.setType(1); @@ -900,6 +935,8 @@ appUser.setShopAmount(appUser.getShopAmount().add(paymentMoney).setScale(2, RoundingMode.HALF_EVEN)); appUser.setLastShopTime(LocalDateTime.now()); appUserClient.editAppUserById(appUser); + //变更等级 + appUserClient.vipUpgrade(appUser.getId()); //构建余额明细变动记录 BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord(); balanceChangeRecord.setAppUserId(appUser.getId()); @@ -913,46 +950,49 @@ balanceChangeRecordClient.saveBalanceChangeRecord(balanceChangeRecord); //修改订支付状态 order.setPayStatus(2); + if(goods.getType() == 2 && null == shoppingCartPayment.getUserAddressId()){ + order.setOrderStatus(2); + } orderService.updateById(order); //删除购物车数据 this.removeBatchByIds(ids); - //检查消费积分满足后升级会员 - vipUpgrade(appUser); } //积分支付 if(3 == shoppingCartPayment.getPaymentType()){ Integer lavePoint = appUser.getLavePoint(); - appUser.setLavePoint(lavePoint - orderPoint); + PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData(); + int earnPoint1 = 0; + //计算可用积分比例 + if(null != pointSetting && 1 == pointSetting.getBuyPointOpen()){ + earnPoint1 = new BigDecimal(earnPoint).multiply(pointSetting.getBuyPoint().divide(new BigDecimal(100))).intValue(); + } + //扣减订单支付积分 + appUser.setLavePoint(appUser.getLavePoint() - orderPoint); + appUser.setAvailablePoint(appUser.getAvailablePoint() - orderPoint); + appUser.setShopPoint(appUser.getShopPoint() + earnPoint); appUser.setLavePoint(appUser.getLavePoint() + earnPoint); + appUser.setAvailablePoint(appUser.getAvailablePoint() + earnPoint1); + if(null != pointSetting && 1 == pointSetting.getBuyPointGift()){ + appUser.setTransferablePoint(appUser.getTransferablePoint() + 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); + //变更等级 + appUserClient.vipUpgrade(appUser.getId()); //构建积分流水记录 UserPoint userPoint = new UserPoint(); - userPoint.setType(4); + 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()); userPoint.setObjectId(order.getId()); userPointClient.saveUserPoint(userPoint); - if(earnPoint > 0){ - userPoint = new UserPoint(); - userPoint.setType(1); - userPoint.setHistoricalPoint(appUser.getLavePoint() - earnPoint); - userPoint.setVariablePoint(earnPoint); - userPoint.setBalance(appUser.getLavePoint()); - userPoint.setCreateTime(LocalDateTime.now()); - userPoint.setAppUserId(appUser.getId()); - userPoint.setObjectId(order.getId()); - userPointClient.saveUserPoint(userPoint); - } //如果有运费,需要先扣除账户积分,再进行支付。支付成功后修改订单状态,未支付成功则回退积分,删除的订单 if(expressFee.compareTo(BigDecimal.ZERO) > 0){ if(shoppingCartPayment.getFreightPaymentType() == 1){ @@ -967,8 +1007,10 @@ 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); @@ -976,6 +1018,7 @@ appUser.setTotalRedPacketAmount(totalRedPacketAmount); appUser.setTotalDistributionAmount(totalDistributionAmount); appUser.setBalance(balance); + distributionAmount = expressFee; }else{ expressFee = expressFee.subtract(totalDistributionAmount); totalDistributionAmount = BigDecimal.ZERO; @@ -983,6 +1026,7 @@ appUser.setTotalRedPacketAmount(totalRedPacketAmount); appUser.setTotalDistributionAmount(totalDistributionAmount); appUser.setBalance(balance); + distributionAmount = totalDistributionAmount; } } @@ -1000,6 +1044,9 @@ balanceChangeRecordClient.saveBalanceChangeRecord(balanceChangeRecord); //修改订支付状态 order.setPayStatus(2); + if(goods.getType() == 2 && null == shoppingCartPayment.getUserAddressId()){ + order.setOrderStatus(2); + } orderService.updateById(order); //删除购物车数据 this.removeBatchByIds(ids); @@ -1007,10 +1054,21 @@ }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()); } @@ -1025,47 +1083,4 @@ } - /** - * 会员等级变化 - * @param appUser - */ - public void vipUpgrade(AppUser appUser){ - Integer shopPoint = appUser.getShopPoint(); - Integer vipId = appUser.getVipId(); - //钻石会员 - VipSetting vipSetting3 = vipSettingClient.getVipSetting(3).getData(); - Integer vipLevelUpShopRole = vipSetting3.getVipLevelUpShopRole(); - Integer vipLevelUpShop = vipSetting3.getVipLevelUpShop(); - if(1 == vipLevelUpShopRole && appUser.getVipId() < 3 && shopPoint >= vipLevelUpShop){ - appUser.setVipId(3); - appUserClient.editAppUserById(appUser); - //添加等级变化记录 - UserChangeLog userChangeLog = new UserChangeLog(); - userChangeLog.setDelFlag(0); - userChangeLog.setCreateTime(LocalDateTime.now()); - userChangeLog.setAppUserId(appUser.getId()); - userChangeLog.setBeforeVipId(vipId); - userChangeLog.setAfterVipId(appUser.getVipId()); - userChangeLog.setChangeType(1); - userChangeLogClient.saveUserChangeLog(userChangeLog); - return; - } - //黄金会员 - VipSetting vipSetting2 = vipSettingClient.getVipSetting(2).getData(); - vipLevelUpShopRole = vipSetting2.getVipLevelUpShopRole(); - vipLevelUpShop = vipSetting2.getVipLevelUpShop(); - if(1 == vipLevelUpShopRole && appUser.getVipId() < 2 && shopPoint >= vipLevelUpShop){ - appUser.setVipId(2); - appUserClient.editAppUserById(appUser); - //添加等级变化记录 - UserChangeLog userChangeLog = new UserChangeLog(); - userChangeLog.setDelFlag(0); - userChangeLog.setCreateTime(LocalDateTime.now()); - userChangeLog.setAppUserId(appUser.getId()); - userChangeLog.setBeforeVipId(vipId); - userChangeLog.setAfterVipId(appUser.getVipId()); - userChangeLog.setChangeType(1); - userChangeLogClient.saveUserChangeLog(userChangeLog); - } - } } -- Gitblit v1.7.1