TsfDisplayService.java 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805
  1. package com.style24.front.biz.service;
  2. import java.util.ArrayList;
  3. import java.util.Collection;
  4. import org.apache.commons.lang3.StringUtils;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.cache.annotation.Cacheable;
  7. import org.springframework.stereotype.Service;
  8. import com.style24.core.biz.service.TscEnvsetService;
  9. import com.style24.core.support.env.TscConstants;
  10. import com.style24.front.biz.dao.TsfDisplayDao;
  11. import com.style24.front.biz.dao.TsfGoodsDao;
  12. import com.style24.front.support.env.TsfConstants;
  13. import com.style24.front.support.security.session.TsfSession;
  14. import com.style24.persistence.domain.BrandGroup;
  15. import com.style24.persistence.domain.Cate1;
  16. import com.style24.persistence.domain.Cate2;
  17. import com.style24.persistence.domain.Cate3;
  18. import com.style24.persistence.domain.Cate4;
  19. import com.style24.persistence.domain.Cate4Srch;
  20. import com.style24.persistence.domain.Cate5;
  21. import com.style24.persistence.domain.Contents;
  22. import com.style24.persistence.domain.GnbTab;
  23. import com.style24.persistence.domain.Goods;
  24. import com.style24.persistence.domain.GoodsSearch;
  25. import com.style24.persistence.domain.Login;
  26. import com.style24.persistence.domain.MainLayout;
  27. import com.style24.persistence.domain.Popup;
  28. import com.style24.persistence.domain.searchengine.Filter;
  29. import com.style24.persistence.domain.searchengine.SearchEngine;
  30. import lombok.extern.slf4j.Slf4j;
  31. import com.gagaframework.web.parameter.GagaMap;
  32. /**
  33. * 전시 Service
  34. *
  35. * @author gagamel
  36. * @since 2020. 12. 29
  37. */
  38. @Service
  39. @Slf4j
  40. public class TsfDisplayService {
  41. @Autowired
  42. private TsfDisplayDao displayDao;
  43. @Autowired
  44. private TscEnvsetService envsetService;
  45. @Autowired
  46. private TsfGoodsDao goodsDao;
  47. /**
  48. * GNB 브랜드그룹 목록
  49. * @param contents - 컨텐츠 정보
  50. * @return
  51. * @author gagamel
  52. * @since 2021. 3. 11
  53. */
  54. @Cacheable(value = "commonGnb", key = "'brandGroup'")
  55. public Collection<BrandGroup> getGnbBrandGroupList(Contents contents) {
  56. return displayDao.getGnbBrandGroupList(contents);
  57. }
  58. /**
  59. * 브랜드메인의 GNB브랜드그룹 정보 조회
  60. * @param brandGroupNo - 브랜드그룹번호
  61. * @return
  62. * @author gagamel
  63. * @since 2021. 3. 16
  64. */
  65. public BrandGroup getGnbBrandGroup(Integer brandGroupNo) {
  66. return displayDao.getGnbBrandGroup(brandGroupNo);
  67. }
  68. /**
  69. * GNB 탭 목록
  70. * @param gnbTab - GNB탭 정보
  71. * @return
  72. * @author gagamel
  73. * @date 2021. 3. 11
  74. */
  75. // @Cacheable(value = "commonGnb", key = "'gnbTab-'.concat(#gnbTab.gtabGb)")
  76. public Collection<GnbTab> getGnbTabList(GnbTab gnbTab) {
  77. return displayDao.getGnbTabList(gnbTab);
  78. }
  79. /**
  80. * 컨텐츠 목록
  81. * @param contents - 컨텐츠 정보
  82. * @return
  83. * @author gagamel
  84. * @date 2021. 3. 11
  85. */
  86. public Collection<Contents> getContentsList(Contents contents) {
  87. return displayDao.getContentsList(contents);
  88. }
  89. // /**
  90. // * FULL 카테고리1 정보
  91. // * @param cateGb - 카테고리구분
  92. // * @param cate1No - 카테고리1번호
  93. // * @return
  94. // * @author gagamel
  95. // * @since 2021. 3. 11
  96. // */
  97. // @Cacheable(value = "cate", key = "'cateList-'.concat(#cateGb).concat(#cate1No)")
  98. // public Cate1 getFullCategory1(String cateGb, Integer cate1No) {
  99. // Cate4Srch cate = new Cate4Srch();
  100. // cate.setSiteCd(TscConstants.Site.STYLE24.value()); // 사이트코드
  101. // cate.setCateGb(cateGb); // 카테고리구분
  102. // cate.setCateType(TsfConstants.CateType.GOODS.value()); // 상품분류카테고리
  103. // cate.setCate1No(cate1No);
  104. // return this.getFullCategory1(cate);
  105. // }
  106. //
  107. // /**
  108. // * FULL 카테고리1 정보
  109. // * @param cate - 카테고리 정보
  110. // * @return
  111. // * @author gagamel
  112. // * @since 2021. 3. 11
  113. // */
  114. // public Cate1 getFullCategory1(Cate4Srch cate) {
  115. // // 카테고리1 정보
  116. // Cate1 cate1 = displayDao.getCategory1List(cate).get(0);
  117. //
  118. // if (cate1 != null) {
  119. // if (cate1.getLeafYn().equals("N")) {
  120. // cate.setCate1No(cate1.getCate1No());
  121. //
  122. // // 카테고리2 목록
  123. // Collection<Cate2> cate2List = displayDao.getCategory2List(cate);
  124. //
  125. // if (cate2List != null && !cate2List.isEmpty()) {
  126. // for (Cate2 cate2 : cate2List) {
  127. // if (cate2.getLeafYn().equals("N")) {
  128. // cate.setCate2No(cate2.getCate2No());
  129. //
  130. // // 카테고리3 목록
  131. // Collection<Cate3> cate3List = displayDao.getCategory3List(cate);
  132. //
  133. // if (cate3List != null && !cate3List.isEmpty()) {
  134. // for (Cate3 cate3 : cate3List) {
  135. // if (cate3.getLeafYn().equals("N")) {
  136. // cate.setCate3No(cate3.getCate3No());
  137. //
  138. // // 카테고리4 목록
  139. // Collection<Cate4> cate4List = displayDao.getCategory4List(cate);
  140. //
  141. // if (cate4List != null && !cate4List.isEmpty()) {
  142. // for (Cate4 cate4 : cate4List) {
  143. // if (cate4.getLeafYn().equals("N")) {
  144. // cate.setCate4No(cate4.getCate4No());
  145. //
  146. // // 카테고리5 목록 담기
  147. // cate4.setCate5List(displayDao.getCategory5List(cate));
  148. // }
  149. // }
  150. //
  151. // log.info("cate4List: {}", cate4List);
  152. //
  153. // // 카테고리4 목록 담기
  154. // cate3.setCate4List(cate4List);
  155. // }
  156. // }
  157. // }
  158. //
  159. // // 카테고리3 목록 담기
  160. // cate2.setCate3List(cate3List);
  161. // }
  162. // }
  163. // }
  164. //
  165. // // 카테고리2 목록 담기
  166. // cate1.setCate2List(cate2List);
  167. // }
  168. // }
  169. // }
  170. //
  171. // return cate1;
  172. // }
  173. /**
  174. * 전체 카테고리 목록
  175. * @param cateGb - 카테고리구분
  176. * @return
  177. * @author gagamel
  178. * @since 2021. 3. 11
  179. */
  180. @Cacheable(value = "cate", key = "'allCate-'.concat(#cateGb)")
  181. public Collection<Cate1> getAllCategoryList(String cateGb) {
  182. Cate4Srch cate = new Cate4Srch();
  183. cate.setSiteCd(TscConstants.Site.STYLE24.value()); // 사이트코드
  184. cate.setCateGb(cateGb); // 카테고리구분
  185. cate.setCateType(TsfConstants.CateType.GOODS.value()); // 상품분류카테고리
  186. cate.setSoldoutGoodsDispYn(envsetService.getSoldoutGoodsDisplayYn(TscConstants.Site.STYLE24.value()));
  187. return this.getAllCategoryList(cate);
  188. }
  189. /**
  190. * 전체 카테고리 목록
  191. * @param cate - 카테고리 정보
  192. * @return
  193. * @author gagamel
  194. * @since 2021. 3. 11
  195. */
  196. public Collection<Cate1> getAllCategoryList(Cate4Srch cate) {
  197. // // 카테고리1 목록
  198. // Collection<Cate1> cate1List = displayDao.getCategory1List(cate);
  199. //
  200. // if (cate1List != null && !cate1List.isEmpty()) {
  201. // for (Cate1 cate1 : cate1List) {
  202. // if (cate1.getLeafYn().equals("N")) {
  203. // cate.setCate1No(cate1.getCate1No());
  204. //
  205. // // 카테고리2 목록
  206. // Collection<Cate2> cate2List = displayDao.getCategory2List(cate);
  207. //
  208. // if (cate2List != null && !cate2List.isEmpty()) {
  209. // for (Cate2 cate2 : cate2List) {
  210. // if (cate2.getLeafYn().equals("N")) {
  211. // cate.setCate2No(cate2.getCate2No());
  212. //
  213. // // 카테고리3 목록
  214. // Collection<Cate3> cate3List = displayDao.getCategory3List(cate);
  215. //
  216. // if (cate3List != null && !cate3List.isEmpty()) {
  217. // for (Cate3 cate3 : cate3List) {
  218. // if (cate3.getLeafYn().equals("N")) {
  219. // cate.setCate3No(cate3.getCate3No());
  220. //
  221. // // 카테고리4 목록
  222. // Collection<Cate4> cate4List = displayDao.getCategory4List(cate);
  223. //
  224. // if (cate4List != null && !cate4List.isEmpty()) {
  225. // for (Cate4 cate4 : cate4List) {
  226. // if (cate4.getLeafYn().equals("N")) {
  227. // cate.setCate4No(cate4.getCate4No());
  228. //
  229. // // 카테고리5 목록 담기
  230. // cate4.setCate5List(displayDao.getCategory5List(cate));
  231. // }
  232. // }
  233. //
  234. // log.info("cate4List: {}", cate4List);
  235. //
  236. // // 카테고리4 목록 담기
  237. // cate3.setCate4List(cate4List);
  238. // }
  239. // }
  240. // }
  241. //
  242. // // 카테고리3 목록 담기
  243. // cate2.setCate3List(cate3List);
  244. // }
  245. // }
  246. // }
  247. //
  248. // // 카테고리2 목록 담기
  249. // cate1.setCate2List(cate2List);
  250. // }
  251. // }
  252. // }
  253. // }
  254. Collection<Cate1> cate1List = new ArrayList<Cate1>();
  255. // 전체 카테고리 목록
  256. Collection<Cate4Srch> cateList = displayDao.getAllCategoryList(cate);
  257. if (cateList != null && !cateList.isEmpty()) {
  258. Integer prevCate1No = 0;
  259. Integer prevCate2No = 0;
  260. Integer prevCate3No = 0;
  261. Integer prevCate4No = 0;
  262. Integer prevCate5No = 0;
  263. for (Cate4Srch cate4srch1 : cateList) {
  264. if (cate4srch1.getCate1No() != null && !cate4srch1.getCate1No().equals(prevCate1No)) {
  265. Cate1 cate1 = new Cate1();
  266. cate1.setSiteCd(cate4srch1.getSiteCd());
  267. cate1.setCateGb(cate4srch1.getCateGb());
  268. cate1.setCateType(cate4srch1.getCateType());
  269. cate1.setCate1No(cate4srch1.getCate1No());
  270. cate1.setCate1Nm(cate4srch1.getCate1Nm());
  271. cate1.setFormalGb(cate4srch1.getFormalGb());
  272. Collection<Cate2> cate2List = new ArrayList<Cate2>();
  273. for (Cate4Srch cate4srch2 : cateList) {
  274. if (cate4srch2.getCate1No() != null && cate4srch1.getCate1No().equals(cate4srch2.getCate1No())) {
  275. if (cate4srch2.getCate2No() != null && !cate4srch2.getCate2No().equals(prevCate2No)) {
  276. Cate2 cate2 = new Cate2();
  277. cate2.setSiteCd(cate4srch2.getSiteCd());
  278. cate2.setCateGb(cate4srch2.getCateGb());
  279. cate2.setCateType(cate4srch2.getCateType());
  280. cate2.setCate2No(cate4srch2.getCate2No());
  281. cate2.setCate2Nm(cate4srch2.getCate2Nm());
  282. cate2.setCate1No(cate4srch2.getCate1No());
  283. cate2.setFormalGb(cate4srch2.getFormalGb());
  284. Collection<Cate3> cate3List = new ArrayList<Cate3>();
  285. for (Cate4Srch cate4srch3 : cateList) {
  286. if (cate4srch3.getCate2No() != null && cate4srch2.getCate2No().equals(cate4srch3.getCate2No())) {
  287. if (cate4srch3.getCate3No() != null && !cate4srch3.getCate3No().equals(prevCate3No)) {
  288. Cate3 cate3 = new Cate3();
  289. cate3.setSiteCd(cate4srch3.getSiteCd());
  290. cate3.setCateGb(cate4srch3.getCateGb());
  291. cate3.setCateType(cate4srch3.getCateType());
  292. cate3.setCate3No(cate4srch3.getCate3No());
  293. cate3.setCate3Nm(cate4srch3.getCate3Nm());
  294. cate3.setCate1No(cate4srch3.getCate1No());
  295. cate3.setCate2No(cate4srch3.getCate2No());
  296. cate3.setFormalGb(cate4srch3.getFormalGb());
  297. Collection<Cate4> cate4List = new ArrayList<Cate4>();
  298. for (Cate4Srch cate4srch4 : cateList) {
  299. if (cate4srch4.getCate3No() != null && cate4srch3.getCate3No().equals(cate4srch4.getCate3No())) {
  300. if (cate4srch4.getCate4No() != null && !cate4srch4.getCate4No().equals(prevCate4No)) {
  301. Cate4 cate4 = new Cate4();
  302. cate4.setSiteCd(cate4srch4.getSiteCd());
  303. cate4.setCateGb(cate4srch4.getCateGb());
  304. cate4.setCateType(cate4srch4.getCateType());
  305. cate4.setCate4No(cate4srch4.getCate4No());
  306. cate4.setCate4Nm(cate4srch4.getCate4Nm());
  307. cate4.setCate1No(cate4srch4.getCate1No());
  308. cate4.setCate2No(cate4srch4.getCate2No());
  309. cate4.setCate3No(cate4srch4.getCate3No());
  310. cate4.setFormalGb(cate4srch4.getFormalGb());
  311. Collection<Cate5> cate5List = new ArrayList<Cate5>();
  312. for (Cate4Srch cate4srch5 : cateList) {
  313. if (cate4srch5.getCate4No() != null && cate4srch4.getCate4No().equals(cate4srch5.getCate4No())) {
  314. if (cate4srch5.getCate5No() != null && !cate4srch5.getCate5No().equals(prevCate5No)) {
  315. Cate5 cate5 = new Cate5();
  316. cate5.setSiteCd(cate4srch5.getSiteCd());
  317. cate5.setCateGb(cate4srch5.getCateGb());
  318. cate5.setCateType(cate4srch5.getCateType());
  319. cate5.setCate5No(cate4srch5.getCate5No());
  320. cate5.setCate5Nm(cate4srch5.getCate5Nm());
  321. cate5.setCate1No(cate4srch5.getCate1No());
  322. cate5.setCate2No(cate4srch5.getCate2No());
  323. cate5.setCate3No(cate4srch5.getCate3No());
  324. cate5.setCate4No(cate4srch5.getCate4No());
  325. cate5.setFormalGb(cate4srch5.getFormalGb());
  326. cate5.setLeafYn("Y");
  327. cate5List.add(cate5);
  328. }
  329. }
  330. prevCate5No = cate4srch5.getCate5No();
  331. }
  332. cate4.setLeafYn(cate5List.size() > 0 ? "N" : "Y");
  333. cate4.setCate5List(cate5List);
  334. cate4List.add(cate4);
  335. }
  336. }
  337. prevCate4No = cate4srch4.getCate4No();
  338. }
  339. cate3.setLeafYn(cate4List.size() > 0 ? "N" : "Y");
  340. cate3.setCate4List(cate4List);
  341. cate3List.add(cate3);
  342. }
  343. }
  344. prevCate3No = cate4srch3.getCate3No();
  345. }
  346. cate2.setLeafYn(cate3List.size() > 0 ? "N" : "Y");
  347. cate2.setCate3List(cate3List);
  348. cate2List.add(cate2);
  349. }
  350. }
  351. prevCate2No = cate4srch2.getCate2No();
  352. }
  353. cate1.setLeafYn(cate2List.size() > 0 ? "N" : "Y");
  354. cate1.setCate2List(cate2List);
  355. cate1List.add(cate1);
  356. }
  357. prevCate1No = cate4srch1.getCate1No();
  358. }
  359. }
  360. // Map<Integer, List<Cate4Srch>> cate4srch1 = cateList.stream().collect(Collectors.groupingBy(Cate4Srch::getCate1No, LinkedHashMap::new, Collectors.toList()));
  361. // cate4srch1.forEach((key1, value1) -> {
  362. // log.info("{}:{}", key1, value1);
  363. // Cate1 cate1 = new Cate1();
  364. // cate1.setCate1No(key1);
  365. // Iterator<Cate4Srch> aaa = value1.iterator();
  366. // while (aaa.hasNext()) {
  367. // aaa.next();
  368. // }
  369. //
  370. // Map<Integer, List<Cate4Srch>> cate4srch2 = value1.stream().collect(Collectors.groupingBy(Cate4Srch::getCate2No, LinkedHashMap::new, Collectors.toList()));
  371. // cate4srch2.forEach((key2, value2) -> {
  372. // log.info("{}:{}", key2, value2);
  373. // });
  374. // });
  375. return cate1List;
  376. }
  377. /**
  378. * 브랜드 카테고리 목록
  379. * @param brandGroupNo - 브랜드그룹번호
  380. * @return
  381. * @author gagamel
  382. * @since 2021. 4. 12
  383. */
  384. @Cacheable(value = "cate", key = "'brandCate-'.concat(#brandGroupNo)")
  385. public Collection<Cate1> getBrandCategoryList(Integer brandGroupNo) {
  386. // 브랜드그룹의 기본카테고리여부 조회
  387. String defaultCateYn = displayDao.getBrandGroupDefaultCategoryYn(brandGroupNo);
  388. Cate4Srch cate = new Cate4Srch();
  389. cate.setSiteCd(TscConstants.Site.STYLE24.value()); // 사이트코드
  390. if (defaultCateYn.equals("Y")) { // 기본카테고리이면
  391. cate.setCateGb(TsfConstants.CateGb.BYITEM.value());
  392. } else { // 별도카테고리이면
  393. cate.setCateGb(TsfConstants.CateGb.BYBRAND.value());
  394. }
  395. cate.setCateType(TsfConstants.CateType.GOODS.value()); // 상품분류카테고리
  396. cate.setBrandGroupNo(brandGroupNo);
  397. cate.setSoldoutGoodsDispYn(envsetService.getSoldoutGoodsDisplayYn(TscConstants.Site.STYLE24.value()));
  398. cate.setDefaultCateYn(defaultCateYn);
  399. return this.getAllCategoryList(cate);
  400. }
  401. /**
  402. * 아울렛 카테고리 목록
  403. * @param brandGroupNo - 브랜드그룹번호
  404. * @return
  405. * @author gagamel
  406. * @since 2021. 4. 12
  407. */
  408. @Cacheable(value = "cate", key = "'outletCate-'.concat(#formalGb)")
  409. public Collection<Cate1> getOutletCategoryList(String formalGb) {
  410. Cate4Srch cate = new Cate4Srch();
  411. cate.setSiteCd(TscConstants.Site.STYLE24.value()); // 사이트코드
  412. cate.setFormalGb(formalGb);
  413. cate.setCateGb(TsfConstants.CateGb.BYITEM.value());
  414. cate.setCateType(TsfConstants.CateType.GOODS.value()); // 상품분류카테고리
  415. cate.setSoldoutGoodsDispYn(envsetService.getSoldoutGoodsDisplayYn(TscConstants.Site.STYLE24.value()));
  416. return this.getAllCategoryList(cate);
  417. }
  418. /**
  419. * 카테고리 목록
  420. * @param brandGroupNo - 브랜드그룹번호
  421. * @return
  422. * @author gagamel
  423. * @since 2021. 4. 12
  424. */
  425. @Cacheable(value = "cate", key = "'reloadCate-'.concat(#cateGb)")
  426. public Collection<Cate1> getCategoryReloadList(String cateGb) {
  427. Cate4Srch cate = new Cate4Srch();
  428. cate.setSiteCd(TscConstants.Site.STYLE24.value()); // 사이트코드
  429. cate.setCateGb(TsfConstants.CateGb.BYITEM.value());
  430. cate.setCateType(TsfConstants.CateType.GOODS.value()); // 상품분류카테고리
  431. cate.setSoldoutGoodsDispYn(envsetService.getSoldoutGoodsDisplayYn(TscConstants.Site.STYLE24.value()));
  432. return this.getAllCategoryList(cate);
  433. }
  434. /**
  435. * 메인 레이아웃 목록
  436. * @param cateNo - 카테고리No
  437. * @return
  438. * @author bin2107
  439. * @date 2021. 3. 16
  440. */
  441. public Collection<MainLayout> getMainLayout(MainLayout mainLayout) {
  442. return displayDao.getMainLayout(mainLayout);
  443. }
  444. /**
  445. * 카테고리 4srch 조회
  446. * @param
  447. * @return
  448. * @author bin2107
  449. * @date 2021. 3. 16
  450. */
  451. public Cate4Srch getCate4srch(Cate4Srch cate4Srch) {
  452. return displayDao.getCate4srch(cate4Srch);
  453. }
  454. /**
  455. * 팝업 목록
  456. *
  457. * @param popup
  458. * @return
  459. * @author eskim
  460. * @date 2021. 3. 30
  461. */
  462. public GagaMap getPopupList(Popup popup) {
  463. GagaMap result = new GagaMap();
  464. Collection<Popup> popupList = new ArrayList<Popup>();
  465. popup.setSiteCd(TscConstants.Site.STYLE24.value());
  466. if ("P".equals(popup.getFrontGb())) {
  467. result.set("dataList", displayDao.getPopupList(popup));
  468. } else {
  469. //우선순위 full 팝
  470. popup.setPopupGb("F");
  471. popupList = displayDao.getPopupList(popup);
  472. result.set("popupGb", "F");
  473. result.set("dataList", popupList);
  474. if (popupList != null && popupList.size() > 0) {
  475. return result;
  476. }
  477. popup.setPopupGb("H");
  478. popupList = displayDao.getPopupList(popup);
  479. result.set("popupGb", "H");
  480. result.set("dataList", popupList);
  481. }
  482. // Collection<Popup>
  483. return result;
  484. }
  485. /**
  486. * 몰메인 MD PICK 목록
  487. * @param
  488. * @return
  489. * @author bin2107
  490. * @date 2021. 3. 30
  491. */
  492. public Collection<Contents> getContentsForGoods(Contents contents) {
  493. Collection<Contents> contentsList = displayDao.getContentsList(contents);
  494. Collection<Goods> goodsList = new ArrayList<>();
  495. Cate4Srch tempContents = new Cate4Srch();
  496. for (Contents data : contentsList) {
  497. tempContents.setContentsLoc(data.getContentsLoc());
  498. tempContents.setDispOrd(data.getDispOrd());
  499. tempContents.setMaxRow(20);
  500. tempContents.setCustNo(TsfSession.isLogin() ? TsfSession.getInfo().getCustNo() : 0);
  501. if ("SMM007".equals(data.getContentsLoc())) {
  502. data.setFrontGb(TsfSession.getFrontGb());
  503. data.setBannerList(displayDao.getContentsBannerList(data));
  504. }
  505. goodsList = (goodsDao.getContentsCategoryGoodsList(tempContents));
  506. if("SMM007".equals(data.getContentsLoc())){
  507. int maxrow = 3;
  508. if(goodsList == null || goodsList.size() < 3){
  509. Cate4Srch cate = new Cate4Srch();
  510. cate.setSiteCd(TscConstants.Site.STYLE24.value());
  511. cate.setCateGb(TsfConstants.CateGb.BYITEM.value());
  512. cate.setFrontGb(data.getFrontGb());
  513. cate.setBrandGroupNo(Integer.parseInt(data.getBrandGroupNo()));
  514. cate.setMaxRow(maxrow-goodsList.size());
  515. goodsList.addAll(goodsDao.getContentsCategoryNewGoodsList(cate));
  516. }
  517. }
  518. data.setGoodsList(goodsList);
  519. }
  520. log.info("getContentsForGoods contentsList.size()::{}", contentsList.size());
  521. return contentsList;
  522. }
  523. /**
  524. * 몰메인 BESTITEM 목록
  525. * @param
  526. * @return
  527. * @author bin2107
  528. * @date 2021. 4. 9
  529. */
  530. public Collection<Contents> getBestItemForGoods(Contents contents) {
  531. contents.setContentsLoc("SCM003");
  532. Collection<Contents> contentsList = displayDao.getBestItemCategoryList(contents);
  533. Cate4Srch tempCate = new Cate4Srch();
  534. for (Contents data : contentsList) {
  535. tempCate.setContentsLoc(data.getContentsLoc());
  536. tempCate.setMaxRow(10);
  537. tempCate.setCustNo(TsfSession.isLogin() ? TsfSession.getInfo().getCustNo() : 0);
  538. tempCate.setCateNo(data.getCateNo());
  539. tempCate.setSiteCd(data.getSiteCd());
  540. tempCate.setCateGb(data.getCateGb());
  541. data.setGoodsList(goodsDao.getContentsCategoryGoodsList(tempCate));
  542. }
  543. return contentsList;
  544. }
  545. /**
  546. * BEST ITEM 카테고리 목록
  547. * @param
  548. * @return
  549. * @author bin2107
  550. * @date 2021. 4. 13
  551. */
  552. public Collection<Contents> getBestItemCategoryList(Contents contents) {
  553. return displayDao.getBestItemCategoryList(contents);
  554. }
  555. /**
  556. * BEST ITEM 카테고리별 상품 리스트
  557. * @param
  558. * @return
  559. * @author bin2107
  560. * @date 2021. 4. 13
  561. */
  562. public Collection<Goods> getBestItemCategoryGoodsList(Contents contents) {
  563. Cate4Srch cate4Srch = new Cate4Srch();
  564. // 로그인 유무 확인 (로그인이 되어 있지 않으면 regNo 를 0으로 장바구니에 저장한다.)
  565. Login login = new Login();
  566. if (TsfSession.isLogin()) {
  567. login = TsfSession.getInfo();
  568. } else {
  569. login.setCustNo(0);
  570. }
  571. cate4Srch.setCustNo(login.getCustNo());
  572. cate4Srch.setPageGb(contents.getPageGb());
  573. cate4Srch.setContentsLoc(contents.getContentsLoc());
  574. cate4Srch.setPageable(contents.getPageable());
  575. cate4Srch.setPageNo(contents.getPageNo());
  576. cate4Srch.setPageSize(contents.getPageSize());
  577. cate4Srch.setPageUnit(contents.getPageUnit());
  578. cate4Srch.setCustNo(TsfSession.isLogin() ? TsfSession.getInfo().getCustNo() : 0);
  579. cate4Srch.setCate1No(contents.getCateNo());
  580. cate4Srch.setSiteCd(TscConstants.Site.STYLE24.value());
  581. cate4Srch.setCateGb("G032_101");
  582. log.info("getBestItemCategoryGoodsList cate4Srch:::::::::{}", cate4Srch);
  583. Collection<Goods> goodsList = goodsDao.getContentsCategoryGoodsList(cate4Srch);
  584. if (goodsList.size() < 100) {
  585. // TODO 추천솔루션
  586. }
  587. return goodsList;
  588. }
  589. /**
  590. * 상품리스트 카테고리별 필터 목록
  591. * @param params - 검색엔진 정보
  592. * @return
  593. * @author gagamel
  594. * @date 2021. 5. 3
  595. */
  596. public Collection<Filter> getGoodsListCategoryFilterList(SearchEngine params) {
  597. params.setSiteCd(TscConstants.Site.STYLE24.value());
  598. if (StringUtils.isBlank(params.getFormalGb())) {
  599. params.setFormalGb("G009_10");
  600. }
  601. return displayDao.getGoodsListCategoryFilterList(params);
  602. }
  603. /**
  604. * 검색키워드를 통한 검색상품리스트 카테고리별 필터 목록
  605. * @param params - 검색엔진 정보
  606. * @return
  607. * @author gagamel
  608. * @date 2021. 5. 3
  609. */
  610. public Collection<Filter> getSearchGoodsListCategoryFilterList(SearchEngine params) {
  611. params.setSiteCd(TscConstants.Site.STYLE24.value());
  612. params.setCateGb(TsfConstants.CateGb.BYITEM.value());
  613. params.setFormalGb("G009_10");
  614. return displayDao.getSearchGoodsListCategoryFilterList(params);
  615. }
  616. /**
  617. * 카테고리별 필터 목록
  618. * @param filterList - 필터 목록
  619. * @param filterGb - 필터 구분
  620. * @return
  621. * @author gagamel
  622. * @date 2021. 5. 3
  623. */
  624. public Collection<Filter> getCategoryFilterList(Collection<Filter> filterList, String filterGb) {
  625. Collection<Filter> resultList = new ArrayList<Filter>();
  626. for (Filter filter : filterList) {
  627. if(!"".equals(filter.getFilterCd()) && !filter.getFilterCd().equals(null)){
  628. if (filter.getFilterGb().equals(filterGb)) {
  629. if ("BENEFIT".equals(filterGb)) {
  630. if (!filter.getFilterCd().equals("40")) {
  631. resultList.add(filter);
  632. }
  633. } else {
  634. resultList.add(filter);
  635. }
  636. }
  637. }
  638. }
  639. return resultList;
  640. }
  641. /**
  642. * 상품카테고리 필터 목록
  643. * @param
  644. * @return
  645. * @author bin2107
  646. * @date 2021. 4. 5
  647. */
  648. public Collection<GoodsSearch> getCategoryFilter(Cate4Srch cate4Srch, String filterGb) {
  649. cate4Srch.setFilterGb(filterGb);
  650. return displayDao.getCategoryFilter(cate4Srch);
  651. }
  652. /**
  653. * 상품카테고리 필터 혜택 목록
  654. * @param
  655. * @return
  656. * @author bin2107
  657. * @date 2021. 4. 7
  658. */
  659. public Collection<GoodsSearch> getCategoryFilterBenefit(Cate4Srch cate4Srch) {
  660. return displayDao.getCategoryFilterBenefit(cate4Srch);
  661. }
  662. /**
  663. * 전체 브랜드 이미지 리스트
  664. * @param
  665. * @return
  666. * @author bin2107
  667. * @since 2021. 4. 28
  668. */
  669. public Collection<BrandGroup> getBrandImgList(BrandGroup brandGroup) {
  670. return displayDao.getBrandImgList(brandGroup);
  671. }
  672. /**
  673. * 전체 브랜드
  674. * @param
  675. * @return
  676. * @author bin2107
  677. * @since 2021. 4. 12
  678. */
  679. public Collection<BrandGroup> getAllBrandList(BrandGroup brandGroup) {
  680. return displayDao.getAllBrandList(brandGroup);
  681. }
  682. /**
  683. * GNB TAB 기획전배너 리스트
  684. * @param Contents
  685. * @return
  686. * @author bin2107
  687. * @since 2021. 4. 14
  688. */
  689. public Collection<Contents> getGnbTabBannerlist(Contents contenst) {
  690. Collection<Contents> contentsList = displayDao.getGnbTabBannerList(contenst);
  691. return contentsList;
  692. }
  693. /**
  694. * 키워드를 이용한 전체 카테고리 목록
  695. * @param keyword - 상품검색키워드
  696. * @return
  697. * @author gagamel
  698. * @since 2021. 5. 6
  699. */
  700. public Collection<Cate1> getKeywordCategoryList(String keyword) {
  701. Cate4Srch cate = new Cate4Srch();
  702. cate.setSiteCd(TscConstants.Site.STYLE24.value()); // 사이트코드
  703. cate.setCateGb(TsfConstants.CateGb.BYITEM.value()); // 카테고리구분
  704. cate.setCateType(TsfConstants.CateType.GOODS.value()); // 상품분류카테고리
  705. cate.setSoldoutGoodsDispYn(envsetService.getSoldoutGoodsDisplayYn(TscConstants.Site.STYLE24.value()));
  706. cate.setKeyword(keyword);
  707. return this.getAllCategoryList(cate);
  708. }
  709. public int getContentsCategoryGoodsCount(Contents contents) {
  710. Cate4Srch cate4Srch = new Cate4Srch();
  711. // 로그인 유무 확인 (로그인이 되어 있지 않으면 regNo 를 0으로 장바구니에 저장한다.)
  712. Login login = new Login();
  713. if (TsfSession.isLogin()) {
  714. login = TsfSession.getInfo();
  715. } else {
  716. login.setCustNo(0);
  717. }
  718. cate4Srch.setCustNo(login.getCustNo());
  719. cate4Srch.setPageGb(contents.getPageGb());
  720. cate4Srch.setContentsLoc(contents.getContentsLoc());
  721. cate4Srch.setMaxRow(100);
  722. cate4Srch.setCustNo(TsfSession.isLogin() ? TsfSession.getInfo().getCustNo() : 0);
  723. cate4Srch.setCate1No(contents.getCateNo());
  724. cate4Srch.setSiteCd(TscConstants.Site.STYLE24.value());
  725. cate4Srch.setCateGb("G032_101");
  726. return goodsDao.getContentsCategoryGoodsCount(cate4Srch);
  727. }
  728. }