yujian
2019-11-25 aa552facf6d833acab0d3e3e29bda2a0fb826ffe
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/CommonTemplateContentServiceImpl.java
@@ -36,6 +36,7 @@
import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
import com.yeshi.fanli.service.inter.taobao.TaobaoMeterialService;
import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailV2Service;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.dataoke.DaTaoKeApiUtil;
import com.yeshi.fanli.util.taobao.DaTaoKeUtil;
@@ -50,6 +51,9 @@
   @Resource
   private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
   @Resource
   private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service;
   @Resource
   private TaobaoMeterialService taobaoMeterialService;
@@ -212,15 +216,36 @@
      if ("-1".equalsIgnoreCase(cid)) {
         result = DaTaoKeApiUtil.search("", null, null, new BigDecimal("10"), page, pageSize,
               DaTaoKeApiUtil.SORT_DEFAULT);
         if (result == null || result.getGoodsList() == null || result.getGoodsList().size() == 0) {
            result = new DaTaoKeGoodsResult();
            result.setGoodsList(daTaoKeGoodsDetailV2Service.listByMaxPrice(null,
                  new BigDecimal("10"),null, page, pageSize));
            result.setTotalCount(
                  daTaoKeGoodsDetailV2Service.countByMaxPrice(null, new BigDecimal("10")));
         }
      } else if ("0".equalsIgnoreCase(cid)) {
         result = DaTaoKeApiUtil.search("", null, null, new BigDecimal("10"), page, pageSize,
               DaTaoKeApiUtil.SORT_CREATETIME);
         if (result == null || result.getGoodsList() == null || result.getGoodsList().size() == 0) {
            result = new DaTaoKeGoodsResult();
            result.setGoodsList(daTaoKeGoodsDetailV2Service.listByMaxPrice(null,
                  new BigDecimal("10"),"createTime", page, pageSize));
            result.setTotalCount(
                  daTaoKeGoodsDetailV2Service.countByMaxPrice(null, new BigDecimal("10")));
         }
      } else {
         List<Integer> cidList = new ArrayList<>();
         cidList.add(Integer.parseInt(cid));
         result = DaTaoKeApiUtil.search("", cidList, null, new BigDecimal("10"), page, pageSize,
               DaTaoKeApiUtil.SORT_DEFAULT);
         if (result == null || result.getGoodsList() == null || result.getGoodsList().size() == 0) {
            result = new DaTaoKeGoodsResult();
            result.setGoodsList(daTaoKeGoodsDetailV2Service.listByMaxPrice(Integer.parseInt(cid),
                  new BigDecimal("10"),null, page, pageSize));
            result.setTotalCount(
                  daTaoKeGoodsDetailV2Service.countByMaxPrice(Integer.parseInt(cid), new BigDecimal("10")));
         }
      }
      List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();