| | |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.event.PayEvent; |
| | | import com.ruoyi.order.mapper.ShoppingCartMapper; |
| | | import com.ruoyi.order.model.Order; |
| | | import com.ruoyi.order.model.OrderBalancePayment; |
| | |
| | | import com.ruoyi.other.api.vo.GetGoodsShopByGoodsIds; |
| | | import com.ruoyi.other.api.vo.GetSeckillActivityInfo; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.context.ApplicationEventPublisher; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneOffset; |
| | | import java.util.*; |
| | | import java.util.concurrent.ArrayBlockingQueue; |
| | | import java.util.concurrent.ThreadPoolExecutor; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Slf4j |
| | |
| | | private CommissionService commissionService; |
| | | |
| | | @Resource |
| | | private VipSettingClient vipSettingClient; |
| | | |
| | | @Resource |
| | | private UserChangeLogClient userChangeLogClient; |
| | | |
| | | @Resource |
| | | private PointSettingClient pointSettingClient; |
| | | |
| | | @Resource |
| | |
| | | |
| | | @Resource |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Resource |
| | | private ApplicationEventPublisher applicationEventPublisher; |
| | | |
| | | |
| | | |
| | |
| | | throw new RuntimeException("根据类型(1=服务商品,2=单品商品)获取商品数据失败"); |
| | | } |
| | | List<Integer> goodsIds = data.stream().map(Goods::getId).collect(Collectors.toList()); |
| | | if(goodsIds.isEmpty()){ |
| | | return new ArrayList<>(); |
| | | } |
| | | //查询符合商品类型的商品数据 |
| | | List<ShoppingCart> list = this.list(new LambdaQueryWrapper<ShoppingCart>().eq(ShoppingCart::getAppUserId, userid) |
| | | .in(ShoppingCart::getGoodsId, goodsIds).eq(ShoppingCart::getStatus, 1)); |
| | |
| | | @Override |
| | | public Long addGoods(ShoppingCart shoppingCart) { |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | Integer goodsSaleNum = orderService.getGoodsSaleNum(shoppingCart.getGoodsId(), null, userid); |
| | | long goodsSaleNum = orderService.getGoodsSaleNum(shoppingCart.getGoodsId(), null, userid); |
| | | long count = count(new LambdaQueryWrapper<ShoppingCart>() |
| | | .eq(ShoppingCart::getGoodsId, shoppingCart.getGoodsId()) |
| | | .eq(ShoppingCart::getStatus,1) |
| | | .eq(ShoppingCart::getAppUserId, userid)); |
| | | goodsSaleNum += count; |
| | | Goods goods = goodsClient.getGoodsById(shoppingCart.getGoodsId()).getData(); |
| | | if(null != goods.getPurchaseLimit() && -1 != goods.getPurchaseLimit() && (goodsSaleNum + shoppingCart.getNumber()) > goods.getPurchaseLimit()){ |
| | | |
| | | Integer maxNum = 0; |
| | | if(shoppingCart.getType() == 2){ |
| | | R<SeckillActivityInfo> r = seckillActivityInfoClient.getSeckillActivityInfoByGoodsId(shoppingCart.getGoodsId()); |
| | | if (R.isError(r)){ |
| | | throw new ServiceException("获取秒杀商品失败!"); |
| | | } |
| | | SeckillActivityInfo seckillActivityInfo = r.getData(); |
| | | maxNum = seckillActivityInfo.getMaxNum(); |
| | | }else { |
| | | maxNum = goods.getPurchaseLimit(); |
| | | } |
| | | |
| | | if(null != goods.getPurchaseLimit() && -1 != maxNum && (goodsSaleNum + shoppingCart.getNumber()) > maxNum){ |
| | | throw new ServiceException("超出购买数量限制"); |
| | | } |
| | | ShoppingCart one = this.getOne(new LambdaQueryWrapper<ShoppingCart>().eq(ShoppingCart::getAppUserId, userid) |
| | |
| | | @Override |
| | | public R setGoodsNumber(SetGoodsNumber setGoodsNumber) { |
| | | |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | ShoppingCart shoppingCart = this.getById(setGoodsNumber.getId()); |
| | | Integer goodsSaleNum = orderService.getGoodsSaleNum(shoppingCart.getGoodsId(), null, userid); |
| | | Goods goods = goodsClient.getGoodsById(shoppingCart.getGoodsId()).getData(); |
| | | if(null != goods.getPurchaseLimit() && -1 != goods.getPurchaseLimit() && (goodsSaleNum + shoppingCart.getNumber()) > goods.getPurchaseLimit()){ |
| | | throw new ServiceException("超出购买数量限制"); |
| | | } |
| | | if(0 >= setGoodsNumber.getNumber()){ |
| | | return R.fail("修改数量不能小于等于0"); |
| | | } |
| | |
| | | if(null != shoppingCart){ |
| | | |
| | | Goods goods1 = goodsClient.getGoodsById(shoppingCart.getGoodsId()).getData(); |
| | | if(null != goods1.getPurchaseLimit() && -1 != goods1.getPurchaseLimit() && goods1.getPurchaseLimit() < setGoodsNumber.getNumber()){ |
| | | if(null != goods1.getPurchaseLimit() && -1 != goods1.getPurchaseLimit() |
| | | && goods1.getPurchaseLimit() < setGoodsNumber.getNumber() |
| | | && setGoodsNumber.getNumber() >= shoppingCart.getNumber()){ |
| | | return R.fail("修改数量不能大于限购数量"); |
| | | } |
| | | |
| | |
| | | BigDecimal bigDecimal = BigDecimal.ZERO; |
| | | for (MyShoppingCartVo myShoppingCartVo : goodsList) { |
| | | bigDecimal = bigDecimal.add(myShoppingCartVo.getCash().multiply(new BigDecimal(myShoppingCartVo.getNumber()))); |
| | | myShoppingCartVo.setEarnSpendingPoints(myShoppingCartVo.getEarnSpendingPoints() * myShoppingCartVo.getNumber()); |
| | | } |
| | | confirmOrderVo.setOrderMoney(bigDecimal); |
| | | }else{ |
| | | int sum = 0; |
| | | for (MyShoppingCartVo myShoppingCartVo : goodsList) { |
| | | sum += ((null != myShoppingCartVo.getPoint() ? myShoppingCartVo.getPoint() : 0) * myShoppingCartVo.getNumber()); |
| | | myShoppingCartVo.setEarnSpendingPoints((null != myShoppingCartVo.getEarnSpendingPoints() ? myShoppingCartVo.getEarnSpendingPoints() : 0) * myShoppingCartVo.getNumber()); |
| | | } |
| | | confirmOrderVo.setOrderPoint(sum); |
| | | } |
| | |
| | | BigDecimal paymentMoney = orderMoney; |
| | | //总优惠金额 |
| | | BigDecimal activityAmount = BigDecimal.ZERO; |
| | | |
| | | |
| | | BaseSetting baseSetting = baseSettingClient.getBaseSetting(4).getData(); |
| | | confirmOrderVo.setUseSimultaneously(JSON.parseObject(baseSetting.getContent()).getInteger("status") == 1); |
| | |
| | | BigDecimal goodsMoney = BigDecimal.ZERO; |
| | | for (MyShoppingCartVo myShoppingCartVo : goodsList) { |
| | | String goodsId = myShoppingCartVo.getGoodsId().toString(); |
| | | BigDecimal cash = myShoppingCartVo.getCash(); |
| | | BigDecimal cash = myShoppingCartVo.getCash().multiply(new BigDecimal(myShoppingCartVo.getNumber())); |
| | | if(parseArray.contains(goodsId)){ |
| | | goodsMoney = goodsMoney.add(cash); |
| | | }else{ |
| | |
| | | vo.setPurchaseLimitNum(goods.getPurchaseLimit() - sum); |
| | | } |
| | | vo.setDistributionMode(goods.getDistributionMode()); |
| | | vo.setEarnSpendingPoints(price.getEarnSpendingPoints()); |
| | | vo.setSuperiorSubcommission(price.getSuperiorSubcommission()); |
| | | vo.setSuperiorRebatePoints(price.getSuperiorRebatePoints()); |
| | | vo.setEarnSpendingPoints(price.getEarnSpendingPoints() * shoppingCart.getNumber()); |
| | | vo.setSuperiorSubcommission(price.getSuperiorSubcommission().multiply(new BigDecimal(shoppingCart.getNumber()))); |
| | | vo.setSuperiorRebatePoints(price.getSuperiorRebatePoints() * shoppingCart.getNumber()); |
| | | vo.setSuperiorType(price.getSuperiorType()); |
| | | vo.setSuperiorPriceType(price.getSuperiorPriceType()); |
| | | vo.setServuceShopCharges(price.getServuceShopCharges()); |
| | | vo.setServuceShopPoints(price.getServuceShopPoints()); |
| | | vo.setTechnicianPoints(price.getTechnicianPoints()); |
| | | vo.setBoundShopCharges(price.getBoundShopCharges()); |
| | | vo.setBoundShopPoints(price.getBoundShopPoints()); |
| | | vo.setBoundShopSuperiorsCharges(price.getBoundShopSuperiorsCharges()); |
| | | vo.setBoundShopSuperiorsPoints(price.getBoundShopSuperiorsPoints()); |
| | | vo.setServuceShopCharges(price.getServuceShopCharges().multiply(new BigDecimal(shoppingCart.getNumber()))); |
| | | vo.setServuceShopPoints(price.getServuceShopPoints() * shoppingCart.getNumber()); |
| | | vo.setTechnicianPoints(price.getTechnicianPoints() * shoppingCart.getNumber()); |
| | | vo.setBoundShopCharges(price.getBoundShopCharges().multiply(new BigDecimal(shoppingCart.getNumber()))); |
| | | vo.setBoundShopPoints(price.getBoundShopPoints() * shoppingCart.getNumber()); |
| | | vo.setBoundShopSuperiorsCharges(price.getBoundShopSuperiorsCharges().multiply(new BigDecimal(shoppingCart.getNumber()))); |
| | | vo.setBoundShopSuperiorsPoints(price.getBoundShopSuperiorsPoints() * shoppingCart.getNumber()); |
| | | page.add(vo); |
| | | } |
| | | return page; |
| | |
| | | BigDecimal goodsMoney = BigDecimal.ZERO; |
| | | for (MyShoppingCartVo myShoppingCartVo : goodsList) { |
| | | String goodsId = myShoppingCartVo.getGoodsId().toString(); |
| | | BigDecimal cash = myShoppingCartVo.getCash(); |
| | | BigDecimal cash = myShoppingCartVo.getCash().multiply(new BigDecimal(myShoppingCartVo.getNumber())); |
| | | if(parseArray.contains(goodsId)){ |
| | | goodsMoney = goodsMoney.add(cash); |
| | | }else{ |
| | |
| | | //可获得的消费积分 |
| | | int earnPoint = 0; |
| | | for (MyShoppingCartVo myShoppingCartVo : goodsList) { |
| | | earnPoint += (myShoppingCartVo.getEarnSpendingPoints() * myShoppingCartVo.getNumber()); |
| | | earnPoint += myShoppingCartVo.getEarnSpendingPoints(); |
| | | } |
| | | |
| | | //获取快递策略,计算快递费 |
| | |
| | | } |
| | | } |
| | | } |
| | | paymentMoney = paymentMoney.add(expressFee); |
| | | if(BigDecimal.ZERO.compareTo(paymentMoney) > 0){ |
| | | paymentMoney = BigDecimal.ZERO; |
| | | } |
| | |
| | | jsonObject.put("transferablePoint", earnPoint1); |
| | | } |
| | | |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(1); |
| | | userPoint.setHistoricalPoint(lavePoint); |
| | | userPoint.setVariablePoint(earnPoint); |
| | | userPoint.setBalance(appUser.getLavePoint()); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUser.getId()); |
| | | userPoint.setObjectId(order.getId()); |
| | | userPoint.setExtention(jsonObject.toJSONString()); |
| | | userPointClient.saveUserPoint(userPoint); |
| | | if(earnPoint > 0){ |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(1); |
| | | userPoint.setVariablePoint(earnPoint); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUser.getId()); |
| | | userPoint.setObjectId(order.getId()); |
| | | userPoint.setExtention(jsonObject.toJSONString()); |
| | | userPoint.setChangeDirection(1); |
| | | userPointClient.saveUserPoint(userPoint); |
| | | } |
| | | } |
| | | appUser.setShopAmount(appUser.getShopAmount().add(paymentMoney).setScale(2, RoundingMode.HALF_EVEN)); |
| | | appUser.setLastShopTime(LocalDateTime.now()); |
| | | appUserClient.editAppUserById(appUser); |
| | | //变更等级 |
| | | appUserClient.vipUpgrade(appUser.getId()); |
| | | applicationEventPublisher.publishEvent(new PayEvent(JSON.toJSONString(appUser))); |
| | | //修改订支付状态 |
| | | order.setPayStatus(2); |
| | | //自提 |
| | |
| | | BigDecimal balance = appUser.getBalance(); |
| | | //红包金额满足支付 |
| | | BigDecimal paymentMoney1 = paymentMoney; |
| | | if(paymentMoney1.compareTo(totalRedPacketAmount) <= 0){ |
| | | totalRedPacketAmount = totalRedPacketAmount.subtract(paymentMoney1); |
| | | balance = balance.subtract(paymentMoney1); |
| | | appUser.setTotalRedPacketAmount(totalRedPacketAmount); |
| | | appUser.setBalance(balance); |
| | | redPacketAmount = paymentMoney1; |
| | | }else{ |
| | | paymentMoney1 = paymentMoney1.subtract(totalRedPacketAmount); |
| | | redPacketAmount = totalRedPacketAmount; |
| | | totalRedPacketAmount = BigDecimal.ZERO; |
| | | if(paymentMoney1.compareTo(totalDistributionAmount) <= 0){ |
| | | totalDistributionAmount = totalDistributionAmount.subtract(paymentMoney1); |
| | | balance = balance.subtract(paymentMoney1); |
| | | appUser.setTotalRedPacketAmount(totalRedPacketAmount); |
| | | appUser.setTotalDistributionAmount(totalDistributionAmount); |
| | | appUser.setBalance(balance); |
| | | distributionAmount = paymentMoney1; |
| | | }else{ |
| | | paymentMoney1 = paymentMoney1.subtract(totalDistributionAmount); |
| | | totalDistributionAmount = BigDecimal.ZERO; |
| | | balance = balance.subtract(paymentMoney1); |
| | | appUser.setTotalRedPacketAmount(totalRedPacketAmount); |
| | | appUser.setTotalDistributionAmount(totalDistributionAmount); |
| | | appUser.setBalance(balance); |
| | | distributionAmount = totalDistributionAmount; |
| | | } |
| | | } |
| | | balance = balance.subtract(paymentMoney1); |
| | | appUser.setBalance(balance); |
| | | |
| | | // if(paymentMoney1.compareTo(totalRedPacketAmount) <= 0){ |
| | | // totalRedPacketAmount = totalRedPacketAmount.subtract(paymentMoney1); |
| | | // balance = balance.subtract(paymentMoney1); |
| | | // appUser.setTotalRedPacketAmount(totalRedPacketAmount); |
| | | // appUser.setBalance(balance); |
| | | // redPacketAmount = paymentMoney1; |
| | | // }else{ |
| | | // paymentMoney1 = paymentMoney1.subtract(totalRedPacketAmount); |
| | | // redPacketAmount = totalRedPacketAmount; |
| | | // totalRedPacketAmount = BigDecimal.ZERO; |
| | | // if(paymentMoney1.compareTo(totalDistributionAmount) <= 0){ |
| | | //// totalDistributionAmount = totalDistributionAmount.subtract(paymentMoney1); |
| | | // balance = balance.subtract(paymentMoney1); |
| | | // appUser.setTotalRedPacketAmount(totalRedPacketAmount); |
| | | //// appUser.setTotalDistributionAmount(totalDistributionAmount); |
| | | // appUser.setBalance(balance); |
| | | // distributionAmount = paymentMoney1; |
| | | // }else{ |
| | | // paymentMoney1 = paymentMoney1.subtract(totalDistributionAmount); |
| | | // totalDistributionAmount = BigDecimal.ZERO; |
| | | // balance = balance.subtract(paymentMoney1); |
| | | // appUser.setTotalRedPacketAmount(totalRedPacketAmount); |
| | | //// appUser.setTotalDistributionAmount(totalDistributionAmount); |
| | | // appUser.setBalance(balance); |
| | | // distributionAmount = totalDistributionAmount; |
| | | // } |
| | | // } |
| | | //构建积分流水记录 |
| | | if(earnPoint > 0){ |
| | | PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData(); |
| | |
| | | if(earnPoint > 0){ |
| | | UserPoint 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()); |
| | | userPoint.setExtention(jsonObject.toJSONString()); |
| | | userPoint.setChangeDirection(1); |
| | | userPointClient.saveUserPoint(userPoint); |
| | | } |
| | | } |
| | |
| | | appUser.setLastShopTime(LocalDateTime.now()); |
| | | appUserClient.editAppUserById(appUser); |
| | | //变更等级 |
| | | appUserClient.vipUpgrade(appUser.getId()); |
| | | applicationEventPublisher.publishEvent(new PayEvent(JSON.toJSONString(appUser))); |
| | | //构建余额明细变动记录 |
| | | 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.setChangeAmount(paymentMoney); |
| | | balanceChangeRecord.setAfterAmount(balance); |
| | | balanceChangeRecord.setDelFlag(0); |
| | | balanceChangeRecord.setCreateTime(LocalDateTime.now()); |
| | | balanceChangeRecord.setChangeDirection(-1); |
| | | balanceChangeRecordClient.saveBalanceChangeRecord(balanceChangeRecord); |
| | | //修改订支付状态 |
| | | order.setPayStatus(2); |
| | |
| | | } |
| | | |
| | | //构建积分流水记录 |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(11); |
| | | userPoint.setHistoricalPoint(lavePoint); |
| | | userPoint.setVariablePoint(orderPoint); |
| | | userPoint.setBalance(appUser.getLavePoint()); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUser.getId()); |
| | | userPoint.setObjectId(order.getId()); |
| | | userPoint.setExtention((tra >= 0 ? orderPoint : transferablePoint) + ""); |
| | | userPointClient.saveUserPoint(userPoint); |
| | | if(orderPoint > 0){ |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(11); |
| | | userPoint.setVariablePoint(orderPoint); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUser.getId()); |
| | | userPoint.setObjectId(order.getId()); |
| | | userPoint.setExtention((tra >= 0 ? orderPoint : transferablePoint) + ""); |
| | | userPoint.setChangeDirection(-1); |
| | | userPointClient.saveUserPoint(userPoint); |
| | | } |
| | | |
| | | appUser.setLastShopTime(LocalDateTime.now()); |
| | | appUserClient.editAppUserById(appUser); |
| | | //变更等级 |
| | | appUserClient.vipUpgrade(appUser.getId()); |
| | | applicationEventPublisher.publishEvent(new PayEvent(JSON.toJSONString(appUser))); |
| | | |
| | | //积分支付不返佣 |
| | | |
| | |
| | | totalDistributionAmount = totalDistributionAmount.subtract(expressFee1); |
| | | balance = balance.subtract(expressFee1); |
| | | appUser.setTotalRedPacketAmount(totalRedPacketAmount); |
| | | appUser.setTotalDistributionAmount(totalDistributionAmount); |
| | | // appUser.setTotalDistributionAmount(totalDistributionAmount); |
| | | appUser.setBalance(balance); |
| | | distributionAmount = expressFee1; |
| | | }else{ |
| | |
| | | totalDistributionAmount = BigDecimal.ZERO; |
| | | balance = balance.subtract(expressFee1); |
| | | appUser.setTotalRedPacketAmount(totalRedPacketAmount); |
| | | appUser.setTotalDistributionAmount(totalDistributionAmount); |
| | | // appUser.setTotalDistributionAmount(totalDistributionAmount); |
| | | appUser.setBalance(balance); |
| | | distributionAmount = totalDistributionAmount; |
| | | } |
| | |
| | | balanceChangeRecord.setVipId(appUser.getVipId()); |
| | | balanceChangeRecord.setOrderId(order.getId()); |
| | | balanceChangeRecord.setChangeType(5); |
| | | balanceChangeRecord.setBeforeAmount(balance.add(expressFee)); |
| | | balanceChangeRecord.setChangeAmount(expressFee); |
| | | balanceChangeRecord.setAfterAmount(balance); |
| | | balanceChangeRecord.setDelFlag(0); |
| | | balanceChangeRecord.setCreateTime(LocalDateTime.now()); |
| | | balanceChangeRecord.setChangeDirection(-1); |
| | | balanceChangeRecordClient.saveBalanceChangeRecord(balanceChangeRecord); |
| | | //修改订支付状态 |
| | | order.setPayStatus(2); |
| | |
| | | orderBalancePayment.setDistributionAmount(distributionAmount); |
| | | orderBalancePaymentService.save(orderBalancePayment); |
| | | } |
| | | |
| | | commissionService.calculationCommissionUser(order.getId()); |
| | | return R.ok(order.getId().toString()); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public String getNumber(Integer size){ |
| | |
| | | jsonObject.put("transferablePoint", earnPoint1); |
| | | } |
| | | |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(1); |
| | | userPoint.setHistoricalPoint(lavePoint); |
| | | userPoint.setVariablePoint(earnPoint); |
| | | userPoint.setBalance(appUser.getLavePoint()); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUser.getId()); |
| | | userPoint.setObjectId(order.getId()); |
| | | userPoint.setExtention(jsonObject.toJSONString()); |
| | | userPointClient.saveUserPoint(userPoint); |
| | | if(earnPoint > 0){ |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(1); |
| | | userPoint.setVariablePoint(earnPoint); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUser.getId()); |
| | | userPoint.setObjectId(order.getId()); |
| | | userPoint.setExtention(jsonObject.toJSONString()); |
| | | userPoint.setChangeDirection(1); |
| | | userPointClient.saveUserPoint(userPoint); |
| | | } |
| | | } |
| | | appUser.setShopAmount(appUser.getShopAmount().add(paymentMoney).setScale(2, RoundingMode.HALF_EVEN)); |
| | | appUser.setLastShopTime(LocalDateTime.now()); |
| | | appUserClient.editAppUserById(appUser); |
| | | //变更等级 |
| | | appUserClient.vipUpgrade(appUser.getId()); |
| | | applicationEventPublisher.publishEvent(new PayEvent(JSON.toJSONString(appUser))); |
| | | //修改订支付状态 |
| | | order.setPayStatus(2); |
| | | //自提 |
| | | if(order.getOrderType() == 1 && StringUtils.isEmpty(order.getAddressJson())){ |
| | | order.setOrderStatus(2); |
| | | } |
| | | |
| | | String r7TrxNo = uniPayCallbackResult.getR9_BankTrxNo(); |
| | | order.setSerialNumber(r7TrxNo); |
| | | orderService.updateById(order); |
| | | |
| | | //处理优惠券 |
| | |
| | | for (Integer goodsId : goodsIds) { |
| | | goodsClient.editGoodsNum(goodsId, 1); |
| | | } |
| | | |
| | | commissionService.calculationCommissionUser(order.getId()); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | //构建积分流水记录 |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(11); |
| | | userPoint.setHistoricalPoint(lavePoint); |
| | | userPoint.setVariablePoint(orderPoint); |
| | | userPoint.setBalance(appUser.getLavePoint()); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUser.getId()); |
| | | userPoint.setObjectId(order.getId()); |
| | | userPoint.setExtention((tra >= 0 ? orderPoint : transferablePoint) + ""); |
| | | userPointClient.saveUserPoint(userPoint); |
| | | if(orderPoint > 0){ |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(11); |
| | | userPoint.setVariablePoint(orderPoint); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUser.getId()); |
| | | userPoint.setObjectId(order.getId()); |
| | | userPoint.setExtention((tra >= 0 ? orderPoint : transferablePoint) + ""); |
| | | userPoint.setChangeDirection(-1); |
| | | userPointClient.saveUserPoint(userPoint); |
| | | } |
| | | |
| | | //积分支付不反积分 |
| | | |
| | | appUser.setLastShopTime(LocalDateTime.now()); |
| | | appUserClient.editAppUserById(appUser); |
| | | //变更等级 |
| | | appUserClient.vipUpgrade(appUser.getId()); |
| | | applicationEventPublisher.publishEvent(new PayEvent(JSON.toJSONString(appUser))); |
| | | |
| | | //修改订支付状态 |
| | | order.setPayStatus(2); |