TsfDisplayService.java 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. package com.style24.front.biz.service;
  2. import java.util.Collection;
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.cache.annotation.Cacheable;
  5. import org.springframework.stereotype.Service;
  6. import com.style24.core.biz.service.TscEnvsetService;
  7. import com.style24.core.support.env.TscConstants;
  8. import com.style24.front.biz.dao.TsfDisplayDao;
  9. import com.style24.front.support.env.TsfConstants;
  10. import com.style24.persistence.domain.BrandGroup;
  11. import com.style24.persistence.domain.Cate1;
  12. import com.style24.persistence.domain.Cate2;
  13. import com.style24.persistence.domain.Cate3;
  14. import com.style24.persistence.domain.Cate4;
  15. import com.style24.persistence.domain.Cate4Srch;
  16. import com.style24.persistence.domain.Contents;
  17. import com.style24.persistence.domain.GnbTab;
  18. import lombok.extern.slf4j.Slf4j;
  19. /**
  20. * 전시 Service
  21. *
  22. * @author gagamel
  23. * @since 2020. 12. 29
  24. */
  25. @Service
  26. @Slf4j
  27. public class TsfDisplayService {
  28. @Autowired
  29. private TsfDisplayDao displayDao;
  30. @Autowired
  31. private TscEnvsetService envsetService;
  32. /**
  33. * GNB 브랜드그룹 목록
  34. * @param contents - 컨텐츠 정보
  35. * @return
  36. * @author gagamel
  37. * @since 2021. 3. 11
  38. */
  39. @Cacheable(value = "commonGnb", key = "'brandGroup'")
  40. public Collection<BrandGroup> getGnbBrandGroupList(Contents contents) {
  41. return displayDao.getGnbBrandGroupList(contents);
  42. }
  43. /**
  44. * GNB 탭 목록
  45. * @param gnbTab - GNB탭 정보
  46. * @return
  47. * @author gagamel
  48. * @date 2021. 3. 11
  49. */
  50. @Cacheable(value = "commonGnb", key = "'gnbTab-'.concat(#gnbTab.gtabGb)")
  51. public Collection<GnbTab> getGnbTabList(GnbTab gnbTab) {
  52. return displayDao.getGnbTabList(gnbTab);
  53. }
  54. /**
  55. * 컨텐츠 목록
  56. * @param contents - 컨텐츠 정보
  57. * @return
  58. * @author gagamel
  59. * @date 2021. 3. 11
  60. */
  61. public Collection<Contents> getContentsList(Contents contents) {
  62. return displayDao.getContentsList(contents);
  63. }
  64. // /**
  65. // * FULL 카테고리1 정보
  66. // * @param cateGb - 카테고리구분
  67. // * @param cate1No - 카테고리1번호
  68. // * @return
  69. // * @author gagamel
  70. // * @since 2021. 3. 11
  71. // */
  72. // @Cacheable(value = "cate", key = "'cateList-'.concat(#cateGb).concat(#cate1No)")
  73. // public Cate1 getFullCategory1(String cateGb, Integer cate1No) {
  74. // Cate4Srch cate = new Cate4Srch();
  75. // cate.setSiteCd(TscConstants.Site.STYLE24.value()); // 사이트코드
  76. // cate.setCateGb(cateGb); // 카테고리구분
  77. // cate.setCateType(TsfConstants.CateType.GOODS.value()); // 상품분류카테고리
  78. // cate.setCate1No(cate1No);
  79. // return this.getFullCategory1(cate);
  80. // }
  81. //
  82. // /**
  83. // * FULL 카테고리1 정보
  84. // * @param cate - 카테고리 정보
  85. // * @return
  86. // * @author gagamel
  87. // * @since 2021. 3. 11
  88. // */
  89. // public Cate1 getFullCategory1(Cate4Srch cate) {
  90. // // 카테고리1 정보
  91. // Cate1 cate1 = displayDao.getCategory1List(cate).get(0);
  92. //
  93. // if (cate1 != null) {
  94. // if (cate1.getLeafYn().equals("N")) {
  95. // cate.setCate1No(cate1.getCate1No());
  96. //
  97. // // 카테고리2 목록
  98. // Collection<Cate2> cate2List = displayDao.getCategory2List(cate);
  99. //
  100. // if (cate2List != null && !cate2List.isEmpty()) {
  101. // for (Cate2 cate2 : cate2List) {
  102. // if (cate2.getLeafYn().equals("N")) {
  103. // cate.setCate2No(cate2.getCate2No());
  104. //
  105. // // 카테고리3 목록
  106. // Collection<Cate3> cate3List = displayDao.getCategory3List(cate);
  107. //
  108. // if (cate3List != null && !cate3List.isEmpty()) {
  109. // for (Cate3 cate3 : cate3List) {
  110. // if (cate3.getLeafYn().equals("N")) {
  111. // cate.setCate3No(cate3.getCate3No());
  112. //
  113. // // 카테고리4 목록
  114. // Collection<Cate4> cate4List = displayDao.getCategory4List(cate);
  115. //
  116. // if (cate4List != null && !cate4List.isEmpty()) {
  117. // for (Cate4 cate4 : cate4List) {
  118. // if (cate4.getLeafYn().equals("N")) {
  119. // cate.setCate4No(cate4.getCate4No());
  120. //
  121. // // 카테고리5 목록 담기
  122. // cate4.setCate5List(displayDao.getCategory5List(cate));
  123. // }
  124. // }
  125. //
  126. // log.info("cate4List: {}", cate4List);
  127. //
  128. // // 카테고리4 목록 담기
  129. // cate3.setCate4List(cate4List);
  130. // }
  131. // }
  132. // }
  133. //
  134. // // 카테고리3 목록 담기
  135. // cate2.setCate3List(cate3List);
  136. // }
  137. // }
  138. // }
  139. //
  140. // // 카테고리2 목록 담기
  141. // cate1.setCate2List(cate2List);
  142. // }
  143. // }
  144. // }
  145. //
  146. // return cate1;
  147. // }
  148. /**
  149. * 전체 카테고리 목록
  150. * @param cateGb - 카테고리구분
  151. * @return
  152. * @author gagamel
  153. * @since 2021. 3. 11
  154. */
  155. @Cacheable(value = "cate", key = "'allCate-'.concat(#cateGb)")
  156. public Collection<Cate1> getAllCategoryList(String cateGb) {
  157. Cate4Srch cate = new Cate4Srch();
  158. cate.setSiteCd(TscConstants.Site.STYLE24.value()); // 사이트코드
  159. cate.setCateGb(cateGb); // 카테고리구분
  160. cate.setCateType(TsfConstants.CateType.GOODS.value()); // 상품분류카테고리
  161. cate.setSoldoutGoodsDispYn(envsetService.getSoldoutGoodsDisplayYn(TscConstants.Site.STYLE24.value()));
  162. return this.getAllCategoryList(cate);
  163. }
  164. /**
  165. * 전체 카테고리 목록
  166. * @param cate - 카테고리 정보
  167. * @return
  168. * @author gagamel
  169. * @since 2021. 3. 11
  170. */
  171. public Collection<Cate1> getAllCategoryList(Cate4Srch cate) {
  172. // 카테고리1 목록
  173. Collection<Cate1> cate1List = displayDao.getCategory1List(cate);
  174. if (cate1List != null && !cate1List.isEmpty()) {
  175. for (Cate1 cate1 : cate1List) {
  176. if (cate1.getLeafYn().equals("N")) {
  177. cate.setCate1No(cate1.getCate1No());
  178. // 카테고리2 목록
  179. Collection<Cate2> cate2List = displayDao.getCategory2List(cate);
  180. if (cate2List != null && !cate2List.isEmpty()) {
  181. for (Cate2 cate2 : cate2List) {
  182. if (cate2.getLeafYn().equals("N")) {
  183. cate.setCate2No(cate2.getCate2No());
  184. // 카테고리3 목록
  185. Collection<Cate3> cate3List = displayDao.getCategory3List(cate);
  186. if (cate3List != null && !cate3List.isEmpty()) {
  187. for (Cate3 cate3 : cate3List) {
  188. if (cate3.getLeafYn().equals("N")) {
  189. cate.setCate3No(cate3.getCate3No());
  190. // 카테고리4 목록
  191. Collection<Cate4> cate4List = displayDao.getCategory4List(cate);
  192. if (cate4List != null && !cate4List.isEmpty()) {
  193. for (Cate4 cate4 : cate4List) {
  194. if (cate4.getLeafYn().equals("N")) {
  195. cate.setCate4No(cate4.getCate4No());
  196. // 카테고리5 목록 담기
  197. cate4.setCate5List(displayDao.getCategory5List(cate));
  198. }
  199. }
  200. log.info("cate4List: {}", cate4List);
  201. // 카테고리4 목록 담기
  202. cate3.setCate4List(cate4List);
  203. }
  204. }
  205. }
  206. // 카테고리3 목록 담기
  207. cate2.setCate3List(cate3List);
  208. }
  209. }
  210. }
  211. // 카테고리2 목록 담기
  212. cate1.setCate2List(cate2List);
  213. }
  214. }
  215. }
  216. }
  217. return cate1List;
  218. }
  219. }