Selaa lähdekoodia

상품동영상 관리

eskim 5 vuotta sitten
vanhempi
commit
c35f7c2b10

+ 67 - 0
style24.admin/src/main/java/com/style24/admin/biz/dao/TsaGoodsDao.java

@@ -14,11 +14,13 @@ import com.style24.persistence.domain.GoodsPriceRes;
 import com.style24.persistence.domain.GoodsResSell;
 import com.style24.persistence.domain.GoodsSearch;
 import com.style24.persistence.domain.GoodsTnmRes;
+import com.style24.persistence.domain.GoodsVideo;
 import com.style24.persistence.domain.Itemkind;
 import com.style24.persistence.domain.NotiInfo;
 import com.style24.persistence.domain.Notice;
 import com.style24.persistence.domain.NoticeGoods;
 import com.style24.persistence.domain.Option;
+import com.style24.persistence.domain.Video;
 import com.style24.persistence.domain.WmsColorMapping;
 import com.style24.persistence.domain.WmsSeasonMapping;
 import com.style24.persistence.domain.WmsStyleYearMapping;
@@ -706,4 +708,69 @@ public interface TsaGoodsDao {
 	 */
 	void deleteGoodPriceRes(GoodsPriceRes goodsPriceRes);
 
+	/**
+	 * 상품 동영상 목록 조회
+	 *
+	 * @param goodsVideo
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 16
+	 */
+	Collection<GoodsVideo> getGoodsVideoList(GoodsVideo goodsVideo);
+
+	/**
+	 * 상품 동영상 사용안함으로 변경
+	 *
+	 * @param video
+	 * @author eskim
+	 * @since 2020. 11. 16
+	 */
+	void updateNotUseGoodsVideo(Video video);
+
+	/**
+	 * 동영상 일련번호 조회
+	 *
+	 * @param video
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 16
+	 */
+	String getVideoSeq(Video video);
+
+	/**
+	 * 동영상 등록
+	 *
+	 * @param video
+	 * @author eskim
+	 * @since 2020. 11. 16
+	 */
+	void createVideo(Video video);
+
+	/**
+	 * 동영상 수정
+	 *
+	 * @param video
+	 * @author eskim
+	 * @since 2020. 11. 16
+	 */
+	void updateVideo(Video video);
+
+	/**
+	 * 동영상 위치 삭제 Y 처리
+	 *
+	 * @param video
+	 * @author eskim
+	 * @since 2020. 11. 16
+	 */
+	void delVideoDispLoc(Video video);
+
+	/**
+	 * 동영상 위치 수정/저장
+	 *
+	 * @param video
+	 * @author eskim
+	 * @since 2020. 11. 16
+	 */
+	void saveVideoDispLoc(Video video);
+
 }

+ 114 - 0
style24.admin/src/main/java/com/style24/admin/biz/service/TsaGoodsService.java

@@ -28,12 +28,14 @@ import com.style24.persistence.domain.GoodsPriceRes;
 import com.style24.persistence.domain.GoodsResSell;
 import com.style24.persistence.domain.GoodsSearch;
 import com.style24.persistence.domain.GoodsTnmRes;
+import com.style24.persistence.domain.GoodsVideo;
 import com.style24.persistence.domain.Itemkind;
 import com.style24.persistence.domain.NotiInfo;
 import com.style24.persistence.domain.Notice;
 import com.style24.persistence.domain.NoticeGoods;
 import com.style24.persistence.domain.Option;
 import com.style24.persistence.domain.SearchData;
+import com.style24.persistence.domain.Video;
 import com.style24.persistence.domain.WmsColorMapping;
 import com.style24.persistence.domain.WmsSeasonMapping;
 import com.style24.persistence.domain.WmsStyleYearMapping;
@@ -1980,4 +1982,116 @@ public class TsaGoodsService {
 
 		return "SUCC";
 	}
+
+
+	/**
+	 * 상품 동영상 목록 조회
+	 *
+	 * @param goodsVideo
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 16
+	 */
+	public Collection<GoodsVideo> getGoodsVideoList(GoodsVideo goodsVideo) {
+		return goodsDao.getGoodsVideoList(goodsVideo);
+	}
+
+	/**
+	 * 상품 동영상 삭제로 변경
+	 *
+	 * @param goodsVideo
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 16
+	 */
+	@Transactional("shopTxnManager")
+	public void updateNotUseGoodsVideo(Collection<GoodsVideo> goodsVideos) {
+		for (GoodsVideo goodsVideo : goodsVideos) {
+			Video video = new Video();
+			video.setUpdNo(TsaSession.getInfo().getUserNo());
+			video.setVideoSq(goodsVideo.getVideoSq());
+			goodsDao.updateNotUseGoodsVideo(video);
+		}
+	}
+
+	/**
+	 * 상품동영상 수정/저장
+	 *
+	 * @param video
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 16
+	 */
+	@Transactional("shopTxnManager")
+	public void saveGoodsVideo(Video video) {
+		video.setRegNo(TsaSession.getInfo().getUserNo());
+		video.setUpdNo(TsaSession.getInfo().getUserNo());
+		if (video.getVideoSq() == null ||  video.getVideoSq() == 0) {
+
+			String videoSeq = goodsDao.getVideoSeq(video);
+			if (StringUtils.isEmpty(videoSeq)) {
+				goodsDao.createVideo(video);
+			}else {
+				//video.setVideoSq(Integer.parseInt(videoSeq));  //why?
+				//goodsDao.updateVideo(video);
+			}
+		}
+
+		if (video.getVideoSq() == null ||  video.getVideoSq() == 0) {
+			String videoSeq = goodsDao.getVideoSeq(video);
+
+			if (!StringUtils.isEmpty(videoSeq)) {
+				video.setVideoSq(Integer.parseInt(videoSeq));
+			}
+		}
+
+		//goodsDao.delVideoDispLoc(video);  why?
+		String[] displocValArr = video.getDisplocValArr();
+		for (String displocVal : displocValArr) {
+			video.setDisplocVal(displocVal);
+			goodsDao.saveVideoDispLoc(video);
+		}
+	}
+
+	/**
+	 * 상품동영상 엑셀파일 등록
+	 *
+	 * @param dataList
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 16
+	 */
+	@Transactional("shopTxnManager")
+	public int saveExcelGoodsVideo(Collection<GagaMap> dataList) {
+
+		int cnt = 0;
+
+		for (GagaMap map : dataList) {
+			Video video = mapper.convertValue(map, Video.class);
+			video.setUpdNo(TsaSession.getInfo().getUserNo());
+			video.setRegNo(TsaSession.getInfo().getUserNo());
+			video.setDisplocGb("G");
+			video.setDispYn("Y");
+			String videoVal = video.getVideoVal();
+			if (videoVal.contains("http")) {
+				video.setVideoGb("M");
+			} else {
+				video.setVideoGb("Y");
+			}
+			String videoSeq = goodsDao.getVideoSeq(video);
+
+			if (StringUtils.isEmpty(videoSeq)) {
+				goodsDao.createVideo(video);
+			}
+
+			videoSeq = goodsDao.getVideoSeq(video);
+			if (!StringUtils.isEmpty(videoSeq)) {
+				video.setVideoSq(Integer.parseInt(videoSeq));
+			}
+			goodsDao.saveVideoDispLoc(video);
+			cnt++;
+		}
+
+		return cnt;
+	}
 }

+ 72 - 2
style24.admin/src/main/java/com/style24/admin/biz/web/TsaGoodsController.java

@@ -37,10 +37,12 @@ import com.style24.persistence.domain.GoodsPriceRes;
 import com.style24.persistence.domain.GoodsResSell;
 import com.style24.persistence.domain.GoodsSearch;
 import com.style24.persistence.domain.GoodsTnmRes;
+import com.style24.persistence.domain.GoodsVideo;
 import com.style24.persistence.domain.Itemkind;
 import com.style24.persistence.domain.NotiInfo;
 import com.style24.persistence.domain.Notice;
 import com.style24.persistence.domain.NoticeGoods;
+import com.style24.persistence.domain.Video;
 import com.style24.persistence.domain.WmsColorMapping;
 import com.style24.persistence.domain.WmsSeasonMapping;
 import com.style24.persistence.domain.WmsStyleYearMapping;
@@ -1240,13 +1242,12 @@ public class TsaGoodsController extends TsaBaseController {
 		return super.ok(message.getMessage("SUCC_0003"));
 	}
 
-
 	/**
 	 * 상품 동영상관리 화면
 	 *
 	 * @return
 	 * @author eskim
-	 * @since 2020. 10. 16
+	 * @since 2020. 11. 16
 	 */
 	@GetMapping("/video/form")
 	public ModelAndView videoForm() {
@@ -1257,6 +1258,75 @@ public class TsaGoodsController extends TsaBaseController {
 		return mav;
 	}
 
+	/**
+	 * 상품 동영상 목록 조회
+	 *
+	 * @param goodsVideo
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 16
+	 */
+	@PostMapping("/video/list")
+	@ResponseBody
+	public Collection<GoodsVideo> getGoodsVideoList(@RequestBody GoodsVideo goodsVideo) {
+		return goodsService.getGoodsVideoList(goodsVideo);
+	}
+
+	/**
+	 * 상품 동영상 미노출 변경
+	 *
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 16
+	 */
+	@PostMapping("/video/update/notUse")
+	@ResponseBody
+	public GagaResponse updateNotUseGoodsVideo(@RequestBody Collection<GoodsVideo> goodsVideos) {
+		goodsService.updateNotUseGoodsVideo(goodsVideos);
+		return super.ok(message.getMessage("SUCC_0009"));
+	}
+
+	/**
+	 * 상품동영상 수정/저장
+	 *
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 16
+	 */
+	@PostMapping("/video/save")
+	@ResponseBody
+	public GagaResponse saveGoodsVideo(@RequestBody Video video) {
+		goodsService.saveGoodsVideo(video);
+		return super.ok(message.getMessage("SUCC_0001"));
+	}
+
+	/**
+	 * 상품동영상 엑셀 저장
+	 *
+	 * @param goods
+	 * @return
+	 * @throws Exception
+	 * @author eskim
+	 * @since 2020. 11. 16
+	 */
+	@PostMapping("/video/excel/save")
+	@ResponseBody
+	public GagaResponse saveExcelGoodsVideo(@RequestBody Video video) throws Exception {
+		String[] cellName = null;
+		// DB 처리 시 사용되는 파라미터명(셀명) 설정
+		cellName = new String[2];
+		cellName[0] = "displocVal";
+		cellName[1] = "videoVal";
+		String targetPath = GagaFileUtil.getConcatenationPath(env.getProperty("upload.default.target.path"), "excel");
+		Collection<GagaMap> dataList = GagaExcelUtil.getList(GagaFileUtil.getConcatenationPath(targetPath, video.getExcelFileNm()), 0, cellName);
+
+		int cnt = goodsService.saveExcelGoodsVideo(dataList);
+
+		GagaFileUtil.deleteFile(GagaFileUtil.getConcatenationPath(targetPath, video.getExcelFileNm()));
+
+		return super.ok(cnt + " 건 처리되었습니다.");
+	}
+
 	/**
 	 * 상품 EP제외상품관리 화면
 	 *

+ 32 - 0
style24.admin/src/main/java/com/style24/persistence/domain/GoodsVideo.java

@@ -0,0 +1,32 @@
+package com.style24.persistence.domain;
+
+import com.style24.persistence.TscBaseDomain;
+
+import lombok.Data;
+
+
+/**
+ * 상품 동영상 Domain
+ *
+ * @author eskim
+ * @since 2020. 11. 16
+ */
+@SuppressWarnings("serial")
+@Data
+public class GoodsVideo extends TscBaseDomain {
+
+	private Integer videoSq;
+	private String brandCd; // 브랜드코드
+	private String brandEnm; // 브랜드영문명
+	private String brandGrpNm; // 브랜드그룹명
+	private String goodsCd;
+	private String videoGb;
+	private String videoVal;
+	private String dispYn;
+	private String goodsNm;
+	private String goodsNum;
+	private String supplyGoodsCd;
+	private String excelFileNm;
+	private String stDate;
+	private String edDate;
+}

+ 38 - 0
style24.admin/src/main/java/com/style24/persistence/domain/Video.java

@@ -0,0 +1,38 @@
+package com.style24.persistence.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.style24.persistence.TscBaseDomain;
+
+import lombok.Data;
+
+
+/**
+ * 동영상 Domain
+ *
+ * @author eskim
+ * @since 2020. 11. 16
+ */
+@SuppressWarnings("serial")
+@Data
+public class Video extends TscBaseDomain {
+
+	private Integer videoSq;
+	private String displocGb;	//노출위치구분(B:브랜드, G:상품)
+	private String displocVal;	//노출위치값(노출위치구분이 "B:브랜드"이면 브랜드코드, "G:상품"이면 상품코드)
+	private String videoGb;	//동영상구분(Y:유투브, M:MP4)
+	private String videoVal;	//동영상값(동영상구분이 Y이면 유투브ID, M이면 URL)
+	private String videoTitle;
+	private String videoTitle2;
+	private String dispYn;
+	private String excelFileNm;
+	private String brandEnm;
+	private String stDate;
+	private String edDate;
+	private String fyear;
+	private String tyear;
+	private String seasonStr;
+
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private String[] displocValArr;
+
+}

+ 174 - 1
style24.admin/src/main/java/com/style24/persistence/mybatis/shop/TsaGoods.xml

@@ -2595,5 +2595,178 @@
 		WHERE GOODS_PRICE_RES_SQ = #{goodsPriceResSq}
 		AND APPLY_YN = 'N'
 	</delete>
-
+
+	<!-- 상품 동영상 조회 -->
+	<select id="getGoodsVideoList" parameterType="GoodsVideo" resultType="GoodsVideo">
+		/* TsaGoods.getGoodsVideoList */
+		SELECT A.VIDEO_SQ
+		     , B.BRAND_CD
+		     , B.BRAND_ENM
+		     , B.BRAND_GRP_NM
+		     , A.DISPLOC_VAL AS GOODS_CD
+		     , E.VIDEO_GB
+		     , E.VIDEO_VAL
+		     , A.DISP_YN
+		     , A.REG_NO
+		     , FN_GET_USER_NM(A.REG_NO) AS REG_NM
+		     , DATE_FORMAT(A.REG_DT,'%Y%m%d%H%i%S') AS REG_DT
+		     , A.UPD_NO
+		     , FN_GET_USER_NM(A.UPD_NO) AS REG_NM
+		     , DATE_FORMAT(A.UPD_DT,'%Y%m%d%H%i%S') AS UPD_DT
+		FROM TB_VIDEO_DISPLOC A
+		INNER JOIN TB_VIDEO E ON A.VIDEO_SQ = E.VIDEO_SQ
+		INNER JOIN (SELECT C.GOODS_CD
+		                 , C.BRAND_CD
+		                 , D.BRAND_ENM
+		                 , D.BRAND_GRP_NM
+		            FROM TB_GOODS C
+		            INNER JOIN TB_BRAND D ON C.BRAND_CD = D.BRAND_CD
+		            WHERE 1 = 1
+		            <if test='goodsNm != null and goodsNm != "" '>
+		            AND C.GOODS_NM = #{goodsNm}
+		            </if>
+		            <if test='goodsNum != null and goodsNum != "" '>
+		            AND C.GOODS_NUM = #{goodsNum}
+		            </if>
+		            <if test='supplyGoodsCd != null and supplyGoodsCd != "" '>
+		            AND C.SUPPLY_GOODS_CD = #{supplyGoodsCd}
+		            </if>
+		            <if test='brandEnm != null and brandEnm != "" '>
+		            AND (
+		                 D.BRAND_ENM LIKE #{brandEnm}||'%'
+		                 OR
+		                 D.BRAND_KNM LIKE #{brandEnm}||'%'
+		                )
+		            </if>
+		            ) B
+		           ON (A.DISPLOC_VAL = B.GOODS_CD
+		           )
+		WHERE A.DISPLOC_VAL = B.GOODS_CD
+		AND A.DISPLOC_GB = 'G'
+		<if test='goodsCd != null and goodsCd != "" '>
+		AND A.DISPLOC_VAL = #{goodsCd}
+		</if>
+		<if test='stDate != null and stDate != "" '>
+		<![CDATA[
+		AND A.REG_DT >= DATE_FORMAT(#{stDate}, '%Y-%m-%d')
+		]]>
+		</if>
+		<if test='edDate != null and edDate != "" '>
+		<![CDATA[
+		AND A.REG_DT < DATE_FORMAT(DATE_ADD(#{edDate}, INTERVAL 1 DAY), '%Y-%m-%d %H:%i:%S')
+		]]>
+		</if>
+		ORDER BY A.DISPLOC_VAL
+	</select>
+		
+	<!-- 상품 동영상 노출안함으로 변경 -->
+	<update id="updateNotUseGoodsVideo" parameterType="Video">
+		/* TsaGoods.updateNotUseGoodsVideo */
+		UPDATE TB_VIDEO_DISPLOC
+		SET DISP_YN = 'N'
+		  , UPD_NO = #{updNo}
+		  , UPD_DT = NOW()
+		WHERE VIDEO_SQ = #{videoSq}
+	</update>
+	
+	<!-- 동영상 코드 조회 -->
+	<select id="getVideoSeq" parameterType="Video" resultType="String">
+		/* TsaGoods.getVideoSeq */
+		SELECT MAX(VIDEO_SQ) AS VIDEO_SQ
+		FROM TB_VIDEO
+		WHERE VIDEO_GB = #{videoGb}
+		AND VIDEO_VAL = #{videoVal}
+	</select>
+	
+	<!-- 동영상  등록 -->
+	<insert id="createVideo" parameterType="Video">
+		/* TsaGoods.createVideo */
+		INSERT INTO TB_VIDEO
+		    (
+		           VIDEO_SQ
+		         , VIDEO_GB
+		         , VIDEO_VAL
+		         , FYEAR
+		         , TYEAR
+		         , SEASON_STR
+		         , VIDEO_TITLE
+		         , VIDEO_TITLE2
+		         , DISP_YN
+		         , REG_NO
+		         , REG_DT
+		         , UPD_NO
+		         , UPD_DT
+		    )
+		    VALUES (
+		           NULL
+		         , #{videoGb}
+		         , #{videoVal}
+		         , #{fyear}
+		         , #{tyear}
+		         , #{seasonStr}
+		         , #{videoTitle}
+		         , #{videoTitle2}
+		         , #{dispYn}
+		         , #{regNo}
+		         , NOW()
+		         , #{updNo}
+		         , NOW()
+		    )
+	</insert>
+	
+	<!-- 동영상  수정 -->
+	<update id="updateVideo" parameterType="Video">
+		/* TsaGoods.saveVideo */
+		UPDATE TB_VIDEO SET
+		           DISP_YN = #{dispYn}
+		         , VIDEO_GB = #{videoGb}
+		         , VIDEO_VAL = #{videoVal}
+		         , FYEAR = #{fyear}
+		         , TYEAR = #{tyear}
+		         , SEASON_STR = #{seasonStr}
+		         , VIDEO_TITLE = #{videoTitle}
+		         , VIDEO_TITLE2 = #{videoTitle2}
+		         , UPD_NO = #{updNo}
+		         , UPD_DT = NOW()
+	</update>
+	
+	<!-- 동영상 위치 노출안함으로 처리 -->
+	<update id="delVideoDispLoc" parameterType="Video">
+		/* TsaGoods.initVideoDispLoc */
+		UPDATE TB_VIDEO_DISPLOC
+		SET DISP_YN = 'N'
+		WHERE VIDEO_SQ = #{videoSq}
+		AND DISPLOC_GB = #{displocGb}
+	</update>
+	
+	<!-- 동영상 위치 등록 -->
+	<insert id="saveVideoDispLoc" parameterType="Video">
+		/* TsaGoods.saveVideoDispLoc */
+		INSERT INTO TB_VIDEO_DISPLOC
+		    (
+		           VIDEO_SQ
+		         , DISPLOC_GB
+		         , DISPLOC_VAL
+		         , DISP_YN
+		         , REG_NO
+		         , REG_DT
+		         , UPD_NO
+		         , UPD_DT
+		    )
+		    VALUES (
+		           #{videoSq}
+		         , #{displocGb}
+		         , #{displocVal}
+		         , #{dispYn}
+		         , #{regNo}
+		         , NOW()
+		         , #{updNo}
+		         , NOW()
+		    )
+		ON DUPLICATE KEY UPDATE
+		       DISP_YN = #{dispYn}
+		     , UPD_NO = #{updNo}
+		     , UPD_DT = NOW()
+	</insert>
+	
 </mapper>

+ 1 - 1
style24.admin/src/main/webapp/WEB-INF/views/goods/GoodsEpSkipForm.html

@@ -7,7 +7,7 @@
  * @desc    : 네이버EP제외상품관리
  *============================================================================
  * PASTEL
- * Copyright(C) 2019 TSIT, All rights reserved.
+ * Copyright(C) 2020 TSIT, All rights reserved.
  *============================================================================
  * VER  DATE         AUTHOR      DESCRIPTION
  * ===  ===========  ==========  =============================================

+ 327 - 0
style24.admin/src/main/webapp/WEB-INF/views/goods/GoodsVideoForm.html

@@ -0,0 +1,327 @@
+<!DOCTYPE html>
+<html lang="ko"
+	xmlns:th="http://www.thymeleaf.org">
+<!--
+ *******************************************************************************
+ * @source  : GoodsVideoForm.html
+ * @desc    : 상품동영상관리 Page
+ *============================================================================
+ * Pastelmall
+ * Copyright(C) 2020 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2020.11.16   eskim       최초 작성
+  *******************************************************************************
+ -->
+	<div id="main">
+		<!-- 메인타이틀 영역 -->
+		<div class="main-title">
+		</div>
+		<!-- //메인타이틀 영역 -->
+		<!-- 메뉴 설명 -->
+		<div class="infoBox menu-desc">
+		</div>
+		<!-- 검색조건 영역 -->
+		<div class="panelStyle">
+			<!-- TITLE -->
+			<div class="panelTitle">
+				<h3><i class="fa fa-info-circle"></i>아래 검색조건 중 하나를 꼭 입력해 주세요.</h3>
+			</div>
+			<!-- //TITLE -->
+			<div class="panelContent">
+			
+			<form id="searchForm" name="searchForm" action="#" th:action="@{'/goods/video/list'}">
+				<table class="frmStyle">
+					<colgroup>
+						<col style="width:10%;"/>
+						<col style="width:40%;"/>
+						<col style="width:10%;"/>
+						<col/>
+					</colgroup>
+					<tr>
+						<th>키워드</th>
+						<td>
+							<select name="keyWord">
+								<option value="goodsCd">상품코드</option>
+								<option value="goodsNm">상품명</option>
+								<option value="goodsNum">품번</option>
+								<option value="supplyGoodsCd">업체상품코드</option>
+							</select>
+							<input type="text" class="w100" maxlength="20" name="searchTxt" placeholder=""/>
+							<input type="text" class="off" name="goodsCd" id="goodsCd"/>
+							<input type="text" class="off" name="goodsNm" id="goodsNm"/>
+							<input type="text" class="off" name="goodsNum" id="goodsNum"/>
+							<input type="text" class="off" name="supplyGoodsCd" id="supplyGoodsCd"/>
+						</td>
+						<th>브랜드명</th>
+						<td>
+							<input type="text" class="w200" name="brandEnm" placeholder="" maxlength="50"/>
+						</td>
+					</tr>
+					<tr>
+						<th>등록일</th>
+						<td colspan="3" id="sellTerms">
+						</td>
+					</tr>
+				</table>
+				<ul class="panelBar">
+					<li class="center">
+						<button type="button" class="btn btn-default btn-lg" id="btnInit">초기화</button>
+						<button type="button" class="btn btn-success btn-lg" id="btnSearch">조회</button>
+					</li>
+				</ul>
+			</form>
+			</div>
+		</div>
+		<!-- //검색조건 영역 -->
+		
+		<!-- 리스트 영역 -->
+		<div class="panelStyle">
+			<ul class="panelBar">
+				<li class="left">
+					<button type="button" class="btn btn-danger btn-lg" id="btnNotUse">노출안함</button>
+				</li>
+				<li  class="right">
+					<button type="button" class="btn btn-default btn-lg" onclick="cfnDownloadSampleFile('SF002');">상품동영상등록 양식다운로드</button>
+					<button type="button" class="btn btn-info btn-lg" id="btnExcReg">엑셀등록</button>
+				</li>
+			</ul>
+			<div id="gridList" style="width: 100%; height: 450px;" class="ag-theme-balham"></div>
+		</div>
+		<!-- //리스트 영역 -->
+		<!-- 등록/수정 -->
+		<div class="panelStyle">
+			<form id="detailForm" name="detailForm" action="#" th:action="@{'/display/brand/save'}">
+				<table class="frmStyle">
+					<colgroup>
+						<col style="width:10%;"/>
+						<col style="width:20%;"/>
+						<col style="width:10%;"/>
+						<col style="width:20%;"/>
+						<col style="width:10%;"/>
+						<col/>
+					</colgroup>
+					<tr>
+						<td colspan='6'>동영상등록(상세)</td>
+					</tr>
+					<tr>
+						<th>상품코드<em class="required" title="필수"></em></th>
+						<td>
+							<input name="videoSq"  data-valid-name="상품동영상일련번호" type="hidden"/>
+							<input type="text" class="w150" name="goodsCd" maxlength="20" required="required" data-valid-name="상품코드"/>
+						</td>
+						<th>동영상구분<em class="required" title="필수"></em></th>
+						<td>
+							<select name="videoGb" id="videoGb" required="required" data-valid-name="동영상구분" onchange="">
+								<option value="">[선택]</option>
+								<option value="Y">[Y] 유투브</option>
+								<option value="M">[M] MP4</option>
+							</select>
+						</td>
+						<th>노출여부<em class="required" title="필수"></em></th>
+						<td>
+							<label class="rdoBtn"><input type="radio" name="dispYn" id="dispYn" value="Y" checked="checked">Y</label>
+							<label class="rdoBtn"><input type="radio" name="dispYn" id="dispYn" value="N">N</label>
+						</td>
+					</tr>
+					<tr>
+						<th>동영상URL<em class="required" title="필수"></em></th>
+						<td class="infoTxt" colspan="5">
+							<em><i class="fa fa-info-circle"></i>유투브의 경우 빨간색 표시로 되어있는 값만 넣으세요.</em><br/>
+							예시 : https://www.youtube.com/embed/<em><strong>5YqYG71bQ3s</strong></em>?showinfo=0&amp;rel=0&amp;vp=hd1080&amp;fs=0&amp;wmode=opaque&amp;enablejsapi=1
+							<br/>
+							<input type="text" class="w400" id="videoVal" name="videoVal" maxlength="100" required="required" data-valid-name="동영상URL">
+							<button type="button" class="btn btn-dark btn-lg" onclick="cfnOpenGoodsVideoPopup('filmVideoView','videoVal', '#detailForm', $('#videoGb').val());">미리보기</button>
+						</td>
+					</tr>
+				</table>
+				<ul class="panelBar">
+					<li class="center">
+						<button type="button" class="btn btn-info btn-lg" id="btnNew">신규</button>
+						<button type="button" class="btn btn-success btn-lg" id="btnSave">저장</button>
+					</li>
+				</ul>
+			</form>
+		</div>
+	</div>
+
+<script th:inline="javascript">
+/*<![CDATA[*/
+	var videoGbList = {'Y':'유투브', 'M':'MP4'};
+	// specify the columns
+	var columnDefs = [
+		{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
+		{headerName: 'No', width: 60, cellClass: 'text-center', valueGetter: function(params) { return params.node.rowIndex + 1 }},
+		{headerName: "브랜드명", field: "brandEnm", width: 120, cellClass: 'text-center'},
+		{headerName: "상품동영상일련번호", field: "goodsVideoSq", width: 120, cellClass: 'text-center', hide: true},
+		{headerName: "상품코드", field: "goodsCd", width: 120, cellClass: 'text-center',
+			cellRenderer: function(params) {
+				return '<a href="javascript:void(0);">' + params.value + '</a>';
+			}	
+		},
+ 		{headerName: "동영상구분", field: "videoGb", width: 100, cellClass: 'text-center',
+			cellRenderer: function (params) { return !gagajf.isNull(params.value) ? "["+params.value+"] "+gagaAgGrid.lookupValue(videoGbList, params.value) : '';}
+		},
+		{headerName: "동영상정보", field: "videoVal", width: 300, cellClass: 'text-center'},
+		{headerName: "노출여부", field: "dispYn", width: 80, cellClass: 'text-center'},
+		{headerName: "등록일자", field: "regDt", width: 150, cellClass: 'text-center',
+			cellRenderer: function(params) {
+				return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss") : '';
+			}
+		},
+		{headerName: "등록자", field: "regNo", width: 150, cellClass: 'text-center'},
+		{headerName: "수정일자", field: "updDt", width: 150, cellClass: 'text-center',
+			cellRenderer: function(params) {
+				return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss") : '';
+			}
+		},
+		{headerName: "수정자", field: "updNo", width: 150, cellClass: 'text-center'},
+	];
+	
+	// Get GridOptions
+	var gridOptions = gagaAgGrid.getGridOptions(columnDefs);
+	
+	gridOptions.rowSelection = 'multiple';
+	gridOptions.suppressRowClickSelection = true;
+	
+	// 상품코드 셀 클릭
+	gridOptions.onCellClicked = function(event) {
+		if (event.colDef.field == "goodsCd"){
+			var formId = '#detailForm';
+			$(formId + " input[name=videoSq]").val(event.data.videoSq);
+			$(formId + " input[name=goodsCd]").val(event.data.goodsCd);
+			$(formId + " select[name=videoGb]").val(event.data.videoGb);
+			$(formId + " input[name=videoVal]").val(event.data.videoVal);
+			$(formId + " input:radio[name=dispYn]:input[value="+event.data.dispYn+"]").click();
+			$(formId + " input[name=goodsCd]").prop("disabled", true);
+			$(formId).closest("div").show();
+		}
+	}
+	
+	// 신규 버튼 클릭
+	$("#btnNew").on('click', function() {
+		$("#detailForm")[0].reset();
+		$("#detailForm input[name=videoSq]").val('');
+		$("#detailForm input[name=goodsCd]").prop("disabled", false);
+	});
+
+	// 엑셀등록
+	$("#btnExcReg").on('click', function() {
+		cfnExcelUploadPopup('','fnExcelUpoadCallback');
+	});
+	
+	var fnExcelUpoadCallback = function(data){
+		
+		var jsonData = JSON.stringify(data);
+		gagajf.ajaxJsonSubmit('/goods/video/excel/save', jsonData, fnSaveCallback);
+		
+	}
+	
+	// 조회
+	$('#btnSearch').on('click', function() {
+		$("#goodsCd").val('');
+		$("#goodsNm").val('');
+		$("#goodsNum").val('');
+		$("#supplyGoodsCd").val('');
+		$("#"+$("#searchForm select[name=keyWord]").val()).val($("#searchForm input[name=searchTxt]").val());
+		// 기간 값 체크
+		if (!fnCalendarDateValidation('#sellTerms', 'stDate', 'edDate')){
+			return false;
+		}
+		// Fetch data
+		gagaAgGrid.fetch($('#searchForm').prop('action'), gridOptions, '#searchForm');
+		$("#btnNew").click();
+	});
+	
+	// 검색조건 초기화
+	$('#btnInit').on('click', function() {
+		$("#searchForm")[0].reset();
+	});
+	
+	// 선택상품 사용안함
+	$("#btnNotUse").on('click', function() {
+		var selectRowData = gagaAgGrid.selectedRowData(gridOptions);
+		if(selectRowData.length>0){
+			mcxDialog.confirm('선택한 상품동영상을 미노출처리 하시겠습니까?', {
+				cancelBtnText: "취소",
+				sureBtnText: "확인",
+				sureBtnClick: function(){
+					var jsonData = JSON.stringify(selectRowData);
+					gagajf.ajaxJsonSubmit('/goods/video/update/notUse', jsonData, fnSaveCallback);
+				}
+			})
+		}else{
+			mcxDialog.alert("선택된 상품동영상이 없습니다.");
+		}
+	});
+	
+	// 동영상 저장
+	$("#btnSave").on('click', function() {
+		
+		var formId = '#detailForm';
+		var videoSq = $(formId + " input[name=videoSq]").val();
+		var displocVal = $(formId + " input[name=goodsCd]").val();
+		var videoGb = $(formId + " select[name=videoGb]").val();
+		var videoVal = $(formId + " input[name=videoVal]").val();
+		var dispYn = $(formId + " input:radio[name=dispYn]:checked").val();
+		
+		if(displocVal==''){
+			gagajf.alertMessage(formId + " input[name=goodsCd]", 'input');
+			return;
+		}
+		if(videoGb==''){
+			gagajf.alertMessage(formId + " select[name=videoGb]", 'select');
+			return;
+		}
+		if(videoVal==''){
+			gagajf.alertMessage(formId + " input[name=videoVal]", 'input');
+			return;
+		}
+		
+		if(videoVal.indexOf("http")>-1){
+			if(videoGb=='Y'){
+				mcxDialog.alert('동영상URL 형식이 유투브와 맞지 않습니다.');
+				return;
+			}
+		}else{
+			if(videoGb=='M'){
+				mcxDialog.alert('동영상URL 형식이 MP4와 맞지 않습니다.');
+				return;
+			}
+		}
+		
+		mcxDialog.confirm('저장 하시겠습니까?', {
+			cancelBtnText: "취소",
+			sureBtnText: "확인",
+			sureBtnClick: function(){
+				var data = {videoSq : videoSq
+							,displocGb : 'G'
+							,displocValArr : [displocVal]
+							,videoGb : videoGb
+							,videoVal : videoVal
+							,dispYn : dispYn
+							};
+				var jsonData = JSON.stringify(data);
+				gagajf.ajaxJsonSubmit('/goods/video/save', jsonData, fnSaveCallback);
+			}
+		})
+	});
+	
+	var fnSaveCallback = function() {
+		$('#btnSearch').click();
+	}
+	
+	$(document).ready(function() {
+		
+		cfnCreateCalendar('#sellTerms', 'stDate', 'edDate', true, '등록일', true);
+		
+		// Create a agGrid
+		gagaAgGrid.createGrid('gridList', gridOptions);
+		
+		//$('#btnSearch').click();
+	});
+/*]]>*/
+</script>
+
+</html>

+ 18 - 1
style24.admin/src/main/webapp/ux/js/admin.common.js

@@ -931,4 +931,21 @@ function cfnGoogleLogin(googleUser) {
 function cfnCellPhonnHypen(obj) {
 	//$(obj).val( $(obj).val().replace(/[^0-9]/g, '').replace(/(^0[0-9]{2})([0-9]+)?([0-9]{4})/, '$1-$2-$3').replace('--', '-') );
 	$(obj).val( $(obj).val().replace(/[^0-9]/g, "").replace(/(^02|^050[0-9]{1}|^1[0-9]{3}|^0[0-9]{2})([0-9]+)?([0-9]{4})$/,"$1-$2-$3").replace("--", "-") );
-}
+}
+
+
+var fnCalendarDateValidation = function(tgtId, dtFromId, dtToId) {
+	var fromVal = Number($(tgtId+" #"+dtFromId).val().replace(/-/gi, ''));
+	var toVal = Number($(tgtId+" #"+dtToId).val().replace(/-/gi, ''));
+	var result = true;
+	if(fromVal > toVal) {
+		mcxDialog.alertC('시작일자가 종료일자보다 큽니다.',{
+			sureBtnText: "확인",
+			sureBtnClick: function() {
+				$(tgtId+" #"+dtFromId).focus();
+			}
+		});
+		result = false;
+	}
+	return result;
+};

+ 4 - 3
style24.admin/src/main/webapp/ux/js/admin.popup.js

@@ -178,16 +178,17 @@ var cfnOpenImagePreViewPopup = function(id,imgUrl) {
  */
 //비디오 팝업 열기
 var cfnOpenGoodsVideoPopup = function(id, objId, formid, type, fullUrl) {
+	
 	var src = $(formid).find("#"+objId).val();
-	var str = '<div class="popupWrap videoClose" id="'+id+'">';
-	str += '<div class="videoPopup modal" data-width="700" data-height="350">';
+	var str = '';
+	str += '<div class="videoPopup"  style="width:700px; height:350px"  id="'+id+'">';
 	str += '<button type="button" class="close" onclick="uifnPopupClose(\''+id+'\')"><i class="fa fa-times"></i></button>';
 	if(src.indexOf('http://')!=-1 || src.indexOf('https://')!=-1 && src.indexOf('youtube')==-1){
 		str += '<video id="video" autoplay></video>';
 	}else{
 		str +='<iframe id="video" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>';
 	}
-	str += '</div></div>';
+	str += '</div>';
 
 	if ($('#'+ id).length == 0) {
 		$('body').append(str);