yujian
2019-08-27 d8359ddb48dab5cc797a9d552e11fde571f4920c
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/TaoLiJinControllerV2.java
@@ -240,7 +240,7 @@
      if (todayUse == null || todayUse.compareTo(zero) > 0) {
         todayUse = zero;
      }
      BigDecimal yesterdayUse = userTaoLiJinDetailService.countUseMoneyByDate(uid, 2);
      if (yesterdayUse == null || yesterdayUse.compareTo(zero) > 0) {
         yesterdayUse = zero;
@@ -252,10 +252,11 @@
      BigDecimal lastMonthUse = userTaoLiJinDetailService.countUseMoneyByDate(uid, 4);
      if (lastMonthUse == null || lastMonthUse.compareTo(zero) > 0) {
         lastMonthUse = zero;
      }
      String giveMin = configTaoLiJinService.getValueByKey("give_min_amount");
      }
      String giveMin = configTaoLiJinService.getValueByKey("give_min_amount");
      JSONObject data = new JSONObject();
      data.put("tlj", tlj.setScale(2).toString());
      data.put("giveMin", giveMin);
@@ -399,7 +400,7 @@
            // 已领取
            money = deviceRecord.getMoney();
         } else {
            String value = configTaoLiJinService.getValueByKey("hongbao_newbies");
            String value = configTaoLiJinService.getValueByKey("hongbao_newbies", null);
            if (StringUtil.isNullOrEmpty(value)) {
               out.print(JsonUtil.loadFalseResult(1, "系统红包不存在"));
               return;
@@ -409,7 +410,7 @@
         }
         JSONObject data = new JSONObject();
         data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon"));
         data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon", null));
         data.put("title", "新人红包");
         data.put("content", "自购直接抵现,优惠真实可见!");
         data.put("type", 1);
@@ -417,8 +418,8 @@
         data.put("usage", "领取成功,已存入“我的-推广红包”");
         data.put("jumpName", "去使用");
         data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot"));
         data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip"));
         data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link"));
         data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip", null));
         data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link", null));
         out.print(JsonUtil.loadTrueResult(data));
         return;
@@ -427,7 +428,7 @@
      // 登录用户
      boolean isReceive = false;
      JSONObject data = new JSONObject();
      data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon"));
      data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon", null));
      if (type.equals(TaoLiJinOriginEnum.newbiesWin.name())) {
         BigDecimal hasMoney = null;
@@ -451,8 +452,8 @@
         data.put("usage", "领取成功,已存入“我的-推广红包”");
         data.put("jumpName", "去使用");
         data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot"));
         data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip"));
         data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link"));
         data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip", null));
         data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link", null));
      } else if (type.equals(TaoLiJinOriginEnum.rankWin.name())) {
         boolean isRank = false;
@@ -488,8 +489,8 @@
            data.put("money", "本月账户等级未达到\r\n继续加油");
            data.put("jumpName", "去查看");
            data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("user_rank"));
            data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_not_enough_tip"));
            data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link"));
            data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_not_enough_tip", null));
            data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link", null));
            out.print(JsonUtil.loadTrueResult(data));
            return;
         } else {
@@ -504,8 +505,8 @@
            }
            data.put("jumpName", "去使用");
            data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot"));
            data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_tip"));
            data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link"));
            data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_tip", null));
            data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link", null));
         }
      } else {
@@ -549,7 +550,7 @@
         }
      }
      BigDecimal proportion = hongBaoManageService.getFanLiRate();
      BigDecimal proportion = hongBaoManageService.getTLJShareRate(System.currentTimeMillis());
      for (ShareHotGoods hotGoods : listHot) {
         TaoBaoGoodsBrief taoBaoGoodsBrief = hotGoods.getGoods();
         if (taoBaoGoodsBrief == null) {
@@ -557,7 +558,7 @@
         }
         // 计算推广红包
         String warningRate = configTaoLiJinService.getValueByKey("warning_value");
         String warningRate = configTaoLiJinService.getValueByKey("warning_value", new Date());
         BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, taoBaoGoodsBrief);
         // 推广红包 不能小于1
@@ -581,8 +582,8 @@
         array.add(gson.toJson(extra));
      }
      /*// 过期 -取消收回
       * executor.execute(new Runnable() {
      /*
       * // 过期 -取消收回 executor.execute(new Runnable() {
       * 
       * @Override public void run() {
       * userTaoLiJinOriginService.overdueHongBao(uid); } });
@@ -593,10 +594,10 @@
      data.put("list", array);
      out.print(JsonUtil.loadTrueResult(data));
   }
   /**
    * 分享爆款商品-限于淘礼金
    *
    * @param acceptData
    * @param uid
    * @param out
@@ -607,19 +608,19 @@
         out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
         return;
      }
      String day = TimeUtil.getGernalTime(java.lang.System.currentTimeMillis());
      List<ShareHotGoods> listHot = shareHotGoodsService.listByDay(day);
      if (listHot == null) {
         listHot = new ArrayList<ShareHotGoods>();
         listHot = new ArrayList<ShareHotGoods>();
      }
      JSONArray array = new JSONArray();
      Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
            .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
      boolean isNewUser = userInfoExtraService.isNewUser(uid);
      // 取消新人自购
      boolean isNewUser = false;// userInfoExtraService.isNewUser(uid);
      if (isNewUser) {
         // 判定为老用户: 新人只要使用了新人红包,也就是那1块钱,那么,他看到的分享爆款中的商品-就只能分享。
         long countRecord = userTaoLiJinRecordService.countRecordByUid(uid);
@@ -627,33 +628,32 @@
            isNewUser = false;
         }
      }
      BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
      BigDecimal shareRate = hongBaoManageService.getShareRate();
      BigDecimal fanLiRate = hongBaoManageService.getTLJShareRate(System.currentTimeMillis());
      BigDecimal shareRate = hongBaoManageService.getTLJShareRate(System.currentTimeMillis());
      for (ShareHotGoods hotGoods : listHot) {
         TaoBaoGoodsBrief taoBaoGoodsBrief = hotGoods.getGoods();
         if (taoBaoGoodsBrief == null) {
            continue;
         }
         // 计算推广红包
         String warningRate = configTaoLiJinService.getValueByKey("warning_value");
         String warningRate = configTaoLiJinService.getValueByKey("warning_value", new Date());
         BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, taoBaoGoodsBrief);
         // 推广红包 不能小于1
         if (spreadMoney.compareTo(new BigDecimal(1.1)) < 0) {
            continue;
         }
         GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate);
         // 去掉标签
         detailVO.setLabels(null);
         MoneyInfoVO moneyInfo = detailVO.getMoneyInfo();
         OtherInfo otherInfo = new OtherInfo();
         SpreadHongBao spreadHongBao = new SpreadHongBao();
         // 显示类型
         if (isNewUser) {
            moneyInfo.setMoneyType(1);
@@ -667,25 +667,23 @@
         detailVO.setMoneyInfo(moneyInfo);
         otherInfo.setSpreadHongBao(spreadHongBao);
         detailVO.setOtherInfo(otherInfo);
         array.add(gson.toJson(detailVO));
      }
      /*
       * executor.execute(new Runnable() {
       * 
       * @Override public void run() { // 过期
       * userTaoLiJinOriginService.overdueHongBao(uid); } });
       */
      JSONObject data = new JSONObject();
      data.put("count", array.size());
      data.put("list", array);
      out.print(JsonUtil.loadTrueResult(data));
   }
   /**
    * 分享爆款商品-限于淘礼金
    * 
@@ -749,18 +747,17 @@
      data.put("list", array);
      if (page == 1) {
         List<SwiperPicture> bannerList = swiperPictureService.getByBannerCard("zigoulijian_banner");
         if (bannerList != null && bannerList.size() > 0)
            data.put("topPicture", bannerList.get(0).getSrc());
         else
            data.put("topPicture", "");
         data.put("ruleUrl", configService.get("zigoulijian_rule"));
      }
      out.print(JsonUtil.loadTrueResult(data));
   }
   /**
    * 分享爆款商品-限于淘礼金
    * 
@@ -796,16 +793,14 @@
            continue;
         }
         GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, proportion, proportion);
         // 去掉标签
         detailVO.setLabels(null);
         MoneyInfoVO moneyInfo = detailVO.getMoneyInfo();
         moneyInfo.setMoneyType(2);
         detailVO.setMoneyInfo(moneyInfo);
         String hongBao = spreadMoney.toString();
         ReduceHongBao vo = new ReduceHongBao();
         vo.setLeft(hotGoods.getLeftHongBaoCount());
@@ -813,11 +808,11 @@
         vo.setName("付款立减 ");
         vo.setTip("");
         vo.setTotal(hotGoods.getTotalHongBaoCount());
         OtherInfo otherInfo = new OtherInfo();
         otherInfo.setReduceHongBao(vo);
         detailVO.setOtherInfo(otherInfo);
         array.add(gson.toJson(detailVO));
      }
@@ -829,12 +824,12 @@
      data.put("list", array);
      if (page == 1) {
         List<SwiperPicture> bannerList = swiperPictureService.getByBannerCard("zigoulijian_banner");
         if (bannerList != null && bannerList.size() > 0)
            data.put("topPicture", bannerList.get(0).getSrc());
         else
            data.put("topPicture", "");
         data.put("ruleUrl", configService.get("zigoulijian_rule"));
      }
      out.print(JsonUtil.loadTrueResult(data));