sowon4187 5 лет назад
Родитель
Сommit
847ba4e85b

+ 29 - 25
src/main/java/com/style24/front/biz/service/TsfCounselService.java

@@ -3,6 +3,7 @@ package com.style24.front.biz.service;
 import java.io.File;
 import java.util.Collection;
 
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;
@@ -59,33 +60,36 @@ public class TsfCounselService {
 			String[] sysItem = counsel.getSysFileNmArr();
 			
 			for (int i = 0; i < orgItem.length; i++) {
-				String imgInd = String.valueOf(ind);
-				if (ind < 10) {
-					imgInd = "0" + imgInd;
-				}
-				String planUploadPath = env.getProperty("upload.default.target.path");
-				String yearMonth = GagaDateUtil.getToday().substring(0, 6);
-				planUploadPath = GagaFileUtil.getConcatenationPath(planUploadPath, "/counsel");
-				File newFile = new File(GagaFileUtil.getConcatenationPath(planUploadPath, sysItem[i]));
-				planUploadPath = GagaFileUtil.getConcatenationPath(planUploadPath, yearMonth);
-				String newFilename = "COUNSEL_" + GagaDateUtil.getTodayDateTime() + "_" + imgInd + "." + org.springframework.util.StringUtils.getFilenameExtension(sysItem[i]);
-				File uniqueFile = GagaFileUtil.getUniqueFile(new File(GagaFileUtil.getConcatenationPath(planUploadPath, newFilename)));
-				// Rename a file
-				File path = new File(planUploadPath);
-				if (!path.exists()) {
-					path.mkdir();
-				}
-				newFile.renameTo(uniqueFile);
-				
-				if (i == 0) {
-					counsel.setOrgFileNm1(orgItem[i]);
-					counsel.setSysFileNm1("/counsel/" + yearMonth + "/" + newFilename);
-				}else {
-					counsel.setOrgFileNm2(orgItem[i]);
-					counsel.setSysFileNm2("/counsel/" + yearMonth + "/" + newFilename);
+				if (orgItem[i] != "") {
+					String imgInd = String.valueOf(ind);
+					if (ind < 10) {
+						imgInd = "0" + imgInd;
+					}
+					String planUploadPath = env.getProperty("upload.default.target.path");
+					String yearMonth = GagaDateUtil.getToday().substring(0, 6);
+					planUploadPath = GagaFileUtil.getConcatenationPath(planUploadPath, "/counsel");
+					File newFile = new File(GagaFileUtil.getConcatenationPath(planUploadPath, sysItem[i]));
+					planUploadPath = GagaFileUtil.getConcatenationPath(planUploadPath, yearMonth);
+					String newFilename = "COUNSEL_" + GagaDateUtil.getTodayDateTime() + "_" + imgInd + "." + org.springframework.util.StringUtils.getFilenameExtension(sysItem[i]);
+					File uniqueFile = GagaFileUtil.getUniqueFile(new File(GagaFileUtil.getConcatenationPath(planUploadPath, newFilename)));
+					// Rename a file
+					File path = new File(planUploadPath);
+					if (!path.exists()) {
+						path.mkdir();
+					}
+					newFile.renameTo(uniqueFile);
+					
+					if (i == 0) {
+						counsel.setOrgFileNm1(orgItem[i]);
+						counsel.setSysFileNm1("/counsel/" + yearMonth + "/" + newFilename);
+					}else {
+						counsel.setOrgFileNm2(orgItem[i]);
+						counsel.setSysFileNm2("/counsel/" + yearMonth + "/" + newFilename);
+					}
+					
+					ind++;
 				}
 				
-				ind++;
 			}
 			
 			counselDao.updateOneToOneQna(counsel);

+ 2 - 1
src/main/java/com/style24/persistence/mybatis/shop/TsfFaq.xml

@@ -27,7 +27,8 @@
 		FROM   TB_FAQ
 		WHERE  SITE_CD = #{siteCd}
 		AND    USE_YN = 'Y'
-		ORDER  BY DISP_ORD
+		ORDER  BY   DISP_ORD 
+		          , REG_DT DESC
 		LIMIT 10
 	</select>
 	

+ 12 - 3
src/main/webapp/WEB-INF/views/mob/callcenter/GoodsQnaFormMob.html

@@ -87,6 +87,15 @@
 		gagajf.ajaxFormSubmit($('#qnaForm').prop('action'), '#qnaForm', fnGetListCallback);
 	});
 	
+	var fnTestBr = function(obj){
+		let tag = '';
+		if(!gagajf.isNull(obj)){
+			var brText = obj;
+			tag = brText.replace(/(&lt;br\/&gt;)/g, '<br>');
+		}
+		return tag;
+	}
+	
 	// QNA 콜백함수
 	var fnGetListCallback = function(result) {
 		// 목록
@@ -101,7 +110,7 @@
 				tag += '						<span class="fold_state ' + (item.ansStat == "G060_10" ? "doing" : "done") + '"">' + item.ansStatNm + '</span>\n'; //답변완료 : done / 처리중 : doing
 				tag += '						<span class="prod">' + item.goodsNm + ' ' + item.relGoodsCd + '</span>\n';
 				tag += '					</div>\n';
-				tag += '					<div class="lap2"><span>' + item.questContent.escapeHtml() + '</span></div>\n';
+				tag += '					<div class="lap2"><span>' + fnTestBr(item.questContent.escapeHtml()) + '</span></div>\n';
 				tag += '				</div>\n';
 				tag += '				<span class="data">' + item.questDt + '</span>\n';
 				tag += '			</div>\n';
@@ -110,14 +119,14 @@
 				tag += '	<div class="fold_cont">\n';
 				tag += '		<div class="fold_detail">\n';
 				tag += '			<div>\n';
-				tag += '				<p>' + item.questContent.escapeHtml() + '</p>\n';
+				tag += '				<p>' + fnTestBr(item.questContent.escapeHtml()) + '</p>\n';
 				tag += '			</div>\n';
 				tag += '		</div>\n';
 				
 				if (item.ansStat == 'G060_20') { // 답변완료일 때
 					tag += '		<div class="fold_answer">\n';
 					tag += '			<div>\n';
-					tag += '				<div class="answer_body">' + item.ansContent + '</div>\n';
+					tag += '				<div class="answer_body">' + fnTestBr(item.ansContent.escapeHtml()) + '</div>\n';
 					tag += '				<div class="answer_foot">\n';
 					tag += '					<span class="data">' + item.ansDt + '</span>\n';
 					tag += '					<button type="button" class="btn_delete" onclick="fnDeleteQna(' + item.counselSq + ');"><span>삭제</span></button>\n';

+ 1 - 1
src/main/webapp/WEB-INF/views/mob/callcenter/NoticeFormMob.html

@@ -95,7 +95,7 @@
 				tag += '	</div>\n';
 				tag += '	<div class="fold_cont">\n';
 				tag += '		<div class="fold_answer">\n';
-				tag += '			<div class="answer_body">' + item.noticeContent.escapeHtml() + '</div>\n';
+				tag += '			<div class="answer_body">' + item.noticeContent + '</div>\n';
 				tag += '		</div>\n';
 				tag += '	</div>\n';
 				tag += '</li>\n';

+ 13 - 2
src/main/webapp/WEB-INF/views/mob/callcenter/OneToOneQnaFormMob.html

@@ -291,6 +291,15 @@
 		gagajf.ajaxFormSubmit($('#qnaForm').prop('action'), '#qnaForm', fnGetListCallback);
 	});
 	
+	var fnTestBr = function(obj){
+		let tag = '';
+		if(!gagajf.isNull(obj)){
+			var brText = obj;
+			tag = brText.replace(/(&lt;br\/&gt;)/g, '<br>');
+		}
+		return tag;
+	}
+	
 	// QNA 콜백함수
 	var fnGetListCallback = function(result) {
 		// 목록
@@ -313,7 +322,9 @@
 				tag += '	</div>\n';
 				tag += '	<div class="fold_cont">\n';
 				tag += '		<div class="fold_detail">\n';
-				tag += '			<div><p>' + item.questContent + '</p></div>\n';
+				tag += '			<div><p>\n';
+				tag += fnTestBr(item.questContent.escapeHtml());
+				tag += '</p></div>\n';
 				
 				if (!gagajf.isNull(item.sysFileNm1) || !gagajf.isNull(item.sysFileNm2)) {
 					tag += '		<p class="img_group">\n';
@@ -340,7 +351,7 @@
 				if (item.ansStat == 'G060_20') { // 답변완료 상태일 때
 					tag += '	<div class="fold_answer">\n';
 					tag += '		<div>\n';
-					tag += '			<div class="answer_body">' + item.ansContent.escapeHtml() + '</div>\n';
+					tag += '			<div class="answer_body">' + fnTestBr(item.ansContent.escapeHtml()) + '</div>\n';
 					tag += '			<div class="answer_foot">\n';
 					tag += '				<span class="data">' + item.ansDt + '</span>\n';
 					

+ 12 - 3
src/main/webapp/WEB-INF/views/web/callcenter/GoodsQnaFormWeb.html

@@ -107,6 +107,15 @@
 		gagaPaging.load(1);
 	}
 	
+	var fnTestBr = function(obj){
+		let tag = '';
+		if(!gagajf.isNull(obj)){
+			var brText = obj;
+			tag = brText.replace(/(&lt;br\/&gt;)/g, '<br>');
+		}
+		return tag;
+	}
+	
 	var fnGetListCallback = function(result) {
 		$('#ulQna').html('');
 
@@ -120,7 +129,7 @@
 				tag += '				<span class="fold_state ' + (item.ansStat == "G060_10" ? "doing" : "done") + '">' + item.ansStatNm + '</span>\n'; //답변완료 : done / 처리중 : doing
 				tag += '				<div class="fold_tit">\n';
 				tag += '					<span class="prod">' + item.goodsNm + ' ' + item.relGoodsCd + '</span>\n';
-				tag += '					<span>' + item.questContent.escapeHtml() + '</span>\n';
+				tag += '					<span>' + fnTestBr(item.questContent.escapeHtml()) + '</span>\n';
 				tag += '				</div>\n';
 				tag += '				<span class="data">' + item.questDt + '</span>\n';
 				tag += '			</div>\n';
@@ -129,7 +138,7 @@
 				tag += '	<div class="fold_cont" style="display: none;">\n';
 				tag += '		<div class="fold_detail">\n'; //문의 내용
 				tag += '			<div>\n';
-				tag += '				<p>' + item.questContent.escapeHtml() + '</p>\n';
+				tag += '				<p>' + fnTestBr(item.questContent.escapeHtml()) + '</p>\n';
 				tag += '			</div>\n';
 				
 				if (item.ansStat == 'G060_20') { // 답변완료일 때
@@ -141,7 +150,7 @@
 				if (item.ansStat == 'G060_20') { // 답변완료 상태일 때
 					tag += '		<div class="fold_answer">\n'; //문의 답변
 					tag += '			<div class="answer_head">답변이 등록되었습니다.</div>\n';
-					tag += '			<div class="answer_body">' + item.ansContent + '</div>\n';
+					tag += '			<div class="answer_body">' + fnTestBr(item.ansContent.escapeHtml()) + '</div>\n';
 					tag += '			<span class="data">' + item.ansDt + '</span>\n';
 					tag += '		</div>\n';
 				}

+ 9 - 0
src/main/webapp/WEB-INF/views/web/callcenter/NoticeFormWeb.html

@@ -86,6 +86,15 @@
 		gagaPaging.load(1);
 	}
 	
+	var fnTestBr = function(obj){
+		let tag = '';
+		if(!gagajf.isNull(obj)){
+			var brText = obj;
+			tag = brText.replace(/(&lt;br\/&gt;)/g, '<br>');
+		}
+		return tag;
+	}
+	
 	var fnGetListCallback = function(result) {
 		$('#ulNotice').html('');
 

+ 15 - 3
src/main/webapp/WEB-INF/views/web/callcenter/OneToOneQnaFormWeb.html

@@ -170,6 +170,17 @@
 		gagaPaging.load(1);
 	}
 	
+	var fnTestBr = function(obj){
+		let tag = '';
+		if(!gagajf.isNull(obj)){
+			var brText = obj;
+			tag = brText.replace(/(&lt;br\/&gt;)/g, '<br>');
+		}
+		return tag;
+	}
+	
+
+	
 	var fnGetListCallback = function(result) {
 		$('#ulQna').html('');
 
@@ -191,8 +202,9 @@
 				tag += '	</div>\n';
 				tag += '	<div class="fold_cont" style="display: none;">\n';
 				tag += '		<div class="fold_detail">\n'; //문의 내용
-				tag += '			<div>\n';
-				tag += '				<p>' + item.questContent + '</p>\n';
+				tag += '			<div><p>\n';
+				tag += fnTestBr(item.questContent.escapeHtml());
+				tag += '</p></div>\n';
 				
 				if (!gagajf.isNull(item.sysFileNm1) || !gagajf.isNull(item.sysFileNm2)) {
 					tag += '				<p class="img_group">\n';
@@ -223,7 +235,7 @@
 				if (item.ansStat == 'G060_20') { // 답변완료 상태일 때
 					tag += '		<div class="fold_answer">\n'; //문의 답변
 					tag += '			<div class="answer_head">답변이 등록되었습니다.</div>\n';
-					tag += '			<div class="answer_body">' + item.ansContent.escapeHtml() + '</div>\n';
+					tag += '			<div class="answer_body">' + fnTestBr(item.ansContent.escapeHtml()) + '</div>\n';
 					tag += '			<span class="data">' + item.ansDt + '</span>\n';
 					tag += '		</div>\n';
 				}