admin
2019-06-05 07c13064382007999e87abe81efe76c98a47dce8
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java
@@ -92,6 +92,7 @@
import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
import com.yeshi.fanli.service.inter.user.ShamUserService;
import com.yeshi.fanli.service.inter.user.TBPidService;
import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
@@ -104,6 +105,7 @@
import com.yeshi.fanli.util.TaoBaoConstant;
import com.yeshi.fanli.util.ThreadUtil;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.VersionUtil;
import com.yeshi.fanli.util.cache.TaoBaoGoodsCacheUtil;
import com.yeshi.fanli.util.factory.MonitorFactory;
import com.yeshi.fanli.util.taobao.TaoBaoCouponUtil;
@@ -223,6 +225,9 @@
   @Resource
   private TaoBaoShopService taoBaoShopService;
   @Resource
   private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
   @RequestMapping(value = "getHonestList")
   public void getHonestList(AcceptData acceptData, PrintWriter out) {
@@ -1602,8 +1607,8 @@
         if ("ios".equalsIgnoreCase(platform)) {
            root.put("htmlLink", configService.get("index_html_link_ios"));
         }
         root.put("spikeGoods",  getSpikeGoodsContent(acceptData));
         root.put("spikeGoods", getSpikeGoodsContent(acceptData));
         out.print(JsonUtil.loadTrueResult(root));
      } catch (Exception e) {
@@ -1687,8 +1692,8 @@
      nextTime.set(Calendar.MILLISECOND, 0);
      JSONArray array = null;
      String timekey = "spikeGoods_hour";
      String cachekey = "spikeGoodsList";
      String timekey = String.format("spikeGoods_hour-%s-%s", acceptData.getPlatform(), acceptData.getVersion());
      String cachekey = String.format("spikeGoodsList-%s-%s", acceptData.getPlatform(), acceptData.getVersion());
      String timeValue = redisManager.getCommonString(timekey);
      if (timeValue == null || !timeValue.equals(hour + "")) {
@@ -1699,7 +1704,7 @@
            array = JSONArray.fromObject(cacheValue);
         }
      }
      JumpDetailV2 jumpDetail = jumpDetailV2Service.getByTypeCache("web");
      if (array == null) {
         array = new JSONArray();
@@ -1714,30 +1719,41 @@
         }
         /* 遍历列表数据 */
         for (QualityFactory qualityFactory : listGoods) {
         for (QualityFactory qualityFactory : listGoods) {
            TaoBaoGoodsBrief taoBaoGoodsBrief = qualityFactory.getTaoBaoGoodsBrief();
            if (taoBaoGoodsBrief == null) {
               continue;
            }
            array.add(gson
            JSONObject goods = new JSONObject();
            goods.put("goods", gson
                  .toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
            goods.put("jumpDetail", jumpDetail);
            JSONObject params = new JSONObject();
            params.put("url", configService.get("spike_goods_link") + "?id=" + taoBaoGoodsBrief.getAuctionId());
            goods.put("params", params);
            // 1.5.4及以后返回
            if (VersionUtil.greaterThan_1_5_40(acceptData.getPlatform(), acceptData.getVersion())) {
               array.add(goods);
            } else {
               array.add(goods.optJSONObject("goods"));
            }
         }
         // 缓存半个小时
         redisManager.cacheCommonString(cachekey, array.toString(), 60 * 30);
      }
      Long endTime = nextTime.getTimeInMillis() - java.lang.System.currentTimeMillis();
      JSONObject root = new JSONObject();
      root.put("time", nextTime.getTimeInMillis());
      root.put("endTime", endTime > 0? endTime : 0);
      root.put("endTime", endTime > 0 ? endTime : 0);
      root.put("listgoods", array);
      JSONObject params = new JSONObject();
      params.put("url", configService.get("spike_goods_link"));
      JumpDetailV2 jumpDetail = jumpDetailV2Service.getByTypeCache("web");
      root.put("params", params);
      root.put("jumpDetail", jumpDetail);
@@ -1924,6 +1940,9 @@
      if (!StringUtil.isNullOrEmpty(tb.getPictUrlWhite()))
         finalImgList.add(0, tb.getPictUrlWhite());
      // 大淘客商品过滤
      goods = daTaoKeGoodsDetailService.filterTaoBaoGoods(goods);
      JSONObject goodsJson = new JSONObject();
      goodsJson.put("auctionId", tb.getAuctionId());
      goodsJson.put("imgList", finalImgList);
@@ -1932,11 +1951,10 @@
      goodsJson.put("price", tb.getReservePrice().toString());
      goodsJson.put("zkPrice", tb.getZkPrice().toString());
      // 30天销量
      goodsJson.put("saleCount", TaoBaoUtil.getSaleCount(tb.getBiz30day()));
      goodsJson.put("salesCount", TaoBaoUtil.getSaleCount(tb.getBiz30day()));
      // 分享赚
      BigDecimal shareMoney = taoBaoGoodsBriefService.getShareGoodsUserHongBao(tb);
      data.put("shareMoney", "¥" + shareMoney);
@@ -2056,17 +2074,15 @@
         } else {
            tbShopInfo.setUserType("0");
         }
         String shopLink = tbShopInfo.getShopUrl();
         if (StringUtil.isNullOrEmpty(shopLink)) {
            tbShopInfo.setShopUrl(TaoBaoUtil.getShopLink(tbShopInfo.getUserId()));
         }
      }
      // 店铺
      if (("android".equalsIgnoreCase(acceptData.getPlatform()) && Integer.parseInt(acceptData.getVersion()) >= 40)
            || ("ios".equalsIgnoreCase(acceptData.getPlatform())
                  && Integer.parseInt(acceptData.getVersion()) >= 49)) {
      // 店铺1.5.4及以后版本
      if (VersionUtil.greaterThan_1_5_40(acceptData.getPlatform(), acceptData.getVersion())) {
         TaoBaoShop shop = taoBaoShopService.getTaoBaoShop(goods.getAuctionId(), goods.getSellerId());
         if (shop != null) {
            String shopLink = shop.getShopLink();
@@ -2079,7 +2095,7 @@
         goodsJson.put("shopInfo", tbShopInfo);
      }
      goodsJson.put("fanliValid",true);// 是否有返利
      goodsJson.put("fanliValid", true);// 是否有返利
      // 分享路径
      String shareUrl = String.format("%s?id=" + tb.getAuctionId(), Constant.systemCommonConfig.getAppShareInfoUrl());
@@ -2097,9 +2113,9 @@
      data.put("shareUsers", listShareUser);
      data.put("couponUsers", listCouponUser);
      data.put("detailWebUrl", "http://apph5.yeshitv.com/apppage/goods_img.html?id=" + id);
      data.put("noRebateHelpLink", configService.get("no_rebate_help_link"));
      // 商品链接
      String h5Url = String.format("http://%s%s?id=%s&appType=flq", configService.getH5Host(),
            Constant.systemCommonConfig.getShareGoodsPagePath(), tb.getAuctionId() + "");