| | |
| | |
|
| | | @Resource
|
| | | private QualityFactoryService qualityFactoryService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private TaoBaoUnionConfigService taoBaoUnionConfigService;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoClassService taoBaoClassService;
|
| | |
|
| | |
|
| | | /**
|
| | | *
|
| | |
| | | public void queryOnSale(String callback, Integer pageIndex, Integer pageSize, String key, Long tbClassId,
|
| | | Integer startPrice, Integer endPrice, String startTkRate, String endTkRate, Integer sort, Integer istmall,
|
| | | Integer hasCoupon, Integer baoYou, Integer startDsr, Integer overseas, Integer needPrepay,
|
| | | Integer includePayRate30, Integer includeGoodRate, Integer includeRfdRate, Integer npxLevel,
|
| | | Integer includePayRate30, Integer includeGoodRate, Integer includeRfdRate, Integer npxLevel, String cid,
|
| | | PrintWriter out) {
|
| | |
|
| | | try {
|
| | | // 查询物料
|
| | | TaoBaoSearchResult result = getGoodsByWuLiao(pageIndex, pageSize, key, tbClassId, startPrice, endPrice, startTkRate, endTkRate, sort,
|
| | | istmall, hasCoupon, baoYou, startDsr, overseas, needPrepay, includePayRate30, includeGoodRate, |
| | | includeRfdRate, npxLevel);
|
| | | |
| | | TaoBaoSearchResult result = getGoodsByWuLiao(pageIndex, pageSize, key, tbClassId, startPrice, endPrice,
|
| | | startTkRate, endTkRate, sort, istmall, hasCoupon, baoYou, startDsr, overseas, needPrepay,
|
| | | includePayRate30, includeGoodRate, includeRfdRate, npxLevel,cid);
|
| | |
|
| | | if (result == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未获取到淘宝商品信息"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | List<TaoBaoGoodsBrief> listTaoBaoGoods = result.getTaoBaoGoodsBriefs();
|
| | | if (listTaoBaoGoods == null || listTaoBaoGoods.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未查询到淘宝商品信息"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | // 插入商品集合
|
| | | List<Long> listAuctionId = new ArrayList<Long>();
|
| | | for (TaoBaoGoodsBrief goodsBrief : listTaoBaoGoods) {
|
| | |
| | | }
|
| | |
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 加入精选库商品
|
| | | * 加入精选库商品
|
| | | * |
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param key
|
| | |
| | | }
|
| | |
|
| | | Gson gson2 = new Gson();
|
| | | List<Long> listTaoBaoId = gson2.fromJson(auctionIds, new TypeToken<ArrayList<Long>>() {}.getType());
|
| | | List<Long> listTaoBaoId = gson2.fromJson(auctionIds, new TypeToken<ArrayList<Long>>() {
|
| | | }.getType());
|
| | | if (listTaoBaoId == null || listTaoBaoId.size() == 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请选择正确的商品入库")));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | // 查询物料
|
| | | TaoBaoSearchResult result = getGoodsByWuLiao(pageIndex, pageSize, key, tbClassId, startPrice, endPrice, startTkRate, endTkRate, sort,
|
| | | istmall, hasCoupon, baoYou, startDsr, overseas, needPrepay, includePayRate30, includeGoodRate, |
| | | includeRfdRate, npxLevel);
|
| | | |
| | | TaoBaoSearchResult result = getGoodsByWuLiao(pageIndex, pageSize, key, tbClassId, startPrice, endPrice,
|
| | | startTkRate, endTkRate, sort, istmall, hasCoupon, baoYou, startDsr, overseas, needPrepay,
|
| | | includePayRate30, includeGoodRate, includeRfdRate, npxLevel,null);
|
| | |
|
| | | if (result == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未获取到淘宝商品信息"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | List<TaoBaoGoodsBrief> listTaoBaoGoods = result.getTaoBaoGoodsBriefs();
|
| | | if (listTaoBaoGoods == null || listTaoBaoGoods.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未查询到淘宝商品信息"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | List<TaoBaoGoodsBrief> listAddGoods = new ArrayList<TaoBaoGoodsBrief>();
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief: listTaoBaoGoods) {
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : listTaoBaoGoods) {
|
| | | Long auctionId = taoBaoGoodsBrief.getAuctionId();
|
| | | if (listTaoBaoId.contains(auctionId)) {
|
| | | listAddGoods.add(taoBaoGoodsBrief);
|
| | | listTaoBaoId.remove(auctionId);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | if (listTaoBaoId != null && listTaoBaoId.size() > 0) {
|
| | | for (Long auctionId: listTaoBaoId) {
|
| | | for (Long auctionId : listTaoBaoId) {
|
| | | /* 根据auctionId 获取淘宝商品 */
|
| | | TaoBaoGoodsBrief goodsBrief = TaoKeApiUtil.searchGoodsDetail(auctionId);
|
| | | if (goodsBrief != null) {
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
|
| | | // 插入精选库
|
| | | qualityFactoryService.addBatchTaoBaoGoods(listAddGoods, lableNames, admin);
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("加入成功"));
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, e.getMessage()));
|
| | |
| | |
|
| | | /**
|
| | | * 根据条件淘宝商品查询
|
| | | * |
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | | * @param key
|
| | |
| | | public TaoBaoSearchResult getGoodsByWuLiao(Integer pageIndex, Integer pageSize, String key, Long tbClassId,
|
| | | Integer startPrice, Integer endPrice, String startTkRate, String endTkRate, Integer sort, Integer istmall,
|
| | | Integer hasCoupon, Integer baoYou, Integer startDsr, Integer overseas, Integer needPrepay,
|
| | | Integer includePayRate30, Integer includeGoodRate, Integer includeRfdRate, Integer npxLevel)
|
| | | Integer includePayRate30, Integer includeGoodRate, Integer includeRfdRate, Integer npxLevel, String cids)
|
| | | throws Exception {
|
| | |
|
| | | SearchFilter filter = new SearchFilter();
|
| | |
| | | GoodsClass rb = goodsClassService.getGoodsClass(tbClassId);
|
| | | if (rb == null) {
|
| | | throw new Exception("该类型已不存在,请刷新重试");
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | // 淘宝类目id
|
| | | String taoBaoCatIds = taoBaoClassService.getTaoBaoCatIds(tbClassId);
|
| | | if (StringUtil.isNullOrEmpty(taoBaoCatIds)) {
|
| | |
| | | filter.setCateIds(taoBaoCatIds);
|
| | | }
|
| | | }
|
| | | if (!StringUtil.isNullOrEmpty(cids))
|
| | | filter.setCateIds(cids);
|
| | |
|
| | | // 查询条件和类目id不能同时为空
|
| | | if (StringUtil.isNullOrEmpty(key) && tbClassId == null) {
|
| | |
| | | int tkRate = (int) (Float.parseFloat(endTkRate) * 100);
|
| | | filter.setEndTkRate(tkRate);
|
| | | }
|
| | | // 排序字段 销量(total_sales)淘客佣金比率(tk_rate)累计推广量(tk_total_sales)总支出佣金(tk_total_commi)
|
| | | // 排序字段
|
| | | // 销量(total_sales)淘客佣金比率(tk_rate)累计推广量(tk_total_sales)总支出佣金(tk_total_commi)
|
| | | if (sort != null) {
|
| | | filter.setSort(sort);
|
| | | }
|
| | |
| | | if (npxLevel != null && npxLevel > 0 && npxLevel < 4) {
|
| | | filter.setNpxLevel(npxLevel);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | boolean islink = false;
|
| | | Long auctionId = null;
|
| | | /* 判断是否是商品链接搜索 */
|