admin
2020-07-07 c9cbad5f5d18c6b2ac5a063e41007933d7028329
fanli/src/main/java/com/yeshi/fanli/service/impl/lable/TaoKeGoodsServiceImpl.java
@@ -9,6 +9,7 @@
import javax.annotation.Resource;
import com.yeshi.fanli.entity.SystemEnum;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.yeshi.utils.JsonUtil;
@@ -16,6 +17,7 @@
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.yeshi.fanli.dto.ConfigParamsDTO;
import com.yeshi.fanli.entity.bus.lable.QualityFactory;
import com.yeshi.fanli.entity.taobao.SearchFilter;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
@@ -25,6 +27,7 @@
import com.yeshi.fanli.entity.taobao.TaoBaoShopInfo;
import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
import com.yeshi.fanli.service.inter.lable.TaoKeGoodsService;
import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService;
import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
import com.yeshi.fanli.util.StringUtil;
@@ -41,6 +44,9 @@
   @Resource
   private HongBaoManageService hongBaoManageService;
   @Resource
   private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService;
   @Resource
   private TaoBaoShopService taoBaoShopService;
@@ -63,7 +69,7 @@
   @Override
   @Cacheable(value = "taoKeMaterialCache", key = "'getBrandsGoods-'+#materialId +'-'+#pageIndex")
   public JSONObject getBrandsGoods(Integer materialId, int pageIndex, int pageSize) throws Exception {
   public JSONObject getBrandsGoods(Integer materialId, int pageIndex, int pageSize, SystemEnum system) throws Exception {
      TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(materialId, pageIndex, pageSize);
@@ -80,7 +86,7 @@
      Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
            .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
      BigDecimal proportion = hongBaoManageService.getFanLiRate();
      BigDecimal proportion = hongBaoManageService.getFanLiRate(system);
      listGoods.parallelStream().forEach(taoBaoGoodsBrief -> {
@@ -186,8 +192,8 @@
   }
   @Override
   @Cacheable(value = "searchWuLiaoCache", key = "'searchWuLiao-'+#sf")
   public JSONObject searchWuLiao(SearchFilter sf) {
   @Cacheable(value = "searchWuLiaoCache", key = "'searchWuLiao-'+#sf+'-'+system")
   public JSONObject searchWuLiao(SearchFilter sf,SystemEnum system) {
      // 淘宝物料接口查询
      TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf);
@@ -207,7 +213,7 @@
      int fh = sf.getHongbao();
      boolean ft = sf.isTmall();
      BigDecimal proportion = hongBaoManageService.getFanLiRate();
      BigDecimal proportion = hongBaoManageService.getFanLiRate(system);
      if (fq == 0 && fh == 0 && !ft) {
         if (result != null && result.getTaoBaoGoodsBriefs() != null)
@@ -274,8 +280,8 @@
   
   
   @Override
   @Cacheable(value = "searchWuLiaoCache", key = "'searchWuLiaoV2-'+#sf")
   public JSONObject searchWuLiaoV2(SearchFilter sf) {
   @Cacheable(value = "searchWuLiaoCache", key = "'searchWuLiaoV2-'+#sf+'-'+#platform+'-'+#version+'-'+#system")
   public JSONObject searchWuLiaoV2(SearchFilter sf,String platform,String version,SystemEnum system) {
      // 淘宝物料接口查询
      TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf);
@@ -295,8 +301,7 @@
      int fh = sf.getHongbao();
      boolean ft = sf.isTmall();
      BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
      BigDecimal shareRate = hongBaoManageService.getShareRate();
       ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(platform, version,system);
      if (fq == 0 && fh == 0 && !ft) {
         if (result != null && result.getTaoBaoGoodsBriefs() != null)
@@ -311,7 +316,7 @@
                  }
               }
               GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(bf, null, fanLiRate, shareRate);
               GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(bf, paramsDTO);
               re.add(goodsDetailVO);
            }
      } else {
@@ -326,7 +331,7 @@
                     break;
                  }
               }
               GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate);
               GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO);
               re.add(goodsDetailVO);
            }
      }
@@ -343,9 +348,8 @@
   
   @Override
   @Cacheable(value = "searchWuLiaoCache", key = "'searchWuLiaoList-'+#sf")
   public List<TaoBaoGoodsBrief> searchWuLiaoList(SearchFilter sf) {
   @Cacheable(value = "searchWuLiaoCache", key = "'searchWuLiaoList-'+#sf+'-'+system")
   public List<TaoBaoGoodsBrief> searchWuLiaoList(SearchFilter sf,SystemEnum system) {
      // 淘宝物料接口查询
      TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf);
      if (result == null)
@@ -356,7 +360,7 @@
   @Override
   public JSONObject listByWuLiao(int page, String key, String cateIds, String filterParams, String order,
         String startprice, String endprice, String searchParam) {
         String startprice, String endprice, String searchParam,SystemEnum system) {
      SearchFilter sf = new SearchFilter();
      sf.setKey(key);
@@ -484,7 +488,7 @@
      int fh = sf.getHongbao();
      boolean ft = sf.isTmall();
      BigDecimal proportion = hongBaoManageService.getFanLiRate();
      BigDecimal proportion = hongBaoManageService.getFanLiRate(system);
      if (fq == 0 && fh == 0 && !ft) {
         if (result != null && result.getTaoBaoGoodsBriefs() != null)
@@ -632,13 +636,13 @@
   @Override
   public JSONObject listQualityGoods(List<QualityFactory> listQuality, List<TaoBaoGoodsBrief> searchWuLiaoList,
         Map<String, String> map) {
         Map<String, String> map,SystemEnum system) {
      JSONArray array = new JSONArray();
      Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
            .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
      BigDecimal proportion = hongBaoManageService.getFanLiRate();
      BigDecimal proportion = hongBaoManageService.getFanLiRate(system);
      /* 遍历列表数据 */
      for (QualityFactory selectionGoods : listQuality) {