admin
2020-07-03 651a15c78f668bef3859d9ed1bb7ad0b669d3600
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java
@@ -408,7 +408,7 @@
         honestList.add(honest);
         if (acceptData.getPlatform().equalsIgnoreCase("ios")
               && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()))) {
               && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()),acceptData.getSystem())) {
            honest = new Honest();
            honest.setName("今日必抢");
            honest.setJumpDetail(detail);
@@ -682,11 +682,11 @@
         // taoBaoGoodsBriefExtra.setAuctionUrl(null);
         data.put("taobao", taobaoJson);
         String info = configService.get(ConfigKeyEnum.detailPrompt.getKey());
         String info = configService.getValue(ConfigKeyEnum.detailPrompt.getKey(),acceptData.getSystem());
         data.put("info", info);
         String onlyInfo = configService.get(ConfigKeyEnum.onlyInfo.getKey());
         String onlyInfo = configService.getValue(ConfigKeyEnum.onlyInfo.getKey(),acceptData.getSystem());
         data.put("only", onlyInfo);
         data.put("helpUrl", configService.get(ConfigKeyEnum.oldGoodsDetailHelpUrl.getKey()));
         data.put("helpUrl", configService.getValue(ConfigKeyEnum.oldGoodsDetailHelpUrl.getKey(),acceptData.getSystem()));
         int showType = taoBaoGoodsBriefExtra.getShowType();
         String price = "";
@@ -701,9 +701,9 @@
         data.put("shareTitle", taoBaoGoodsBriefExtra.getTitle());
         data.put("shareContent", "¥" + price + "元");
         data.put("shareImg", taoBaoGoodsBriefExtra.getPictUrl());
         String html = configService.get(ConfigKeyEnum.downAPP.getKey());
         String html = configService.getValue(ConfigKeyEnum.downAPP.getKey(),acceptData.getSystem());
         data.put("downAPP", html);
         String shareSinaContent = configService.get("shareSinaContent");
         String shareSinaContent = configService.getValue("shareSinaContent",acceptData.getSystem());
         data.put("shareSina",
               "¥" + price + "元      送" + appName + "红包¥"
                     + taoBaoGoodsBriefExtra.getTaoBaoHongBaoInfo().getHongbao() + "元    "
@@ -757,7 +757,7 @@
      data.put("invalid", false);
      // IOS是否正在上线
      if ("ios".equalsIgnoreCase(acceptData.getPlatform())) {
         data.put("iosOnling", configService.iosOnLining(Integer.parseInt(acceptData.getVersion())));
         data.put("iosOnling", configService.iosOnLining(Integer.parseInt(acceptData.getVersion()),acceptData.getSystem()));
      }
      long startTime = java.lang.System.currentTimeMillis();
@@ -774,7 +774,7 @@
      LogHelper.test("获取PID耗时:" + (java.lang.System.currentTimeMillis() - startTime));
      // 是否在服务端进行转链
      boolean convertInServer = configService.isConvertTaoBaoLinkInServer();
      boolean convertInServer = configService.isConvertTaoBaoLinkInServer(acceptData.getSystem());
      final String clientPid = clientTBPid.getPid();
      List<String> taskList = new ArrayList<>();
      taskList.add("goods");
@@ -850,7 +850,7 @@
               });
            }
         } else if (task.equalsIgnoreCase("imgs")) {// 获取图文详情
            List<ImageInfo> imgs = redisManager.getTaoBaoGoodsDetailImgs(Long.parseLong(id));
            List<ImageInfo> imgs = redisManager.getTaoBaoGoodsDetailImgs(Long.parseLong(id),acceptData.getSystem());
            if (imgs != null && imgs.size() > 0) {
               detailImgs.clear();
               detailImgsSize.clear();
@@ -906,7 +906,7 @@
      goods.put("zkPrice", tb.getZkPrice().toString());
      BigDecimal proportion = manageService.getFanLiRate();
      String hongBao = TaoBaoUtil.getGoodsHongBaoInfo(tb, proportion);
      String hongBao = TaoBaoUtil.getGoodsHongBaoInfo(tb, proportion,false);
      goods.put("hongBao", hongBao);
      // 30天销量
@@ -1036,7 +1036,7 @@
      JSONObject data = new JSONObject();
      // 是否在服务端进行转链
      boolean convertInServer = configService.isConvertTaoBaoLinkInServer();
      boolean convertInServer = configService.isConvertTaoBaoLinkInServer(acceptData.getSystem());
      TaoBaoGoodsBrief tb = null;
      JSONObject ticket = new JSONObject();
      if (convertInServer) {
@@ -1388,7 +1388,7 @@
                  TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods.getGoods(),
                        TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE + "", null);
                  String hongBao = TaoBaoUtil.getGoodsHongBaoInfo(goods.getGoods(),
                        TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE);
                        TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE,false);
                  TLJBuyHongBaoVO vo = new TLJBuyHongBaoVO();
                  vo.setLeft(goods.getLeftHongBaoCount());
                  vo.setMoney(hongBao);
@@ -1582,117 +1582,10 @@
    * @param acceptData
    * @param out
    */
   @Deprecated
   @RequestMapping(value = "getNewRecommendInfo")
   public void getNewRecommendInfo(AcceptData acceptData, Long uid, String specialCard, String swiperCard,
         PrintWriter out) {
      BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
            acceptData.getPackages());
      if (system == null) {
         out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
         return;
      }
      List<BannerVO> listswiper = null;
      if (!StringUtil.isNullOrEmpty(specialCard)) {
         try {
            listswiper = swiperPictureService.getByBannerCardAndVersion(swiperCard, acceptData.getPlatform(),
                  Integer.parseInt(acceptData.getVersion()));
            if (listswiper == null) {
               listswiper = new ArrayList<BannerVO>();
            }
         } catch (Exception e) {
            e.printStackTrace();
         }
      }
      Special miaoShaSpecial = null;
      List<SpecialVO> honestList = new ArrayList<SpecialVO>();
      List<SpecialVO> specialList = new ArrayList<SpecialVO>();
      if (!StringUtil.isNullOrEmpty(specialCard)) {
         try {
            List<SpecialVO> listSpecial = specialService.listBySystemAndCard(specialCard, system.getId());
            if (listSpecial != null && listSpecial.size() > 0) {
               for (SpecialVO special : listSpecial) {
                  if ("限时秒杀".equals(special.getName())) {
                     miaoShaSpecial = special;
                     continue;
                  }
                  if ("arc".equals(special.getShowType())) {
                     // 同一行专题
                     honestList.add(special);
                  } else {
                     // 其他专题
                     specialList.add(special);
                  }
               }
            }
         } catch (Exception e) {
            e.printStackTrace();
         }
      }
      /* 限时秒杀 - 时间处理 */
      JSONObject msJSON = JSONObject.fromObject(new Gson().toJson(miaoShaSpecial));
      if (miaoShaSpecial != null) {
         // 获取秒杀
         int[] hours = new int[] { 0, 9, 12, 14, 16, 20, 22 };
         int hour = -1;
         Calendar calendar = Calendar.getInstance();
         calendar.setTimeInMillis(Long.parseLong(acceptData.getTime()));
         int nowHour = calendar.get(Calendar.HOUR_OF_DAY);
         for (int i = 0; i < hours.length - 1; i++) {
            if (nowHour >= hours[i] && nowHour < hours[i + 1]) {
               hour = hours[i + 1];
               break;
            }
         }
         if (hour < 0)
            hour = 24;
         long time = TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(calendar.getTimeInMillis(), "yyyy-MM-dd"),
               "yyyy-MM-dd") + 1000 * 60 * 60 * hour;
         msJSON.put("time", time);
      }
      JSONObject root = new JSONObject();
      root.put("banner", JsonUtil.getApiCommonGson().toJson(listswiper));
      root.put("honest", JsonUtil.getApiCommonGson().toJson(honestList));
      root.put("special", JsonUtil.getApiCommonGson().toJson(specialList));
      root.put("miaoSha", msJSON);
      // 增加邀请有奖
      JSONObject invite = new JSONObject();
      JumpDetailV2 jumpDetail = jumpDetailV2Service.getByTypeCache("invite");
      invite.put("jumpDetail", jumpDetail);
      invite.put("picture", configService.get(ConfigKeyEnum.homeInviteBanner.getKey()));
      if ("ios".equalsIgnoreCase(acceptData.getPlatform())
            && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()))) {
         // 如果IOS当前版本处于审核状态就不返回
      } else {
         // 按照版本返回,版本覆盖足够后可删除
         if (("android".equalsIgnoreCase(acceptData.getPlatform()) && Integer.parseInt(acceptData.getVersion()) > 30)
               || ("ios".equalsIgnoreCase(acceptData.getPlatform())
                     && Integer.parseInt(acceptData.getVersion()) > 37)) {
            if (uid != null) {
               try {
                  UserSettingsVO vo = userCustomSettingsService.getMySettings(uid);
                  if (vo == null || vo.getNoInvitationBonus() == null || vo.getNoInvitationBonus() == 0)// 没有关闭邀请
                     root.put("invite", invite);
               } catch (UserCustomSettingsException e) {
                  e.printStackTrace();
               }
            } else
               root.put("invite", invite);
         }
      }
      out.print(JsonUtil.loadTrueResult(root));
   }
   /**
@@ -1708,7 +1601,7 @@
         int deviceSex = deviceSexService.getDeviceSex(acceptData.getDevice());
         // 1、专题模块
         JSONObject root = specialService.listCacheSpecialToIndex(acceptData, deviceSex);
         JSONObject root = specialService.listCacheSpecialToIndex(acceptData, deviceSex,acceptData.getSystem());
         // 2、顶部轮播图
         List<BannerVO> topPicList = getSwiperByCard("index_top", acceptData);
@@ -1720,7 +1613,7 @@
         // 3、邀请有奖
         List<BannerVO> invitePicList = null;
         if ("ios".equalsIgnoreCase(acceptData.getPlatform())
               && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()))) {
               && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()),acceptData.getSystem())) {
            // 如果IOS当前版本处于审核状态就不返回
         } else {
            invitePicList = getSwiperByCard("index_invite", acceptData);
@@ -1734,7 +1627,7 @@
         // 4、IOS的底部网页链接
         String platform = acceptData.getPlatform();
         if ("ios".equalsIgnoreCase(platform)) {
            root.put("htmlLink", configService.get(ConfigKeyEnum.indexHtmlLinkIos.getKey()));
            root.put("htmlLink", configService.getValue(ConfigKeyEnum.indexHtmlLinkIos.getKey(),acceptData.getSystem()));
         }
         root.put("spikeGoods", getSpikeGoodsContent(acceptData));
@@ -1760,7 +1653,7 @@
   public List<BannerVO> getInvitePicList(Long uid, AcceptData acceptData) {
      // 如果IOS当前版本处于审核状态就不返回
      if ("ios".equalsIgnoreCase(acceptData.getPlatform())
            && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()))) {
            && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()),acceptData.getSystem())) {
         return null;
      }
@@ -1773,7 +1666,7 @@
      List<BannerVO> swiperList = null;
      try {
         swiperList = swiperPictureService.getByBannerCardAndVersion(card, acceptData.getPlatform(),
               Integer.parseInt(acceptData.getVersion()));
               Integer.parseInt(acceptData.getVersion()),acceptData.getSystem());
      } catch (Exception e) {
         try {
            LogHelper.errorDetailInfo(e);
@@ -1860,7 +1753,7 @@
                  .toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
            goods.put("jumpDetail", jumpDetail);
            JSONObject params = new JSONObject();
            params.put("url", configService.get(ConfigKeyEnum.spikeGoodsLink.getKey()) + "?id=" + taoBaoGoodsBrief.getAuctionId());
            params.put("url", configService.getValue(ConfigKeyEnum.spikeGoodsLink.getKey(),acceptData.getSystem()) + "?id=" + taoBaoGoodsBrief.getAuctionId());
            goods.put("params", params);
            // 1.5.4及以后返回
@@ -1882,7 +1775,7 @@
      root.put("listgoods", array);
      JSONObject params = new JSONObject();
      params.put("url", configService.get(ConfigKeyEnum.spikeGoodsLink.getKey()));
      params.put("url", configService.getValue(ConfigKeyEnum.spikeGoodsLink.getKey(),acceptData.getSystem()));
      root.put("params", params);
      root.put("jumpDetail", jumpDetail);
@@ -1908,7 +1801,6 @@
    * @param acceptData
    * @param id
    * @param uid
    * @param pageSource
    *            页面来源
    * @param out
    */
@@ -1933,7 +1825,7 @@
      // IOS是否正在上线
      if ("ios".equalsIgnoreCase(acceptData.getPlatform())) {
         String version = acceptData.getVersion();
         data.put("iosOnling", configService.iosOnLining(Integer.parseInt(version)));
         data.put("iosOnling", configService.iosOnLining(Integer.parseInt(version),acceptData.getSystem()));
      }
      long startTime = java.lang.System.currentTimeMillis();
@@ -1952,7 +1844,7 @@
      final List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
      // 是否在服务端进行转链
      boolean convertInServer = configService.isConvertTaoBaoLinkInServer();
      boolean convertInServer = configService.isConvertTaoBaoLinkInServer(acceptData.getSystem());
      JSONObject ticket = new JSONObject();
      TaoBaoGoodsBrief goods = null;
@@ -2180,7 +2072,7 @@
         BigDecimal proportion = manageService.getFanLiRate();
         if ("taolijin".equalsIgnoreCase(from))
            proportion = manageService.getTLJShareRate(System.currentTimeMillis());
         hongBao = TaoBaoUtil.getGoodsHongBaoInfo(tb, proportion);
         hongBao = TaoBaoUtil.getGoodsHongBaoInfo(tb, proportion,false);
      }
      goodsJson.put("hongBao", hongBao);
@@ -2252,7 +2144,7 @@
      String noRebateHelpLink = null;
      // 商品链接
      String h5Url = String.format("http://%s%s?id=%s&appType=flq", configService.getH5Host(),
      String h5Url = String.format("http://%s%s?id=%s&appType=flq", configService.getH5Host(acceptData.getSystem()),
            Constant.systemCommonConfig.getShareGoodsPagePath(), tb.getAuctionId() + "");
      try {
         data.put("h5Url", HttpUtil.getShortLink(h5Url));
@@ -2339,7 +2231,7 @@
         }
      } else if (from != null && from.equals("taolijin_buy")) {
         noRebateHelpLink = configService.get(ConfigKeyEnum.zigoulijianNofanliHelp.getKey());
         noRebateHelpLink = configService.getValue(ConfigKeyEnum.zigoulijianNofanliHelp.getKey(),acceptData.getSystem());
         // 查询分享库
         TLJBuyGoods buyGoods = tljBuyGoodsService.selectByAuctionIdAndDay(goods.getAuctionId(),
               TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd"));
@@ -2350,7 +2242,7 @@
         fanliValid = true;
         goodsJson.put("shareValid", false);
         String tljHongBao = TaoBaoUtil.getGoodsHongBaoMoney(goods, new BigDecimal(70)).toString();
         String tljHongBao = TaoBaoUtil.getGoodsHongBaoMoney(goods, new BigDecimal(70),false).toString();
         TLJBuyHongBaoVO vo = new TLJBuyHongBaoVO();
         vo.setLeft(buyGoods.getLeftHongBaoCount());
         vo.setMoney(tljHongBao);
@@ -2368,7 +2260,7 @@
      if (!StringUtil.isNullOrEmpty(noRebateHelpLink)) {
         data.put("noRebateHelpLink", noRebateHelpLink);
      } else {
         data.put("noRebateHelpLink", configService.get(ConfigKeyEnum.noRebateHelpLink.getKey()));
         data.put("noRebateHelpLink", configService.getValue(ConfigKeyEnum.noRebateHelpLink.getKey(),acceptData.getSystem()));
      }
      // 取消分享活动
@@ -2422,7 +2314,7 @@
      List<String> detailImgs = new ArrayList<>();
      JSONArray detailImgsSize = new JSONArray();
      List<ImageInfo> imgs = redisManager.getTaoBaoGoodsDetailImgs(Long.parseLong(id));
      List<ImageInfo> imgs = redisManager.getTaoBaoGoodsDetailImgs(Long.parseLong(id),acceptData.getSystem());
      if (imgs != null && imgs.size() > 0) {
@@ -2550,7 +2442,7 @@
   @RequestMapping(value = "getSpecialActivities")
   public void getSpecialActivities(AcceptData acceptData, Long uid, PrintWriter out, String callback) {
      List<SpecialVO> listSpecial = specialService.listByVersion(0, Integer.MAX_VALUE, "special_activities",
            acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
            acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem());
      List<SpecialVO> list = new ArrayList<SpecialVO>();
      if (listSpecial != null) {