|
@@ -2,16 +2,21 @@ package com.style24.batch.biz.job.marketing;
|
|
|
|
|
|
|
|
import com.gagaframework.web.parameter.GagaMap;
|
|
import com.gagaframework.web.parameter.GagaMap;
|
|
|
import com.style24.batch.biz.job.TsbAbstractJob;
|
|
import com.style24.batch.biz.job.TsbAbstractJob;
|
|
|
|
|
+import com.style24.batch.biz.service.TsbOrderService;
|
|
|
import com.style24.batch.biz.service.TsbPointService;
|
|
import com.style24.batch.biz.service.TsbPointService;
|
|
|
import com.style24.batch.support.env.TsbConstants;
|
|
import com.style24.batch.support.env.TsbConstants;
|
|
|
import com.style24.core.biz.service.TscEnvsetService;
|
|
import com.style24.core.biz.service.TscEnvsetService;
|
|
|
|
|
+import com.style24.core.biz.service.TscOrderService;
|
|
|
import com.style24.core.biz.service.TscPointService;
|
|
import com.style24.core.biz.service.TscPointService;
|
|
|
import com.style24.core.support.env.TscConstants;
|
|
import com.style24.core.support.env.TscConstants;
|
|
|
|
|
+import com.style24.persistence.domain.Order;
|
|
|
|
|
+import com.style24.persistence.domain.OrderChange;
|
|
|
import com.style24.persistence.domain.Point;
|
|
import com.style24.persistence.domain.Point;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Collection;
|
|
import java.util.Collection;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -33,33 +38,51 @@ public class TsbAutoBuyConfirmJob extends TsbAbstractJob<Collection<Point>, Gaga
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private TscPointService corePointService;
|
|
private TscPointService corePointService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private TsbOrderService orderService;
|
|
|
|
|
+
|
|
|
private int succCnt = 0;
|
|
private int succCnt = 0;
|
|
|
private int failCnt = 0;
|
|
private int failCnt = 0;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public Collection<Point> read() throws Exception {
|
|
public Collection<Point> read() throws Exception {
|
|
|
- int expireDays = envsetService.getBuyPointExpireDays(TscConstants.Site.STYLE24.value());
|
|
|
|
|
- int confirmDays = envsetService.getAutoBuyConfirmDays(TscConstants.Site.STYLE24.value());
|
|
|
|
|
- Point point = new Point();
|
|
|
|
|
- point.setBuyPointExpireDays(expireDays);
|
|
|
|
|
- point.setAutoBuyConfirmDays(confirmDays);
|
|
|
|
|
- return pointService.getAutoBuyConfirmList(point);
|
|
|
|
|
|
|
+ Collection<Point> readItem = new ArrayList<>();
|
|
|
|
|
+ return readItem;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public GagaMap process(Collection<Point> readItem) throws Exception {
|
|
public GagaMap process(Collection<Point> readItem) throws Exception {
|
|
|
|
|
+ // 1. 구매확정 임시 테이블 생성
|
|
|
|
|
+ int confirmCnt = orderService.createTempBuyConfirmData();
|
|
|
|
|
+ log.info("1. 구매확정 임시테이블 생성 건 : {}", confirmCnt);
|
|
|
|
|
|
|
|
- for (Point point: readItem) {
|
|
|
|
|
- try {
|
|
|
|
|
- point.setRegNo(TsbConstants.REG_NO);
|
|
|
|
|
- point.setUpdNo(TsbConstants.REG_NO);
|
|
|
|
|
- corePointService.saveAutoBuyConfirm(point);
|
|
|
|
|
- succCnt++;
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- failCnt++;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 대상 있는 경우 구매확정 처리 시작
|
|
|
|
|
+ if (confirmCnt > 0) {
|
|
|
|
|
+ // 2. 구매확정 상태 변경
|
|
|
|
|
+ orderService.cahgneStatButConfirm();
|
|
|
|
|
+
|
|
|
|
|
+ // 3. 구매확정 대상 중 포인트 지급 대상 조회
|
|
|
|
|
+ int expireDays = envsetService.getBuyPointExpireDays(TscConstants.Site.STYLE24.value());
|
|
|
|
|
+ int confirmDays = envsetService.getAutoBuyConfirmDays(TscConstants.Site.STYLE24.value());
|
|
|
|
|
+ Point point = new Point();
|
|
|
|
|
+ point.setBuyPointExpireDays(expireDays);
|
|
|
|
|
+ point.setAutoBuyConfirmDays(confirmDays);
|
|
|
|
|
+ Collection<Point> pointList = pointService.getAutoBuyConfirmList(point);
|
|
|
|
|
+ log.info("3. 구매확정 포인트 지급 대상 건 : {}", pointList.size());
|
|
|
|
|
|
|
|
|
|
+ for (Point pointInfo : pointList) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ pointInfo.setRegNo(TsbConstants.REG_NO);
|
|
|
|
|
+ pointInfo.setUpdNo(TsbConstants.REG_NO);
|
|
|
|
|
+ corePointService.saveAutoBuyConfirm(pointInfo);
|
|
|
|
|
+ succCnt++;
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ failCnt++;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|