Subversion Repositories SmartDukaan

Rev

Rev 24875 | Rev 24947 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 24875 Rev 24946
Line 7... Line 7...
7
import java.util.Iterator;
7
import java.util.Iterator;
8
import java.util.List;
8
import java.util.List;
9
import java.util.Map;
9
import java.util.Map;
10
import java.util.stream.Collectors;
10
import java.util.stream.Collectors;
11
 
11
 
-
 
12
import javax.mail.search.SearchTerm;
12
import javax.servlet.http.HttpServletRequest;
13
import javax.servlet.http.HttpServletRequest;
13
 
14
 
14
import org.apache.commons.lang3.StringUtils;
15
import org.apache.commons.lang3.StringUtils;
15
import org.apache.http.conn.HttpHostConnectException;
16
import org.apache.http.conn.HttpHostConnectException;
16
import org.apache.logging.log4j.LogManager;
17
import org.apache.logging.log4j.LogManager;
Line 185... Line 186...
185
			@RequestParam(value = "categoryId", required = false, defaultValue = "(3 OR 6)") String categoryId,
186
			@RequestParam(value = "categoryId", required = false, defaultValue = "(3 OR 6)") String categoryId,
186
			@RequestParam(value = "offset") String offset, @RequestParam(value = "limit") String limit,
187
			@RequestParam(value = "offset") String offset, @RequestParam(value = "limit") String limit,
187
			@RequestParam(value = "sort", required = false) String sort,
188
			@RequestParam(value = "sort", required = false) String sort,
188
			@RequestParam(value = "brand", required = false) String brand,
189
			@RequestParam(value = "brand", required = false) String brand,
189
			@RequestParam(value = "subCategoryId", required = false) String subCategoryId,
190
			@RequestParam(value = "subCategoryId", required = false) String subCategoryId,
-
 
191
			@RequestParam(value = "q", required = false) String queryTerm,
190
			@RequestParam(value = "hotDeal", required = false) boolean hotDeal) throws Throwable {
192
			@RequestParam(value = "hotDeal", required = false) boolean hotDeal) throws Throwable {
191
		List<FofoCatalogResponse> dealResponse = new ArrayList<>();
193
		List<FofoCatalogResponse> dealResponse = new ArrayList<>();
192
		UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
194
		UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
193
		if (roleManagerService.isPartner(userInfo.getRoleIds())) {
195
		if (roleManagerService.isPartner(userInfo.getRoleIds())) {
194
			UserCart uc = userAccountRepository.getUserCart(userInfo.getUserId());
196
			UserCart uc = userAccountRepository.getUserCart(userInfo.getUserId());
Line 203... Line 205...
203
								categoryId, brand, brand, StringUtils.join(tagIds, " ")));
205
								categoryId, brand, brand, StringUtils.join(tagIds, " ")));
204
			} else if (subCategoryId != null) {
206
			} else if (subCategoryId != null) {
205
				mandatoryQ.add(
207
				mandatoryQ.add(
206
						String.format("+(subCategoryId_i:%s) +{!parent which=\"subCategoryId_i:%s\"} tagId_i:(%s)",
208
						String.format("+(subCategoryId_i:%s) +{!parent which=\"subCategoryId_i:%s\"} tagId_i:(%s)",
207
								subCategoryId, subCategoryId, StringUtils.join(tagIds, " ")));
209
								subCategoryId, subCategoryId, StringUtils.join(tagIds, " ")));
-
 
210
			} else if (queryTerm != null) {
-
 
211
				mandatoryQ.add(
-
 
212
						String.format("+(*:%s) +{!parent which=\"*:%s\"} tagId_i:(%s)",
-
 
213
								queryTerm, queryTerm, StringUtils.join(tagIds, " ")));
208
			} else if (hotDeal) {
214
			} else if (hotDeal) {
209
				mandatoryQ.add(String.format("+{!parent which=\"hot_deals_b=true\"} tagId_i:(%s)",
215
				mandatoryQ.add(String.format("+{!parent which=\"hot_deals_b=true\"} tagId_i:(%s)",
210
						StringUtils.join(tagIds, " ")));
216
						StringUtils.join(tagIds, " ")));
211
			} else {
217
			} else {
212
				mandatoryQ.add(
218
				mandatoryQ.add(