Authored by Lixiaodi

新销售日历

... ... @@ -179,6 +179,36 @@ public class ProductSearchController {
return new ApiResponse.ApiResponseBuilder().code(200).message("product.search.saleCalendar").data(timeJson).build();
}
@ApiOperation(name = "ufo.product.search.newSaleCalendar", desc="销售日历列表")
@RequestMapping(params = "method=ufo.product.search.newSaleCalendar")
@IgnoreSession
public ApiResponse searchNewSaleCalendar(@RequestParam(value = "uid", required = false)Integer uid,
@RequestParam(value = "start_time", required = false)String startTime,
@RequestParam(value = "end_time", required = false)String endTime) {
if (StringUtils.isBlank(startTime) || StringUtils.isBlank(endTime)) {
return new ApiResponse.ApiResponseBuilder().code(400).message("参数错误!").data(null).build();
}
LOG.info("in method=ufo.product.search.newSaleCalendar uid={}, start_time={}, end_time={}", uid, startTime, endTime);
Integer start = getValidTimestamp(startTime, true);
Integer end = getValidTimestamp(endTime, false);
if (start == null || end == null) {
return new ApiResponse.ApiResponseBuilder().code(400).message("参数错误!").data(null).build();
}
JSONObject productJson = productSearchService.searchNewSaleCalendar(start, end);
productSearchService.processUserFavoriteProductList(productJson, uid);
return new ApiResponse.ApiResponseBuilder().code(200).message("product.search.newSaleCalendar").data(productJson).build();
}
@ApiOperation(name = "ufo.product.search.newSaleCalendarCount", desc="销售日历列汇总数量")
@RequestMapping(params = "method=ufo.product.search.newSaleCalendarCount")
@IgnoreSession
@Cachable(expire=180)
public ApiResponse searchNewSaleCalendarCount() {
LOG.info("in method=ufo.product.search.newSaleCalendarCount");
JSONObject timeJson = productSearchService.getNewSaleCalendarCountData();
return new ApiResponse.ApiResponseBuilder().code(200).message("product.search.newSaleCalendarCount").data(timeJson).build();
}
@IgnoreSignature
@ApiOperation(name = "ufo.product.search.hotSale", desc="热销列表")
@RequestMapping(params = "method=ufo.product.search.hotSale")
... ...
... ... @@ -28,12 +28,14 @@ public interface ProductSearchService {
List<ProductBrandSeriesResp> searchSeriesList();
JSONObject searchSaleCalendar(Integer startTime, Integer endTime);
JSONObject searchNewSaleCalendar(Integer startTime, Integer endTime);
JSONObject searchHotSale(Integer page, Integer limit);
void processUserFavoriteProductList(JSONObject productJSON, Integer uid);
JSONObject getSaleCalendarCountData();
JSONObject getNewSaleCalendarCountData();
JSONObject searchUvscoreProductList(ProductSearchReq req);
... ...
... ... @@ -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,11 +467,19 @@ public class ProductSearchServiceImpl implements ProductSearchService {
@Override
public JSONObject getSaleCalendarCountData() {
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();
String url = SALE_CALENDAR_COUNT_URL;
countMap = search(searchParam.getParam(), url).getJSONObject("sale_date_count_list");
} catch (Exception e) {
logger.error("调用销售日历汇总数据出错: " + e.getMessage(), e);
... ... @@ -512,6 +524,20 @@ public class ProductSearchServiceImpl implements ProductSearchService {
}
@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);
SearchParam searchParam = new SearchParam().buildPageSearchParam(req);
... ...