|
|
@@ -1,5 +1,8 @@
|
|
|
package com.style24.front.biz.thirdparty;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.Collection;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -13,6 +16,8 @@ import org.springframework.stereotype.Component;
|
|
|
import com.diquest.ir.common.exception.IRException;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.google.gson.Gson;
|
|
|
+import com.style24.front.support.security.session.TsfSession;
|
|
|
+import com.style24.persistence.domain.searchengine.Filter;
|
|
|
import com.style24.persistence.domain.searchengine.SearchEngine;
|
|
|
|
|
|
import istyle.AutoSearch;
|
|
|
@@ -74,6 +79,91 @@ public class SearchEngineDiquest {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 카테고리 목록
|
|
|
+ * @param params - 파라미터
|
|
|
+ * @return
|
|
|
+ * @author gagamel
|
|
|
+ * @since 2021. 5. 31
|
|
|
+ */
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ public SearchEngine getCategoryList(SearchEngine params) {
|
|
|
+ SearchEngine result = new SearchEngine();
|
|
|
+
|
|
|
+ Map<String, Object> paramMap = new HashMap<>();// this.convertObjectToMap(params);
|
|
|
+ paramMap.put("adminIp", ipAddr);
|
|
|
+ paramMap.put("adminPort", port);
|
|
|
+// paramMap.put("cate1No", 1300);
|
|
|
+ paramMap.put("brandGroupNo", 0);
|
|
|
+ paramMap.put("frontGb", TsfSession.getFrontGb());
|
|
|
+ paramMap.put("keyword", "키즈");
|
|
|
+ paramMap.put("formalGb", "G009_20");
|
|
|
+
|
|
|
+ // 브랜드그룹번호 값이 있으면 (=브랜드메인에서 조회했으면)
|
|
|
+ paramMap.put("defaultCateYn", "Y");
|
|
|
+ if (params.getBrandGroupNo() > 0) {
|
|
|
+ paramMap.put("defaultCateYn", "Y");
|
|
|
+ }
|
|
|
+
|
|
|
+ log.info("--------------------------1");
|
|
|
+ log.info("{}", paramMap);
|
|
|
+
|
|
|
+ try {
|
|
|
+ log.info("--------------------------2");
|
|
|
+ JSONObject jsonObj = SearchService.getCategoryGoodsList(paramMap);
|
|
|
+ log.info("jsonObj: {}", jsonObj.toString());
|
|
|
+
|
|
|
+// Gson gson = new Gson();
|
|
|
+// Map<String, Object> resMap = gson.fromJson(jsonObj.toJSONString(), Map.class);
|
|
|
+// log.info("{}", resMap);
|
|
|
+//
|
|
|
+// if (resMap.get("returnCode").equals("1")) { // 성공
|
|
|
+// result = gson.fromJson(resMap.get("response").toString(), SearchEngine.class);
|
|
|
+// }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 필터 목록
|
|
|
+ * @param params - 파라미터
|
|
|
+ * @return
|
|
|
+ * @author gagamel
|
|
|
+ * @since 2021. 5. 31
|
|
|
+ */
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ public Collection<Filter> getFilterList(SearchEngine params) {
|
|
|
+ Collection<Filter> result = new ArrayList<Filter>();
|
|
|
+
|
|
|
+ Map<String, Object> paramMap = this.convertObjectToMap(params);
|
|
|
+ paramMap.put("adminIp", ipAddr);
|
|
|
+ paramMap.put("adminPort", port);
|
|
|
+ log.info("{}", paramMap);
|
|
|
+
|
|
|
+ try {
|
|
|
+ JSONObject jsonObj = SearchService.getFilterList(paramMap);
|
|
|
+ log.info("jsonObj.toJSONString(): {}", jsonObj.toJSONString());
|
|
|
+
|
|
|
+ Gson gson = new Gson();
|
|
|
+ Map<String, Object> resMap = gson.fromJson(jsonObj.toJSONString(), Map.class);
|
|
|
+ log.info("{}", resMap);
|
|
|
+
|
|
|
+ if (resMap.get("returnCode").equals("1")) { // 성공
|
|
|
+ Filter[] arrFilter = gson.fromJson(resMap.get("response").toString(), Filter[].class);
|
|
|
+ result = Arrays.asList(arrFilter);
|
|
|
+// result = gson.fromJson(resMap.get("response").toString(), new TypeToken<Collection<Filter>>() {
|
|
|
+// }.getType());
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 상품리스트
|
|
|
* @param params - 파라미터
|
|
|
@@ -81,6 +171,7 @@ public class SearchEngineDiquest {
|
|
|
* @author gagamel
|
|
|
* @since 2021. 5. 31
|
|
|
*/
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
public SearchEngine getGoodsList(SearchEngine params) {
|
|
|
SearchEngine result = new SearchEngine();
|
|
|
|
|
|
@@ -94,7 +185,12 @@ public class SearchEngineDiquest {
|
|
|
log.info("jsonObj.toJSONString(): {}", jsonObj.toJSONString());
|
|
|
|
|
|
Gson gson = new Gson();
|
|
|
- result = gson.fromJson(jsonObj.toJSONString(), SearchEngine.class);
|
|
|
+ Map<String, Object> resMap = gson.fromJson(jsonObj.toJSONString(), Map.class);
|
|
|
+ log.info("{}", resMap);
|
|
|
+
|
|
|
+ if (resMap.get("returnCode").equals("1")) { // 성공
|
|
|
+ result = gson.fromJson(resMap.get("response").toString(), SearchEngine.class);
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|