| | |
| | | orderItem.setSkuImage(sku.getSkuImage()); |
| | | orderItem.setIsNormal(mallGoods.getIsNormal()); |
| | | orderItem.setCostPrice(sku.getCostPrice()); |
| | | orderItem.setStaticMulti(mallGoods.getStaticMulti()); |
| | | orderItem.setGoodsLevel(mallGoods.getGoodsLevel()); |
| | | orderItem.setNormalBonus(mallGoods.getNormalBonus()); |
| | | orderItem.setNormalPer(mallGoods.getNormalPer()); |
| | | |
| | | |
| | | total = total.add(amount); |
| | | carriage = carriage.add(mallGoods.getCarriage()); |
| | |
| | | orderInfo.setPayResult("1"); |
| | | this.baseMapper.updateById(orderInfo); |
| | | |
| | | commonService.changeWallet(orderInfo.getId(), FlowTypeEnum.BALANCE.getValue()); |
| | | // 商品级别 会员/代理/股东 |
| | | int goodsLevel = 0; |
| | | BigDecimal score = BigDecimal.ZERO; |
| | | for (MallOrderItem item : orderInfo.getItems()) { |
| | | // 计算静态倍数 |
| | | if(item.getIsNormal() == 2) { |
| | | score = score.add(item.getPrice().multiply(item.getStaticMulti())); |
| | | } |
| | | |
| | | //发送直推返利消息 |
| | | agentProducer.sendOrderReturn(orderInfo.getId()); |
| | | // 判断会员层级 |
| | | if (item.getIsNormal() == 2 && goodsLevel < item.getGoodsLevel()) { |
| | | goodsLevel = item.getGoodsLevel(); |
| | | } |
| | | } |
| | | |
| | | // 根据用户购买的商品设置其等级 |
| | | member.setLevel(GoodsToLevelEnums.getLevelByAccountLevel(goodsLevel)); |
| | | member.setAccountLevel(goodsLevel); |
| | | this.memberMapper.updateById(member); |
| | | |
| | | memberWalletService.add(score, member.getId(), "score"); |
| | | |
| | | if (orderInfo.getScoreCnt().compareTo(BigDecimal.ZERO) > 0) { |
| | | int reduce = memberWalletService.reduce(orderInfo.getScoreCnt(), member.getId(), "prizeScore"); |
| | | if (reduce == 2) { |
| | | throw new FebsException("积分不足"); |
| | | } |
| | | mallMoneyFlowService.addMoneyFlow(member.getId(), orderInfo.getScoreCnt().negate(), MoneyFlowTypeEnum.PAY.getValue(), orderInfo.getOrderNo(), FlowTypeEnum.PRIZE_SCORE.getValue()); |
| | | } |
| | | |
| | | mallMoneyFlowService.addMoneyFlow(member.getId(), score, MoneyFlowTypeEnum.BUY_TC.getValue(), orderInfo.getOrderNo(), FlowTypeEnum.SCORE.getValue()); |
| | | mallMoneyFlowService.addMoneyFlow(member.getId(), orderInfo.getAmount().negate(), MoneyFlowTypeEnum.PAY.getValue(), orderInfo.getOrderNo(), FlowTypeEnum.BALANCE.getValue()); |
| | | |
| | | //发送代理自动升级消息 |
| | | agentProducer.sendAutoLevelUpMsg(member.getId()); |
| | | //发送直推返利消息 |
| | | agentProducer.sendOrderReturn(orderInfo.getId()); |
| | | // 发送分红消息 |
| | | agentProducer.sendOrderBonus(orderInfo.getId()); |
| | | break; |
| | | case "4": |
| | | if (orderInfo.getOrderType() != 2) { |
| | |
| | | map.put("orderNo", orderInfo.getOrderNo()); |
| | | map.put("orderId", orderInfo.getId()); |
| | | map.put("rcResult", rcResult); |
| | | |
| | | return map; |
| | | } |
| | | |
| | |
| | | if (reduce == 2) { |
| | | throw new FebsException("余额不足"); |
| | | } |
| | | |
| | | |
| | | return orderInfo.getOrderNo(); |
| | | } |
| | | |
| | |
| | | if(ObjectUtil.isEmpty(mallGoods)){ |
| | | throw new FebsException("商品已更新,请重新下单"); |
| | | } |
| | | /** |
| | | * 贡献点判断 |
| | | |
| | | /* |
| | | 获取单个商品的折扣积分数量 |
| | | = 现价 * 数量 * 折扣现金比例 |
| | | */ |
| | | if (mallGoods.getIsNormal() == 2) { |
| | | hasTc = true; |
| | | } |
| | | /* |
| | | 获取单个商品的折扣积分数量 |
| | | = 现价 * 数量 * 折扣现金比例 |
| | | */ |
| | | BigDecimal scorePercent = new BigDecimal(mallGoods.getScorePercent()).multiply(new BigDecimal(0.01)); |
| | | BigDecimal scorePercent = new BigDecimal(mallGoods.getScorePercent()).multiply(BigDecimal.valueOf(0.01)); |
| | | BigDecimal amount = sku.getPresentPrice().multiply(BigDecimal.valueOf(item.getCnt())).multiply(scorePercent); |
| | | total = total.add(amount); |
| | | } |
| | |
| | | if(prizeScore.compareTo(score) < 0){ |
| | | throw new FebsException("积分不足"); |
| | | } |
| | | if(hasTc){ |
| | | //系统设置的个人贡献点最大值 |
| | | DataDictionaryCustom starGetDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.STAR_GET.getType(), |
| | | DataDictionaryEnum.STAR_GET.getCode()); |
| | | if(ObjectUtil.isNotEmpty(starGetDic)){ |
| | | String starGetStr = StrUtil.isEmpty(starGetDic.getValue()) ? "0" : starGetDic.getValue(); |
| | | BigDecimal starGet = new BigDecimal(starGetStr); |
| | | BigDecimal star = new BigDecimal(mallMemberWallet.getStar()); |
| | | if(starGet.compareTo(BigDecimal.ZERO) != 0 && starGet.compareTo(star) <= 0){ |
| | | throw new FebsException("无法购买套餐"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 使用积分折扣现金 |
| | | */ |