TsaCustomerController.java 26 KB

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