admin
2019-11-12 0cf8c0bf5649b0b7269f78f6eae7c09cffea75cd
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RedPackControllerV2.java
@@ -29,10 +29,12 @@
import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.redpack.RedPackBalance;
import com.yeshi.fanli.entity.redpack.RedPackDetail.RedPackDetailTypeEnum;
import com.yeshi.fanli.entity.redpack.RedPackExchange;
import com.yeshi.fanli.entity.redpack.RedPackWinInvite;
import com.yeshi.fanli.entity.redpack.RedPackWinInvite.RedPackWinInviteTypeEnum;
import com.yeshi.fanli.exception.redpack.RedPackBalanceException;
import com.yeshi.fanli.exception.redpack.RedPackExchangeException;
import com.yeshi.fanli.exception.redpack.RedPackGiveRecordException;
import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
@@ -77,8 +79,8 @@
   @Resource
   private RedPackWinInviteService redPackWinInviteService;
   @Resource
   @Resource
   private RedPackWinNewUserService redPackWinNewUserService;
   @Resource
@@ -86,10 +88,10 @@
   @Resource
   private UserInfoExtraService userInfoExtraService;
   @Resource
   private JumpDetailV2Service jumpDetailV2Service;
   @Resource
   private SwiperPictureService swiperPictureService;
@@ -116,7 +118,14 @@
      BigDecimal yesterdayUse = zero;
      BigDecimal thisMonthUse = zero;
      BigDecimal lastMonthUse = zero;
      BigDecimal balance = redPackBalanceService.getBalance(uid);
      BigDecimal balance = null;
      try {
         balance = redPackBalanceService.getBalance(uid);
      } catch (RedPackBalanceException e) {
         out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
         return;
      }
      if (balance == null) {
         balance = zero;
      } else {
@@ -380,10 +389,23 @@
         out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
         return;
      }
      JSONObject data = new JSONObject();
      data.put("balance", redPackBalanceService.getBalance(uid));
      try {
         data.put("balance", redPackBalanceService.getBalance(uid));
      } catch (RedPackBalanceException e) {
         out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
         return;
      }
      data.put("ruleLink", redPackConfigService.getValueByKey("invite_reward_rule_link"));
      data.put("shareLink", UserInviteUtil.getShareUrl(uid));
      RedPackBalance redPackBalance = redPackBalanceService.selectByPrimaryKey(uid);
      if (redPackBalance != null && redPackBalance.getState() == RedPackBalance.STATE_LOCKED) {
         data.put("redPackLock", true);
      } else {
         data.put("redPackLock", false);
      }
      UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
      if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
@@ -397,10 +419,10 @@
      } else
         out.print(JsonUtil.loadTrueResult(data));
   }
   /**
    * 新人红包详情
    *
    * @param acceptData
    * @param uid
    * @param out
@@ -411,14 +433,16 @@
         out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
         return;
      }
      try {
         RedPackWinDetailVO winDetail = redPackWinNewUserService.receiveReward(uid);
         if (winDetail == null) {
            out.print(JsonUtil.loadFalseResult(1, "红包已被抢光"));
            return;
         }
         winDetail.setLogo(Constant.systemCommonConfig.getDefaultPortrait());
         winDetail.setLogoLight(Constant.systemCommonConfig.getDefaultPortrait());
         JSONObject params = new JSONObject();
         params.put("url", redPackConfigService.getValueByKey("goods_shop_link_h5"));
         winDetail.setParams(params.toString());
@@ -427,15 +451,15 @@
         winDetail.setTips(redPackConfigService.getValueByKey("new_user_win_tips"));
         // 2、顶部轮播图
         List<SwiperPicture> oldtopPicList = swiperPictureService.getByBannerCard("index_top");
         List<SwiperPicture> oldtopPicList = swiperPictureService.getByBannerCard("redpack_win_detail_banner");
         List<SwiperPicture> topPicList = new ArrayList<>();
         if (oldtopPicList != null && oldtopPicList.size() > 0)
            topPicList.addAll(oldtopPicList);
         JSONObject data = new JSONObject();
         data.put("detail", JsonUtil.getApiCommonGson().toJson(winDetail));
         data.put("banner", JsonUtil.getApiCommonGson().toJson(topPicList));
          out.print(JsonUtil.loadTrueResult(data));
         out.print(JsonUtil.loadTrueResult(data));
      } catch (Exception e) {
         out.print(JsonUtil.loadFalseResult(1, "红包已被抢光啦"));
      }