|
@@ -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,39 +467,47 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
@@ -463,39 +467,47 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
463
|
|
467
|
|
464
|
@Override
|
468
|
@Override
|
465
|
public JSONObject getSaleCalendarCountData() {
|
469
|
public JSONObject getSaleCalendarCountData() {
|
466
|
- JSONObject countMap = new JSONObject();
|
|
|
467
|
-
|
|
|
468
|
- try {
|
|
|
469
|
- SearchParam searchParam = new SearchParam();
|
|
|
470
|
- String url = SALE_CALENDAR_COUNT_URL;
|
|
|
471
|
- countMap = search(searchParam.getParam(), url).getJSONObject("sale_date_count_list");
|
|
|
472
|
- } catch (Exception e) {
|
|
|
473
|
- logger.error("调用销售日历汇总数据出错: " + e.getMessage(), e);
|
|
|
474
|
- }
|
|
|
475
|
-
|
|
|
476
|
- JSONObject jo = new JSONObject();
|
|
|
477
|
- String ymd = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
|
|
478
|
- jo.put("today", ymd);
|
|
|
479
|
- JSONArray yearArray = new JSONArray();
|
|
|
480
|
- int year = Integer.parseInt(ymd.substring(0, 4));
|
|
|
481
|
- int month = Integer.parseInt(ymd.substring(5, 7));
|
|
|
482
|
- for (int y = year - 1; y <= year + 1; y++) {
|
|
|
483
|
- JSONObject yearData = new JSONObject();
|
|
|
484
|
- JSONArray monthArray = new JSONArray();
|
|
|
485
|
- for (int m = ((y == year - 1)? month:1); m <= ((y == year + 1)?month:12); m++) {
|
|
|
486
|
- String ym = y + "-" + (m < 10 ? "0" + m : Integer.toString(m));
|
|
|
487
|
- Integer count = countMap.getInteger(ym);
|
|
|
488
|
- JSONObject ymData = new JSONObject();
|
|
|
489
|
- ymData.put("month", m);
|
|
|
490
|
- ymData.put("count", count == null ? Integer.valueOf(0) : count);
|
|
|
491
|
- monthArray.add(ymData);
|
|
|
492
|
- }
|
|
|
493
|
- yearData.put(Integer.toString(y), monthArray);
|
|
|
494
|
- yearArray.add(yearData);
|
|
|
495
|
- }
|
|
|
496
|
- jo.put("countData", yearArray);
|
|
|
497
|
- return jo;
|
470
|
+ return getSaleCalendarCountData(SALE_CALENDAR_COUNT_URL);
|
498
|
}
|
471
|
}
|
|
|
472
|
+
|
|
|
473
|
+ @Override
|
|
|
474
|
+ public JSONObject getNewSaleCalendarCountData() {
|
|
|
475
|
+ return getSaleCalendarCountData(NEW_SALE_CALENDAR_COUNT_URL);
|
|
|
476
|
+ }
|
|
|
477
|
+
|
|
|
478
|
+ private JSONObject getSaleCalendarCountData(String url) {
|
|
|
479
|
+ JSONObject countMap = new JSONObject();
|
|
|
480
|
+
|
|
|
481
|
+ try {
|
|
|
482
|
+ SearchParam searchParam = new SearchParam();
|
|
|
483
|
+ countMap = search(searchParam.getParam(), url).getJSONObject("sale_date_count_list");
|
|
|
484
|
+ } catch (Exception e) {
|
|
|
485
|
+ logger.error("调用销售日历汇总数据出错: " + e.getMessage(), e);
|
|
|
486
|
+ }
|
|
|
487
|
+
|
|
|
488
|
+ JSONObject jo = new JSONObject();
|
|
|
489
|
+ String ymd = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
|
|
490
|
+ jo.put("today", ymd);
|
|
|
491
|
+ JSONArray yearArray = new JSONArray();
|
|
|
492
|
+ int year = Integer.parseInt(ymd.substring(0, 4));
|
|
|
493
|
+ int month = Integer.parseInt(ymd.substring(5, 7));
|
|
|
494
|
+ for (int y = year - 1; y <= year + 1; y++) {
|
|
|
495
|
+ JSONObject yearData = new JSONObject();
|
|
|
496
|
+ JSONArray monthArray = new JSONArray();
|
|
|
497
|
+ for (int m = ((y == year - 1)? month:1); m <= ((y == year + 1)?month:12); m++) {
|
|
|
498
|
+ String ym = y + "-" + (m < 10 ? "0" + m : Integer.toString(m));
|
|
|
499
|
+ Integer count = countMap.getInteger(ym);
|
|
|
500
|
+ JSONObject ymData = new JSONObject();
|
|
|
501
|
+ ymData.put("month", m);
|
|
|
502
|
+ ymData.put("count", count == null ? Integer.valueOf(0) : count);
|
|
|
503
|
+ monthArray.add(ymData);
|
|
|
504
|
+ }
|
|
|
505
|
+ yearData.put(Integer.toString(y), monthArray);
|
|
|
506
|
+ yearArray.add(yearData);
|
|
|
507
|
+ }
|
|
|
508
|
+ jo.put("countData", yearArray);
|
|
|
509
|
+ return jo;
|
|
|
510
|
+ }
|
499
|
|
511
|
|
500
|
@Override
|
512
|
@Override
|
501
|
@Cachable(expire=180)
|
513
|
@Cachable(expire=180)
|
|
@@ -511,6 +523,20 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
@@ -511,6 +523,20 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
511
|
return data;
|
523
|
return data;
|
512
|
}
|
524
|
}
|
513
|
|
525
|
|
|
|
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
|
+
|
514
|
@Override
|
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);
|