|
|
@@ -0,0 +1,80 @@
|
|
|
+package com.style24.batch.biz.job.order;
|
|
|
+
|
|
|
+import java.util.Collection;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import com.style24.batch.biz.job.TsbAbstractJob;
|
|
|
+import com.style24.batch.biz.service.TsbOrderService;
|
|
|
+import com.style24.core.biz.service.TscOrderChangeService;
|
|
|
+import com.style24.core.biz.service.TscOrderService;
|
|
|
+import com.style24.core.support.env.TscConstants;
|
|
|
+import com.style24.persistence.domain.Order;
|
|
|
+import com.style24.persistence.domain.OrderChange;
|
|
|
+
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 선물하기 배송지 등록 기간 만료 주문 취소
|
|
|
+ *
|
|
|
+ * @author xodud1202
|
|
|
+ * @since 2021. 05. 06
|
|
|
+ */
|
|
|
+@Component
|
|
|
+@Slf4j
|
|
|
+public class TsbOrderGiftExpirationJob extends TsbAbstractJob<Collection<Order>, Collection<Order>, OrderChange> {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TscOrderChangeService coreOrderChangeService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TscOrderService coreOrderService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TsbOrderService orderService;
|
|
|
+
|
|
|
+ private int succCnt = 0;
|
|
|
+ private int failCnt = 0;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Collection<Order> read() throws Exception {
|
|
|
+ return orderService.getOrderGiftExpirationList();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Collection<Order> process(Collection<Order> params) throws Exception {
|
|
|
+ return params;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public OrderChange write(Collection<Order> params) throws Exception {
|
|
|
+ OrderChange result = new OrderChange();
|
|
|
+ for(Order order : params) {
|
|
|
+ OrderChange orderChange = new OrderChange();
|
|
|
+ orderChange.setOrdNo(order.getOrdNo());
|
|
|
+ orderChange.setReqGbn("cnclComplete"); // 전체취소
|
|
|
+ orderChange.setChgReason(TscConstants.OrderCancelReason.ADMIN_CANCEL.value());
|
|
|
+ orderChange.setChgReasonNm("전체취소 - 선물 배송지 입력 기한 만료");
|
|
|
+ orderChange.setRegNo(0);
|
|
|
+ orderChange.setUpdNo(0);
|
|
|
+ orderChange.setBatchYn("Y");
|
|
|
+
|
|
|
+ try {
|
|
|
+ coreOrderChangeService.allCnclComplete(orderChange);
|
|
|
+ succCnt++;
|
|
|
+ } catch (Exception e) {
|
|
|
+ failCnt++;
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void notify(OrderChange param) throws Exception {
|
|
|
+ super.printResult(succCnt, failCnt);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|