yujian
2019-12-18 89cc8f054c27f70fcfe16f14554a8a12e0c19e23
fanli/src/main/java/com/yeshi/fanli/service/manger/HongBaoV2AddManager.java
@@ -28,7 +28,6 @@
import com.yeshi.fanli.entity.order.HongBaoOrder;
import com.yeshi.fanli.exception.order.HongBaoException;
import com.yeshi.fanli.exception.user.UserAccountException;
import com.yeshi.fanli.exception.user.UserInfoException;
import com.yeshi.fanli.service.inter.order.CommonOrderService;
import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
import com.yeshi.fanli.service.inter.order.msg.UserOrderMsgNotificationService;
@@ -78,32 +77,6 @@
   @Resource
   private UserVIPInfoService userVIPInfoService;
   // 保存红包
   public void saveHongBao1(CommonOrder commonOrder, int commonOrderType) throws HongBaoException, UserInfoException {
      // 查询上2级的信息
      long uid = commonOrder.getUserInfo().getId();
      UserInfo user = userInfoService.selectAvailableByPrimaryKey(uid);
      if (user == null)
         throw new UserInfoException(1, "用户不存在");
      UserInfo lastUser = threeSaleSerivce.getBoss(uid);
      UserInfo superLastUser = null;
      if (lastUser != null) {
         lastUser = userInfoService.selectAvailableByPrimaryKey(lastUser.getId());
         if (lastUser != null)
            superLastUser = threeSaleSerivce.getBoss(lastUser.getId());
         if (superLastUser != null)
            superLastUser = userInfoService.selectAvailableByPrimaryKey(superLastUser.getId());
      }
      if (commonOrderType == CommonOrder.ORDER_TYPE_ZIGOU) {
         // 保存红包信息
      } else if (commonOrderType == CommonOrder.ORDER_TYPE_SHARE) {
      }
   }
   /**
    * 添加红包信息
    * 
@@ -123,7 +96,6 @@
         boolean hasAdd = false;
         boolean hasUpdate = false;
         Set<Integer> stateSet = new HashSet<>();// 订单状态Set
         boolean isVIP = userVIPInfoService.isVIP(commonOrderList.get(0).getUserInfo().getId());
         for (CommonOrder commonOrder : commonOrderList) {
            stateSet.add(commonOrder.getState());
            goodsCount += commonOrder.getCount();
@@ -131,7 +103,7 @@
               throw new HongBaoException(1, "订单信息不完整");
            HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId());
            if (hongBaoOrder == null) {
               saveHongBao(commonOrder, type, isVIP, notificationMap);
               saveHongBao(commonOrder, type, notificationMap);
               hasAdd = true;
            } else {
               boolean update = updateHongBao(hongBaoOrder, commonOrder, type, notificationMap);
@@ -458,8 +430,10 @@
   }
   @Transactional(rollbackFor = Exception.class)
   private void saveHongBao(CommonOrder commonOrder, int type, boolean vip, Map<Integer, HongBaoOrder> notificationMap)
   private void saveHongBao(CommonOrder commonOrder, int type, Map<Integer, HongBaoOrder> notificationMap)
         throws HongBaoException, UserAccountException {
      boolean vip = commonOrder.getUrank() != null && commonOrder.getUrank() == 100;
      if (type == HongBaoV2.TYPE_ZIGOU) {// 获取自购的返利比例
         BigDecimal fanliRate = hongBaoManageService
               .getRate(new OrderHongBaoRateParams(0, type, false, vip, commonOrder.getThirdCreateTime()));