|
@@ -85,19 +85,35 @@ public class SearchProductServiceImpl implements SearchProductService {
|
|
|
filter.append("p_brand:'").append(brandIds).append("'");
|
|
|
}
|
|
|
}
|
|
|
- if (newFlag == 1) {
|
|
|
-// p_time=20201105
|
|
|
- Calendar c = Calendar.getInstance();
|
|
|
- c.setTime(new Date());
|
|
|
- c.add(Calendar.YEAR, -1);
|
|
|
- String time = new SimpleDateFormat("yyyyMMdd").format(c.getTime());
|
|
|
- filter.append("p_time > ").append(time);
|
|
|
- }
|
|
|
- if (promotionFlag == 1) {
|
|
|
+ if (!StringUtils.isEmpty(brandIds)) {
|
|
|
if (newFlag == 1) {
|
|
|
- filter.append("AND p_promotions_id > 0");
|
|
|
- } else {
|
|
|
- filter.append("p_promotions_id > 0");
|
|
|
+ Calendar c = Calendar.getInstance();
|
|
|
+ c.setTime(new Date());
|
|
|
+ c.add(Calendar.YEAR, -1);
|
|
|
+ String time = new SimpleDateFormat("yyyyMMdd").format(c.getTime());
|
|
|
+ filter.append(" AND p_time > ").append(time);
|
|
|
+ }
|
|
|
+ if (promotionFlag == 1) {
|
|
|
+ if (newFlag == 1) {
|
|
|
+ filter.append(" AND p_promotions_id > 0");
|
|
|
+ } else {
|
|
|
+ filter.append("p_promotions_id > 0");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if (newFlag == 1) {
|
|
|
+ Calendar c = Calendar.getInstance();
|
|
|
+ c.setTime(new Date());
|
|
|
+ c.add(Calendar.YEAR, -1);
|
|
|
+ String time = new SimpleDateFormat("yyyyMMdd").format(c.getTime());
|
|
|
+ filter.append("p_time > ").append(time);
|
|
|
+ }
|
|
|
+ if (promotionFlag == 1) {
|
|
|
+ if (newFlag == 1) {
|
|
|
+ filter.append(" AND p_promotions_id > 0");
|
|
|
+ } else {
|
|
|
+ filter.append("p_promotions_id > 0");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
// 阿里云搜索
|
|
@@ -232,18 +248,35 @@ public class SearchProductServiceImpl implements SearchProductService {
|
|
|
filter.append("p_brand:'").append(brandIds).append("'");
|
|
|
}
|
|
|
}
|
|
|
- if (newFlag == 1) {
|
|
|
- Calendar c = Calendar.getInstance();
|
|
|
- c.setTime(new Date());
|
|
|
- c.add(Calendar.YEAR, -1);
|
|
|
- String time = new SimpleDateFormat("yyyyMMdd").format(c.getTime());
|
|
|
- filter.append("p_time > ").append(time);
|
|
|
- }
|
|
|
- if (promotionFlag == 1) {
|
|
|
+ if (!StringUtils.isEmpty(brandIds)) {
|
|
|
if (newFlag == 1) {
|
|
|
- filter.append("AND p_promotions_id > 0");
|
|
|
- } else {
|
|
|
- filter.append("p_promotions_id > 0");
|
|
|
+ Calendar c = Calendar.getInstance();
|
|
|
+ c.setTime(new Date());
|
|
|
+ c.add(Calendar.YEAR, -1);
|
|
|
+ String time = new SimpleDateFormat("yyyyMMdd").format(c.getTime());
|
|
|
+ filter.append(" AND p_time > ").append(time);
|
|
|
+ }
|
|
|
+ if (promotionFlag == 1) {
|
|
|
+ if (newFlag == 1) {
|
|
|
+ filter.append(" AND p_promotions_id > 0");
|
|
|
+ } else {
|
|
|
+ filter.append("p_promotions_id > 0");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if (newFlag == 1) {
|
|
|
+ Calendar c = Calendar.getInstance();
|
|
|
+ c.setTime(new Date());
|
|
|
+ c.add(Calendar.YEAR, -1);
|
|
|
+ String time = new SimpleDateFormat("yyyyMMdd").format(c.getTime());
|
|
|
+ filter.append("p_time > ").append(time);
|
|
|
+ }
|
|
|
+ if (promotionFlag == 1) {
|
|
|
+ if (newFlag == 1) {
|
|
|
+ filter.append(" AND p_promotions_id > 0");
|
|
|
+ } else {
|
|
|
+ filter.append("p_promotions_id > 0");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
SearchParams searchParams = searchOpenService.getScrollProductParams(queryStr, identity, requestPageSize, sortField, sortType);
|