TsaCustomerController.java 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110
  1. package com.style24.admin.biz.web;
  2. import java.util.Collection;
  3. import org.apache.commons.lang3.StringUtils;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.stereotype.Controller;
  6. import org.springframework.web.bind.annotation.GetMapping;
  7. import org.springframework.web.bind.annotation.PathVariable;
  8. import org.springframework.web.bind.annotation.PostMapping;
  9. import org.springframework.web.bind.annotation.RequestBody;
  10. import org.springframework.web.bind.annotation.RequestMapping;
  11. import org.springframework.web.bind.annotation.RequestParam;
  12. import org.springframework.web.bind.annotation.ResponseBody;
  13. import org.springframework.web.servlet.ModelAndView;
  14. import com.style24.admin.biz.service.TsaCounselService;
  15. import com.style24.admin.biz.service.TsaCustomerService;
  16. import com.style24.admin.biz.service.TsaRendererService;
  17. import com.style24.admin.support.controller.TsaBaseController;
  18. import com.style24.admin.support.security.session.TsaSession;
  19. import com.style24.core.biz.service.TscAnswerPhaseService;
  20. import com.style24.core.biz.service.TscKakaotalkService;
  21. import com.style24.core.biz.service.TscMailService;
  22. import com.style24.core.support.env.TscConstants;
  23. import com.style24.core.support.message.TscMessageByLocale;
  24. import com.style24.core.support.session.TscSession;
  25. import com.style24.core.support.util.CryptoUtils;
  26. import com.style24.persistence.TscPageRequest;
  27. import com.style24.persistence.domain.AnswerPhase;
  28. import com.style24.persistence.domain.Counsel;
  29. import com.style24.persistence.domain.Coupon;
  30. import com.style24.persistence.domain.CustContactHst;
  31. import com.style24.persistence.domain.CustDeliveryAddr;
  32. import com.style24.persistence.domain.CustGrade;
  33. import com.style24.persistence.domain.Customer;
  34. import com.style24.persistence.domain.CustomerSearch;
  35. import com.style24.persistence.domain.GiftCard;
  36. import com.style24.persistence.domain.Point;
  37. import com.style24.persistence.domain.Review;
  38. import lombok.extern.slf4j.Slf4j;
  39. import com.gagaframework.web.parameter.GagaMap;
  40. import com.gagaframework.web.rest.server.GagaResponse;
  41. import com.gagaframework.web.util.GagaStringUtil;
  42. /**
  43. * 고객 Controller
  44. *
  45. * @author gagamel
  46. * @since 2020. 12. 28
  47. */
  48. @Controller
  49. @RequestMapping("/customer")
  50. @Slf4j
  51. public class TsaCustomerController extends TsaBaseController {
  52. @Autowired
  53. private TscMessageByLocale message;
  54. @Autowired
  55. private TsaCounselService counselService;
  56. @Autowired
  57. private TsaRendererService rendererService;
  58. @Autowired
  59. private TscAnswerPhaseService ansPhaseService;
  60. @Autowired
  61. private TsaCustomerService customerService;
  62. @Autowired
  63. private TscKakaotalkService kakaotalkService;
  64. @Autowired
  65. private TscMailService mailService;
  66. /**
  67. * 1:1문의관리 화면
  68. * @return
  69. * @author gagamel
  70. * @since 2020. 12. 24
  71. */
  72. @GetMapping("/onetoone/qna/form")
  73. public ModelAndView oneToOneQnaForm() {
  74. ModelAndView mav = new ModelAndView();
  75. // 사이트 목록
  76. mav.addObject("siteList", rendererService.getAvailCommonCodeList("G000"));
  77. // 상담분류
  78. mav.addObject("counselClsfList", rendererService.getCommonCodeList("G059", "Y", new String[] {"G596"}));
  79. // 상담상태 목록
  80. mav.addObject("ansStatList", rendererService.getAvailCommonCodeList("G060"));
  81. mav.setViewName("customer/OneToOneQnaForm");
  82. return mav;
  83. }
  84. /**
  85. * 1:1문의 목록
  86. * @param counsel - 상담정보
  87. * @return
  88. * @author gagamel
  89. * @since 2020. 12. 24
  90. */
  91. @PostMapping("/onetoone/qna/list")
  92. @ResponseBody
  93. public GagaMap getOneToOneQnaList(@RequestBody Counsel counsel) {
  94. GagaMap result = new GagaMap();
  95. counsel.setPageable(new TscPageRequest(counsel.getPageNo() - 1, counsel.getPageSize()));
  96. counsel.getPageable().setTotalCount(counselService.getOneToOneQnaListCount(counsel));
  97. Collection<Counsel> counselList = counselService.getOneToOneQnaList(counsel);
  98. result.set("pageing", counsel);
  99. result.set("counselList", counselList);
  100. return result;
  101. }
  102. /**
  103. * 1:1문의상세 화면
  104. * @param counselSq -상담일련번호
  105. * @return
  106. * @author gagamel
  107. * @since 2020. 12. 24
  108. */
  109. @GetMapping("/onetoone/qna/detail/form/{counselSq}")
  110. public ModelAndView oneToOneQnaDetailForm(@PathVariable Integer counselSq) {
  111. ModelAndView mav = new ModelAndView();
  112. // 1:1문의 상세 정보
  113. mav.addObject("counselInfo", counselService.getOneToOneQna(counselSq));
  114. // 문의용 답변문구
  115. mav.addObject("ansPhaseList", rendererService.getQnaAnswerPhaseList("G061_20"));
  116. mav.setViewName("customer/OneToOneQnaDetailForm");
  117. return mav;
  118. }
  119. /**
  120. * 문의용 답변문구 조회
  121. * @param ansSq - 답변일련번호
  122. * @param ansClsf - 답변종류
  123. * @return
  124. * @author gagamel
  125. * @since 2020. 12. 24
  126. */
  127. @GetMapping("/qna/answerphase/{ansSq}/{ansClsf}")
  128. @ResponseBody
  129. public AnswerPhase getQnaAnswerPhase(@PathVariable Integer ansSq, @PathVariable String ansClsf) {
  130. AnswerPhase ansPhase = new AnswerPhase();
  131. ansPhase.setAnsSq(ansSq);
  132. ansPhase.setAnsClsf(ansClsf);
  133. return ansPhaseService.getQnaAnswerPhase(ansPhase);
  134. }
  135. /**
  136. * 문의 답변 저장
  137. * @param counsel -상담정보
  138. * @return
  139. * @author gagamel
  140. * @since 2020. 12. 24
  141. */
  142. @PostMapping("/qna/answer/save")
  143. @ResponseBody
  144. public GagaResponse saveQnaAnswer(@RequestBody Counsel counsel) {
  145. counsel.setAnsNo(TsaSession.getInfo().getUserNo());
  146. counsel.setUpdNo(TsaSession.getInfo().getUserNo());
  147. counselService.updateQnaAnswer(counsel);
  148. // 고객이 알림톡답변수신을 요청했을 때
  149. if (counsel.getSmsReqYn().equals("Y")) {
  150. try {
  151. if (counsel.getCounselType().equals("C")) {
  152. // 일대일문의상세 조회
  153. Counsel tCounsel = counselService.getOneToOneQna(counsel.getCounselSq());
  154. // 1:1문의답변완료안내 카카오알림톡 발송
  155. kakaotalkService.sendOneToOneAnswerNotify(tCounsel, tCounsel.getCustNo());
  156. } else if (counsel.getCounselType().equals("G")) {
  157. // 상품문의상세 조회
  158. Counsel tCounsel = counselService.getGoodsQna(counsel.getCounselSq());
  159. // 상품문의답변완료안내 카카오알림톡 발송
  160. kakaotalkService.sendGoodsAskNotify(tCounsel, tCounsel.getCustNo());
  161. }
  162. } catch (Exception e) {
  163. // Do nothing
  164. }
  165. }
  166. return super.ok(message.getMessage("SUCC_0001"));
  167. }
  168. /**
  169. * 상품문의관리 화면
  170. * @return
  171. * @author gagamel
  172. * @since 2020. 12. 24
  173. */
  174. @GetMapping("/goods/qna/form")
  175. public ModelAndView goodsQnaForm() {
  176. ModelAndView mav = new ModelAndView();
  177. // 사이트 목록
  178. mav.addObject("siteList", rendererService.getAvailCommonCodeList("G000"));
  179. // 답변의뢰업체 목록
  180. mav.addObject("supplyCompList", rendererService.getSupplyCompanyList(TsaSession.getInfo().getSupplyCompCd(), "N"));
  181. // 상담상태 목록
  182. mav.addObject("ansStatList", rendererService.getAvailCommonCodeList("G060"));
  183. mav.setViewName("customer/GoodsQnaForm");
  184. return mav;
  185. }
  186. /**
  187. * 상품문의 목록
  188. * @param counsel - 상담정보
  189. * @return
  190. * @author gagamel
  191. * @since 2020. 12. 24
  192. */
  193. @PostMapping("/goods/qna/list")
  194. @ResponseBody
  195. public GagaMap getGoodsQnaList(@RequestBody Counsel counsel) {
  196. GagaMap result = new GagaMap();
  197. counsel.setPageable(new TscPageRequest(counsel.getPageNo() - 1, counsel.getPageSize()));
  198. counsel.getPageable().setTotalCount(counselService.getGoodsQnaListCount(counsel));
  199. Collection<Counsel> counselList = counselService.getGoodsQnaList(counsel);
  200. result.set("pageing", counsel);
  201. result.set("counselList", counselList);
  202. return result;
  203. }
  204. /**
  205. * 상품문의상세 화면
  206. * @param counselSq -상담일련번호
  207. * @return
  208. * @author gagamel
  209. * @since 2020. 12. 24
  210. */
  211. @GetMapping("/goods/qna/detail/form/{counselSq}")
  212. public ModelAndView goodsQnaDetailForm(@PathVariable Integer counselSq) {
  213. ModelAndView mav = new ModelAndView();
  214. // 답변의뢰업체
  215. mav.addObject("supplyCompList", rendererService.getSupplyCompanyList(TsaSession.getInfo().getSupplyCompCd(), "N"));
  216. // 상품문의 상세
  217. mav.addObject("counselInfo", counselService.getGoodsQna(counselSq));
  218. // 문의용 답변문구
  219. mav.addObject("ansPhaseList", rendererService.getQnaAnswerPhaseList("G061_21"));
  220. mav.setViewName("customer/GoodsQnaDetailForm");
  221. return mav;
  222. }
  223. /**
  224. * 상품문의 입점업체에 답변의뢰 (입점상품일 경우)
  225. * @param counsel -상담정보
  226. * @return
  227. * @author gagamel
  228. * @since 2020. 12. 24
  229. */
  230. @PostMapping("/goods/qna/answer/transfer/save")
  231. @ResponseBody
  232. public GagaResponse saveGoodsQnaAnswerTransfer(@RequestBody Counsel counsel) {
  233. counsel.setAnsTransNo(TsaSession.getInfo().getUserNo());
  234. counsel.setUpdNo(TsaSession.getInfo().getUserNo());
  235. counselService.updateGoodsQnaAnswerTransfer(counsel);
  236. return super.ok(message.getMessage("SUCC_0004"));
  237. }
  238. /**
  239. * 활동회원
  240. * @return ModelAndView
  241. * @author jsshin
  242. * @since 2021. 01. 12
  243. */
  244. @GetMapping("/active/list/form")
  245. public ModelAndView customerActiveListForm() {
  246. ModelAndView mav = new ModelAndView();
  247. // 사이트 목록
  248. mav.addObject("siteList", rendererService.getCommonCodeList("G000", "Y"));
  249. // 성별
  250. mav.addObject("genderGbList", rendererService.getCommonCodeList("G007", "Y"));
  251. // 회원 구분
  252. mav.addObject("custGbList", rendererService.getCommonCodeList("G100", "Y"));
  253. // 회원 등급
  254. mav.addObject("custGradeList", rendererService.getCommonCodeList("G110", "Y"));
  255. // 관리대상
  256. mav.addObject("managedRsnList", rendererService.getCommonCodeList("G103", "Y"));
  257. // 간편가입유형
  258. mav.addObject("snsTypeList", rendererService.getCommonCodeList("G105", "Y"));
  259. mav.setViewName("customer/CustomerActiveListForm");
  260. return mav;
  261. }
  262. /**
  263. * 활동회원 목록
  264. * @param customerSearch - 검색조건
  265. * @return Collection<Customer>
  266. * @author jsshin
  267. * @since 2021. 01. 12
  268. */
  269. @PostMapping("/active/list")
  270. @ResponseBody
  271. public GagaMap getCustomerActiveList(@RequestBody CustomerSearch customerSearch) {
  272. GagaMap result = new GagaMap();
  273. // multi row 검색관련 처리
  274. if (!StringUtils.isBlank(customerSearch.getCondition())) {
  275. if (customerSearch.getSearch().equals("custNm") || customerSearch.getSearch().equals("email")) {
  276. String[] multiParams = customerSearch.getCondition().replaceAll("\r", "").split("\n");
  277. for (int i = 0; i < multiParams.length; i++) {
  278. multiParams[i] = CryptoUtils.encryptAES(multiParams[i]);
  279. }
  280. customerSearch.setConditions(multiParams);
  281. } else {
  282. customerSearch.setConditions(customerSearch.getCondition().replaceAll("\r", "").split("\n"));
  283. }
  284. }
  285. // 회원명, 이메일 암호화
  286. if ("custNm".equals(customerSearch.getSearchGb()) || "email".equals(customerSearch.getSearchGb())) {
  287. customerSearch.setSearchTxt(CryptoUtils.encryptAES(customerSearch.getSearchTxt()));
  288. }
  289. if (!"Y".equals(customerSearch.getCpnPubPopYn())) {
  290. customerSearch.setCpnPubPopYn("N");
  291. }
  292. customerSearch.encryptData(); //데이터 암호화 필요
  293. customerSearch.setRegNo(TsaSession.getInfo().getUserNo());
  294. customerSearch.setPageable(new TscPageRequest(customerSearch.getPageNo() - 1, customerSearch.getPageSize()));
  295. customerSearch.getPageable().setTotalCount(customerService.getCustomerActiveListCount(customerSearch));
  296. TscSession.setAttribute("maskingYn", TsaSession.getInfo().getMaskingYn());
  297. result.set("pageing", customerSearch);
  298. result.set("custList", customerService.getCustomerActiveList(customerSearch));
  299. return result;
  300. }
  301. /**
  302. * 회원상세 목록
  303. * @param custNo - 고객번호
  304. * @return ModelAndView
  305. * @author jsshin
  306. * @since 2021. 01. 14
  307. */
  308. @GetMapping("/detail/form/{custNo}")
  309. public ModelAndView getCustomerDetailForm(@PathVariable Integer custNo) {
  310. ModelAndView mav = new ModelAndView();
  311. // 사이트 목록
  312. mav.addObject("siteList", rendererService.getCommonCodeList("G000"));
  313. // 몰구분
  314. mav.addObject("mallGbList", rendererService.getCommonCodeList("G011"));
  315. // 성별
  316. mav.addObject("genderGbList", rendererService.getCommonCodeList("G007"));
  317. // 회원 구분
  318. mav.addObject("custGbList", rendererService.getCommonCodeList("G100", "Y"));
  319. // 회원 등급
  320. mav.addObject("custGradeList", rendererService.getCommonCodeList("G110"));
  321. // 관리대상
  322. mav.addObject("managedRsnList", rendererService.getCommonCodeList("G103"));
  323. // 전화번호국번
  324. mav.addObject("nationalNumberList", rendererService.getCommonCodeList("G095"));
  325. // 휴대폰번호국번
  326. mav.addObject("nationalHpNumberList", rendererService.getCommonCodeList("G096"));
  327. // 이메일도메인
  328. mav.addObject("emailDomainList", rendererService.getCommonCodeList("G097"));
  329. // 상담분류
  330. mav.addObject("counselClsfList", rendererService.getCommonCodeList("G059"));
  331. // 회원접촉유형 목록
  332. mav.addObject("contactTypeList", rendererService.getCommonCodeList("G054"));
  333. // 회원접촉방법 목록
  334. mav.addObject("contactMethodList", rendererService.getCommonCodeList("G055"));
  335. // 주문상태
  336. mav.addObject("orderStatList", rendererService.getCommonCodeList("G012"));
  337. // 주문상세상태
  338. mav.addObject("orderDtlStatList", rendererService.getCommonCodeList("G013"));
  339. // 쿠폰유형
  340. mav.addObject("cpnType", rendererService.getCommonCodeList("G230", "Y"));
  341. // 쿠폰할인방식
  342. //mav.addObject("dcWayList", rendererService.getCommonCodeList("G240"));
  343. // 쿠폰발행사유
  344. mav.addObject("pubReasonList", rendererService.getCommonCodeList("G068"));
  345. // 포인트반영상태
  346. mav.addObject("pntOccurGbList", rendererService.getCommonCodeList("G069"));
  347. // 포인트반영상태
  348. mav.addObject("pntUploadStatList", rendererService.getCommonCodeList("G070"));
  349. // 상품평포인트반영상태
  350. mav.addObject("reviewPntStatList", rendererService.getCommonCodeList("G043"));
  351. // 상품권유형
  352. mav.addObject("giftCardOccurGbList", rendererService.getCommonCodeList("G074"));
  353. mav.addObject("custNo", custNo);
  354. mav.setViewName("customer/CustomerDetailForm");
  355. return mav;
  356. }
  357. /**
  358. * 회원정보
  359. * @param custNo - 고객번호
  360. * @return Customer
  361. * @author jsshin
  362. * @since 2021. 01. 18
  363. */
  364. @GetMapping("/info/{custNo}")
  365. @ResponseBody
  366. public Customer getCustomerInfo(@PathVariable Integer custNo) {
  367. TscSession.setAttribute("maskingYn", TsaSession.getInfo().getMaskingYn());
  368. return customerService.getCustomerInfo(custNo);
  369. }
  370. /**
  371. * 회원정보 수정
  372. * @param customer - 고객정보
  373. * @return Customer
  374. * @author jsshin
  375. * @since 2021. 01. 21
  376. */
  377. @PostMapping("/info/save")
  378. @ResponseBody
  379. public GagaResponse saveCustomerInfo(@RequestBody Customer customer) {
  380. customerService.saveCustomerInfo(customer);
  381. return ok(message.getMessage("SUCC_0002"));
  382. }
  383. /**
  384. * 회원비밀번호초기화
  385. *
  386. * @param customer -고객정보
  387. * @return GagaResponse
  388. * @throws Exception
  389. * @author jsshin
  390. * @since 2021. 01. 21
  391. */
  392. @PostMapping("/password/reset")
  393. @ResponseBody
  394. public GagaResponse resetCustomerPassword(@RequestBody Customer customer) {
  395. Customer custInfo = customerService.getCustomerInfo(customer.getCustNo());
  396. // 비밀번호 수정
  397. customerService.saveCustomerPassword(custInfo);
  398. return ok(message.getMessage("SUCC_0005"));
  399. }
  400. /**
  401. * 메시지 발송 팝업 화면
  402. *
  403. * @param elementCellPhnno - 휴대폰
  404. * @param elementCustNo - 고객일련번호
  405. * @param maskingCellPhnno - 마스킹된 휴대폰
  406. * @return ModelAndView
  407. * @author jsshin
  408. * @since 2021. 01. 21
  409. */
  410. @GetMapping("/lms/popup/form")
  411. public ModelAndView lmsPopupForm(@RequestParam(value = "elementCellPhnno", required = false) String elementCellPhnno, @RequestParam(value = "elementCustNo") String elementCustNo, @RequestParam(value = "elementMaskingCellPhnno", required = false) String maskingCellPhnno, @RequestParam(value = "pageGb", required = false) String pageGb) {
  412. ModelAndView mav = new ModelAndView();
  413. // 휴대폰 번호
  414. mav.addObject("elementCellPhnno", elementCellPhnno);
  415. // 휴대폰 번호
  416. mav.addObject("maskingCellPhnno", StringUtils.defaultString(maskingCellPhnno, ""));
  417. // 고객 아이디
  418. mav.addObject("elementCustNo", elementCustNo);
  419. mav.addObject("callBack", TscConstants.CALLCENTER_TEL_NO);
  420. mav.addObject("pageGb", StringUtils.defaultString(pageGb, ""));
  421. mav.setViewName("customer/LmsPopupForm");
  422. return mav;
  423. }
  424. /**
  425. * 메시지 발송
  426. *
  427. * @param customer -고객정보
  428. * @return GagaResponse
  429. * @author jsshin
  430. * @since 2021. 01. 21
  431. */
  432. @PostMapping("/message/send")
  433. @ResponseBody
  434. public GagaResponse sendMessage(@RequestBody Customer customer) {
  435. Customer custInfo = customerService.getCustomerInfo(customer.getCustNo());
  436. customer.setCustNm(custInfo.getCustNm());
  437. customer.setCustNo(custInfo.getCustNo());
  438. if (StringUtils.isNotBlank(customer.getCellPhnno())) {
  439. Integer userNo = TsaSession.getInfo().getUserNo();
  440. kakaotalkService.sendCustomerBasicLms(customer, userNo);
  441. }
  442. return super.ok(message.getMessage("SUCC_0005"));
  443. }
  444. /**
  445. * 메시지 발송
  446. *
  447. * @param customer -고객정보
  448. * @return GagaResponse
  449. * @author jsshin
  450. * @since 2021. 01. 21
  451. */
  452. @PostMapping("/message/send2")
  453. @ResponseBody
  454. public GagaResponse sendLms(@RequestBody Customer customer) {
  455. Customer custInfo = customerService.getCustomerInfo(customer.getCustNo());
  456. customer.setCustNm(custInfo.getCustNm());
  457. customer.setCustNo(custInfo.getCustNo());
  458. if (StringUtils.isNotBlank(customer.getCellPhnno())) {
  459. Integer userNo = TsaSession.getInfo().getUserNo();
  460. kakaotalkService.sendBasicLms(customer, userNo);
  461. }
  462. return super.ok(message.getMessage("SUCC_0005"));
  463. }
  464. /**
  465. * 메시지 발송 팝업 화면
  466. *
  467. * @param elementCellPhnno - 휴대폰
  468. * @param elementCustNo - 고객일련번호
  469. * @return ModelAndView
  470. * @author jsshin
  471. * @since 2021. 01. 25
  472. */
  473. @GetMapping("/cellphone/change/popup/form")
  474. public ModelAndView cellphoneChangePopupForm(@RequestParam(value = "elementCellPhnno", required = false) String elementCellPhnno, @RequestParam(value = "elementCustNo") String elementCustNo) {
  475. ModelAndView mav = new ModelAndView();
  476. // 휴대폰 번호
  477. mav.addObject("elementCellPhnno", elementCellPhnno);
  478. // 고객 아이디
  479. mav.addObject("elementCustNo", elementCustNo);
  480. mav.addObject("callBack", TscConstants.CALLCENTER_TEL_NO);
  481. mav.setViewName("customer/CellphoneChangePopupForm");
  482. return mav;
  483. }
  484. /**
  485. * 인증번호 발송
  486. *
  487. * @param customer -고객정보
  488. * @return GagaResponse
  489. * @author jsshin
  490. * @since 2021. 01. 21
  491. */
  492. @PostMapping("/certno/send")
  493. @ResponseBody
  494. public GagaResponse sendCustomerCertNo(@RequestBody Customer customer) {
  495. // 1.기존 사용하고 있는 고객이 있는지 확인
  496. int custCnt = customerService.getCustomerFindByCellPhone(customer.getCellPhnno());
  497. if (custCnt > 0) {
  498. throw new IllegalStateException("해당 휴대전화번호로 사용하고 있는 고객이 있습니다.");
  499. }
  500. String certNo = GagaStringUtil.getRandomNumber(6);
  501. TsaSession.setAttribute("certNo", certNo);
  502. TsaSession.setAttribute("cellPhnno", customer.getCellPhnno());
  503. Customer custInfo = customerService.getCustomerInfo(customer.getCustNo());
  504. customer.setCustNm(custInfo.getCustNm());
  505. customer.setCertNo(certNo);
  506. log.info("certNo {}", certNo);
  507. // 카카오알림톡 발송(카카오 템플릿 문구검수 후 변경 해야함)
  508. // 광고가 아니므로 SMS수신동의여부 체크할 필요 없음. 무조건 발송해야 함
  509. if (StringUtils.isNotBlank(customer.getCellPhnno())) {
  510. Integer userNo = TsaSession.getInfo().getUserNo();
  511. kakaotalkService.sendCustomerCertNo(customer, userNo);
  512. }
  513. return super.ok(message.getMessage("SUCC_0005"));
  514. }
  515. /**
  516. * 인증번호 확인
  517. *
  518. * @param customer -고객정보
  519. * @return GagaMap
  520. * @author jsshin
  521. * @since 2021. 01. 25
  522. */
  523. @PostMapping("/certno/confirm")
  524. @ResponseBody
  525. public GagaMap confirmCustomerCertNo(@RequestBody Customer customer) {
  526. String certNo = TsaSession.getAttribute("certNo");
  527. String cellPhnno = TsaSession.getAttribute("cellPhnno");
  528. String crtfdNoYn = "N";
  529. if (certNo.equals(customer.getCertNo())) {
  530. customer.setCellPhnno(cellPhnno);
  531. if (StringUtils.isNotBlank(cellPhnno)) {
  532. customerService.updateCustomerCellphnno(customer);
  533. }
  534. crtfdNoYn = "Y";
  535. }
  536. GagaMap result = new GagaMap();
  537. result.setString("crtfdNoYn", crtfdNoYn);
  538. return result;
  539. }
  540. /**
  541. * 메일 발송 팝업 화면
  542. *
  543. * @param elementEmail - 이메일
  544. * @param elementCustNo - 고객일련번호
  545. * @param elementMaskingEmail - 마스킹 이메일
  546. * @return ModelAndView
  547. * @author jsshin
  548. * @since 2021. 01. 21
  549. */
  550. @GetMapping("/email/popup/form")
  551. public ModelAndView emailPopupForm(@RequestParam(value = "elementEmail") String elementEmail, @RequestParam(value = "elementCustNo") String elementCustNo, @RequestParam(value = "elementMaskingEmail", required = false) String elementMaskingEmail) {
  552. ModelAndView mav = new ModelAndView();
  553. // 받는사람 이메일
  554. mav.addObject("elementEmail", elementEmail);
  555. // 마스킹된 이메일
  556. mav.addObject("elementMaskingEmail", StringUtils.defaultString(elementMaskingEmail, ""));
  557. // 고객 번호
  558. mav.addObject("elementCustNo", elementCustNo);
  559. mav.addObject("sendEmail", TscConstants.REP_EMAIL);
  560. mav.setViewName("customer/EmailPopupForm");
  561. return mav;
  562. }
  563. /**
  564. * 이메일 발송
  565. *
  566. * @param customer -고객정보
  567. * @return GagaResponse
  568. * @throws Exception
  569. * @author jsshin
  570. * @since 2021. 01. 21
  571. */
  572. @PostMapping("/email/send")
  573. @ResponseBody
  574. public GagaResponse sendEmail(@RequestBody Customer customer) throws Exception {
  575. Customer custInfo = customerService.getCustomerInfo(customer.getCustNo());
  576. customer.setCustNm(custInfo.getCustNm());
  577. // 메일 발송
  578. if (StringUtils.isNotBlank(customer.getEmail())) {
  579. mailService.sendBasicMail(customer, TsaSession.getInfo().getUserNo());
  580. }
  581. return super.ok(message.getMessage("SUCC_0005"));
  582. }
  583. /**
  584. * 회원탈퇴처리 화면
  585. *
  586. * @param elementCustNo - 고객일련번호
  587. * @return ModelAndView
  588. * @author jsshin
  589. * @since 2021. 01. 21
  590. */
  591. @GetMapping("/secede/popup/form")
  592. public ModelAndView emailPopupForm(@RequestParam(value = "elementCustNo") String elementCustNo) {
  593. ModelAndView mav = new ModelAndView();
  594. // 고객일련번호
  595. mav.addObject("elementCustNo", elementCustNo);
  596. // 탈퇴 구분
  597. mav.addObject("secedeRsnList", rendererService.getCommonCodeList("G102", "Y"));
  598. mav.setViewName("customer/CustomerSecedePopupForm");
  599. return mav;
  600. }
  601. /**
  602. * 회원탈퇴처리
  603. *
  604. * @param customer - 고객일련번호
  605. * @return GagaMap
  606. * @author jsshin
  607. * @since 2021. 01. 21
  608. */
  609. @PostMapping("/secede/save")
  610. @ResponseBody
  611. public GagaMap saveCustomerSecede(@RequestBody Customer customer) {
  612. Integer userNo = TsaSession.getInfo().getUserNo();
  613. customer.setRegNo(userNo);
  614. customer.setUpdNo(userNo);
  615. return customerService.saveCustomerSecede(customer);
  616. }
  617. /**
  618. * 회원상세-주문내역목록
  619. *
  620. * @param customerSearch -고객일련번호, 페이징
  621. * @return Collection<Order>
  622. * @author jsshin
  623. * @since 2021. 01. 21
  624. */
  625. @PostMapping("/order/list")
  626. @ResponseBody
  627. public GagaMap getCustomerOrderList(@RequestBody CustomerSearch customerSearch) {
  628. GagaMap result = new GagaMap();
  629. customerSearch.setRegNo(TsaSession.getInfo().getUserNo());
  630. customerSearch.setPageable(new TscPageRequest(customerSearch.getPageNo() - 1, customerSearch.getPageSize()));
  631. customerSearch.getPageable().setTotalCount(customerService.getCustomerOrderListCount(customerSearch));
  632. result.set("pageing", customerSearch);
  633. result.set("custOrderList", customerService.getCustomerOrderList(customerSearch));
  634. return result;
  635. }
  636. /**
  637. * 회원상세-주소정보
  638. *
  639. * @param custNo -고객일련번호
  640. * @return Collection<Delivery>
  641. * @author jsshin
  642. * @since 2021. 01. 21
  643. */
  644. @GetMapping("/delivery/list/{custNo}")
  645. @ResponseBody
  646. public Collection<CustDeliveryAddr> getCustomerDeliveryList(@PathVariable Integer custNo) {
  647. return customerService.getCustomerDeliveryAddrList(custNo);
  648. }
  649. /**
  650. * 회원상세 - 주소지 저장
  651. *
  652. * @param custDeliveryAddr - 고객배송지정보
  653. * @return GagaResponse
  654. * @author jsshin
  655. * @since 2021. 1. 21.
  656. */
  657. @PostMapping("/delivery/addr/save")
  658. @ResponseBody
  659. public GagaResponse saveCustomerDeliveryAddr(@RequestBody CustDeliveryAddr custDeliveryAddr) {
  660. customerService.saveCustomerDeliveryAddr(custDeliveryAddr);
  661. return super.ok(message.getMessage("SUCC_0001"));
  662. }
  663. /**
  664. * 회원상세-쿠폰내역
  665. *
  666. * @param custNo -고객일련번호
  667. * @return Collection<Coupon>
  668. * @author jsshin
  669. * @since 2021. 01. 21
  670. */
  671. @GetMapping("/coupon/list/{custNo}")
  672. @ResponseBody
  673. public Collection<Coupon> getCustomerCouponList(@PathVariable Integer custNo) {
  674. return customerService.getCustomerCouponList(custNo);
  675. }
  676. /**
  677. * 회원상세-포인트
  678. *
  679. * @param custNo -고객일련번호
  680. * @return Point
  681. * @author jsshin
  682. * @since 2021. 01. 21
  683. */
  684. @GetMapping("/point/{custNo}")
  685. @ResponseBody
  686. public Point getCustomerPoint(@PathVariable Integer custNo) {
  687. return customerService.getCustomerPoint(custNo);
  688. }
  689. /**
  690. * 회원상세-포인트내역
  691. *
  692. * @param custNo -고객일련번호
  693. * @return Collection<TsaPoint>
  694. * @author jsshin
  695. * @since 2021. 01. 21
  696. */
  697. @GetMapping("/point/list/{custNo}")
  698. @ResponseBody
  699. public Collection<Point> getCustomerPointList(@PathVariable Integer custNo) {
  700. return customerService.getCustomerPointList(custNo);
  701. }
  702. /**
  703. * 회원상세-1:1문의내역
  704. *
  705. * @param custNo -고객일련번호
  706. * @return Collection<Counsel>
  707. * @author jsshin
  708. * @since 2021. 01. 21
  709. */
  710. @GetMapping("/giftcard/list/{custNo}")
  711. @ResponseBody
  712. public Collection<GiftCard> getCustomerGiftCardList(@PathVariable Integer custNo) {
  713. return customerService.getCustomerGiftCardList(custNo);
  714. }
  715. /**
  716. * 회원상세-1:1문의내역
  717. *
  718. * @param custNo -고객일련번호
  719. * @return Collection<Counsel>
  720. * @author jsshin
  721. * @since 2021. 01. 21
  722. */
  723. @GetMapping("/counsel/list/{custNo}")
  724. @ResponseBody
  725. public Collection<Counsel> getCustomerCounselList(@PathVariable Integer custNo) {
  726. return customerService.getCustomerCounselList(custNo);
  727. }
  728. /**
  729. * 회원상세-상품문의내역
  730. *
  731. * @param custNo -고객일련번호
  732. * @return Collection<Counsel>
  733. * @author jsshin
  734. * @since 2021. 01. 21
  735. */
  736. @GetMapping("/goodsQna/list/{custNo}")
  737. @ResponseBody
  738. public Collection<Counsel> getCustomerGoodsQnaList(@PathVariable Integer custNo) {
  739. return customerService.getCustomerGoodsQnaList(custNo);
  740. }
  741. /**
  742. * 회원상세-상품평내역
  743. *
  744. * @param custNo -고객일련번호
  745. * @return Collection<TsaReview>
  746. * @author jsshin
  747. * @since 2021. 01. 21
  748. */
  749. @GetMapping("/review/list/{custNo}")
  750. @ResponseBody
  751. public Collection<Review> getCustomerReviewList(@PathVariable Integer custNo) {
  752. return customerService.getCustomerReviewList(custNo);
  753. }
  754. /**
  755. * 회원상세-회원등급변경이력
  756. *
  757. * @param custNo -고객일련번호
  758. * @return Collection<TsaCustomer>
  759. * @author jsshin
  760. * @since 2021. 01. 21
  761. */
  762. @GetMapping("/change/grade/list/{custNo}")
  763. @ResponseBody
  764. public Collection<CustGrade> getCustomerChageGradeList(@PathVariable Integer custNo) {
  765. return customerService.getCustomerChangeGradeList(custNo);
  766. }
  767. /**
  768. * 회원상세-회원접촉이력
  769. *
  770. * @param custNo -고객일련번호
  771. * @return Collection<Customer>
  772. * @author jsshin
  773. * @since 2021. 01. 21
  774. */
  775. @GetMapping("/contact/list/{custNo}")
  776. @ResponseBody
  777. public Collection<CustContactHst> getCustomerContactList(@PathVariable Integer custNo) {
  778. return customerService.getCustomerContactList(custNo);
  779. }
  780. /**
  781. * 회원상세-회원접촉이력 생성
  782. *
  783. * @param custContactHst -고객정보
  784. * @return GagaResponse
  785. * @author jsshin
  786. * @since 2021. 01. 21
  787. */
  788. @PostMapping("/contact/create")
  789. @ResponseBody
  790. public GagaResponse createCustomerContactHistory(@RequestBody CustContactHst custContactHst) {
  791. customerService.createCustomerContactHistory(custContactHst);
  792. return super.ok(message.getMessage("SUCC_0001"));
  793. }
  794. /**
  795. * 탈퇴회원
  796. * @return ModelAndView
  797. * @author jsshin
  798. * @since 2020. 01. 14
  799. */
  800. @GetMapping("/secede/list/form")
  801. public ModelAndView customerSecedeListForm() {
  802. ModelAndView mav = new ModelAndView();
  803. // 사이트 목록
  804. mav.addObject("siteList", rendererService.getCommonCodeList("G000", "Y"));
  805. // 탈퇴 구분
  806. mav.addObject("secedeRsnList", rendererService.getCommonCodeList("G102", "Y"));
  807. mav.setViewName("customer/CustomerSecedeListForm");
  808. return mav;
  809. }
  810. /**
  811. * 탈퇴회원 목록
  812. * @param customerSearch - 검색조건
  813. * @return Collection<Customer>
  814. * @author jsshin
  815. * @since 2020. 01. 14
  816. */
  817. @PostMapping("/secede/list")
  818. @ResponseBody
  819. public GagaMap getCustomerSecedeList(@RequestBody CustomerSearch customerSearch) {
  820. GagaMap result = new GagaMap();
  821. // 회원명, 이메일 암호화
  822. if ("custNm".equals(customerSearch.getSearchGb()) || "email".equals(customerSearch.getSearchGb())) {
  823. customerSearch.setSearchTxt(CryptoUtils.encryptAES(customerSearch.getSearchTxt()));
  824. }
  825. customerSearch.encryptData(); //데이터 암호화 필요
  826. customerSearch.setRegNo(TsaSession.getInfo().getUserNo()); // 엑셀조회시 로그인 사용자의 엑셀 상품조회시 사용
  827. customerSearch.setPageable(new TscPageRequest(customerSearch.getPageNo() - 1, customerSearch.getPageSize()));
  828. customerSearch.getPageable().setTotalCount(customerService.getCustomerSecedeListCount(customerSearch));
  829. TscSession.setAttribute("maskingYn", TsaSession.getInfo().getMaskingYn());
  830. result.set("pageing", customerSearch);
  831. result.set("custList", customerService.getCustomerSecedeList(customerSearch));
  832. return result;
  833. }
  834. /**
  835. * 휴면회원
  836. * @return ModelAndView
  837. * @author jsshin
  838. * @since 2020. 01. 14
  839. */
  840. @GetMapping("/dormant/list/form")
  841. public ModelAndView customerDormantListForm() {
  842. ModelAndView mav = new ModelAndView();
  843. // 사이트 목록
  844. mav.addObject("siteList", rendererService.getCommonCodeList("G000", "Y"));
  845. mav.setViewName("customer/CustomerDormantListForm");
  846. return mav;
  847. }
  848. /**
  849. * 휴면회원 목록
  850. * @param customerSearch - 검색조건
  851. * @return Collection<Customer>
  852. * @author jsshin
  853. * @since 2020. 01. 14
  854. */
  855. @PostMapping("/dormant/list")
  856. @ResponseBody
  857. public GagaMap getCustomerDormantList(@RequestBody CustomerSearch customerSearch) {
  858. GagaMap result = new GagaMap();
  859. // 회원명, 이메일 암호화
  860. if ("custNm".equals(customerSearch.getSearchGb()) || "email".equals(customerSearch.getSearchGb())) {
  861. customerSearch.setSearchTxt(CryptoUtils.encryptAES(customerSearch.getSearchTxt()));
  862. }
  863. customerSearch.encryptData(); //데이터 암호화 필요
  864. customerSearch.setRegNo(TsaSession.getInfo().getUserNo()); // 엑셀조회시 로그인 사용자의 엑셀 상품조회시 사용
  865. customerSearch.setPageable(new TscPageRequest(customerSearch.getPageNo() - 1, customerSearch.getPageSize()));
  866. customerSearch.getPageable().setTotalCount(customerService.getCustomerDormantListCount(customerSearch));
  867. TscSession.setAttribute("maskingYn", TsaSession.getInfo().getMaskingYn());
  868. result.set("pageing", customerSearch);
  869. result.set("custList", customerService.getCustomerDormantList(customerSearch));
  870. return result;
  871. }
  872. /**
  873. * 휴면해제 처리
  874. * @param customerCollection - 휴면해제대상목록
  875. * @return GagaMap - 결과
  876. * @author jsshin
  877. * @since 2020. 01. 14
  878. */
  879. @PostMapping("/dormant/release")
  880. @ResponseBody
  881. public GagaMap releaseDormantCustomer(@RequestBody Collection<Customer> customerCollection) {
  882. GagaMap result = new GagaMap();
  883. int totalCnt = customerCollection.size();
  884. int succCnt = 0;
  885. int failCnt = 0;
  886. for (Customer customer : customerCollection) {
  887. try {
  888. boolean isRelase = customerService.releaseDormantCustomer(customer);
  889. if (isRelase) {
  890. succCnt++;
  891. } else {
  892. failCnt++;
  893. }
  894. } catch (Exception e) {
  895. log.error(e.getMessage());
  896. failCnt++;
  897. }
  898. }
  899. result.setInt("totalCnt", totalCnt);
  900. result.setInt("succCnt", succCnt);
  901. result.setInt("failCnt", failCnt);
  902. return result;
  903. }
  904. /**
  905. * 탈퇴이력 삭제
  906. *
  907. * @param customerCollection - 탈퇴이력 삭제
  908. * @return GagaMap - 결과
  909. * @author jsshin
  910. * @since 2020. 01. 14
  911. */
  912. @PostMapping("/secede/delete")
  913. @ResponseBody
  914. public GagaMap deleteSecedCustomer(@RequestBody Collection<Customer> customerCollection) {
  915. GagaMap result = new GagaMap();
  916. int totalCnt = customerCollection.size();
  917. int succCnt = 0;
  918. int failCnt = 0;
  919. for (Customer customer : customerCollection) {
  920. try {
  921. customerService.deleteSecedeCustomer(customer.getCustNo());
  922. succCnt++;
  923. } catch (Exception e) {
  924. log.error(e.getMessage());
  925. failCnt++;
  926. }
  927. }
  928. result.setInt("totalCnt", totalCnt);
  929. result.setInt("succCnt", succCnt);
  930. result.setInt("failCnt", failCnt);
  931. return result;
  932. }
  933. }