Showing
3 changed files
with
59 additions
and
1 deletions
@@ -179,6 +179,36 @@ public class ProductSearchController { | @@ -179,6 +179,36 @@ public class ProductSearchController { | ||
179 | return new ApiResponse.ApiResponseBuilder().code(200).message("product.search.saleCalendar").data(timeJson).build(); | 179 | return new ApiResponse.ApiResponseBuilder().code(200).message("product.search.saleCalendar").data(timeJson).build(); |
180 | } | 180 | } |
181 | 181 | ||
182 | + @ApiOperation(name = "ufo.product.search.newSaleCalendar", desc="销售日历列表") | ||
183 | + @RequestMapping(params = "method=ufo.product.search.newSaleCalendar") | ||
184 | + @IgnoreSession | ||
185 | + public ApiResponse searchNewSaleCalendar(@RequestParam(value = "uid", required = false)Integer uid, | ||
186 | + @RequestParam(value = "start_time", required = false)String startTime, | ||
187 | + @RequestParam(value = "end_time", required = false)String endTime) { | ||
188 | + if (StringUtils.isBlank(startTime) || StringUtils.isBlank(endTime)) { | ||
189 | + return new ApiResponse.ApiResponseBuilder().code(400).message("参数错误!").data(null).build(); | ||
190 | + } | ||
191 | + LOG.info("in method=ufo.product.search.newSaleCalendar uid={}, start_time={}, end_time={}", uid, startTime, endTime); | ||
192 | + Integer start = getValidTimestamp(startTime, true); | ||
193 | + Integer end = getValidTimestamp(endTime, false); | ||
194 | + if (start == null || end == null) { | ||
195 | + return new ApiResponse.ApiResponseBuilder().code(400).message("参数错误!").data(null).build(); | ||
196 | + } | ||
197 | + JSONObject productJson = productSearchService.searchNewSaleCalendar(start, end); | ||
198 | + productSearchService.processUserFavoriteProductList(productJson, uid); | ||
199 | + return new ApiResponse.ApiResponseBuilder().code(200).message("product.search.newSaleCalendar").data(productJson).build(); | ||
200 | + } | ||
201 | + | ||
202 | + @ApiOperation(name = "ufo.product.search.newSaleCalendarCount", desc="销售日历列汇总数量") | ||
203 | + @RequestMapping(params = "method=ufo.product.search.newSaleCalendarCount") | ||
204 | + @IgnoreSession | ||
205 | + @Cachable(expire=180) | ||
206 | + public ApiResponse searchNewSaleCalendarCount() { | ||
207 | + LOG.info("in method=ufo.product.search.newSaleCalendarCount"); | ||
208 | + JSONObject timeJson = productSearchService.getNewSaleCalendarCountData(); | ||
209 | + return new ApiResponse.ApiResponseBuilder().code(200).message("product.search.newSaleCalendarCount").data(timeJson).build(); | ||
210 | + } | ||
211 | + | ||
182 | @IgnoreSignature | 212 | @IgnoreSignature |
183 | @ApiOperation(name = "ufo.product.search.hotSale", desc="热销列表") | 213 | @ApiOperation(name = "ufo.product.search.hotSale", desc="热销列表") |
184 | @RequestMapping(params = "method=ufo.product.search.hotSale") | 214 | @RequestMapping(params = "method=ufo.product.search.hotSale") |
@@ -28,12 +28,14 @@ public interface ProductSearchService { | @@ -28,12 +28,14 @@ public interface ProductSearchService { | ||
28 | List<ProductBrandSeriesResp> searchSeriesList(); | 28 | List<ProductBrandSeriesResp> searchSeriesList(); |
29 | 29 | ||
30 | JSONObject searchSaleCalendar(Integer startTime, Integer endTime); | 30 | JSONObject searchSaleCalendar(Integer startTime, Integer endTime); |
31 | + JSONObject searchNewSaleCalendar(Integer startTime, Integer endTime); | ||
31 | 32 | ||
32 | JSONObject searchHotSale(Integer page, Integer limit); | 33 | JSONObject searchHotSale(Integer page, Integer limit); |
33 | 34 | ||
34 | void processUserFavoriteProductList(JSONObject productJSON, Integer uid); | 35 | void processUserFavoriteProductList(JSONObject productJSON, Integer uid); |
35 | 36 | ||
36 | JSONObject getSaleCalendarCountData(); | 37 | JSONObject getSaleCalendarCountData(); |
38 | + JSONObject getNewSaleCalendarCountData(); | ||
37 | 39 | ||
38 | JSONObject searchUvscoreProductList(ProductSearchReq req); | 40 | JSONObject searchUvscoreProductList(ProductSearchReq req); |
39 | 41 |
@@ -91,6 +91,10 @@ public class ProductSearchServiceImpl implements ProductSearchService { | @@ -91,6 +91,10 @@ public class ProductSearchServiceImpl implements ProductSearchService { | ||
91 | 91 | ||
92 | public static final String SALE_CALENDAR_LIST_URL = "/yohosearch/ufo/saleCalendarProductList.json"; | 92 | public static final String SALE_CALENDAR_LIST_URL = "/yohosearch/ufo/saleCalendarProductList.json"; |
93 | public static final String SALE_CALENDAR_COUNT_URL = "/yohosearch/ufo/SaleDateCountList.json"; | 93 | public static final String SALE_CALENDAR_COUNT_URL = "/yohosearch/ufo/SaleDateCountList.json"; |
94 | + | ||
95 | + public static final String NEW_SALE_CALENDAR_LIST_URL = "/yohosearch/ufo/saleCalendarNewProductList.json"; | ||
96 | + public static final String NEW_SALE_CALENDAR_COUNT_URL = "/yohosearch/ufo/saleDateNewCountList.json"; | ||
97 | + | ||
94 | public static final String HOT_SALE_LIST_URL = "/yohosearch/ufo/hotSaleProductList.json"; | 98 | public static final String HOT_SALE_LIST_URL = "/yohosearch/ufo/hotSaleProductList.json"; |
95 | 99 | ||
96 | public static final String PRODUCT_POOL_URL = "/yohosearch/ufo/pool/productList.json"; | 100 | public static final String PRODUCT_POOL_URL = "/yohosearch/ufo/pool/productList.json"; |
@@ -463,11 +467,19 @@ public class ProductSearchServiceImpl implements ProductSearchService { | @@ -463,11 +467,19 @@ public class ProductSearchServiceImpl implements ProductSearchService { | ||
463 | 467 | ||
464 | @Override | 468 | @Override |
465 | public JSONObject getSaleCalendarCountData() { | 469 | public JSONObject getSaleCalendarCountData() { |
470 | + return getSaleCalendarCountData(SALE_CALENDAR_COUNT_URL); | ||
471 | + } | ||
472 | + | ||
473 | + @Override | ||
474 | + public JSONObject getNewSaleCalendarCountData() { | ||
475 | + return getSaleCalendarCountData(NEW_SALE_CALENDAR_COUNT_URL); | ||
476 | + } | ||
477 | + | ||
478 | + private JSONObject getSaleCalendarCountData(String url) { | ||
466 | JSONObject countMap = new JSONObject(); | 479 | JSONObject countMap = new JSONObject(); |
467 | 480 | ||
468 | try { | 481 | try { |
469 | SearchParam searchParam = new SearchParam(); | 482 | SearchParam searchParam = new SearchParam(); |
470 | - String url = SALE_CALENDAR_COUNT_URL; | ||
471 | countMap = search(searchParam.getParam(), url).getJSONObject("sale_date_count_list"); | 483 | countMap = search(searchParam.getParam(), url).getJSONObject("sale_date_count_list"); |
472 | } catch (Exception e) { | 484 | } catch (Exception e) { |
473 | logger.error("调用销售日历汇总数据出错: " + e.getMessage(), e); | 485 | logger.error("调用销售日历汇总数据出错: " + e.getMessage(), e); |
@@ -512,6 +524,20 @@ public class ProductSearchServiceImpl implements ProductSearchService { | @@ -512,6 +524,20 @@ public class ProductSearchServiceImpl implements ProductSearchService { | ||
512 | } | 524 | } |
513 | 525 | ||
514 | @Override | 526 | @Override |
527 | + @Cachable(expire=180) | ||
528 | + public JSONObject searchNewSaleCalendar(Integer startTime, Integer endTime) { | ||
529 | + ProductSearchReq req = new ProductSearchReq(); | ||
530 | + req.setStartTime(startTime).setEndTime(endTime); | ||
531 | + SearchParam searchParam = new SearchParam().buildPageSearchParam(req); | ||
532 | + JSONObject data = search(searchParam.getParam(), NEW_SALE_CALENDAR_LIST_URL); | ||
533 | + // 将图片的相对路径转成绝对路径 | ||
534 | + if (null != data) { | ||
535 | + processProductList(data.getJSONArray("product_list")); | ||
536 | + } | ||
537 | + return data; | ||
538 | + } | ||
539 | + | ||
540 | + @Override | ||
515 | public JSONObject searchHotSale(Integer page, Integer limit) { | 541 | public JSONObject searchHotSale(Integer page, Integer limit) { |
516 | ProductSearchReq req = new ProductSearchReq().setViewNum(limit).setPage(page); | 542 | ProductSearchReq req = new ProductSearchReq().setViewNum(limit).setPage(page); |
517 | SearchParam searchParam = new SearchParam().buildPageSearchParam(req); | 543 | SearchParam searchParam = new SearchParam().buildPageSearchParam(req); |
-
Please register or login to post a comment