| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | 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;
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchNav;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoShopInfo;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | 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;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Service
|
| | | public class TaoKeGoodsServiceImpl implements TaoKeGoodsService {
|
| | |
|
| | | @Resource
|
| | | private HongBaoManageService manageService;
|
| | | private HongBaoManageService hongBaoManageService;
|
| | | |
| | | @Resource
|
| | | private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoShopService taoBaoShopService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private QualityGoodsService qualityGoodsService;
|
| | | |
| | |
|
| | | @Cacheable(value = "taoKeMaterialCache", key = "'listByMaterial-'+#materialId +'-'+#pageIndex")
|
| | | @Override
|
| | |
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | Map<String, String> map = manageService.convertMap();
|
| | | String proportion = map.get("hongbao_goods_proportion");
|
| | | String fcRate = map.get("hongbao_fc_ratio");
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | |
|
| | | listGoods.parallelStream().forEach(taoBaoGoodsBrief -> {
|
| | |
|
| | |
| | | taoBaoGoodsBrief.setPictUrl(TbImgUtil.getTBSize320Img(pictUrl));
|
| | | }
|
| | |
|
| | | arrayGoods
|
| | | .add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion, fcRate, null)));
|
| | | arrayGoods.add(
|
| | | gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
|
| | |
|
| | | });
|
| | |
|
| | |
| | | int fh = sf.getHongbao();
|
| | | boolean ft = sf.isTmall();
|
| | |
|
| | | Map<String, String> map = manageService.convertMap();
|
| | | String proportion = map.get("hongbao_goods_proportion");
|
| | | String fcRate = map.get("hongbao_fc_ratio");
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | |
|
| | | if (fq == 0 && fh == 0 && !ft) {
|
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null)
|
| | |
| | | if (!StringUtil.isNullOrEmpty(startBiz30day)) {
|
| | | int biz30day = Integer.parseInt(startBiz30day);
|
| | | if (count < biz30day) {
|
| | | break;
|
| | | continue;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | double sales = count;
|
| | | String salesCountMidea = String.format("%.1f", sales / 10000);
|
| | | bf.setSalesCount(salesCountMidea + "万");
|
| | | re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion, fcRate, ""));
|
| | | re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion.toString(), ""));
|
| | | } else {
|
| | | bf.setSalesCount(count + "");
|
| | | re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion, fcRate, ""));
|
| | | re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion.toString(), ""));
|
| | | }
|
| | | }
|
| | | } else {
|
| | |
| | | double sales = count;
|
| | | String salesCountMidea = String.format("%.1f", sales / 10000);
|
| | | taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
|
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion,
|
| | | fcRate, "");
|
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
|
| | | proportion.toString(), "");
|
| | | re.add(taoBaoGoodsBriefExtra);
|
| | | } else {
|
| | | taoBaoGoodsBrief.setSalesCount(count + "");
|
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion,
|
| | | fcRate, "");
|
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
|
| | | proportion.toString(), "");
|
| | | re.add(taoBaoGoodsBriefExtra);
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | return data;
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | @Cacheable(value = "searchWuLiaoCache", key = "'searchWuLiaoV2-'+#sf+'-'+#platform+'-'+#version")
|
| | | public JSONObject searchWuLiaoV2(SearchFilter sf,String platform,String version) {
|
| | |
|
| | | // 淘宝物料接口查询
|
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf);
|
| | |
|
| | | 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));
|
| | |
|
| | | List<GoodsDetailVO> re = new ArrayList<GoodsDetailVO>();
|
| | | List<TaoBaoGoodsBrief> taoBaoGoodsBriefs = result.getTaoBaoGoodsBriefs();
|
| | |
|
| | | int fq = sf.getQuan();
|
| | | int fh = sf.getHongbao();
|
| | | boolean ft = sf.isTmall();
|
| | |
|
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(platform, version);
|
| | |
|
| | | if (fq == 0 && fh == 0 && !ft) {
|
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null)
|
| | | for (TaoBaoGoodsBrief bf : result.getTaoBaoGoodsBriefs()) {
|
| | | int count = bf.getBiz30day();
|
| | |
|
| | | String startBiz30day = sf.getStartBiz30day();
|
| | | if (!StringUtil.isNullOrEmpty(startBiz30day)) {
|
| | | int biz30day = Integer.parseInt(startBiz30day);
|
| | | if (count < biz30day) {
|
| | | continue;
|
| | | }
|
| | | }
|
| | |
|
| | | GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(bf, paramsDTO);
|
| | | re.add(goodsDetailVO);
|
| | | }
|
| | | } else {
|
| | | if (taoBaoGoodsBriefs != null)
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) {
|
| | |
|
| | | 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);
|
| | | }
|
| | | }
|
| | |
|
| | | Gson gson2 = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().create();
|
| | |
|
| | | data.put("result", gson2.toJson(re));
|
| | | data.put("count", result.getTaoBaoHead().getDocsfound());
|
| | |
|
| | | return data;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | @Cacheable(value = "searchWuLiaoCache", key = "'searchWuLiaoList-'+#sf")
|
| | |
| | |
|
| | | return result.getTaoBaoGoodsBriefs();
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public JSONObject listByWuLiao(int page, String key, String cateIds, String filterParams, String order,
|
| | | String startprice, String endprice, String searchParam) {
|
| | |
| | | int fh = sf.getHongbao();
|
| | | boolean ft = sf.isTmall();
|
| | |
|
| | | Map<String, String> map = manageService.convertMap();
|
| | | String proportion = map.get("hongbao_goods_proportion");
|
| | | String fcRate = map.get("hongbao_fc_ratio");
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | |
|
| | | if (fq == 0 && fh == 0 && !ft) {
|
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null)
|
| | |
| | | double sales = count;
|
| | | String salesCountMidea = String.format("%.1f", sales / 10000);
|
| | | bf.setSalesCount(salesCountMidea + "万");
|
| | | re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion, fcRate, ""));
|
| | | re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion.toString(), ""));
|
| | | } else {
|
| | | bf.setSalesCount(count + "");
|
| | | re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion, fcRate, ""));
|
| | | re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion.toString(), ""));
|
| | | }
|
| | | }
|
| | | } else {
|
| | |
| | | double sales = count;
|
| | | String salesCountMidea = String.format("%.1f", sales / 10000);
|
| | | taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
|
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion,
|
| | | fcRate, "");
|
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
|
| | | proportion.toString(), "");
|
| | | re.add(taoBaoGoodsBriefExtra);
|
| | | } else {
|
| | | taoBaoGoodsBrief.setSalesCount(count + "");
|
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion,
|
| | | fcRate, "");
|
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
|
| | | proportion.toString(), "");
|
| | | re.add(taoBaoGoodsBriefExtra);
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | 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 (!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 {
|
| | | 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,
|
| | | @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;
|
| | | |
| | |
|
| | | 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,
|
| | | 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;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | @Cacheable(value = "qualityCache",key="'countByQuality-'+#searchKey+'-'+#systemCid+'-'+#listLabId")
|
| | | @Cacheable(value = "qualityCache", key = "'countByQuality-'+#searchKey+'-'+#systemCid+'-'+#listLabId")
|
| | | public long countByQuality(String searchKey, Long systemCid, List<Long> listLabId) {
|
| | | |
| | |
|
| | | long incount = 0;
|
| | | |
| | |
|
| | | if (listLabId != null && listLabId.size() > 0) {
|
| | | // 含标签
|
| | | incount = qualityGoodsService.countQueryKeyAndlabIDs(searchKey, listLabId, systemCid, |
| | | null, null, null, null, null);
|
| | | incount = qualityGoodsService.countQueryKeyAndlabIDs(searchKey, listLabId, systemCid, null, null, null,
|
| | | null, null);
|
| | | } else {
|
| | | incount = qualityGoodsService.countQueryByKey(searchKey, systemCid, null, null, null, null, null);
|
| | | }
|
| | | |
| | |
|
| | | return incount;
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | @Override
|
| | | public JSONObject listQualityGoods(List<QualityFactory> listQuality, List<TaoBaoGoodsBrief> searchWuLiaoList, |
| | | Map<String, String> map ) {
|
| | | |
| | | public JSONObject listQualityGoods(List<QualityFactory> listQuality, List<TaoBaoGoodsBrief> searchWuLiaoList,
|
| | | Map<String, String> map) {
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | |
| | | String proportion = map.get("hongbao_goods_proportion");
|
| | | String fcRate = map.get("hongbao_fc_ratio");
|
| | |
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | |
|
| | | /* 遍历列表数据 */
|
| | | for (QualityFactory selectionGoods : listQuality) {
|
| | |
| | | taoBaoGoodsBrief.setSalesCount(biz30day + "");
|
| | | }
|
| | |
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion, fcRate, null)));
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
|
| | | }
|
| | |
|
| | | if (searchWuLiaoList != null && searchWuLiaoList.size() > 0) {
|
| | |
| | | }
|
| | |
|
| | | array.add(gson
|
| | | .toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion, fcRate, null)));
|
| | | .toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | data.put("nav", gsonBuilder.toJson(navList));
|
| | | data.put("count", 5000);
|
| | | data.put("result", array);
|
| | | |
| | |
|
| | | return data;
|
| | | }
|
| | | |
| | |
|
| | | }
|