Bladeren bron

브랜드 그룹관리 흑백이미지 추가

eskim 5 jaren geleden
bovenliggende
commit
317e1ea0fa

+ 34 - 9
src/main/java/com/style24/admin/biz/service/TsaBusinessService.java

@@ -454,12 +454,12 @@ public class TsaBusinessService {
 	 */
 	@Transactional("shopTxnManager")
 	public void saveBrandGroup(BrandGroup brandGroup) {
+		
+		String brandUploadPath = env.getProperty("upload.default.target.path");
+		brandUploadPath = GagaFileUtil.getConcatenationPath(brandUploadPath, "contents", "brand");
 
-		if (brandGroup.getNewSysFileNm() != null && !"".equals(brandGroup.getNewSysFileNm())) {
-			String brandImgName = "BRAND_" + brandGroup.getBrandGroupNo() + "_" + GagaDateUtil.getTodayDateTime() + "." + StringUtils.getFilenameExtension(brandGroup.getNewSysFileNm());
-
-			String brandUploadPath = env.getProperty("upload.default.target.path");
-			brandUploadPath = GagaFileUtil.getConcatenationPath(brandUploadPath, "contents", "brand");
+		if (brandGroup.getNewSysFileNm1() != null && !"".equals(brandGroup.getNewSysFileNm1())) {
+			String brandImgName1 = "BRAND_" + brandGroup.getBrandGroupNo() + "_" + GagaDateUtil.getTodayDateTime() + "." + StringUtils.getFilenameExtension(brandGroup.getNewSysFileNm1());
 
 			//기존이미지 삭제
 			try {
@@ -470,15 +470,40 @@ public class TsaBusinessService {
 				//e.printStackTrace();
 			}
 
-			File uniqueFile = GagaFileUtil.getUniqueFile(new File(GagaFileUtil.getConcatenationPath(brandUploadPath, brandImgName)));
+			File uniqueFile = GagaFileUtil.getUniqueFile(new File(GagaFileUtil.getConcatenationPath(brandUploadPath, brandImgName1)));
 
-			File file = new File(GagaFileUtil.getConcatenationPath(brandUploadPath, brandGroup.getNewSysFileNm()));
+			File file = new File(GagaFileUtil.getConcatenationPath(brandUploadPath, brandGroup.getNewSysFileNm1()));
 
 			// Rename a file
 			file.renameTo(uniqueFile);
 
-			brandImgName = "/contents/brand/" + brandImgName;
-			brandGroup.setLogoFileNm(brandImgName);
+			brandImgName1 = "/contents/brand/" + brandImgName1;
+			brandGroup.setLogoFileNm(brandImgName1);
+
+		}
+		
+		// 흑백이미지
+		if (brandGroup.getNewSysFileNm2() != null && !"".equals(brandGroup.getNewSysFileNm2())) {
+			String brandImgName2 = "BRAND_" + brandGroup.getBrandGroupNo() + "_" + GagaDateUtil.getTodayDateTime() + "_1." + StringUtils.getFilenameExtension(brandGroup.getNewSysFileNm2());
+
+			//기존이미지 삭제
+			try {
+				GagaFileUtil.deleteFile(GagaFileUtil.getConcatenationPath(brandUploadPath, brandGroup.getBwLogoFileNm()));
+			} catch (IOException e) {
+				//  nothing
+				log.info("[saveBanner 기존 이미지 삭제중 error]");
+				//e.printStackTrace();
+			}
+
+			File uniqueFile2 = GagaFileUtil.getUniqueFile(new File(GagaFileUtil.getConcatenationPath(brandUploadPath, brandImgName2)));
+
+			File file2 = new File(GagaFileUtil.getConcatenationPath(brandUploadPath, brandGroup.getNewSysFileNm2()));
+
+			// Rename a file
+			file2.renameTo(uniqueFile2);
+
+			brandImgName2 = "/contents/brand/" + brandImgName2;
+			brandGroup.setBwLogoFileNm(brandImgName2);
 
 		}
 		

+ 3 - 1
src/main/java/com/style24/persistence/domain/BrandGroup.java

@@ -22,12 +22,14 @@ public class BrandGroup extends TscBaseDomain {
 	private String dispNmLang;		// 노출명언어
 	private String rgbCd;			// RGB코드(front 브랜드메인 GNB 색상)
 	private String logoFileNm;		// 로고파일명
+	private String bwLogoFileNm;	// 로고파일명(흑백)
 	private int dispOrd;			// 표시순서
 	private String useYn;			// 사용여부(Y:사용)
 	private String defaultCateYn;	// 기본전시카테고리사용여부(N:별도카테고리)
 	private int brandCateNo;		// 카테고리번호
 
-	private String newSysFileNm;	//신규이미지파일명
+	private String newSysFileNm1;	//신규이미지파일명(칼라)
+	private String newSysFileNm2;	//신규이미지파일명(흑백)
 
 	// 검색조건
 	private String callbackFn;		// 콜백함수

+ 4 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsaBusiness.xml

@@ -1040,6 +1040,7 @@
 		     , A.BRAND_GROUP_KNM
 		     , A.DISP_NM_LANG
 		     , A.LOGO_FILE_NM
+		     , A.BW_LOGO_FILE_NM
 		     , A.RGB_CD
 		     , A.DISP_ORD
 		     , A.DEFAULT_CATE_YN
@@ -1077,6 +1078,7 @@
 		     , DISP_NM_LANG
 		     , RGB_CD
 		     , LOGO_FILE_NM
+		     , BW_LOGO_FILE_NM
 		     , DEFAULT_CATE_YN
 		     , BRAND_CATE_NO
 		     , REG_NO
@@ -1096,6 +1098,7 @@
 		     , #{dispNmLang}
 		     , IFNULL(NULLIF(#{rgbCd},''),'222222')
 		     , #{logoFileNm}
+		     , #{bwLogoFileNm}
 		     , #{defaultCateYn}
 		     , #{brandCateNo}
 		     , #{regNo}
@@ -1114,6 +1117,7 @@
 		     , DISP_NM_LANG = #{dispNmLang}
 		     , RGB_CD = IFNULL(NULLIF(#{rgbCd},''),'222222')
 		     , LOGO_FILE_NM = #{logoFileNm}
+		     , BW_LOGO_FILE_NM = #{bwLogoFileNm}
 		     , DEFAULT_CATE_YN = IFNULL(#{defaultCateYn},'Y')
 		     <if test="brandCateNo != null and brandCateNo > 0">
 		     , BRAND_CATE_NO =  #{brandCateNo}

+ 110 - 33
src/main/webapp/WEB-INF/views/business/BrandGroupPopupForm.html

@@ -14,8 +14,8 @@
  * 1.0  2021.02.19   eskim       최초 작성
  *******************************************************************************
  -->
-<div class="modalPopup" data-width="900" data-height="870" id="popupBrandGroup">
-	<div class="panelStyle">
+<div class="modalPopup" data-width="920"  id="popupBrandGroup">
+	<div class="panelStyle" style="max-height:700px;overflow-y:scroll;">
 		<!-- TITLE -->
 		<div class="panelTitle">
 			<strong>브랜드 그룹 목록</strong>
@@ -24,7 +24,7 @@
 		<!-- //TITLE -->
 		
 		<!-- 검색 조건 -->
-		<div class="panelContent" >
+		<div class="panelContent"  >
 		<form id="searchBrandGroupForm" name="searchBrandGroupForm" action="#" th:action="@{'/business/brand/group/list'}" >
 			
 			<table class="frmStyle" aria-describedby="검색조건">
@@ -38,11 +38,11 @@
 					<tr>
 						<th>브랜드그룹코드<i class="required" title="필수"></i></th>
 						<td>
-							<textarea class="textareaR3" name="searchBrandGroupNo" id="searchBrandGroupNo"></textarea>
+							<textarea class="textareaR2" name="searchBrandGroupNo" id="searchBrandGroupNo"></textarea>
 						</td>
 						<th>브랜드그룹명<i class="required" title="필수"></i></th>
 						<td>
-							<textarea class="textareaR3" name="searchBrandGroupNm" id="searchBrandGroupNm"></textarea>
+							<textarea class="textareaR2" name="searchBrandGroupNm" id="searchBrandGroupNm"></textarea>
 						</td>
 					</tr>
 				</tbody>
@@ -67,6 +67,7 @@
 		<div class="panelContent">
 			<form id="brandGroupForm" name="searchBrandGroupForm" action="#" th:action="@{'/business/brand/group/save'}">
 			<input type="hidden" name="mode" value="N"/>
+			<input type="hidden" name="uploadDefaultUrl" id="uploadDefaultUrl" th:value="${@environment.getProperty('upload.default.view')}"/>
 			<table class="frmStyle" aria-describedby="등록/수정 폼">
 				<colgroup>
 					<col style="width:10%;"/>
@@ -110,18 +111,33 @@
 					</td>
 				</tr>
 				<tr style="height:100px">
-					<th>브랜드이미지</th>
+					<th>브랜드이미지(칼라)</th>
 					<td colspan="3">
 						<div class="uFile w300">
-							<input id="file" name="file" type="file" class="uFileInput w300"/>
-							<label for="file" class="uFileLabel">파일선택</label>
+							<input id="file1" name="file" type="file" class="uFileInput w300"/>
+							<label for="file1" class="uFileLabel">파일선택</label>
 							<input type="hidden" name="logoFileNm" id="logoFileNm"/>
-							<input type="hidden" name="sysFileNm" id="sysFileNm"/>
-							<input type="hidden" name="newSysFileNm" id="newSysFileNm"/>
+							<input type="hidden" name="sysFileNm1" id="sysFileNm1"/>
+							<input type="hidden" name="newSysFileNm1" id="newSysFileNm1"/>
 						</div>
-						<input type="hidden" name="uploadDefaultUrl" id="uploadDefaultUrl" th:value="${@environment.getProperty('upload.default.view')}"/>
-						<span id="imgView" class="off">
-							<img id="bannerPreViewUrl" src="" style="width:100px"/>
+						
+						<span id="imgView1" class="off">
+							<img id="bannerPreViewUrl1" src="" style="width:100px"/>
+						</span>
+					</td>
+				</tr>
+				<tr style="height:100px">
+					<th>브랜드이미지(흑백)</th>
+					<td colspan="3">
+						<div class="uFile w300">
+							<input id="file2" name="file" type="file" class="uFileInput w300"/>
+							<label for="file2" class="uFileLabel">파일선택</label>
+							<input type="hidden" name="bwLogoFileNm" id="bwLogoFileNm"/>
+							<input type="hidden" name="sysFileNm2" id="sysFileNm2"/>
+							<input type="hidden" name="newSysFileNm2" id="newSysFileNm2"/>
+						</div>
+						<span id="imgView2" class="off">
+							<img id="bannerPreViewUrl2" src="" style="width:100px"/>
 						</span>
 					</td>
 				</tr>
@@ -167,7 +183,7 @@
 	gridOptionsBrandGroupList.onCellClicked = function(event) {
 		if (event.colDef.field != 'brandGroupNo')
 			return;
-		
+		debugger;
 		$("#brandGroupForm input[name=mode]").val("U");
 		$("#brandGroupForm input[name=brandGroupNo]").val(event.data.brandGroupNo);
 		$("#brandGroupForm input[name=brandGroupEnm]").val(event.data.brandGroupEnm);
@@ -177,18 +193,32 @@
 		$("#brandGroupForm input:radio[name=defaultCateYn]:input[value=" + event.data.defaultCateYn + "]").click();
 		$("#brandGroupForm input[name=brandCateNo]").val(event.data.brandCateNo);
 		
-		 var brandImg = event.data.logoFileNm;
-		if(!gagajf.isNull(brandImg)){
-			$("#logoFileNm").val(brandImg);
-			$("#bannerPreViewUrl").attr('src', $("#uploadDefaultUrl").val()+brandImg);
-			$("#imgView").removeClass("off").addClass("on");
+		var brandImg1 = event.data.logoFileNm;
+		if(!gagajf.isNull(brandImg1)){
+			$("#logoFileNm").val(brandImg1);
+			$("#bannerPreViewUrl1").attr('src', $("#uploadDefaultUrl").val()+brandImg1);
+			$("#imgView1").removeClass("off").addClass("on");
 		}else {
-			$("#logoFileNm").val('');
-			$("#orgFileNm").val('');
-			$("#bannerPreViewUrl").attr('src', '');
+			$("#logoFileNm1").val('');
+			$("#orgFileNm1").val('');
+			$("#bannerPreViewUrl1").attr('src', '');
+			$("#imgView1").removeClass("on").addClass("off");
+			
+		}
+		
+		var brandImg2 = event.data.bwLogoFileNm;
+		if(!gagajf.isNull(brandImg2)){
+			$("#bwLogoFileNm").val(brandImg2);
+			$("#bannerPreViewUrl2").attr('src', $("#uploadDefaultUrl").val()+brandImg2);
+			$("#imgView2").removeClass("off").addClass("on");
+		}else {
+			$("#logoFileNm2").val('');
+			$("#orgFileNm2").val('');
+			$("#bannerPreViewUrl2").attr('src', '');
 			$("#imgView").removeClass("on").addClass("off");
 			
 		}
+		
 		$('#brandGroupForm input[name=file]').closest('div').find('label').text('파일선택'); 
 		
 	}
@@ -235,12 +265,38 @@
 	});
 	
 	//이미지 클릭시 미리보기
-	$("#bannerPreViewUrl").click(function(){
-		cfnOpenImagePreViewPopup('bannerPreimgView',$('#bannerPreViewUrl').attr('src'));
+	$("#bannerPreViewUrl1").click(function(){
+		cfnOpenImagePreViewPopup('bannerPreimgView',$('#bannerPreViewUrl1').attr('src'));
+	});
+	
+	$("#bannerPreViewUrl2").click(function(){
+		cfnOpenImagePreViewPopup('bannerPreimgView',$('#bannerPreViewUrl2').attr('src'));
 	});
 	
+	// 파일첨부 선택 시
+	$('#file1').on('change', function() { fnChooseFile(this, 1); });
+	$('#file2').on('change', function() { fnChooseFile(this, 2); });
+	
+	var fnChooseFile = function(obj, fileNo) {
+		// multiple 속성이 있으면 files에는 다수의 객체가 할당됨
+		var file = obj.files[0];
+
+		// 파일 업로드
+		gagajf.ajaxFileUpload('/common/file/upload?subDir=/contents/brand'
+			, file
+			, function(result) {
+				$('#brandGroupForm').find('#newSysFileNm' + fileNo).val(result.newFileName);
+				$('#brandGroupForm').find('#sysFileNm' + fileNo).val(result.newFileName);
+				$('#bannerPreViewUrl' + fileNo).attr('src', $("#uploadDefaultUrl").val()+"/contents/brand/"+result.newFileName);
+				$('#imgView' + fileNo).removeClass("off").addClass("on");
+			}
+			, 'image'
+		);
+	}
+	
+	
 	//첨부파일 등록
-	$('#brandGroupForm input[name=file]').on('change', function() {
+	/* $('#brandGroupForm input[name=file]').on('change', function() {
 		var file = this.files[0];
 		file.name = 'test';
 		if (typeof(file) == 'undefined'){
@@ -250,14 +306,14 @@
 		gagajf.ajaxFileUpload('/common/file/upload?subDir=/contents'
 				, file
 				, function(result) {
-					$('#brandGroupForm input[name=newSysFileNm]').val(result.newFileName);
-					$('#brandGroupForm input[name=sysFileNm]').val(result.newFileName);
+					$('#brandGroupForm input[name=newSysFileNm2]').val(result.newFileName);
+					$('#brandGroupForm input[name=sysFileNm2]').val(result.newFileName);
 					$("#bannerPreViewUrl").attr('src', $("#uploadDefaultUrl").val()+"/contents/brand/"+result.newFileName);
-					$("#imgView").removeClass("off").addClass("on");
+					//$("#imgView").removeClass("off").addClass("on");
 				}
 				, 'image'
 		);
-	});
+	}); */
 	
 	// 저장
 	$("#btnBrandGroupSave").on("click", function() {
@@ -290,7 +346,23 @@
 				return false;
 			}
 		}
+		debugger;
+		// 이미지 체크
+		if (!gagajf.isNull($("#brandGroupForm input[name=logoFileNm]").val()) || !gagajf.isNull($("#brandGroupForm input[name=sysFileNm1]").val())){
+			if (gagajf.isNull($("#brandGroupForm input[name=bwLogoFileNm]").val()) && gagajf.isNull($("#brandGroupForm input[name=sysFileNm2]").val())){
+				mcxDialog.alert("브랜드 흑백 이미지를 등록 해주세요.");
+				return false;
+			}
+			
+		}
 		
+		if (!gagajf.isNull($("#brandGroupForm input[name=bwLogoFileNm]").val()) || !gagajf.isNull($("#brandGroupForm input[name=sysFileNm2]").val())){
+			if (gagajf.isNull($("#brandGroupForm input[name=logoFileNm]").val()) && gagajf.isNull($("#brandGroupForm input[name=sysFileNm1]").val())){
+				mcxDialog.alert("브랜드 칼라이미지를 등록 해주세요.");
+				return false;
+			}
+			
+		}
 		
 		mcxDialog.confirm('저장하시겠습니까?', {
 			cancelBtnText: "취소",
@@ -307,11 +379,16 @@
 	$("#btnBrandGroupNew").on("click", function() {
 		$("#brandGroupForm")[0].reset();
 		$("#brandGroupForm input[name=mode]").val("N");
-		$("#bannerPreViewUrl").attr('src', '');
-		$('#brandGroupForm input[name=newSysFileNm]').val('');
-		$('#brandGroupForm input[name=sysFileNm]').val('');
+		$("#bannerPreViewUrl1").attr('src', '');
+		$("#bannerPreViewUrl2").attr('src', '');
+		$('#brandGroupForm input[name=newSysFileNm1]').val('');
+		$('#brandGroupForm input[name=sysFileNm1]').val('');
+		$('#brandGroupForm input[name=newSysFileNm2]').val('');
+		$('#brandGroupForm input[name=sysFileNm2]').val('');
 		$('#brandGroupForm input[name=logoFileNm]').val('');
-		$("#imgView").removeClass("on").addClass("off");
+		$('#brandGroupForm input[name=bwLogoFileNm]').val('');
+		$("#imgView1").removeClass("on").addClass("off");
+		$("#imgView2").removeClass("on").addClass("off");
 	});
 	
 	$(document).ready(function() {

+ 8 - 18
src/main/webapp/WEB-INF/views/display/PopupListForm.html

@@ -164,6 +164,7 @@
 		<div class="panelStyle">
 			<form id="detailForm" name="detailForm" action="#" th:action="@{'/display/popup/save'}">
 				<input type="hidden" name="popupGb" value="W"/>	<!--팝업종류-->
+				<input type="hidden" name="unexpDays" value="1"/>	<!--미노출일수-->
 				<table class="frmStyle">
 					<colgroup>
 						<col style="width:10%;"/>
@@ -172,6 +173,7 @@
 						<col style="width:15%;"/>
 						<col style="width:10%;"/>
 						<col style="width:15%;"/>
+						<col style="width:10%;"/>
 						<col/>
 					</colgroup>
 					<tr>
@@ -186,7 +188,7 @@
 							</select>
 						</td>
 						<th>전시위치<i class="required" title="필수"></i></th>
-						<td colspan="3">
+						<td>
 							<select name="viewPage" id="viewPage" onchange="fnChangeViewPage('')" data-valid-name="전시위치">
 								<option th:if="${viewPageList}" th:each="oneData, status : ${viewPageList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
 							</select>
@@ -199,8 +201,6 @@
 							<input type="text" class="off w80" name="planSq" id="planSq" placeholder="기획전번호" data-valid-name="기획전번호"/>
 							<button type="button" class="off btn btn-base btn-lg" id="btnSearchPlan"  onclick="fnPlanSearch('')">기획전 조회</button>
 						</td>
-					</tr>
-					<tr>
 						<th>PC/모바일 구분<i class="required" title="필수"></i></th>
 						<td>
 							<select name="frontGb" id="frontGb">
@@ -209,20 +209,10 @@
 								<option value="M">[M] 모바일</option>
 							</select>
 						</td>
-						<!--<th>팝업종류<i class="required" title="필수"></i></th>
-						<td>
-							<select name="popupGb" id="popupGb">
-								<option value="W">윈도우</option>
-								<option value="L">고정레이어</option>
-								<option value="M">이동레이어</option>
-							</select>
-						</td>-->
-						<th>미노출일수<i class="required" title="필수"></i></th>
-						<td>
-							<input type="text" class="w90" name="unexpDays" id="unexpDays" required="required" data-valid-type=numeric data-valid-name="미노출일수" value="1"/>
-						</td>
+					</tr>
+					<tr>
 						<th>우선순위<i class="required" title="필수"></i></th>
-						<td colspan="3">
+						<td colspan="7">
 							<input type="text" class="w90" name="dispOrd" id="dispOrd" required="required" data-valid-type=numeric data-valid-name="우선순위"/>
 						</td>
 					</tr>
@@ -453,7 +443,7 @@
 		$("#linkUrl").val('#');
 		$('#detailForm input[name=imgUrl]').val('');
 		$('#detailForm input[name=imgUrl]').closest('div').find('label').text('파일선택');
-		$('#detailForm #imgFileNm1').html('');
+		//$('#detailForm #imgFileNm1').html('');
 		$('#detailForm input[name=orgFileNm]').val('');
 		$('#detailForm input[name=sysFileNm]').val('');
 		$('#detailForm input[name=newSysFileNm]').val('');
@@ -497,7 +487,7 @@
 			}
 		}
 
-		var orgFileNm = $('#detailForm #imgFileNm1').html();
+		var orgFileNm = $('#detailForm input[name=sysFileNm]').val()
 		var imgFileNm = $('#detailForm input[name=newSysFileNm]').val();
 		if(gagajf.isNull(orgFileNm)){
 			if(gagajf.isNull(imgFileNm)){