|
@@ -1,6 +1,8 @@
|
|
|
package com.style24.core.biz.service;
|
|
package com.style24.core.biz.service;
|
|
|
|
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
|
+import java.util.Calendar;
|
|
|
import java.util.Collection;
|
|
import java.util.Collection;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
@@ -14,9 +16,13 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.gagaframework.excel.env.GagaExcelConstants;
|
|
import com.gagaframework.excel.env.GagaExcelConstants;
|
|
|
import com.gagaframework.excel.xssf.GagaExcelResultHandler;
|
|
import com.gagaframework.excel.xssf.GagaExcelResultHandler;
|
|
|
import com.gagaframework.web.parameter.GagaMap;
|
|
import com.gagaframework.web.parameter.GagaMap;
|
|
|
|
|
+import com.gagaframework.web.rest.server.GagaResponseStatus;
|
|
|
import com.style24.core.biz.dao.TscOrderDao;
|
|
import com.style24.core.biz.dao.TscOrderDao;
|
|
|
|
|
+import com.style24.core.biz.dao.TscPointDao;
|
|
|
|
|
+import com.style24.core.support.env.TscConstants;
|
|
|
import com.style24.core.support.message.TscMessageByLocale;
|
|
import com.style24.core.support.message.TscMessageByLocale;
|
|
|
import com.style24.persistence.domain.Order;
|
|
import com.style24.persistence.domain.Order;
|
|
|
|
|
+import com.style24.persistence.domain.Point;
|
|
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
|
@@ -38,6 +44,9 @@ public class TscOrderService {
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private TscOrderDao orderDao;
|
|
private TscOrderDao orderDao;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private TscPointService pointService;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ObjectMapper mapper;
|
|
private ObjectMapper mapper;
|
|
@@ -833,175 +842,74 @@ public class TscOrderService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 마이페이지 주문 정보 조회
|
|
|
|
|
|
|
+ * 구매확정 처리
|
|
|
*
|
|
*
|
|
|
* @param Order
|
|
* @param Order
|
|
|
|
|
+ * @result GagaMap
|
|
|
* @author card007
|
|
* @author card007
|
|
|
- * @since 2021. 02. 04
|
|
|
|
|
|
|
+ * @since 2021. 02. 17
|
|
|
*/
|
|
*/
|
|
|
- public Collection<GagaMap> getOrderListForMypage(Order order) {
|
|
|
|
|
- Collection<GagaMap> mapList = new ArrayList<>();
|
|
|
|
|
- List<Order> orderList = new ArrayList<>();
|
|
|
|
|
- int ordNo = 0;
|
|
|
|
|
- String ordDt = "";
|
|
|
|
|
- String delvFeeCd = "";
|
|
|
|
|
- String ordDtlStat = "";
|
|
|
|
|
- String shotDelvYn = "";
|
|
|
|
|
- String selfGoodsYn = "";
|
|
|
|
|
- String shipCompNm = "";
|
|
|
|
|
- String invoiceNo = "";
|
|
|
|
|
- String giftPackYn = "";
|
|
|
|
|
- int reviewSq = 0;
|
|
|
|
|
- int index = 0;
|
|
|
|
|
- int ordDtlStatCnt = 0;
|
|
|
|
|
- int rowspan = 0;
|
|
|
|
|
-
|
|
|
|
|
- for (Order tmpOrder : orderDao.getOrderListForMypage(order)) {
|
|
|
|
|
- // 주문번호, 배송구분(총알배송, 일반배송, 업체직배송), 배송정책 변경
|
|
|
|
|
- if (ordNo != tmpOrder.getOrdNo() || !selfGoodsYn.equals(tmpOrder.getSelfGoodsYn()) || ("N".equals(tmpOrder.getSelfGoodsYn()) && !delvFeeCd.equals(tmpOrder.getDelvFeeCd())) || !shotDelvYn.equals(tmpOrder.getShotDelvYn())) {
|
|
|
|
|
- // 데이터 설정
|
|
|
|
|
- if (index > 0) {
|
|
|
|
|
- GagaMap map = new GagaMap();
|
|
|
|
|
- map.set("ordNo", ordNo); // 주문번호
|
|
|
|
|
- map.set("ordDt", ordDt); // 주문일시
|
|
|
|
|
- map.set("shotDelvYn", shotDelvYn); // 총알배송여부
|
|
|
|
|
- map.set("selfGoodsYn", selfGoodsYn); // 자사여부
|
|
|
|
|
- map.set("ordDtlStat", ordDtlStat); // 주문상태코드
|
|
|
|
|
- map.set("shipCompNm", shipCompNm); // 배송업체명
|
|
|
|
|
- map.set("invoiceNo", invoiceNo); // 송장번호
|
|
|
|
|
- map.set("giftPackYn", giftPackYn); // 선물하기여부
|
|
|
|
|
- map.set("reviewSq", reviewSq); // 리뷰일련번호
|
|
|
|
|
- map.set("orderList", setOrderListParameter(orderList, rowspan, ordDtlStatCnt, "Y")); // 주문내역
|
|
|
|
|
- mapList.add(map);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 데이터 설정 후 초기화 진행
|
|
|
|
|
- ordNo = tmpOrder.getOrdNo();
|
|
|
|
|
- ordDt = tmpOrder.getOrdDt();
|
|
|
|
|
- delvFeeCd = tmpOrder.getDelvFeeCd();
|
|
|
|
|
- ordDtlStat = tmpOrder.getOrdDtlStat();
|
|
|
|
|
- shotDelvYn = tmpOrder.getShotDelvYn();
|
|
|
|
|
- selfGoodsYn = tmpOrder.getSelfGoodsYn();
|
|
|
|
|
- shipCompNm = tmpOrder.getShipCompNm();
|
|
|
|
|
- invoiceNo = tmpOrder.getInvoiceNo();
|
|
|
|
|
- reviewSq = tmpOrder.getReviewSq();
|
|
|
|
|
- giftPackYn = tmpOrder.getGiftPackYn();
|
|
|
|
|
- orderList = new ArrayList<>();
|
|
|
|
|
- ordDtlStatCnt = 0;
|
|
|
|
|
- rowspan = 0;
|
|
|
|
|
- } else if (index > 0 && !ordDtlStat.equals(tmpOrder.getOrdDtlStat())) {
|
|
|
|
|
- // 주문내역 데이터 추가
|
|
|
|
|
- orderList = setOrderListParameter(orderList, rowspan, ordDtlStatCnt, "N");
|
|
|
|
|
-
|
|
|
|
|
- // 상태 별 배너 설정 후 초기화 진행
|
|
|
|
|
- ordDtlStat = tmpOrder.getOrdDtlStat();
|
|
|
|
|
- rowspan = 0;
|
|
|
|
|
|
|
+ @Transactional("shopTxnManager")
|
|
|
|
|
+ public GagaMap decideOrder(Order order) {
|
|
|
|
|
+ GagaMap result = new GagaMap();
|
|
|
|
|
+
|
|
|
|
|
+ Integer custNo = order.getCustNo();
|
|
|
|
|
+ Integer ordNo = order.getOrdNo();
|
|
|
|
|
+ Integer reviewSq = order.getReviewSq();
|
|
|
|
|
+ Integer regNo = order.getRegNo();
|
|
|
|
|
+ Integer updNo = order.getUpdNo();
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ for (Integer ordDtlNo : order.getOrdDtlNoArr()) {
|
|
|
|
|
+ // 구매확정 포인트 적립
|
|
|
|
|
+ int savePntAmt = pointService.getOrderDecisionPoint(ordDtlNo);
|
|
|
|
|
+
|
|
|
|
|
+ Point point = new Point();
|
|
|
|
|
+ point.setCustNo(custNo);
|
|
|
|
|
+ point.setGvPntAmt(savePntAmt);
|
|
|
|
|
+ point.setUsPntAmt(0);
|
|
|
|
|
+ point.setRmPntAmt(savePntAmt);
|
|
|
|
|
+ point.setExpBeDt(getExpBeDt());
|
|
|
|
|
+ point.setOccurGb(TscConstants.PointOccurGb.EXPECT_POINT.value());
|
|
|
|
|
+ point.setOccurDtlDesc("구매확정");
|
|
|
|
|
+ point.setPntAmt(savePntAmt);
|
|
|
|
|
+ point.setOrdNo(ordNo);
|
|
|
|
|
+ point.setOrdDtlNo(ordDtlNo);
|
|
|
|
|
+ point.setReviewSq(reviewSq);
|
|
|
|
|
+ point.setPntUploadStat(TscConstants.PntUploadStat.APPLY_COMPLETE.value());
|
|
|
|
|
+ point.setRegNo(regNo);
|
|
|
|
|
+ point.setUpdNo(updNo);
|
|
|
|
|
+
|
|
|
|
|
+ pointService.saveCustomerPoint(point);
|
|
|
|
|
+
|
|
|
|
|
+ // 주문상세 상태값 변경
|
|
|
|
|
+ order.setOrdDtlStat(TscConstants.OrderDetailStat.PURCHASE_CONFIRM.value());
|
|
|
|
|
+ order.setOrdDtlNo(ordDtlNo);
|
|
|
|
|
+ orderDao.changedOrdDtlStat(order);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- // 주문내역 설정
|
|
|
|
|
- orderList.add(tmpOrder);
|
|
|
|
|
-
|
|
|
|
|
- // 인덱스 처리
|
|
|
|
|
- index++;
|
|
|
|
|
- ordDtlStatCnt++;
|
|
|
|
|
- rowspan++;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ result.set("message", message.getMessage("SUCC_0004"));
|
|
|
|
|
+ result.set("status", GagaResponseStatus.SUCCESS.getCode());
|
|
|
|
|
+ } catch(Exception e) {
|
|
|
|
|
+ result.set("message", message.getMessage("FAIL_1003"));
|
|
|
|
|
+ result.set("status", GagaResponseStatus.FAIL.getCode());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 마지막 데이터 설정
|
|
|
|
|
- GagaMap map = new GagaMap();
|
|
|
|
|
- map.set("ordNo", ordNo);
|
|
|
|
|
- map.set("ordDt", ordDt);
|
|
|
|
|
- map.set("shotDelvYn", shotDelvYn);
|
|
|
|
|
- map.set("selfGoodsYn", selfGoodsYn);
|
|
|
|
|
- map.set("ordDtlStat", ordDtlStat);
|
|
|
|
|
- map.set("shipCompNm", shipCompNm);
|
|
|
|
|
- map.set("invoiceNo", invoiceNo);
|
|
|
|
|
- map.set("giftPackYn", giftPackYn);
|
|
|
|
|
- map.set("reviewSq", reviewSq);
|
|
|
|
|
- map.set("orderList", setOrderListParameter(orderList, rowspan, ordDtlStatCnt, "Y"));
|
|
|
|
|
- mapList.add(map);
|
|
|
|
|
-
|
|
|
|
|
- return mapList;
|
|
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 마이페이지 주문내역 데이터 추가
|
|
|
|
|
|
|
+ * 구매확정 만료예정일 계산
|
|
|
*
|
|
*
|
|
|
- * @param List<Order>
|
|
|
|
|
- * @return List<Order>
|
|
|
|
|
|
|
+ * @result String
|
|
|
* @author card007
|
|
* @author card007
|
|
|
- * @since 2021. 02. 08
|
|
|
|
|
|
|
+ * @since 2021. 02. 17
|
|
|
*/
|
|
*/
|
|
|
- private List<Order> setOrderListParameter(List<Order> orderList, int rowspan, int ordDtlStatCnt, String setLastBanner) {
|
|
|
|
|
- // rowspan 설정
|
|
|
|
|
- for (int i = 0;i <= rowspan;i++) {
|
|
|
|
|
- if (i == rowspan) {
|
|
|
|
|
- orderList.get(ordDtlStatCnt - rowspan).setRowspan(rowspan);
|
|
|
|
|
- } else if (rowspan == 1){
|
|
|
|
|
- orderList.get(ordDtlStatCnt - rowspan).setRowspan(1);
|
|
|
|
|
- } else {
|
|
|
|
|
- orderList.get(ordDtlStatCnt - rowspan).setRowspan(0);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 주문상세상태값 별 배너 설정
|
|
|
|
|
- if ("Y".equals(setLastBanner)) {
|
|
|
|
|
- orderList.get(orderList.size() - 1).setOrdDtlStatBanner("Y");
|
|
|
|
|
- } else {
|
|
|
|
|
- orderList.get(ordDtlStatCnt - 1).setOrdDtlStatBanner("Y");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return orderList;
|
|
|
|
|
|
|
+ private String getExpBeDt() {
|
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
|
|
+ cal.add(Calendar.YEAR, 1);
|
|
|
|
|
+ return sdf.format(cal.getTime()) + "235959";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 마이페이지 주문상태 별 주문수량 조회
|
|
|
|
|
- *
|
|
|
|
|
- * @param Order
|
|
|
|
|
- * @return int
|
|
|
|
|
- * @author card007
|
|
|
|
|
- * @since 2021. 02. 08
|
|
|
|
|
- */
|
|
|
|
|
- public int getOrderStatCount(Order order) { return orderDao.getOrderStatCount(order); }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 마이페이지 주문변경상태 별 주문수량 조회
|
|
|
|
|
- *
|
|
|
|
|
- * @param Order
|
|
|
|
|
- * @return int
|
|
|
|
|
- * @author card007
|
|
|
|
|
- * @since 2021. 02. 08
|
|
|
|
|
- */
|
|
|
|
|
- public int getOrderChangeStatCount(Order order) { return orderDao.getOrderChangeStatCount(order); }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 마이페이지 주문상세 금액정보 조회
|
|
|
|
|
- *
|
|
|
|
|
- * @param Order
|
|
|
|
|
- * @return Order
|
|
|
|
|
- * @author card007
|
|
|
|
|
- * @since 2021. 02. 16
|
|
|
|
|
- */
|
|
|
|
|
- public Order getOrderAmtForMypage(Order order) { return orderDao.getOrderAmtForMypage(order); }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 마이페이지 주문상세 결제정보 조회
|
|
|
|
|
- *
|
|
|
|
|
- * @param Order
|
|
|
|
|
- * @return Order
|
|
|
|
|
- * @author card007
|
|
|
|
|
- * @since 2021. 02. 16
|
|
|
|
|
- */
|
|
|
|
|
- public Order getPaymentInfoForMypage(Order order) { return orderDao.getPaymentInfoForMypage(order); }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 마이페이지 주문상세 배송지 정보 조회
|
|
|
|
|
- *
|
|
|
|
|
- * @param Order
|
|
|
|
|
- * @return Order
|
|
|
|
|
- * @author card007
|
|
|
|
|
- * @since 2021. 02. 16
|
|
|
|
|
- */
|
|
|
|
|
- public Order getOrderDeliveryAddrInfo(Order order) { return orderDao.getOrderDeliveryAddrInfo(order); }
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|