Просмотр исходного кода

문의내용과 답변내용 표출 시 개행문자(\r\n)을 <br/> 태그로 치환하는 로직 추가

gagamel 5 лет назад
Родитель
Сommit
6082f37d8e
1 измененных файлов с 16 добавлено и 2 удалено
  1. 16 2
      src/main/java/com/style24/front/biz/service/TsfCounselService.java

+ 16 - 2
src/main/java/com/style24/front/biz/service/TsfCounselService.java

@@ -13,6 +13,8 @@ import com.style24.persistence.domain.Counsel;
 
 
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 
 
+import com.gagaframework.web.util.GagaStringUtil;
+
 /**
 /**
  * 상담(1:1문의) Service
  * 상담(1:1문의) Service
  *
  *
@@ -76,7 +78,13 @@ public class TsfCounselService {
 	 * @since 2020. 12. 28
 	 * @since 2020. 12. 28
 	 */
 	 */
 	public Collection<Counsel> getOneToOneQnaList(Counsel counsel) {
 	public Collection<Counsel> getOneToOneQnaList(Counsel counsel) {
-		return counselDao.getOneToOneQnaList(counsel);
+		Collection<Counsel> counselList = counselDao.getOneToOneQnaList(counsel);
+		for (Counsel item : counselList) {
+			item.setQuestContent(GagaStringUtil.replace(item.getQuestContent(), "\r\n", "<br/>"));
+			item.setAnsContent(GagaStringUtil.replace(item.getAnsContent(), "\r\n", "<br/>"));
+		}
+
+		return counselList;
 	}
 	}
 
 
 	/**
 	/**
@@ -192,7 +200,13 @@ public class TsfCounselService {
 	 * @since 2020. 12. 24
 	 * @since 2020. 12. 24
 	 */
 	 */
 	public Collection<Counsel> getGoodsQnaList(Counsel counsel) {
 	public Collection<Counsel> getGoodsQnaList(Counsel counsel) {
-		return counselDao.getGoodsQnaList(counsel);
+		Collection<Counsel> counselList = counselDao.getGoodsQnaList(counsel);
+		for (Counsel item : counselList) {
+			item.setQuestContent(GagaStringUtil.replace(item.getQuestContent(), "\r\n", "<br/>"));
+			item.setAnsContent(GagaStringUtil.replace(item.getAnsContent(), "\r\n", "<br/>"));
+		}
+
+		return counselList;
 	}
 	}
 
 
 	/**
 	/**