yujian
2019-12-19 626d711cb15896055c13fe344eb7fcc824589715
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/CommonContentControllerV2.java
@@ -15,6 +15,7 @@
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.yeshi.fanli.dto.ConfigParamsDTO;
import com.yeshi.fanli.dto.common.CommonContentNav;
import com.yeshi.fanli.dto.common.CommonContentResult;
import com.yeshi.fanli.dto.common.CommonContentTypeEnum;
@@ -147,7 +148,8 @@
         String imei = acceptData.getImei();
         result = guessLikeDeviceTB(idfa, imei, page);
      } else {
         result = commonTemplateContentService.getContentList(type, cid, page, Constant.PAGE_SIZE);
         // 大淘客页码只能为10,50,100,200
         result = commonTemplateContentService.getContentList(type, cid, page, 10);
      }
      JSONObject root = new JSONObject();
@@ -156,19 +158,20 @@
         List<SwiperPicture> bannerList = new ArrayList<>();
         root.put("bannerList", new Gson().toJson(bannerList));
      }
      JSONArray array = new JSONArray();
      Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create();
      List<TaoBaoGoodsBrief> goodsList = result.getGoodsList();
      BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
      BigDecimal shareRate = hongBaoManageService.getShareRate();
      ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE,   hongBaoManageService.getVIPFanLiRate());
      for (TaoBaoGoodsBrief taoBaoGoodsBrief : goodsList) {
         GoodsDetailVO vo = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate);
         GoodsDetailVO vo = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO);
         if (type == CommonContentTypeEnum.mianDan)// 免单商品
         {
            vo.getMoneyInfo().setFanliMoney("¥" + TaoBaoUtil.getAfterUseCouplePrice(taoBaoGoodsBrief));
            vo.getMoneyInfo().setShareMoney("¥" + TaoBaoUtil.getAfterUseCouplePrice(taoBaoGoodsBrief));
            vo.getMoneyInfo().setMaxMoney(null);
         }
         array.add(gson.toJson(vo));
      }
@@ -211,8 +214,9 @@
            BigDecimal shareRate = hongBaoManageService.getShareRate();
            Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                  .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
            ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE,   hongBaoManageService.getVIPFanLiRate());
            for (JDGoods goods : goodsList) {
               array.add(gson.toJson(GoodsDetailVOFactory.convertJDGoods(goods, fanLiRate, shareRate)));
               array.add(gson.toJson(GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO)));
            }
         }
      }
@@ -237,7 +241,7 @@
         // 2、顶部轮播图
         List<SwiperPicture> bannerList = null;
         if (Constant.IS_TEST) {
            bannerList = swiperPictureService.getByBannerCard("index_top");
            bannerList = swiperPictureService.getByBannerCardAndVersion("index_top",acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
         }
         if (bannerList == null) {
@@ -260,8 +264,9 @@
            BigDecimal shareRate = hongBaoManageService.getShareRate();
            Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                  .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
            ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE,   hongBaoManageService.getVIPFanLiRate());
            for (PDDGoodsDetail goods : goodsList) {
               array.add(gson.toJson(GoodsDetailVOFactory.convertPDDGoods(goods, fanLiRate, shareRate)));
               array.add(gson.toJson(GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO)));
            }
         }
      }
@@ -270,10 +275,10 @@
      data.put("count", count);
      out.print(JsonUtil.loadTrueResult(data));
   }
   /**
    * 猜你喜欢-淘宝设备推荐
    *
    * @param acceptData
    * @param page
    * @return
@@ -281,7 +286,7 @@
   @Cacheable(value = "commonContentCache", key = "#idfa+'-'+#imei+'-'+#page")
   private CommonContentResult guessLikeDeviceTB(String idfa, String imei, Integer page) {
      TaoBaoSearchResult searchResult = TaoKeApiUtil.guessDeviceLike(page, Constant.PAGE_SIZE, imei, idfa);
      if (searchResult != null && searchResult.getTaoBaoGoodsBriefs() != null
      if (searchResult != null && searchResult.getTaoBaoGoodsBriefs() != null
            && searchResult.getTaoBaoGoodsBriefs().size() > 0) {
         CommonContentResult result = new CommonContentResult();
         result.setCount(searchResult.getPageEntity().getTotalCount());