yujian
2020-01-18 f4a0f2acc63d7785eab108419a4e16f5f688cb95
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/BrandControllerV2.java
@@ -1,7 +1,6 @@
package com.yeshi.fanli.controller.client.v2;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@@ -26,7 +25,7 @@
import com.yeshi.fanli.entity.jd.JDGoods;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoShop;
import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
import com.yeshi.fanli.exception.taobao.TaoKeApiException;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.service.inter.brand.BrandClassService;
@@ -41,7 +40,7 @@
import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsService;
import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailV2Service;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.ThreadUtil;
@@ -79,7 +78,7 @@
   private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
   @Resource
   private DaTaoKeGoodsService daTaoKeGoodsService;
   private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service;
   @Resource
   private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
@@ -252,9 +251,9 @@
      List<TaoBaoGoodsBrief> listGoodsBrief = new ArrayList<TaoBaoGoodsBrief>();
      // 先查询大淘客数据
      List<DaTaoKeDetail> listDaTaoKe = daTaoKeGoodsService.listBySellerId(0, pageSize, sid);
      List<DaTaoKeDetailV2> listDaTaoKe = daTaoKeGoodsDetailV2Service.listBySellerId(0, pageSize, sid);
      if (listDaTaoKe != null && listDaTaoKe.size() > 0) {
         for (DaTaoKeDetail daTaoKe : listDaTaoKe) {
         for (DaTaoKeDetailV2 daTaoKe : listDaTaoKe) {
            listGoodsBrief.add(TaoBaoUtil.convert(daTaoKe));
         }
      }
@@ -352,7 +351,7 @@
   @RequestMapping(value = "getList", method = RequestMethod.POST)
   public void getList(AcceptData acceptData, Integer page, Long cid, Long uid, PrintWriter out) {
      if ("ios".equalsIgnoreCase(acceptData.getPlatform())) {
         if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
         if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) {
            getListV3(acceptData, page, cid, uid, out);
            return;
         }
@@ -407,7 +406,7 @@
   public void getShopInfoV2(AcceptData acceptData, Integer page, Long id, Long uid, PrintWriter out) {
      
      if ("ios".equalsIgnoreCase(acceptData.getPlatform())) {
         if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
         if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) {
            getShopInfoV3(acceptData, page, id, uid, out);
            return;
         }
@@ -476,9 +475,9 @@
      List<TaoBaoGoodsBrief> listGoodsBrief = new ArrayList<TaoBaoGoodsBrief>();
      // 先查询大淘客数据
      List<DaTaoKeDetail> listDaTaoKe = daTaoKeGoodsService.listBySellerId(0, pageSize, id);
      List<DaTaoKeDetailV2> listDaTaoKe = daTaoKeGoodsDetailV2Service.listBySellerId(0, pageSize, id);
      if (listDaTaoKe != null && listDaTaoKe.size() > 0) {
         for (DaTaoKeDetail daTaoKe : listDaTaoKe) {
         for (DaTaoKeDetailV2 daTaoKe : listDaTaoKe) {
            listGoodsBrief.add(TaoBaoUtil.convert(daTaoKe));
         }
      }
@@ -576,7 +575,7 @@
   @RequestMapping(value = "getHistoryV2", method = RequestMethod.POST)
   public void getHistoryV2(AcceptData acceptData, Integer page, Long uid, Integer type, PrintWriter out) {
      if ("ios".equalsIgnoreCase(acceptData.getPlatform())) {
         if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
         if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) {
            getHistoryV3(acceptData, page, uid, type, out);
            return;
         }
@@ -663,19 +662,25 @@
         out.print(JsonUtil.loadFalseResult("页码不正确"));
         return;
      }
      if (cid != null && cid == 0) {
         cid = null;
      }
      
      JSONObject data = new JSONObject();
      if (page == 1  && cid == null) { // 精选页banner
         List<SwiperPicture> banners = swiperPictureService.getByBannerCardAndVersion("brand_banners",acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
         if (banners == null)
            banners = new ArrayList<>();
         data.put("banners", JsonUtil.getApiCommonGson().toJson(banners));
      }
      if (page == 1 && cid != null) {
         List<BrandInfo> brandlist = brandInfoService.listValidByCidToApp(cid);
         if(brandlist == null)
            brandlist = new ArrayList<BrandInfo>();
         data.put("brandlist", JsonUtil.getApiCommonGson().toJson(brandlist));
      }
      
      long count = brandInfoService.countValidByCidToApp(cid);