Przeglądaj źródła

약관관리 추가

gagamel 5 lat temu
rodzic
commit
b9fda53c21

+ 51 - 0
style24.admin/src/main/java/com/style24/admin/biz/dao/TsaClauseDao.java

@@ -0,0 +1,51 @@
+package com.style24.admin.biz.dao;
+
+import java.util.Collection;
+
+import com.style24.core.support.annotation.ShopDs;
+import com.style24.persistence.domain.Clause;
+
+/**
+ * 약관 Dao
+ * 
+ * @author gagamel
+ * @since 2020. 10. 29
+ */
+@ShopDs
+public interface TsaClauseDao {
+
+	/**
+	 * 약관 목록
+	 * @param clause - 약관 정보
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 10. 29
+	 */
+	Collection<Clause> getClauseList(Clause clause);
+
+	/**
+	 * 약관 상세
+	 * @param clause - 약관 정보
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 10. 29
+	 */
+	Clause getClauseDetail(Integer clauseSq);
+
+	/**
+	 * 약관 생성
+	 * @param clause - 약관 정보
+	 * @author gagamel
+	 * @since 2020. 10. 29
+	 */
+	void createClause(Clause clause);
+
+	/**
+	 * 약관 수정
+	 * @param clause - 약관 정보
+	 * @author gagamel
+	 * @since 2020. 10. 29
+	 */
+	void updateClause(Clause clause);
+
+}

+ 75 - 0
style24.admin/src/main/java/com/style24/admin/biz/service/TsaClauseService.java

@@ -0,0 +1,75 @@
+package com.style24.admin.biz.service;
+
+import java.util.Collection;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.style24.admin.biz.dao.TsaClauseDao;
+import com.style24.admin.support.security.session.TsaSession;
+import com.style24.persistence.domain.Clause;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 약관 Service
+ *
+ * @author gagamel
+ * @since 2020. 10. 29
+ */
+@Service
+@Slf4j
+public class TsaClauseService {
+
+	@Autowired
+	private TsaClauseDao clauseDao;
+
+	/**
+	 * 약관 목록
+	 * @param clause - 약관 정보
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 10. 29
+	 */
+	public Collection<Clause> getClauseList(Clause clause) {
+		return clauseDao.getClauseList(clause);
+	}
+
+	/**
+	 * 약관 상세
+	 * @param clause - 약관 정보
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 10. 29
+	 */
+	public Clause getClauseDetail(Integer clauseSq) {
+		return clauseDao.getClauseDetail(clauseSq);
+	}
+
+	/**
+	 * 약관 생성
+	 * @param clause - 약관 정보
+	 * @author gagamel
+	 * @since 2020. 10. 29
+	 */
+	@Transactional("shopTxnManager")
+	public void createClause(Clause clause) {
+		clause.setRegNo(TsaSession.getInfo().getUserNo());
+		clause.setUpdNo(TsaSession.getInfo().getUserNo());
+		clauseDao.createClause(clause);
+	}
+
+	/**
+	 * 약관 수정
+	 * @param clause - 약관 정보
+	 * @author gagamel
+	 * @since 2020. 10. 29
+	 */
+	@Transactional("shopTxnManager")
+	public void updateClause(Clause clause) {
+		clause.setUpdNo(TsaSession.getInfo().getUserNo());
+		clauseDao.updateClause(clause);
+	}
+
+}

+ 96 - 1
style24.admin/src/main/java/com/style24/admin/biz/web/TsaEnvsetController.java

@@ -13,11 +13,13 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
+import com.style24.admin.biz.service.TsaClauseService;
 import com.style24.admin.biz.service.TsaEnvsetService;
 import com.style24.admin.biz.service.TsaRendererService;
 import com.style24.admin.support.controller.TsaBaseController;
 import com.style24.core.biz.service.TscEnvsetService;
 import com.style24.core.support.message.TscMessageByLocale;
+import com.style24.persistence.domain.Clause;
 import com.style24.persistence.domain.Envset;
 
 import lombok.extern.slf4j.Slf4j;
@@ -27,7 +29,7 @@ import com.gagaframework.web.rest.server.GagaResponse;
 /**
  * 환경설정 Controller
  *
- * @author jaewonHo
+ * @author gagamel
  * @since 2020. 10. 21
  */
 @Controller
@@ -47,6 +49,9 @@ public class TsaEnvsetController extends TsaBaseController {
 	@Autowired
 	private TsaRendererService rendererService;
 
+	@Autowired
+	private TsaClauseService clauseService;
+
 	/**
 	 * 기본환경설정 화면
 	 * @return
@@ -138,4 +143,94 @@ public class TsaEnvsetController extends TsaBaseController {
 		return envsetService.getEnvsetHistoryList(siteCd, envsetType);
 	}
 
+	/**
+	 * 약관관리 화면
+	 * @return ModelAndView
+	 * @author gagamel
+	 * @since 2020. 10. 29
+	 */
+	@GetMapping("/clause/form")
+	public ModelAndView clauseForm() {
+		ModelAndView mav = new ModelAndView();
+
+		// 사이트 목록
+		mav.addObject("siteList", rendererService.getAvailCommonCodeList("G000"));
+
+		// 약관유형 목록
+		mav.addObject("clauseTypeList", rendererService.getAvailCommonCodeList("G057"));
+
+		mav.setViewName("envset/ClauseForm");
+
+		return mav;
+	}
+
+	/**
+	 * 약관관리 목록
+	 * @param clause - 약관 정보
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 10. 29
+	 */
+	@PostMapping("/clause/list")
+	@ResponseBody
+	public Collection<Clause> getClauseList(@RequestBody Clause clause) {
+		return clauseService.getClauseList(clause);
+	}
+
+	/**
+	 * 약관관리상세 화면
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 10. 29
+	 */
+	@GetMapping("/clause/detail/form")
+	public ModelAndView clauseDetailForm(@RequestParam(value = "mode") String mode, @RequestParam(value = "clauseSq", required = false) Integer clauseSq) {
+		ModelAndView mav = new ModelAndView();
+
+		// 사이트 목록
+		mav.addObject("siteList", rendererService.getAvailCommonCodeList("G000"));
+
+		// 약관유형 목록
+		mav.addObject("clauseTypeList", rendererService.getAvailCommonCodeList("G057"));
+
+		// 모드 값
+		mav.addObject("mode", mode);
+
+		if ("U".equals(mode)) {
+			mav.addObject("clauseInfo", clauseService.getClauseDetail(clauseSq));
+		}
+
+		mav.setViewName("envset/ClauseDetailForm");
+
+		return mav;
+	}
+
+	/**
+	 * 약관 생성
+	 * @param clause - 약관 정보
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 10. 29
+	 */
+	@PostMapping("/clause/detail/create")
+	@ResponseBody
+	public GagaResponse createClause(@RequestBody Clause clause) {
+		clauseService.createClause(clause);
+		return super.ok(message.getMessage("SUCC_0001"));
+	}
+
+	/**
+	 * 약관 수정
+	 * @param clause - 약관 정보
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 10. 29
+	 */
+	@PostMapping("/clause/detail/update")
+	@ResponseBody
+	public GagaResponse updateClause(@RequestBody Clause clause) {
+		clauseService.updateClause(clause);
+		return super.ok(message.getMessage("SUCC_0001"));
+	}
+
 }

+ 87 - 0
style24.admin/src/main/java/com/style24/persistence/mybatis/shop/TsaClause.xml

@@ -0,0 +1,87 @@
+<?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.admin.biz.dao.TsaClauseDao">
+
+	<!-- 약관 목록 조회 -->
+	<select id="getClauseList" parameterType="Clause" resultType="Clause">
+		/* TsaClasue.getClauseList */
+		SELECT CLAUSE_SQ
+		     , SITE_CD
+		     , CLAUSE_TYPE
+		     , CLAUSE_TITLE
+		     , CLAUSE_CONTENT
+		     , DATE_FORMAT(EFFECT_DT,'%Y%m%d')    AS EFFECT_DT
+		     , DISP_YN
+		     , REG_NO
+		     , DATE_FORMAT(REG_DT,'%Y%m%d%H%i%S') AS REG_DT
+		     , UPD_NO
+		     , DATE_FORMAT(UPD_DT,'%Y%m%d%H%i%S') AS UPD_DT
+		FROM   TB_CLAUSE
+		WHERE  SITE_CD = #{siteCd}
+		<if test="clauseType != null and clauseType != ''">
+		AND    CLAUSE_TYPE = #{clauseType}
+		</if>
+		ORDER  BY CLAUSE_TYPE
+	</select>
+	
+	<!-- 약관 상세 조회 -->
+	<select id="getClauseDetail" parameterType="Integer" resultType="Clause">
+		/* TsaClause.getClauseDetail */
+		SELECT CLAUSE_SQ
+		     , SITE_CD
+		     , CLAUSE_TYPE
+		     , CLAUSE_TITLE
+		     , CLAUSE_CONTENT
+		     , DISP_YN
+		     , REG_NO
+		     , DATE_FORMAT(REG_DT,'%Y%m%d%H%i%S') AS REG_DT
+		     , UPD_NO
+		     , DATE_FORMAT(UPD_DT,'%Y%m%d%H%i%S') AS UPD_DT
+		FROM   TB_CLAUSE
+		WHERE  CLAUSE_SQ = #{clauseSq}
+	</select>
+
+	<!-- 약관 생성 -->
+	<insert id="createClause" parameterType="Clause">
+		/* TsaClasue.createClause */
+		INSERT INTO TB_CLAUSE (
+		       CLAUSE_SQ
+		     , SITE_CD
+		     , CLAUSE_TYPE
+		     , CLAUSE_TITLE
+		     , CLAUSE_CONTENT
+		     , DISP_YN
+		     , REG_ID
+		     , REG_DT
+		     , UPD_ID
+		     , UPD_DT
+		)
+		VALUES (
+		       NULL
+		     , #{siteCd}
+		     , #{clauseType}
+		     , #{clauseTitle}
+		     , #{clauseContent}
+		     , #{dispYn}
+		     , #{regNo}
+		     , NOW()
+		     , #{updNo}
+		     , NOW()
+		)
+	</insert>
+
+	<!-- 약관 수정 -->
+	<update id="updateClause" parameterType="Clause">
+		/* TsaClasue.updateClause */
+		UPDATE TB_CLAUSE
+		SET    SITE_CD = #{siteCd}
+		     , CLAUSE_TYPE = #{clauseType}
+		     , CLAUSE_TITLE = #{clauseTitle}
+		     , CLAUSE_CONTENT = #{clauseContent}
+		     , DISP_YN = #{dispYn}
+		     , UPD_NO = #{updNo}
+		     , UPD_DT = NOW()
+		WHERE  CLAUSE_SQ = #{clauseSq}
+	</update>
+
+</mapper>