Bläddra i källkod

포인트 적립 관련 서비스 추가

jsshin 5 år sedan
förälder
incheckning
3cb31ffc2b

+ 36 - 0
src/main/java/com/style24/core/biz/dao/TscPointDao.java

@@ -0,0 +1,36 @@
+package com.style24.core.biz.dao;
+
+import com.style24.core.support.annotation.ShopDs;
+import com.style24.persistence.domain.Point;
+import org.springframework.stereotype.Repository;
+
+
+/**
+ * 포인트 Dao
+ * 
+ * @author jsshin
+ * @since 2020. 1. 27
+ */
+@ShopDs
+@Repository
+public interface TscPointDao {
+
+	/**
+	 * 포인트 적립
+	 * @param point - 포인트 정보
+	 * @return int
+	 * @author jsshin
+	 * @since 2021. 01. 27
+	 */
+	int createCustomerPoint(Point point);
+
+	/**
+	 * 포인트 적립 이력
+	 * @param point - 포인트 정보
+	 * @return int
+	 * @author jsshin
+	 * @since 2021. 01. 27
+	 */
+	int createCustomerPointHst(Point point);
+
+}

+ 1 - 2
src/main/java/com/style24/core/biz/service/TscCustomerService.java

@@ -2,7 +2,6 @@ package com.style24.core.biz.service;
 
 import com.gagaframework.web.parameter.GagaMap;
 import com.style24.core.biz.dao.TscCustomerDao;
-import com.style24.core.support.env.TscConstants;
 import com.style24.persistence.domain.CustContactHst;
 import com.style24.persistence.domain.Customer;
 import lombok.extern.slf4j.Slf4j;
@@ -13,7 +12,7 @@ import org.springframework.transaction.annotation.Transactional;
 /**
  * 회원 Service
  * 
- * @author gagamel
+ * @author jsshin
  * @since 2020. 01. 20
  */
 @Service

+ 39 - 0
src/main/java/com/style24/core/biz/service/TscPointService.java

@@ -0,0 +1,39 @@
+package com.style24.core.biz.service;
+
+import com.style24.core.biz.dao.TscPointDao;
+import com.style24.persistence.domain.Point;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+
+/**
+ * 포인트 Service
+ * 
+ * @author jsshin
+ * @since 2020. 01. 27
+ */
+@Service
+@Slf4j
+public class TscPointService {
+
+	@Autowired
+	private TscPointDao pointDao;
+
+
+	/**
+	 * 포인트 적립
+	 * @param point - 포인트 정보
+	 * @author jsshin
+	 * @since 2021. 01. 27
+	 */
+	@Transactional("shopTxnManager")
+	public void saveCustomerPoint(Point point) {
+		pointDao.createCustomerPoint(point);
+		pointDao.createCustomerPointHst(point);
+	}
+
+
+
+}

+ 17 - 17
src/main/java/com/style24/core/support/env/TscConstants.java

@@ -441,23 +441,23 @@ public class TscConstants {
 //		}
 //	}
 //
-//	// 포인트발생상태
-//	public enum PointOccurStat {
-//		APPLY_EXPECT("10"),				// 반영예정
-//		BEFORE_APPLY_CANCEL("20"),		// 반영전취소
-//		APPLY_COMPLETE("30"),			// 반영완료
-//		AFTER_APPLY_CANCEL("40");		// 반영완료취소
-//
-//		private String value;
-//
-//		private PointOccurStat(String value) {
-//			this.value = value;
-//		}
-//
-//		public String value() {
-//			return value;
-//		}
-//	}
+	// 포인트발생상태
+	public enum PntUploadStat {
+		APPLY_EXPECT("G070_10"),				// 반영예정
+		BEFORE_APPLY_CANCEL("G070_20"),		// 반영전취소
+		APPLY_COMPLETE("G070_30"),			// 반영완료
+		AFTER_APPLY_CANCEL("G070_40");		// 반영완료취소
+
+		private String value;
+
+		PntUploadStat(String value) {
+			this.value = value;
+		}
+
+		public String value() {
+			return value;
+		}
+	}
 //
 //	public enum StoreCode {
 //		GWANGJU("MZ0134"),				//광주물류

+ 82 - 0
src/main/java/com/style24/persistence/mybatis/shop/TscPoint.xml

@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.style24.core.biz.dao.TscPointDao">
+
+	<!--포인트 적립 생성-->
+	<insert id="createCustomerPoint" parameterType="Point" keyProperty="custPntSq">
+		/*TscPoint.createCustomerPoint*/
+		INSERT INTO TB_CUST_POINT (
+		       CUST_NO
+		     , GV_PNT_AMT
+		     , US_PNT_AMT
+		     , RM_PNT_AMT
+		     , EXP_BE_DT
+		     , EXP_CMP_DT
+		     , REG_NO
+		     , REG_DT
+		     , UPD_NO
+		     , UPD_DT
+		) VALUES (
+		       #{custNo}
+		     , #{gvPntAmt}
+		     , #{usPntAmt}
+		     , #{rmPntAmt}
+		     , DATE_FORMAT(#{expBeDt}, '%Y%m%d%H%i%S')
+		     , #{expCmpDt}
+		     , #{regNo}
+		     , NOW()
+		     , #{updNo}
+		     , NOW()
+		)
+	</insert>
+
+	<!--포인트 이력 생성-->
+	<insert id="createCustomerPointHst" parameterType="Point" keyProperty="pntHstSq">
+		/*TscPoint.createCustomerPointHst*/
+		INSERT INTO TB_CUST_POINT_HST (
+		       CUST_NO
+		     , OCCUR_GB
+		     , OCCUR_DTL_DESC
+		     , PNT_AMT
+		     , CUST_PNT_SQ
+		     , ORD_NO
+		     , ORD_DTL_NO
+		     , REVIEW_SQ
+		     , SWITCH_DUE_DT
+		     , PNT_UPLOAD_STAT
+		     , PNT_UPLOAD_DT
+		     , REG_NO
+		     , REG_DT
+		     , UPD_NO
+		     , UPD_DT
+		) VALUES (
+		       #{custNo}
+		     , #{occurGb}
+		     , #{occurDtlDesc}
+		     , #{pntAmt}
+		     , #{custPntSq}
+		     , #{ordNo}
+		     , #{ordDtlNo}
+		     , #{reviewSq}
+		     <if test='pntUploadStat == "G070_30"'>
+		     , NOW()                                -- SWITCH_DUE_DT
+		     </if>
+		     <if test='pntUploadStat != "G070_30"'>
+		     , DATE_FORMAT(#{switchDueDt}, '%Y%m%d%H%i%S') -- SWITCH_DUE_DT
+		     </if>
+		     , #{pntUploadStat}
+		     <if test='pntUploadStat == "G070_30"'>
+		     , NOW()                                -- PNT_UPLOAD_DT
+		     </if>
+		     <if test='pntUploadStat != "G070_30"'>
+		     , NULL                                 -- PNT_UPLOAD_DT
+		     </if>
+		     , #{regNo}
+		     , NOW()                                -- REG_DT
+		     , #{updNo}
+		     , NOW()                                -- UPD_DT
+		)
+	</insert>
+
+
+</mapper>