Explorar el Código

Merge branch 'develop' into jsshin

jsshin hace 5 años
padre
commit
e40d5de56f

+ 10 - 2
src/main/java/com/style24/batch/biz/dao/TsbBatchDao.java

@@ -13,13 +13,13 @@ import com.style24.persistence.domain.BatchLog;
 public interface TsbBatchDao {
 
 	/**
-	 * 배치ID로 배치명 조회
+	 * 배치정보 조회
 	 * @param batchId - 배치ID
 	 * @return
 	 * @author gagamel
 	 * @since 2020. 12. 2
 	 */
-	String getBatchName(String batchId);
+	BatchLog getBatchInfo(String batchId);
 
 	/**
 	 * 배치로그 생성
@@ -37,4 +37,12 @@ public interface TsbBatchDao {
 	 */
 	void updateBatchLog(Integer batchLogSq);
 
+	/**
+	 * 배치상태 처리
+	 * @param batchLog - 배치로그 정보
+	 * @author gagamel
+	 * @since 2021. 5. 24
+	 */
+	void updateBatchStatus(BatchLog batchLog);
+
 }

+ 11 - 3
src/main/java/com/style24/batch/biz/job/TsbAbstractJob.java

@@ -7,6 +7,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import com.style24.batch.biz.service.TsbBatchService;
+import com.style24.persistence.domain.BatchLog;
 
 import lombok.extern.slf4j.Slf4j;
 
@@ -76,7 +77,7 @@ public abstract class TsbAbstractJob<I, O, R> {
 	protected void printEnd() {
 		if (StringUtils.isNotBlank(batchId)) {
 			// 배치로그 종료 처리
-			batchService.updateBatchLog(batchLogSq);
+			batchService.updateBatchLog(batchLogSq, batchId);
 		}
 
 		endTime = System.currentTimeMillis();
@@ -98,13 +99,20 @@ public abstract class TsbAbstractJob<I, O, R> {
 
 		if (StringUtils.isNotBlank(batchId)) {
 			// 배치명 조회
-			batchName = batchService.getBatchName(batchId);
+			BatchLog batchLog = batchService.getBatchInfo(batchId);
 
-			if (StringUtils.isBlank(batchName)) {
+			if (batchLog == null) {
 				log.info("{} 배치는 미사용으로 종료합니다.(TB_BATCH 테이블 참조)", batchId);
 				return;
 			}
 
+			if (batchLog.getBatchStat().equals("I")) {
+				log.info("{} 배치는 현재 실행중입니다.(TB_BATCH 테이블 참조)", batchId);
+				return;
+			}
+
+			batchName = batchLog.getBatchNm();
+
 			// 배치로그 생성
 			batchLogSq = batchService.createBatchLog(batchId);
 		}

+ 17 - 5
src/main/java/com/style24/batch/biz/service/TsbBatchService.java

@@ -24,14 +24,14 @@ public class TsbBatchService {
 	private TsbBatchDao batchDao;
 
 	/**
-	 * 배치ID로 배치명 조회
+	 * 배치정보 조회
 	 * @param batchId - 배치ID
 	 * @return
 	 * @author gagamel
 	 * @since 2020. 12. 2
 	 */
-	public String getBatchName(String batchId) {
-		return batchDao.getBatchName(batchId);
+	public BatchLog getBatchInfo(String batchId) {
+		return batchDao.getBatchInfo(batchId);
 	}
 
 	/**
@@ -43,24 +43,36 @@ public class TsbBatchService {
 	 */
 	@Transactional("shopTxnManager")
 	public Integer createBatchLog(String batchId) {
-
 		BatchLog batchLog = new BatchLog();
 		batchLog.setBatchId(batchId);
 		batchLog.setRegNo(TsbConstants.REG_NO);
+
+		// 배치로그 생성
 		batchDao.createBatchLog(batchLog);
 
+		// 배치상태 진행중으로 처리
+		batchLog.setBatchStat("I");
+		batchDao.updateBatchStatus(batchLog);
+
 		return batchLog.getBatchLogSq();
 	}
 
 	/**
 	 * 배치로그 종료 처리
 	 * @param batchLogSq - 배치로그일련번호
+	 * @param batchId - 배치ID
 	 * @return
 	 * @author gagamel
 	 * @since 2020. 12. 2
 	 */
-	public void updateBatchLog(Integer batchLogSq) {
+	public void updateBatchLog(Integer batchLogSq, String batchId) {
 		batchDao.updateBatchLog(batchLogSq);
+
+		// 배치상태 완료로 처리
+		BatchLog batchLog = new BatchLog();
+		batchLog.setBatchId(batchId);
+		batchLog.setBatchStat("F");
+		batchDao.updateBatchStatus(batchLog);
 	}
 
 }

+ 23 - 0
src/main/java/com/style24/batch/biz/web/TsbCustomerController.java

@@ -0,0 +1,23 @@
+package com.style24.batch.biz.web;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import com.style24.core.support.controller.TscBaseController;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 고객 Controller
+ * 
+ * @author gagamel
+ * @since 2021. 5. 24
+ */
+@Controller
+@RequestMapping("/goods")
+@CrossOrigin(origins = "${domain.admin}")
+@Slf4j
+public class TsbCustomerController extends TscBaseController {
+
+}

+ 23 - 0
src/main/java/com/style24/batch/biz/web/TsbDeliveryController.java

@@ -0,0 +1,23 @@
+package com.style24.batch.biz.web;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import com.style24.core.support.controller.TscBaseController;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 배송 Controller
+ * 
+ * @author gagamel
+ * @since 2021. 5. 24
+ */
+@Controller
+@RequestMapping("/goods")
+@CrossOrigin(origins = "${domain.admin}")
+@Slf4j
+public class TsbDeliveryController extends TscBaseController {
+
+}

+ 23 - 0
src/main/java/com/style24/batch/biz/web/TsbDisplayController.java

@@ -0,0 +1,23 @@
+package com.style24.batch.biz.web;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import com.style24.core.support.controller.TscBaseController;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 전시 Controller
+ * 
+ * @author gagamel
+ * @since 2021. 5. 24
+ */
+@Controller
+@RequestMapping("/goods")
+@CrossOrigin(origins = "${domain.admin}")
+@Slf4j
+public class TsbDisplayController extends TscBaseController {
+
+}

+ 23 - 0
src/main/java/com/style24/batch/biz/web/TsbGoodsController.java

@@ -0,0 +1,23 @@
+package com.style24.batch.biz.web;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import com.style24.core.support.controller.TscBaseController;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 상품 Controller
+ * 
+ * @author gagamel
+ * @since 2021. 5. 24
+ */
+@Controller
+@RequestMapping("/goods")
+@CrossOrigin(origins = "${domain.admin}")
+@Slf4j
+public class TsbGoodsController extends TscBaseController {
+
+}

+ 23 - 0
src/main/java/com/style24/batch/biz/web/TsbMarketingController.java

@@ -0,0 +1,23 @@
+package com.style24.batch.biz.web;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import com.style24.core.support.controller.TscBaseController;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 마케팅 Controller
+ * 
+ * @author gagamel
+ * @since 2021. 5. 24
+ */
+@Controller
+@RequestMapping("/goods")
+@CrossOrigin(origins = "${domain.admin}")
+@Slf4j
+public class TsbMarketingController extends TscBaseController {
+
+}

+ 23 - 0
src/main/java/com/style24/batch/biz/web/TsbOrderController.java

@@ -0,0 +1,23 @@
+package com.style24.batch.biz.web;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import com.style24.core.support.controller.TscBaseController;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 주문 Controller
+ * 
+ * @author gagamel
+ * @since 2021. 5. 24
+ */
+@Controller
+@RequestMapping("/goods")
+@CrossOrigin(origins = "${domain.admin}")
+@Slf4j
+public class TsbOrderController extends TscBaseController {
+
+}

+ 61 - 0
src/main/java/com/style24/batch/biz/web/TsbStatisticsController.java

@@ -0,0 +1,61 @@
+package com.style24.batch.biz.web;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.style24.batch.biz.job.statistics.TsbInflowStatisticsJob;
+import com.style24.batch.biz.job.statistics.TsbInflowYesterdayStatisticsJob;
+import com.style24.core.support.controller.TscBaseController;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 통계 Controller
+ * 
+ * @author gagamel
+ * @since 2021. 5. 24
+ */
+@Controller
+@RequestMapping("/statistics")
+@CrossOrigin(origins = "${domain.admin}")
+@Slf4j
+public class TsbStatisticsController extends TscBaseController {
+
+	@Autowired
+	private TsbInflowStatisticsJob inflowStatisticsJob;
+
+	@Autowired
+	private TsbInflowYesterdayStatisticsJob inflowYesterdayStatisticsJob;
+
+	/**
+	 * 제휴채널 유입집계 생성
+	 * @throws Exception
+	 * @author gagamel
+	 * @since 2021. 5. 24
+	 */
+	@GetMapping("/aflink/inflow/create")
+	@ResponseBody
+	public String createAflinkInflow() throws Exception {
+		inflowStatisticsJob.runById("cron.statistics.inflow");
+		return "OK";
+	}
+
+	/**
+	 * 제휴채널 유입집계 전일자 생성
+	 * @return 메시지
+	 * @throws Exception
+	 * @author gagamel
+	 * @since 2021. 5. 24
+	 */
+	@GetMapping("/aflink/inflow/yesterday/create")
+	@ResponseBody
+	public String createAflinkInflowYesterday() throws Exception {
+		inflowYesterdayStatisticsJob.runById("cron.statistics.inflow.yesterday");
+		return "OK";
+	}
+
+}

+ 11 - 2
src/main/java/com/style24/persistence/mybatis/shop/TsbBatch.xml

@@ -2,10 +2,11 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.style24.batch.biz.dao.TsbBatchDao">
 	
-	<!-- 배치 조회 -->
-	<select id="getBatchName" parameterType="String" resultType="String">
+	<!-- 배치정보 조회 -->
+	<select id="getBatchInfo" parameterType="String" resultType="BatchLog">
 		/* TsbBatch.getBatchName */
 		SELECT BATCH_NM
+		     , IFNULL(BATCH_STAT,'F') AS BATCH_STAT
 		FROM   TB_BATCH
 		WHERE  BATCH_ID = #{batchId}
 		AND    USE_YN = 'Y' /*사용하는 넘만*/
@@ -42,4 +43,12 @@
 		AND    BATCH_STAT = 'I'
 	</update>
 	
+	<!-- 배치상태 처리 -->
+	<update id="updateBatchStatus" parameterType="BatchLog">
+		/* TsbBatch.updateBatchStatus */
+		UPDATE TB_BATCH
+		SET    BATCH_STAT = #{batchStat}
+		WHERE  BATCH_ID = #{batchId}
+	</update>
+	
 </mapper>

+ 3 - 0
src/main/resources/config/application-locd.yml

@@ -16,6 +16,9 @@ spring:
 logging:
     config: classpath:log/logback-locd.xml
 
+domain:
+    admin: https://ldadmin.style24.com
+
 upload:
     goods:
         target.path: /WIDE/workspace/files/data/style24

+ 3 - 0
src/main/resources/config/application-locp.yml

@@ -16,6 +16,9 @@ spring:
 logging:
     config: classpath:log/logback-locp.xml
 
+domain:
+    admin: https://lpadmin.style24.com
+
 # USAFE 보증보험 정보
 usafe.guarantee:
     mall.id: istyle2400

+ 3 - 0
src/main/resources/config/application-run.yml

@@ -26,6 +26,9 @@ spring:
 logging:
     config: classpath:log/logback-run.xml
 
+domain:
+    admin: https://bos.style24.com
+
 upload:
     goods:
         target.path: /files/data/style24/ProductImage

+ 3 - 0
src/main/resources/config/application-style.yml

@@ -26,6 +26,9 @@ spring:
 logging:
     config: classpath:log/logback-run.xml
 
+domain:
+    admin: https://bos.style24.com
+
 upload:
     goods:
         target.path: /files/data/style24/ProductImage