From 81082e03207761edff6b317df8268dc3f968c20a Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期日, 05 五月 2019 12:35:29 +0800 Subject: [PATCH] 淘宝后台搜索增加分类ID填写 --- fanli/src/main/java/com/yeshi/fanli/controller/admin/TaoBaoGoodsBriefAdminController.java | 64 +++++++++++++++++--------------- 1 files changed, 34 insertions(+), 30 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/admin/TaoBaoGoodsBriefAdminController.java b/fanli/src/main/java/com/yeshi/fanli/controller/admin/TaoBaoGoodsBriefAdminController.java index 45cbf2a..c38b880 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/admin/TaoBaoGoodsBriefAdminController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/admin/TaoBaoGoodsBriefAdminController.java @@ -51,7 +51,7 @@ @Resource private QualityFactoryService qualityFactoryService; - + @Resource private TaoBaoUnionConfigService taoBaoUnionConfigService; @@ -62,7 +62,6 @@ @Resource private TaoBaoClassService taoBaoClassService; - /** * @@ -86,26 +85,26 @@ 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) { @@ -218,9 +217,10 @@ } } - + /** - * 鍔犲叆绮鹃�夊簱鍟嗗搧 + * 鍔犲叆绮鹃�夊簱鍟嗗搧 + * * @param callback * @param pageIndex * @param key @@ -252,39 +252,40 @@ } 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("璇烽�夋嫨姝g‘鐨勫晢鍝佸叆搴�"))); 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) { @@ -292,11 +293,11 @@ } } } - + AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN); // 鎻掑叆绮鹃�夊簱 qualityFactoryService.addBatchTaoBaoGoods(listAddGoods, lableNames, admin); - + JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("鍔犲叆鎴愬姛")); } catch (Exception e) { @@ -308,6 +309,7 @@ /** * 鏍规嵁鏉′欢娣樺疂鍟嗗搧鏌ヨ + * * @param pageIndex * @param pageSize * @param key @@ -332,7 +334,7 @@ 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(); @@ -347,8 +349,8 @@ GoodsClass rb = goodsClassService.getGoodsClass(tbClassId); if (rb == null) { throw new Exception("璇ョ被鍨嬪凡涓嶅瓨鍦�,璇峰埛鏂伴噸璇�"); - } - + } + // 娣樺疂绫荤洰id String taoBaoCatIds = taoBaoClassService.getTaoBaoCatIds(tbClassId); if (StringUtil.isNullOrEmpty(taoBaoCatIds)) { @@ -357,6 +359,8 @@ filter.setCateIds(taoBaoCatIds); } } + if (!StringUtil.isNullOrEmpty(cids)) + filter.setCateIds(cids); // 鏌ヨ鏉′欢鍜岀被鐩甶d涓嶈兘鍚屾椂涓虹┖ if (StringUtil.isNullOrEmpty(key) && tbClassId == null) { @@ -380,7 +384,8 @@ int tkRate = (int) (Float.parseFloat(endTkRate) * 100); filter.setEndTkRate(tkRate); } - // 鎺掑簭瀛楁 閿�閲忥紙total_sales锛夋窐瀹剑閲戞瘮鐜囷紙tk_rate锛夌疮璁℃帹骞块噺锛坱k_total_sales锛夋�绘敮鍑轰剑閲戯紙tk_total_commi锛� + // 鎺掑簭瀛楁 + // 閿�閲忥紙total_sales锛夋窐瀹剑閲戞瘮鐜囷紙tk_rate锛夌疮璁℃帹骞块噺锛坱k_total_sales锛夋�绘敮鍑轰剑閲戯紙tk_total_commi锛� if (sort != null) { filter.setSort(sort); } @@ -426,8 +431,7 @@ if (npxLevel != null && npxLevel > 0 && npxLevel < 4) { filter.setNpxLevel(npxLevel); } - - + boolean islink = false; Long auctionId = null; /* 鍒ゆ柇鏄惁鏄晢鍝侀摼鎺ユ悳绱� */ -- Gitblit v1.8.0