yujian
2019-02-28 70c9043f312a52a922cb15490d90a172b3515060
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java
@@ -710,7 +710,7 @@
      if (type == HongBaoV2.TYPE_ZIGOU) {// 获取自购的返利比例
         BigDecimal fanliRate = hongBaoManageService.getFanLiRate(commonOrder.getCreateTime().getTime());
         // 查询是否有免单计划
         boolean mianDan = false;
         BigDecimal mianDanMoney = null;
         if (commonOrder.getState() == CommonOrder.STATE_JS || commonOrder.getState() == CommonOrder.STATE_FK) {
            List<CommonOrder> orderList = commonOrderService.listBySourceTypeAndOrderId(Constant.SOURCE_TYPE_TAOBAO,
                  commonOrder.getOrderNo());
@@ -724,16 +724,22 @@
               if (goods != null) {
                  try {
                     mianDan = userSystemCouponService.updateCouponRecordUsed(commonOrder.getUserInfo().getId(),
                           commonOrder.getOrderNo(), payMent, Long.parseLong(goods.getGoodsId()));
                     if (mianDan)
                        fanliRate = new BigDecimal(100);
                     if (userSystemCouponService.updateCouponRecordUsed(commonOrder.getUserInfo().getId(),
                           commonOrder.getOrderNo(), payMent, Long.parseLong(goods.getGoodsId())))
                        mianDanMoney = payMent;
                  } catch (NumberFormatException e) {
                     throw new HongBaoException(10, "免单商品处理出错");
                  } catch (Exception e) {
                     e.printStackTrace();
                     throw new HongBaoException(11, "免单商品处理出错");
                  }
               }
            }
         } else if (commonOrder.getState() == CommonOrder.STATE_SX) {// 设置免单券失效
            try {
               userSystemCouponService.updateStateByDrawback(commonOrder.getOrderNo());
            } catch (Exception e) {
               e.printStackTrace();
            }
         }
@@ -757,6 +763,10 @@
         } else {
            throw new HongBaoException(3, "维权订单不能创建红包");
         }
         if (mianDanMoney != null)
            hongBao.setMoney(mianDanMoney);
         UserInfo user = userInfoService.getUserById(commonOrder.getUserInfo().getId());
         hongBao.setUrank(user.getRank());
         hongBaoV2Mapper.insertSelective(hongBao);
@@ -785,7 +795,7 @@
         }
         UserInfo boss = threeSaleSerivce.getBoss(user.getId());
         if (boss != null && hongBao.getState() != HongBaoV2.STATE_SHIXIAO && !mianDan) {// 1级BOSS存在且红包未失效,免单不支持多级分销
         if (boss != null && hongBao.getState() != HongBaoV2.STATE_SHIXIAO && mianDanMoney == null) {// 1级BOSS存在且红包未失效,免单不支持多级分销
            // 插入一级子红包
            BigDecimal firstRate = hongBaoManageService