|
|
@@ -3,6 +3,7 @@ package com.style24.admin.biz.web;
|
|
|
import java.util.Collection;
|
|
|
import java.util.List;
|
|
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
@@ -19,7 +20,9 @@ import com.gagaframework.web.rest.server.GagaResponseStatus;
|
|
|
import com.style24.admin.biz.service.TsaRendererService;
|
|
|
import com.style24.admin.support.controller.TsaBaseController;
|
|
|
import com.style24.admin.support.security.session.TsaSession;
|
|
|
+import com.style24.core.biz.service.TscKakaotalkService;
|
|
|
import com.style24.core.biz.service.TscKcpService;
|
|
|
+import com.style24.core.biz.service.TscMailService;
|
|
|
import com.style24.core.biz.service.TscOrderChangeService;
|
|
|
import com.style24.core.biz.service.TscOrderRefundService;
|
|
|
import com.style24.core.biz.service.TscOrderService;
|
|
|
@@ -59,6 +62,12 @@ public class TsaOrderChangeController extends TsaBaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private TscKcpService coreKcpService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TscKakaotalkService coreKakaotalkService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TscMailService coreMailService;
|
|
|
|
|
|
/**
|
|
|
* 취소요청, 취소완료 통합 화면 (관리자)
|
|
|
@@ -154,12 +163,10 @@ public class TsaOrderChangeController extends TsaBaseController {
|
|
|
@PostMapping("/cnclComplete")
|
|
|
@ResponseBody
|
|
|
public GagaResponse cnclComplete(@RequestBody OrderChange cnclReq) {
|
|
|
-
|
|
|
+ GagaMap result = new GagaMap();
|
|
|
if (cnclReq== null) {
|
|
|
throw new IllegalStateException(message.getMessage("FAIL_1001"));
|
|
|
}
|
|
|
-
|
|
|
- GagaMap map = new GagaMap();
|
|
|
|
|
|
// 1. 세션회원조회
|
|
|
int userNo = TsaSession.getInfo().getUserNo();
|
|
|
@@ -174,7 +181,7 @@ public class TsaOrderChangeController extends TsaBaseController {
|
|
|
|
|
|
// 2. 환불금액계산
|
|
|
// 2021.01.19 취소신청정보를 목록 (주문상세번호, 취소/반품수량) 으로 표현
|
|
|
- map = orderRefundService.cnclRtnRefundAmt2(cnclReqList);
|
|
|
+ GagaMap map = orderRefundService.cnclRtnRefundAmt2(cnclReqList);
|
|
|
|
|
|
// 3. 주문변경 기본정보 설정
|
|
|
map.set("ordNo" , cnclReq.getOrdNo()); // 주문번호
|
|
|
@@ -218,7 +225,7 @@ public class TsaOrderChangeController extends TsaBaseController {
|
|
|
}
|
|
|
// 2021.06.09 취소접수승인
|
|
|
else if ("cnclReqComplete".equals(cnclReq.getReqGbn())) {
|
|
|
- orderChangeService.approveCancelRequest(cnclReq, userNo);
|
|
|
+ result = orderChangeService.approveCancelRequest(cnclReq, userNo);
|
|
|
}
|
|
|
// 2021.06.09 취소접수철회
|
|
|
else if ("cnclReqCancel".equals(cnclReq.getReqGbn())) {
|
|
|
@@ -226,9 +233,34 @@ public class TsaOrderChangeController extends TsaBaseController {
|
|
|
}
|
|
|
// 취소완료
|
|
|
else {
|
|
|
- orderChangeService.partialCancelTemp(map, userNo);
|
|
|
+ result = orderChangeService.partialCancelTemp(map, userNo);
|
|
|
}
|
|
|
|
|
|
+ // 5. 취소 알림톡 및 메일 발송
|
|
|
+ int ordChgSq = result.getInt("ordChgSq");
|
|
|
+
|
|
|
+ if (ordChgSq > 0) {
|
|
|
+ try {
|
|
|
+ // 취소 알림톡 관련 정보 조회
|
|
|
+ OrderChange orderChange = orderChangeService.getKakaoOrderCancelInfo(ordChgSq);
|
|
|
+
|
|
|
+ // 취소 알림톡 발송
|
|
|
+ if (StringUtils.isNotBlank(orderChange.getOrdPhnno())) {
|
|
|
+ coreKakaotalkService.sendOrderCancelComplete(orderChange, userNo);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 취소 안내 메일 정보 조회
|
|
|
+ GagaMap replaceInfo = orderChangeService.getMailOrderCancelReplaceInfo(orderChange);
|
|
|
+
|
|
|
+ // 취소 안내 메일 발송
|
|
|
+ if (StringUtils.isNotBlank(replaceInfo.getString("ordEmail"))) {
|
|
|
+ coreMailService.sendOrderCancel(replaceInfo, userNo);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new IllegalStateException(message.getMessage("FAIL_0004"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return super.ok("성공");
|
|
|
}
|
|
|
|