...
|
...
|
@@ -91,6 +91,10 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
|
|
|
public static final String SALE_CALENDAR_LIST_URL = "/yohosearch/ufo/saleCalendarProductList.json";
|
|
|
public static final String SALE_CALENDAR_COUNT_URL = "/yohosearch/ufo/SaleDateCountList.json";
|
|
|
|
|
|
public static final String NEW_SALE_CALENDAR_LIST_URL = "/yohosearch/ufo/saleCalendarNewProductList.json";
|
|
|
public static final String NEW_SALE_CALENDAR_COUNT_URL = "/yohosearch/ufo/saleDateNewCountList.json";
|
|
|
|
|
|
public static final String HOT_SALE_LIST_URL = "/yohosearch/ufo/hotSaleProductList.json";
|
|
|
|
|
|
public static final String PRODUCT_POOL_URL = "/yohosearch/ufo/pool/productList.json";
|
...
|
...
|
@@ -463,39 +467,47 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
|
|
|
@Override
|
|
|
public JSONObject getSaleCalendarCountData() {
|
|
|
JSONObject countMap = new JSONObject();
|
|
|
|
|
|
try {
|
|
|
SearchParam searchParam = new SearchParam();
|
|
|
String url = SALE_CALENDAR_COUNT_URL;
|
|
|
countMap = search(searchParam.getParam(), url).getJSONObject("sale_date_count_list");
|
|
|
} catch (Exception e) {
|
|
|
logger.error("调用销售日历汇总数据出错: " + e.getMessage(), e);
|
|
|
}
|
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
String ymd = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
|
|
jo.put("today", ymd);
|
|
|
JSONArray yearArray = new JSONArray();
|
|
|
int year = Integer.parseInt(ymd.substring(0, 4));
|
|
|
int month = Integer.parseInt(ymd.substring(5, 7));
|
|
|
for (int y = year - 1; y <= year + 1; y++) {
|
|
|
JSONObject yearData = new JSONObject();
|
|
|
JSONArray monthArray = new JSONArray();
|
|
|
for (int m = ((y == year - 1)? month:1); m <= ((y == year + 1)?month:12); m++) {
|
|
|
String ym = y + "-" + (m < 10 ? "0" + m : Integer.toString(m));
|
|
|
Integer count = countMap.getInteger(ym);
|
|
|
JSONObject ymData = new JSONObject();
|
|
|
ymData.put("month", m);
|
|
|
ymData.put("count", count == null ? Integer.valueOf(0) : count);
|
|
|
monthArray.add(ymData);
|
|
|
}
|
|
|
yearData.put(Integer.toString(y), monthArray);
|
|
|
yearArray.add(yearData);
|
|
|
}
|
|
|
jo.put("countData", yearArray);
|
|
|
return jo;
|
|
|
return getSaleCalendarCountData(SALE_CALENDAR_COUNT_URL);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public JSONObject getNewSaleCalendarCountData() {
|
|
|
return getSaleCalendarCountData(NEW_SALE_CALENDAR_COUNT_URL);
|
|
|
}
|
|
|
|
|
|
private JSONObject getSaleCalendarCountData(String url) {
|
|
|
JSONObject countMap = new JSONObject();
|
|
|
|
|
|
try {
|
|
|
SearchParam searchParam = new SearchParam();
|
|
|
countMap = search(searchParam.getParam(), url).getJSONObject("sale_date_count_list");
|
|
|
} catch (Exception e) {
|
|
|
logger.error("调用销售日历汇总数据出错: " + e.getMessage(), e);
|
|
|
}
|
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
String ymd = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
|
|
jo.put("today", ymd);
|
|
|
JSONArray yearArray = new JSONArray();
|
|
|
int year = Integer.parseInt(ymd.substring(0, 4));
|
|
|
int month = Integer.parseInt(ymd.substring(5, 7));
|
|
|
for (int y = year - 1; y <= year + 1; y++) {
|
|
|
JSONObject yearData = new JSONObject();
|
|
|
JSONArray monthArray = new JSONArray();
|
|
|
for (int m = ((y == year - 1)? month:1); m <= ((y == year + 1)?month:12); m++) {
|
|
|
String ym = y + "-" + (m < 10 ? "0" + m : Integer.toString(m));
|
|
|
Integer count = countMap.getInteger(ym);
|
|
|
JSONObject ymData = new JSONObject();
|
|
|
ymData.put("month", m);
|
|
|
ymData.put("count", count == null ? Integer.valueOf(0) : count);
|
|
|
monthArray.add(ymData);
|
|
|
}
|
|
|
yearData.put(Integer.toString(y), monthArray);
|
|
|
yearArray.add(yearData);
|
|
|
}
|
|
|
jo.put("countData", yearArray);
|
|
|
return jo;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@Cachable(expire=180)
|
...
|
...
|
@@ -511,6 +523,20 @@ public class ProductSearchServiceImpl implements ProductSearchService { |
|
|
return data;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@Cachable(expire=180)
|
|
|
public JSONObject searchNewSaleCalendar(Integer startTime, Integer endTime) {
|
|
|
ProductSearchReq req = new ProductSearchReq();
|
|
|
req.setStartTime(startTime).setEndTime(endTime);
|
|
|
SearchParam searchParam = new SearchParam().buildPageSearchParam(req);
|
|
|
JSONObject data = search(searchParam.getParam(), NEW_SALE_CALENDAR_LIST_URL);
|
|
|
// 将图片的相对路径转成绝对路径
|
|
|
if (null != data) {
|
|
|
processProductList(data.getJSONArray("product_list"));
|
|
|
}
|
|
|
return data;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public JSONObject searchHotSale(Integer page, Integer limit) {
|
|
|
ProductSearchReq req = new ProductSearchReq().setViewNum(limit).setPage(page);
|
...
|
...
|
|