| | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.lijin.manager.GoodsLijinMnager; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.stereotype.Service; |
| | | import org.yeshi.utils.JsonUtil; |
| | |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.yeshi.fanli.dto.ConfigParamsDTO; |
| | | import com.yeshi.fanli.dto.GoodsMoneyConfigParamsDTO; |
| | | import com.yeshi.fanli.entity.bus.lable.QualityFactory; |
| | | import com.yeshi.fanli.entity.taobao.SearchFilter; |
| | | import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief; |
| | |
| | | @Service |
| | | public class TaoKeGoodsServiceImpl implements TaoKeGoodsService { |
| | | |
| | | @Resource |
| | | private HongBaoManageService hongBaoManageService; |
| | | |
| | | @Resource |
| | | private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService; |
| | | @Resource |
| | | private HongBaoManageService hongBaoManageService; |
| | | |
| | | @Resource |
| | | private TaoBaoShopService taoBaoShopService; |
| | | @Resource |
| | | private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService; |
| | | |
| | | @Resource |
| | | private QualityGoodsService qualityGoodsService; |
| | | @Resource |
| | | private TaoBaoShopService taoBaoShopService; |
| | | |
| | | @Cacheable(value = "taoKeMaterialCache", key = "'listByMaterial-'+#materialId +'-'+#pageIndex") |
| | | @Override |
| | | public List<TaoBaoGoodsBrief> listByMaterial(Integer materialId, Integer pageIndex, int pageSize) throws Exception { |
| | | @Resource |
| | | private QualityGoodsService qualityGoodsService; |
| | | |
| | | TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(materialId, pageIndex, pageSize); |
| | | @Resource |
| | | private GoodsLijinMnager goodsLijinMnager; |
| | | |
| | | if (result == null) { |
| | | return null; |
| | | } |
| | | @Cacheable(value = "taoKeMaterialCache", key = "'listByMaterial-'+#materialId +'-'+#pageIndex") |
| | | @Override |
| | | public List<TaoBaoGoodsBrief> listByMaterial(Integer materialId, Integer pageIndex, int pageSize) throws Exception { |
| | | |
| | | return result.getTaoBaoGoodsBriefs(); |
| | | } |
| | | TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(materialId, pageIndex, pageSize); |
| | | |
| | | @Override |
| | | @Cacheable(value = "taoKeMaterialCache", key = "'getBrandsGoods-'+#materialId +'-'+#pageIndex") |
| | | public JSONObject getBrandsGoods(Integer materialId, int pageIndex, int pageSize, SystemEnum system) throws Exception { |
| | | if (result == null) { |
| | | return null; |
| | | } |
| | | |
| | | TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(materialId, pageIndex, pageSize); |
| | | return result.getTaoBaoGoodsBriefs(); |
| | | } |
| | | |
| | | if (result == null) { |
| | | return null; |
| | | } |
| | | @Override |
| | | @Cacheable(value = "taoKeMaterialCache", key = "'getBrandsGoods-'+#materialId +'-'+#pageIndex") |
| | | public JSONObject getBrandsGoods(Integer materialId, int pageIndex, int pageSize, SystemEnum system) throws Exception { |
| | | |
| | | List<TaoBaoGoodsBrief> listGoods = result.getTaoBaoGoodsBriefs(); |
| | | if (listGoods == null || listGoods.size() == 0) { |
| | | return null; |
| | | } |
| | | TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(materialId, pageIndex, pageSize); |
| | | |
| | | JSONArray arrayGoods = new JSONArray(); |
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) |
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create(); |
| | | if (result == null) { |
| | | return null; |
| | | } |
| | | |
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate(system); |
| | | List<TaoBaoGoodsBrief> listGoods = result.getTaoBaoGoodsBriefs(); |
| | | if (listGoods == null || listGoods.size() == 0) { |
| | | return null; |
| | | } |
| | | |
| | | listGoods.parallelStream().forEach(taoBaoGoodsBrief -> { |
| | | JSONArray arrayGoods = new JSONArray(); |
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) |
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create(); |
| | | |
| | | // Long sellerId = taoBaoGoodsBrief.getSellerId(); |
| | | // String title = taoBaoGoodsBrief.getTitle(); |
| | | // Long auctionId = taoBaoGoodsBrief.getAuctionId(); |
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate(system); |
| | | |
| | | // TaoBaoShopInfo shopInfo = TaoBaoShopUtil.getTaoBaoShopInfo(title, |
| | | // sellerId, auctionId); |
| | | listGoods.parallelStream().forEach(taoBaoGoodsBrief -> { |
| | | |
| | | TaoBaoShopInfo shopInfo = taoBaoShopService.getTaoBaoShopInfo(taoBaoGoodsBrief); |
| | | // Long sellerId = taoBaoGoodsBrief.getSellerId(); |
| | | // String title = taoBaoGoodsBrief.getTitle(); |
| | | // Long auctionId = taoBaoGoodsBrief.getAuctionId(); |
| | | |
| | | if (shopInfo != null) { |
| | | taoBaoGoodsBrief.setShopTitle(shopInfo.getShopTitle()); |
| | | String shopType = shopInfo.getShopType(); |
| | | if (shopType.contains("tm")) { |
| | | taoBaoGoodsBrief.setUserType(1); |
| | | } else { |
| | | taoBaoGoodsBrief.setUserType(0); |
| | | } |
| | | } |
| | | // TaoBaoShopInfo shopInfo = TaoBaoShopUtil.getTaoBaoShopInfo(title, |
| | | // sellerId, auctionId); |
| | | |
| | | int count = taoBaoGoodsBrief.getBiz30day(); |
| | | if (count >= 10000) { |
| | | double sales = count; |
| | | String salesCountMidea = String.format("%.1f", sales / 10000); |
| | | taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万"); |
| | | } else { |
| | | taoBaoGoodsBrief.setSalesCount(count + ""); |
| | | } |
| | | TaoBaoShopInfo shopInfo = taoBaoShopService.getTaoBaoShopInfo(taoBaoGoodsBrief); |
| | | |
| | | // 改变图片尺寸 |
| | | String pictUrl = taoBaoGoodsBrief.getPictUrl(); |
| | | if (!StringUtil.isNullOrEmpty(pictUrl) && !pictUrl.contains("320x320")) { |
| | | taoBaoGoodsBrief.setPictUrl(TbImgUtil.getTBSize320Img(pictUrl)); |
| | | } |
| | | if (shopInfo != null) { |
| | | taoBaoGoodsBrief.setShopTitle(shopInfo.getShopTitle()); |
| | | String shopType = shopInfo.getShopType(); |
| | | if (shopType.contains("tm")) { |
| | | taoBaoGoodsBrief.setUserType(1); |
| | | } else { |
| | | taoBaoGoodsBrief.setUserType(0); |
| | | } |
| | | } |
| | | |
| | | arrayGoods.add( |
| | | gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null))); |
| | | int count = taoBaoGoodsBrief.getBiz30day(); |
| | | if (count >= 10000) { |
| | | double sales = count; |
| | | String salesCountMidea = String.format("%.1f", sales / 10000); |
| | | taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万"); |
| | | } else { |
| | | taoBaoGoodsBrief.setSalesCount(count + ""); |
| | | } |
| | | |
| | | }); |
| | | // 改变图片尺寸 |
| | | String pictUrl = taoBaoGoodsBrief.getPictUrl(); |
| | | if (!StringUtil.isNullOrEmpty(pictUrl) && !pictUrl.contains("320x320")) { |
| | | taoBaoGoodsBrief.setPictUrl(TbImgUtil.getTBSize320Img(pictUrl)); |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("count", arrayGoods.size()); |
| | | data.put("result_list", arrayGoods); |
| | | arrayGoods.add( |
| | | gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null))); |
| | | |
| | | return data; |
| | | } |
| | | }); |
| | | |
| | | @Override |
| | | @Cacheable(value = "taoKeMaterialCache", key = "'getBrandsShops-'+#materialId +'-'+#pageIndex") |
| | | public JSONObject getBrandsShops(Integer materialId, int pageIndex, int pageSize) throws Exception { |
| | | JSONObject data = new JSONObject(); |
| | | data.put("count", arrayGoods.size()); |
| | | data.put("result_list", arrayGoods); |
| | | |
| | | TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(materialId, pageIndex, pageSize); |
| | | return data; |
| | | } |
| | | |
| | | if (result == null) { |
| | | return null; |
| | | } |
| | | @Override |
| | | @Cacheable(value = "taoKeMaterialCache", key = "'getBrandsShops-'+#materialId +'-'+#pageIndex") |
| | | public JSONObject getBrandsShops(Integer materialId, int pageIndex, int pageSize) throws Exception { |
| | | |
| | | List<TaoBaoGoodsBrief> listGoods = result.getTaoBaoGoodsBriefs(); |
| | | if (listGoods == null || listGoods.size() == 0) { |
| | | return null; |
| | | } |
| | | TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(materialId, pageIndex, pageSize); |
| | | |
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) |
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create(); |
| | | if (result == null) { |
| | | return null; |
| | | } |
| | | |
| | | JSONArray arrayShop = new JSONArray(); |
| | | List<TaoBaoGoodsBrief> listGoods = result.getTaoBaoGoodsBriefs(); |
| | | if (listGoods == null || listGoods.size() == 0) { |
| | | return null; |
| | | } |
| | | |
| | | listGoods.parallelStream().forEach(taoBaoGoodsBrief -> { |
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) |
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create(); |
| | | |
| | | // Long sellerId = taoBaoGoodsBrief.getSellerId(); |
| | | // String title = taoBaoGoodsBrief.getTitle(); |
| | | // Long auctionId = taoBaoGoodsBrief.getAuctionId(); |
| | | JSONArray arrayShop = new JSONArray(); |
| | | |
| | | // TaoBaoShopInfo shopInfo = TaoBaoShopUtil.getTaoBaoShopInfo(title, |
| | | // sellerId, auctionId); |
| | | listGoods.parallelStream().forEach(taoBaoGoodsBrief -> { |
| | | |
| | | TaoBaoShopInfo shopInfo = taoBaoShopService.getTaoBaoShopInfo(taoBaoGoodsBrief); |
| | | // Long sellerId = taoBaoGoodsBrief.getSellerId(); |
| | | // String title = taoBaoGoodsBrief.getTitle(); |
| | | // Long auctionId = taoBaoGoodsBrief.getAuctionId(); |
| | | |
| | | if (shopInfo != null) { |
| | | // TaoBaoShopInfo shopInfo = TaoBaoShopUtil.getTaoBaoShopInfo(title, |
| | | // sellerId, auctionId); |
| | | |
| | | JSONObject jsonShop = new JSONObject(); |
| | | String shopType = shopInfo.getShopType(); |
| | | if (shopType.contains("tm")) { |
| | | shopInfo.setShopType("2"); |
| | | } else { |
| | | shopInfo.setShopType("1"); |
| | | } |
| | | TaoBaoShopInfo shopInfo = taoBaoShopService.getTaoBaoShopInfo(taoBaoGoodsBrief); |
| | | |
| | | jsonShop.put("shopInfo", shopInfo); |
| | | jsonShop.put("auctionId", taoBaoGoodsBrief.getAuctionId()); |
| | | arrayShop.add(gson.toJson(jsonShop)); |
| | | } |
| | | if (shopInfo != null) { |
| | | |
| | | }); |
| | | JSONObject jsonShop = new JSONObject(); |
| | | String shopType = shopInfo.getShopType(); |
| | | if (shopType.contains("tm")) { |
| | | shopInfo.setShopType("2"); |
| | | } else { |
| | | shopInfo.setShopType("1"); |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("count", listGoods.size()); |
| | | data.put("result_list", arrayShop); |
| | | jsonShop.put("shopInfo", shopInfo); |
| | | jsonShop.put("auctionId", taoBaoGoodsBrief.getAuctionId()); |
| | | arrayShop.add(gson.toJson(jsonShop)); |
| | | } |
| | | |
| | | return data; |
| | | } |
| | | }); |
| | | |
| | | @Override |
| | | @Cacheable(value = "searchWuLiaoCache", key = "'searchWuLiao-'+#sf+'-'+system") |
| | | public JSONObject searchWuLiao(SearchFilter sf,SystemEnum system) { |
| | | JSONObject data = new JSONObject(); |
| | | data.put("count", listGoods.size()); |
| | | data.put("result_list", arrayShop); |
| | | |
| | | // 淘宝物料接口查询 |
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf,null,null); |
| | | return data; |
| | | } |
| | | |
| | | List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav(); |
| | | if (result.getNavList() != null) |
| | | navList.addAll(result.getNavList()); |
| | | @Override |
| | | @Cacheable(value = "searchWuLiaoCache", key = "'searchWuLiao-'+#sf+'-'+system") |
| | | public JSONObject searchWuLiao(SearchFilter sf, SystemEnum system) { |
| | | |
| | | Gson gson = new GsonBuilder().create(); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("nav", gson.toJson(navList)); |
| | | // 淘宝物料接口查询 |
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiaoNew(sf, null, null); |
| | | |
| | | List<TaoBaoGoodsBriefExtra> re = new ArrayList<TaoBaoGoodsBriefExtra>(); |
| | | List<TaoBaoGoodsBrief> taoBaoGoodsBriefs = result.getTaoBaoGoodsBriefs(); |
| | | List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav(); |
| | | if (result.getNavList() != null) |
| | | navList.addAll(result.getNavList()); |
| | | |
| | | int fq = sf.getQuan(); |
| | | int fh = sf.getHongbao(); |
| | | boolean ft = sf.isTmall(); |
| | | Gson gson = new GsonBuilder().create(); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("nav", gson.toJson(navList)); |
| | | |
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate(system); |
| | | List<TaoBaoGoodsBriefExtra> re = new ArrayList<TaoBaoGoodsBriefExtra>(); |
| | | List<TaoBaoGoodsBrief> taoBaoGoodsBriefs = result.getTaoBaoGoodsBriefs(); |
| | | |
| | | if (fq == 0 && fh == 0 && !ft) { |
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null) |
| | | for (TaoBaoGoodsBrief bf : result.getTaoBaoGoodsBriefs()) { |
| | | int count = bf.getBiz30day(); |
| | | int fq = sf.getQuan(); |
| | | int fh = sf.getHongbao(); |
| | | boolean ft = sf.isTmall(); |
| | | |
| | | String startBiz30day = sf.getStartBiz30day(); |
| | | if (!StringUtil.isNullOrEmpty(startBiz30day)) { |
| | | int biz30day = Integer.parseInt(startBiz30day); |
| | | if (count < biz30day) { |
| | | continue; |
| | | } |
| | | } |
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate(system); |
| | | |
| | | if (count >= 10000) { // 对销量数据做处理 页面展示7.3万 |
| | | double sales = count; |
| | | String salesCountMidea = String.format("%.1f", sales / 10000); |
| | | bf.setSalesCount(salesCountMidea + "万"); |
| | | re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion.toString(), "")); |
| | | } else { |
| | | bf.setSalesCount(count + ""); |
| | | re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion.toString(), "")); |
| | | } |
| | | } |
| | | } else { |
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra; |
| | | if (taoBaoGoodsBriefs != null) |
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) { |
| | | if (fq == 0 && fh == 0 && !ft) { |
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null) |
| | | for (TaoBaoGoodsBrief bf : result.getTaoBaoGoodsBriefs()) { |
| | | int count = bf.getBiz30day(); |
| | | |
| | | int count = taoBaoGoodsBrief.getBiz30day(); |
| | | String startBiz30day = sf.getStartBiz30day(); |
| | | if (!StringUtil.isNullOrEmpty(startBiz30day)) { |
| | | int biz30day = Integer.parseInt(startBiz30day); |
| | | if (count < biz30day) { |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | String startBiz30day = sf.getStartBiz30day(); |
| | | if (!StringUtil.isNullOrEmpty(startBiz30day)) { |
| | | int biz30day = Integer.parseInt(startBiz30day); |
| | | if (count < biz30day) { |
| | | break; |
| | | } |
| | | } |
| | | if (count >= 10000) { // 对销量数据做处理 页面展示7.3万 |
| | | double sales = count; |
| | | String salesCountMidea = String.format("%.1f", sales / 10000); |
| | | bf.setSalesCount(salesCountMidea + "万"); |
| | | re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion.toString(), "")); |
| | | } else { |
| | | bf.setSalesCount(count + ""); |
| | | re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion.toString(), "")); |
| | | } |
| | | } |
| | | } else { |
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra; |
| | | if (taoBaoGoodsBriefs != null) |
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) { |
| | | |
| | | if (count >= 10000) { |
| | | double sales = count; |
| | | String salesCountMidea = String.format("%.1f", sales / 10000); |
| | | taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万"); |
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, |
| | | proportion.toString(), ""); |
| | | re.add(taoBaoGoodsBriefExtra); |
| | | } else { |
| | | taoBaoGoodsBrief.setSalesCount(count + ""); |
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, |
| | | proportion.toString(), ""); |
| | | re.add(taoBaoGoodsBriefExtra); |
| | | } |
| | | } |
| | | } |
| | | int count = taoBaoGoodsBrief.getBiz30day(); |
| | | |
| | | Gson gson2 = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) |
| | | .excludeFieldsWithoutExposeAnnotation().create(); |
| | | String startBiz30day = sf.getStartBiz30day(); |
| | | if (!StringUtil.isNullOrEmpty(startBiz30day)) { |
| | | int biz30day = Integer.parseInt(startBiz30day); |
| | | if (count < biz30day) { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | data.put("result", gson2.toJson(re)); |
| | | data.put("count", result.getTaoBaoHead().getDocsfound()); |
| | | if (count >= 10000) { |
| | | double sales = count; |
| | | String salesCountMidea = String.format("%.1f", sales / 10000); |
| | | taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万"); |
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, |
| | | proportion.toString(), ""); |
| | | re.add(taoBaoGoodsBriefExtra); |
| | | } else { |
| | | taoBaoGoodsBrief.setSalesCount(count + ""); |
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, |
| | | proportion.toString(), ""); |
| | | re.add(taoBaoGoodsBriefExtra); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return data; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @Cacheable(value = "searchWuLiaoCache", key = "'searchWuLiaoV2-'+#sf+'-'+#platform+'-'+#version+'-'+#system") |
| | | public JSONObject searchWuLiaoV2(SearchFilter sf,String platform,String version,SystemEnum system) { |
| | | Gson gson2 = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) |
| | | .excludeFieldsWithoutExposeAnnotation().create(); |
| | | |
| | | // 淘宝物料接口查询 |
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf,null,null); |
| | | data.put("result", gson2.toJson(re)); |
| | | data.put("count", result.getTaoBaoHead().getDocsfound()); |
| | | |
| | | List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav(); |
| | | if (result.getNavList() != null) |
| | | navList.addAll(result.getNavList()); |
| | | return data; |
| | | } |
| | | |
| | | Gson gson = new GsonBuilder().create(); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("nav", gson.toJson(navList)); |
| | | |
| | | List<GoodsDetailVO> re = new ArrayList<GoodsDetailVO>(); |
| | | List<TaoBaoGoodsBrief> taoBaoGoodsBriefs = result.getTaoBaoGoodsBriefs(); |
| | | @Override |
| | | @Cacheable(value = "searchWuLiaoCache", key = "'searchWuLiaoV2-'+#sf+'-'+#platform+'-'+#version+'-'+#system") |
| | | public JSONObject searchWuLiaoV2(SearchFilter sf, String platform, String version, SystemEnum system) { |
| | | |
| | | int fq = sf.getQuan(); |
| | | int fh = sf.getHongbao(); |
| | | boolean ft = sf.isTmall(); |
| | | // 淘宝物料接口查询 |
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiaoNew(sf, null, null); |
| | | |
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(platform, version,system); |
| | | List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav(); |
| | | if (result.getNavList() != null) |
| | | navList.addAll(result.getNavList()); |
| | | |
| | | if (fq == 0 && fh == 0 && !ft) { |
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null) |
| | | for (TaoBaoGoodsBrief bf : result.getTaoBaoGoodsBriefs()) { |
| | | int count = bf.getBiz30day(); |
| | | Gson gson = new GsonBuilder().create(); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("nav", gson.toJson(navList)); |
| | | |
| | | String startBiz30day = sf.getStartBiz30day(); |
| | | if (!StringUtil.isNullOrEmpty(startBiz30day)) { |
| | | int biz30day = Integer.parseInt(startBiz30day); |
| | | if (count < biz30day) { |
| | | continue; |
| | | } |
| | | } |
| | | List<GoodsDetailVO> re = new ArrayList<GoodsDetailVO>(); |
| | | List<TaoBaoGoodsBrief> taoBaoGoodsBriefs = result.getTaoBaoGoodsBriefs(); |
| | | |
| | | GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(bf, paramsDTO); |
| | | re.add(goodsDetailVO); |
| | | } |
| | | } else { |
| | | if (taoBaoGoodsBriefs != null) |
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) { |
| | | int fq = sf.getQuan(); |
| | | int fh = sf.getHongbao(); |
| | | boolean ft = sf.isTmall(); |
| | | |
| | | int count = taoBaoGoodsBrief.getBiz30day(); |
| | | String startBiz30day = sf.getStartBiz30day(); |
| | | if (!StringUtil.isNullOrEmpty(startBiz30day)) { |
| | | int biz30day = Integer.parseInt(startBiz30day); |
| | | if (count < biz30day) { |
| | | break; |
| | | } |
| | | } |
| | | GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO); |
| | | re.add(goodsDetailVO); |
| | | } |
| | | } |
| | | GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(platform, version, system); |
| | | |
| | | Gson gson2 = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) |
| | | .excludeFieldsWithoutExposeAnnotation().create(); |
| | | List<TaoBaoGoodsBrief> goodsBriefList = new ArrayList<>(); |
| | | if (fq == 0 && fh == 0 && !ft) { |
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null) |
| | | for (TaoBaoGoodsBrief bf : result.getTaoBaoGoodsBriefs()) { |
| | | int count = bf.getBiz30day(); |
| | | |
| | | data.put("result", gson2.toJson(re)); |
| | | data.put("count", result.getTaoBaoHead().getDocsfound()); |
| | | String startBiz30day = sf.getStartBiz30day(); |
| | | if (!StringUtil.isNullOrEmpty(startBiz30day)) { |
| | | int biz30day = Integer.parseInt(startBiz30day); |
| | | if (count < biz30day) { |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | return data; |
| | | } |
| | | |
| | | |
| | | goodsBriefList.add(bf); |
| | | } |
| | | } else { |
| | | if (taoBaoGoodsBriefs != null) |
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) { |
| | | |
| | | @Override |
| | | @Cacheable(value = "searchWuLiaoCache", key = "'searchWuLiaoList-'+#sf+'-'+system") |
| | | public List<TaoBaoGoodsBrief> searchWuLiaoList(SearchFilter sf,SystemEnum system) { |
| | | // 淘宝物料接口查询 |
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf,null,null); |
| | | if (result == null) |
| | | return null; |
| | | int count = taoBaoGoodsBrief.getBiz30day(); |
| | | String startBiz30day = sf.getStartBiz30day(); |
| | | if (!StringUtil.isNullOrEmpty(startBiz30day)) { |
| | | int biz30day = Integer.parseInt(startBiz30day); |
| | | if (count < biz30day) { |
| | | break; |
| | | } |
| | | } |
| | | goodsBriefList.add(taoBaoGoodsBrief); |
| | | } |
| | | } |
| | | Gson gson2 = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) |
| | | .excludeFieldsWithoutExposeAnnotation().create(); |
| | | |
| | | return result.getTaoBaoGoodsBriefs(); |
| | | } |
| | | List<GoodsDetailVO> voList = goodsLijinMnager.loadTBMoneyInfo(system, null, goodsBriefList, paramsDTO,false); |
| | | for (GoodsDetailVO vo : voList) { |
| | | re.add(vo); |
| | | } |
| | | |
| | | @Override |
| | | public JSONObject listByWuLiao(int page, String key, String cateIds, String filterParams, String order, |
| | | String startprice, String endprice, String searchParam,SystemEnum system) { |
| | | |
| | | SearchFilter sf = new SearchFilter(); |
| | | sf.setKey(key); |
| | | sf.setPage(page); |
| | | sf.setCateIds(cateIds); |
| | | data.put("result", gson2.toJson(re)); |
| | | data.put("count", result.getTaoBaoHead().getDocsfound()); |
| | | |
| | | if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(startprice)) { |
| | | sf.setStartPrice(new BigDecimal(startprice)); |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(endprice)) { |
| | | sf.setEndPrice(new BigDecimal(endprice)); |
| | | } |
| | | |
| | | if (com.yeshi.fanli.util.StringUtil.isNullOrEmpty(order)) { |
| | | // 默认销量从高到低排序 |
| | | sf.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW); |
| | | } else { |
| | | if (Integer.parseInt(order) == 1) { |
| | | sf.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW); |
| | | } else if (Integer.parseInt(order) == 2) { |
| | | sf.setSort(TaoBaoUtil.SORT_PRICE_HIGH_TO_LOW); |
| | | } else if (Integer.parseInt(order) == 3) { |
| | | sf.setSort(TaoBaoUtil.SORT_PRICE_LOW_TO_HIGH); |
| | | } |
| | | } |
| | | @Override |
| | | @Cacheable(value = "searchWuLiaoCache", key = "'searchWuLiaoList-'+#sf+'-'+system") |
| | | public List<TaoBaoGoodsBrief> searchWuLiaoList(SearchFilter sf, SystemEnum system) { |
| | | // 淘宝物料接口查询 |
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiaoNew(sf, null, null); |
| | | if (result == null) |
| | | return null; |
| | | |
| | | return result.getTaoBaoGoodsBriefs(); |
| | | } |
| | | |
| | | @Override |
| | | public JSONObject listByWuLiao(int page, String key, String cateIds, String filterParams, String order, |
| | | String startprice, String endprice, String searchParam, SystemEnum system) { |
| | | |
| | | SearchFilter sf = new SearchFilter(); |
| | | sf.setKey(key); |
| | | sf.setPage(page); |
| | | sf.setCateIds(cateIds); |
| | | |
| | | if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(startprice)) { |
| | | sf.setStartPrice(new BigDecimal(startprice)); |
| | | } |
| | | |
| | | if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(endprice)) { |
| | | sf.setEndPrice(new BigDecimal(endprice)); |
| | | } |
| | | |
| | | if (com.yeshi.fanli.util.StringUtil.isNullOrEmpty(order)) { |
| | | // 默认销量从高到低排序 |
| | | sf.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW); |
| | | } else { |
| | | if (Integer.parseInt(order) == 1) { |
| | | sf.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW); |
| | | } else if (Integer.parseInt(order) == 2) { |
| | | sf.setSort(TaoBaoUtil.SORT_PRICE_HIGH_TO_LOW); |
| | | } else if (Integer.parseInt(order) == 3) { |
| | | sf.setSort(TaoBaoUtil.SORT_PRICE_LOW_TO_HIGH); |
| | | } |
| | | } |
| | | |
| | | if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(filterParams)) { |
| | | if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(filterParams)) { |
| | | |
| | | Set<String> params = new HashSet<String>(); |
| | | Set<String> params = new HashSet<String>(); |
| | | |
| | | JSONArray array = JSONArray.fromObject(filterParams); |
| | | JSONArray array = JSONArray.fromObject(filterParams); |
| | | |
| | | for (int i = 0; i < array.size(); i++) { |
| | | for (int i = 0; i < array.size(); i++) { |
| | | |
| | | String type = array.optJSONObject(i).optString("type"); |
| | | String type = array.optJSONObject(i).optString("type"); |
| | | |
| | | switch (type) { |
| | | case "shoptype": |
| | | if (array.optJSONObject(i).optInt("id") == 21) { |
| | | sf.setTmFlagship(false); // 不筛�? |
| | | } else { |
| | | sf.setTmFlagship(true); |
| | | sf.setTmall(true); |
| | | sf.setShopTag("b2c"); |
| | | } |
| | | break; |
| | | switch (type) { |
| | | case "shoptype": |
| | | if (array.optJSONObject(i).optInt("id") == 21) { |
| | | sf.setTmFlagship(false); // 不筛�? |
| | | } else { |
| | | sf.setTmFlagship(true); |
| | | sf.setTmall(true); |
| | | sf.setShopTag("b2c"); |
| | | } |
| | | break; |
| | | |
| | | case "category": |
| | | sf.setCateIds(array.optJSONObject(i).optString("id")); |
| | | break; |
| | | case "category": |
| | | sf.setCateIds(array.optJSONObject(i).optString("id")); |
| | | break; |
| | | |
| | | case "userType": |
| | | sf.setCateIds(array.optJSONObject(i).optString("id")); |
| | | break; |
| | | case "userType": |
| | | sf.setCateIds(array.optJSONObject(i).optString("id")); |
| | | break; |
| | | |
| | | case "baoyou": |
| | | sf.setBaoYou(true); |
| | | break; |
| | | case "baoyou": |
| | | sf.setBaoYou(true); |
| | | break; |
| | | |
| | | case "quantype": |
| | | sf.setQuan(1); |
| | | if (sf.isTmFlagship()) { |
| | | sf.setShopTag(sf.getShopTag() + ",dpyhq"); |
| | | } else { |
| | | sf.setShopTag("dpyhq"); |
| | | } |
| | | break; |
| | | case "quantype": |
| | | sf.setQuan(1); |
| | | if (sf.isTmFlagship()) { |
| | | sf.setShopTag(sf.getShopTag() + ",dpyhq"); |
| | | } else { |
| | | sf.setShopTag("dpyhq"); |
| | | } |
| | | break; |
| | | |
| | | case "hongbaotype": |
| | | if (array.optJSONObject(i).optInt("id") == 41) { |
| | | sf.setHongbao(1); |
| | | } else { |
| | | sf.setHongbao(2); |
| | | } |
| | | break; |
| | | case "hongbaotype": |
| | | if (array.optJSONObject(i).optInt("id") == 41) { |
| | | sf.setHongbao(1); |
| | | } else { |
| | | sf.setHongbao(2); |
| | | } |
| | | break; |
| | | |
| | | case "property": |
| | | String pid = (String) array.optJSONObject(i).opt("pid"); |
| | | String id = (String) array.optJSONObject(i).opt("id"); |
| | | boolean flag = false; |
| | | String str = null; |
| | | for (String string : params) { |
| | | flag = string.contains(pid + ":"); |
| | | if (flag) { |
| | | str = string; |
| | | break; |
| | | } |
| | | } |
| | | if (flag) { |
| | | params.add(str + "," + id); |
| | | params.remove(str); |
| | | } else { |
| | | params.add(pid + ":" + id); |
| | | } |
| | | break; |
| | | case "property": |
| | | String pid = (String) array.optJSONObject(i).opt("pid"); |
| | | String id = (String) array.optJSONObject(i).opt("id"); |
| | | boolean flag = false; |
| | | String str = null; |
| | | for (String string : params) { |
| | | flag = string.contains(pid + ":"); |
| | | if (flag) { |
| | | str = string; |
| | | break; |
| | | } |
| | | } |
| | | if (flag) { |
| | | params.add(str + "," + id); |
| | | params.remove(str); |
| | | } else { |
| | | params.add(pid + ":" + id); |
| | | } |
| | | break; |
| | | |
| | | case "fahuodi": |
| | | int provinceId = array.optJSONObject(i).optInt("id"); |
| | | sf.setProvinceId(provinceId); |
| | | break; |
| | | case "fahuodi": |
| | | int provinceId = array.optJSONObject(i).optInt("id"); |
| | | sf.setProvinceId(provinceId); |
| | | break; |
| | | |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | sf.setParams(params); |
| | | } |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | sf.setParams(params); |
| | | } |
| | | |
| | | // 淘宝物料接口查询 |
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf,null,null); |
| | | // 淘宝物料接口查询 |
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiaoNew(sf, null, null); |
| | | |
| | | List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav(); |
| | | if (result.getNavList() != null) |
| | | navList.addAll(result.getNavList()); |
| | | List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav(); |
| | | if (result.getNavList() != null) |
| | | navList.addAll(result.getNavList()); |
| | | |
| | | Gson gson = new GsonBuilder().create(); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("nav", gson.toJson(navList)); |
| | | Gson gson = new GsonBuilder().create(); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("nav", gson.toJson(navList)); |
| | | |
| | | List<TaoBaoGoodsBriefExtra> re = new ArrayList<TaoBaoGoodsBriefExtra>(); |
| | | List<TaoBaoGoodsBrief> taoBaoGoodsBriefs = result.getTaoBaoGoodsBriefs(); |
| | | List<TaoBaoGoodsBriefExtra> re = new ArrayList<TaoBaoGoodsBriefExtra>(); |
| | | List<TaoBaoGoodsBrief> taoBaoGoodsBriefs = result.getTaoBaoGoodsBriefs(); |
| | | |
| | | int fq = sf.getQuan(); |
| | | int fh = sf.getHongbao(); |
| | | boolean ft = sf.isTmall(); |
| | | int fq = sf.getQuan(); |
| | | int fh = sf.getHongbao(); |
| | | boolean ft = sf.isTmall(); |
| | | |
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate(system); |
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate(system); |
| | | |
| | | if (fq == 0 && fh == 0 && !ft) { |
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null) |
| | | for (TaoBaoGoodsBrief bf : result.getTaoBaoGoodsBriefs()) { |
| | | int count = bf.getBiz30day(); |
| | | if (count >= 10000) { // 对销量数据做处理 页面展示7.3万 |
| | | double sales = count; |
| | | String salesCountMidea = String.format("%.1f", sales / 10000); |
| | | bf.setSalesCount(salesCountMidea + "万"); |
| | | re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion.toString(), "")); |
| | | } else { |
| | | bf.setSalesCount(count + ""); |
| | | re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion.toString(), "")); |
| | | } |
| | | } |
| | | } else { |
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra; |
| | | if (taoBaoGoodsBriefs != null) |
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) { |
| | | int count = taoBaoGoodsBrief.getBiz30day(); |
| | | if (count >= 10000) { |
| | | double sales = count; |
| | | String salesCountMidea = String.format("%.1f", sales / 10000); |
| | | taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万"); |
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, |
| | | proportion.toString(), ""); |
| | | re.add(taoBaoGoodsBriefExtra); |
| | | } else { |
| | | taoBaoGoodsBrief.setSalesCount(count + ""); |
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, |
| | | proportion.toString(), ""); |
| | | re.add(taoBaoGoodsBriefExtra); |
| | | } |
| | | } |
| | | } |
| | | if (fq == 0 && fh == 0 && !ft) { |
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null) |
| | | for (TaoBaoGoodsBrief bf : result.getTaoBaoGoodsBriefs()) { |
| | | int count = bf.getBiz30day(); |
| | | if (count >= 10000) { // 对销量数据做处理 页面展示7.3万 |
| | | double sales = count; |
| | | String salesCountMidea = String.format("%.1f", sales / 10000); |
| | | bf.setSalesCount(salesCountMidea + "万"); |
| | | re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion.toString(), "")); |
| | | } else { |
| | | bf.setSalesCount(count + ""); |
| | | re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion.toString(), "")); |
| | | } |
| | | } |
| | | } else { |
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra; |
| | | if (taoBaoGoodsBriefs != null) |
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) { |
| | | int count = taoBaoGoodsBrief.getBiz30day(); |
| | | if (count >= 10000) { |
| | | double sales = count; |
| | | String salesCountMidea = String.format("%.1f", sales / 10000); |
| | | taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万"); |
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, |
| | | proportion.toString(), ""); |
| | | re.add(taoBaoGoodsBriefExtra); |
| | | } else { |
| | | taoBaoGoodsBrief.setSalesCount(count + ""); |
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, |
| | | proportion.toString(), ""); |
| | | re.add(taoBaoGoodsBriefExtra); |
| | | } |
| | | } |
| | | } |
| | | |
| | | Gson gson2 = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) |
| | | .excludeFieldsWithoutExposeAnnotation().create(); |
| | | Gson gson2 = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) |
| | | .excludeFieldsWithoutExposeAnnotation().create(); |
| | | |
| | | data.put("result", gson2.toJson(re)); |
| | | data.put("count", result.getTaoBaoHead().getDocsfound()); |
| | | data.put("result", gson2.toJson(re)); |
| | | data.put("count", result.getTaoBaoHead().getDocsfound()); |
| | | |
| | | return data; |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | @Override |
| | | public void setSearchFilter(SearchFilter searchfilter, String filter, String order, String startprice, |
| | | String endprice, String fastFilter, Integer totalSales) { |
| | | @Override |
| | | public void setSearchFilter(SearchFilter searchfilter, String filter, String order, String startprice, |
| | | String endprice, String fastFilter, Integer totalSales) { |
| | | |
| | | if (!StringUtil.isNullOrEmpty(startprice)) { |
| | | searchfilter.setStartPrice(new BigDecimal(startprice)); |
| | | } |
| | | if (!StringUtil.isNullOrEmpty(startprice)) { |
| | | searchfilter.setStartPrice(new BigDecimal(startprice)); |
| | | } |
| | | |
| | | if (!StringUtil.isNullOrEmpty(endprice)) { |
| | | searchfilter.setEndPrice(new BigDecimal(endprice)); |
| | | } |
| | | if (!StringUtil.isNullOrEmpty(endprice)) { |
| | | searchfilter.setEndPrice(new BigDecimal(endprice)); |
| | | } |
| | | |
| | | if (totalSales != null) { |
| | | searchfilter.setStartBiz30day(totalSales + ""); |
| | | } |
| | | if (totalSales != null) { |
| | | searchfilter.setStartBiz30day(totalSales + ""); |
| | | } |
| | | |
| | | if (!StringUtil.isNullOrEmpty(fastFilter)) { |
| | | if (!StringUtil.isNullOrEmpty(filter)) { |
| | | JSONArray filterArray = JSONArray.fromObject(filter); |
| | | JSONArray fastFilterArray = JSONArray.fromObject(fastFilter); |
| | | filterArray.addAll(fastFilterArray); |
| | | filter = filterArray.toString(); |
| | | } else { |
| | | filter = fastFilter; |
| | | } |
| | | } |
| | | if (!StringUtil.isNullOrEmpty(fastFilter)) { |
| | | if (!StringUtil.isNullOrEmpty(filter)) { |
| | | JSONArray filterArray = JSONArray.fromObject(filter); |
| | | JSONArray fastFilterArray = JSONArray.fromObject(fastFilter); |
| | | filterArray.addAll(fastFilterArray); |
| | | filter = filterArray.toString(); |
| | | } else { |
| | | filter = fastFilter; |
| | | } |
| | | } |
| | | |
| | | if (!StringUtil.isNullOrEmpty(filter)) { |
| | | // 查询淘宝天猫 |
| | | JSONArray array = JSONArray.fromObject(filter); |
| | | for (int i = 0; i < array.size(); i++) { |
| | | String type = array.optJSONObject(i).optString("type"); |
| | | /* 含券 */ |
| | | if ("quantype".equalsIgnoreCase(type)) { |
| | | searchfilter.setQuan(1); |
| | | continue; |
| | | } |
| | | /* 搜索天猫 */ |
| | | if ("shoptype".equalsIgnoreCase(type)) { |
| | | searchfilter.setTmall(true); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | if (!StringUtil.isNullOrEmpty(filter)) { |
| | | // 查询淘宝天猫 |
| | | JSONArray array = JSONArray.fromObject(filter); |
| | | for (int i = 0; i < array.size(); i++) { |
| | | String type = array.optJSONObject(i).optString("type"); |
| | | /* 含券 */ |
| | | if ("quantype".equalsIgnoreCase(type)) { |
| | | searchfilter.setQuan(1); |
| | | continue; |
| | | } |
| | | /* 搜索天猫 */ |
| | | if ("shoptype".equalsIgnoreCase(type)) { |
| | | searchfilter.setTmall(true); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(order)) { |
| | | if (Integer.parseInt(order) == 1 || Integer.parseInt(order) == 0) { |
| | | searchfilter.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW); |
| | | } else if (Integer.parseInt(order) == 2) { |
| | | searchfilter.setSort(TaoBaoUtil.SORT_PRICE_HIGH_TO_LOW); |
| | | } else if (Integer.parseInt(order) == 3) { |
| | | searchfilter.setSort(TaoBaoUtil.SORT_PRICE_LOW_TO_HIGH); |
| | | } else if (Integer.parseInt(order) == 4) { |
| | | searchfilter.setSort(TaoBaoUtil.SORT_TOTAL_SALES_HIGH_TO_LOW); |
| | | } else if (Integer.parseInt(order) == 5) { |
| | | searchfilter.setSort(TaoBaoUtil.SORT_SALE_LOW_TO_HIGH); |
| | | } |
| | | } else { |
| | | searchfilter.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW); |
| | | } |
| | | if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(order)) { |
| | | if (Integer.parseInt(order) == 1 || Integer.parseInt(order) == 0) { |
| | | searchfilter.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW); |
| | | } else if (Integer.parseInt(order) == 2) { |
| | | searchfilter.setSort(TaoBaoUtil.SORT_PRICE_HIGH_TO_LOW); |
| | | } else if (Integer.parseInt(order) == 3) { |
| | | searchfilter.setSort(TaoBaoUtil.SORT_PRICE_LOW_TO_HIGH); |
| | | } else if (Integer.parseInt(order) == 4) { |
| | | searchfilter.setSort(TaoBaoUtil.SORT_TOTAL_SALES_HIGH_TO_LOW); |
| | | } else if (Integer.parseInt(order) == 5) { |
| | | searchfilter.setSort(TaoBaoUtil.SORT_SALE_LOW_TO_HIGH); |
| | | } |
| | | } else { |
| | | searchfilter.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Cacheable(value = "qualityCache", key = "'countByQuality-'+#start+'-'+#searchKey+'-'+#systemCid+'-'+#listLabId") |
| | | public List<QualityFactory> queryByQuality(long start, int count, String searchKey, Long systemCid, |
| | | List<Long> listLabId) { |
| | | @Override |
| | | @Cacheable(value = "qualityCache", key = "'countByQuality-'+#start+'-'+#searchKey+'-'+#systemCid+'-'+#listLabId") |
| | | public List<QualityFactory> queryByQuality(long start, int count, String searchKey, Long systemCid, |
| | | List<Long> listLabId) { |
| | | |
| | | /* 1、 精选库筛选 */ |
| | | List<QualityFactory> listQuality = null; |
| | | /* 1、 精选库筛选 */ |
| | | List<QualityFactory> listQuality = null; |
| | | |
| | | if (listLabId != null && listLabId.size() > 0) { |
| | | // 含标签 |
| | | listQuality = qualityGoodsService.listQueryByKeyAndlabIDs(start, count, searchKey, listLabId, null, |
| | | systemCid, null, null, null, null, null); |
| | | } else { |
| | | listQuality = qualityGoodsService.listQueryByKey(start, count, searchKey, null, systemCid, null, null, null, |
| | | null, null); |
| | | } |
| | | if (listLabId != null && listLabId.size() > 0) { |
| | | // 含标签 |
| | | listQuality = qualityGoodsService.listQueryByKeyAndlabIDs(start, count, searchKey, listLabId, null, |
| | | systemCid, null, null, null, null, null); |
| | | } else { |
| | | listQuality = qualityGoodsService.listQueryByKey(start, count, searchKey, null, systemCid, null, null, null, |
| | | null, null); |
| | | } |
| | | |
| | | return listQuality; |
| | | } |
| | | return listQuality; |
| | | } |
| | | |
| | | @Override |
| | | @Cacheable(value = "qualityCache", key = "'countByQuality-'+#searchKey+'-'+#systemCid+'-'+#listLabId") |
| | | public long countByQuality(String searchKey, Long systemCid, List<Long> listLabId) { |
| | | @Override |
| | | @Cacheable(value = "qualityCache", key = "'countByQuality-'+#searchKey+'-'+#systemCid+'-'+#listLabId") |
| | | public long countByQuality(String searchKey, Long systemCid, List<Long> listLabId) { |
| | | |
| | | long incount = 0; |
| | | long incount = 0; |
| | | |
| | | if (listLabId != null && listLabId.size() > 0) { |
| | | // 含标签 |
| | | incount = qualityGoodsService.countQueryKeyAndlabIDs(searchKey, listLabId, systemCid, null, null, null, |
| | | null, null); |
| | | } else { |
| | | incount = qualityGoodsService.countQueryByKey(searchKey, systemCid, null, null, null, null, null); |
| | | } |
| | | if (listLabId != null && listLabId.size() > 0) { |
| | | // 含标签 |
| | | incount = qualityGoodsService.countQueryKeyAndlabIDs(searchKey, listLabId, systemCid, null, null, null, |
| | | null, null); |
| | | } else { |
| | | incount = qualityGoodsService.countQueryByKey(searchKey, systemCid, null, null, null, null, null); |
| | | } |
| | | |
| | | return incount; |
| | | } |
| | | return incount; |
| | | } |
| | | |
| | | @Override |
| | | public JSONObject listQualityGoods(List<QualityFactory> listQuality, List<TaoBaoGoodsBrief> searchWuLiaoList, |
| | | Map<String, String> map,SystemEnum system) { |
| | | @Override |
| | | public JSONObject listQualityGoods(List<QualityFactory> listQuality, List<TaoBaoGoodsBrief> searchWuLiaoList, |
| | | Map<String, String> map, SystemEnum system) { |
| | | |
| | | JSONArray array = new JSONArray(); |
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) |
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create(); |
| | | JSONArray array = new JSONArray(); |
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) |
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create(); |
| | | |
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate(system); |
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate(system); |
| | | |
| | | /* 遍历列表数据 */ |
| | | for (QualityFactory selectionGoods : listQuality) { |
| | | /* 遍历列表数据 */ |
| | | for (QualityFactory selectionGoods : listQuality) { |
| | | |
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief(); |
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief(); |
| | | |
| | | if (taoBaoGoodsBrief == null) { |
| | | continue; |
| | | } |
| | | if (taoBaoGoodsBrief == null) { |
| | | continue; |
| | | } |
| | | |
| | | int biz30day = taoBaoGoodsBrief.getBiz30day(); |
| | | if (biz30day >= 10000) { |
| | | double sales = biz30day; |
| | | String salesCountMidea = String.format("%.1f", sales / 10000); |
| | | taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万"); |
| | | } else { |
| | | taoBaoGoodsBrief.setSalesCount(biz30day + ""); |
| | | } |
| | | int biz30day = taoBaoGoodsBrief.getBiz30day(); |
| | | if (biz30day >= 10000) { |
| | | double sales = biz30day; |
| | | String salesCountMidea = String.format("%.1f", sales / 10000); |
| | | taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万"); |
| | | } else { |
| | | taoBaoGoodsBrief.setSalesCount(biz30day + ""); |
| | | } |
| | | |
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null))); |
| | | } |
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null))); |
| | | } |
| | | |
| | | if (searchWuLiaoList != null && searchWuLiaoList.size() > 0) { |
| | | /* 遍历列表数据 */ |
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : searchWuLiaoList) { |
| | | if (searchWuLiaoList != null && searchWuLiaoList.size() > 0) { |
| | | /* 遍历列表数据 */ |
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : searchWuLiaoList) { |
| | | |
| | | int biz30day = taoBaoGoodsBrief.getBiz30day(); |
| | | int biz30day = taoBaoGoodsBrief.getBiz30day(); |
| | | |
| | | if (biz30day >= 10000) { |
| | | double sales = biz30day; |
| | | String salesCountMidea = String.format("%.1f", sales / 10000); |
| | | taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万"); |
| | | } else { |
| | | taoBaoGoodsBrief.setSalesCount(biz30day + ""); |
| | | } |
| | | if (biz30day >= 10000) { |
| | | double sales = biz30day; |
| | | String salesCountMidea = String.format("%.1f", sales / 10000); |
| | | taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万"); |
| | | } else { |
| | | taoBaoGoodsBrief.setSalesCount(biz30day + ""); |
| | | } |
| | | |
| | | array.add(gson |
| | | .toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null))); |
| | | } |
| | | } |
| | | array.add(gson |
| | | .toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null))); |
| | | } |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | JSONObject data = new JSONObject(); |
| | | |
| | | List<TaoBaoSearchNav> navList = new ArrayList<TaoBaoSearchNav>(); |
| | | Gson gsonBuilder = new GsonBuilder().create(); |
| | | data.put("nav", gsonBuilder.toJson(navList)); |
| | | data.put("count", 5000); |
| | | data.put("result", array); |
| | | List<TaoBaoSearchNav> navList = new ArrayList<TaoBaoSearchNav>(); |
| | | Gson gsonBuilder = new GsonBuilder().create(); |
| | | data.put("nav", gsonBuilder.toJson(navList)); |
| | | data.put("count", 5000); |
| | | data.put("result", array); |
| | | |
| | | return data; |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | } |