메인화면 배너 롤링 기능 구현
This commit is contained in:
parent
2194fad76a
commit
a716dda23e
@ -58,4 +58,20 @@ public interface MainService
|
|||||||
*/
|
*/
|
||||||
public List<CollectionVO> listOnline(String mngOrgCd);
|
public List<CollectionVO> listOnline(String mngOrgCd);
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* 지방문화원별 배너 정보를 조회한다.
|
||||||
|
*
|
||||||
|
* @param mngOrgCd
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<Map<String, String>> listBannerInfos(String mngOrgCd);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 메인화면 배너ID에 대한 정보를 가져온다.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Map<String, String> getBannerInfo(String bannerId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -42,4 +42,18 @@ public interface MainDAO {
|
|||||||
*/
|
*/
|
||||||
public List<CollectionVO> listOnline(String mngOrgCd);
|
public List<CollectionVO> listOnline(String mngOrgCd);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 지방문화원별 배너 정보를 조회한다.
|
||||||
|
*
|
||||||
|
* @param mngOrgCd
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<Map<String, String>> listBannerInfos(String mngOrgCd);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 메인화면 배너ID에 대한 정보를 가져온다.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Map<String, String> getBannerInfo(String bannerId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,4 +93,23 @@ public class MainServiceImpl implements MainService
|
|||||||
return mainDAO.listOnline(mngOrgCd);
|
return mainDAO.listOnline(mngOrgCd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 지방문화원별 배너 정보를 조회한다.
|
||||||
|
*
|
||||||
|
* @param mngOrgCd
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<Map<String, String>> listBannerInfos(String mngOrgCd) {
|
||||||
|
return mainDAO.listBannerInfos(mngOrgCd);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 메인화면 배너ID에 대한 정보를 가져온다.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Map<String, String> getBannerInfo(String bannerId) {
|
||||||
|
return mainDAO.getBannerInfo(bannerId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,9 +1,12 @@
|
|||||||
package nlib.cmm.web;
|
package nlib.cmm.web;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.activation.MimetypesFileTypeMap;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@ -16,6 +19,7 @@ import org.springframework.security.web.savedrequest.RequestCache;
|
|||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
import nlib.bbs.service.ArticleVO;
|
import nlib.bbs.service.ArticleVO;
|
||||||
import nlib.bbs.service.BoardService;
|
import nlib.bbs.service.BoardService;
|
||||||
@ -127,6 +131,10 @@ public class MainController extends NlibCommonController {
|
|||||||
List<ArticleVO> listQna = qnaService.listArticles(searchArticleVO);
|
List<ArticleVO> listQna = qnaService.listArticles(searchArticleVO);
|
||||||
model.addAttribute("listQna", listQna);
|
model.addAttribute("listQna", listQna);
|
||||||
|
|
||||||
|
// 메인 화면 배너
|
||||||
|
List<Map<String, String>> listBannerInfos = mainService.listBannerInfos(mngOrgCd);
|
||||||
|
model.addAttribute("listBannerInfos", listBannerInfos);
|
||||||
|
|
||||||
return "nlib/cmm/home";
|
return "nlib/cmm/home";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,4 +181,37 @@ public class MainController extends NlibCommonController {
|
|||||||
return "nlib/cmm/headerSubPart";
|
return "nlib/cmm/headerSubPart";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/main/bannerImage.do")
|
||||||
|
public void getBannerImage(HttpServletRequest request, HttpServletResponse response, String bannerId) throws IOException {
|
||||||
|
|
||||||
|
Map<String, String> bannerInfo = mainService.getBannerInfo(bannerId);
|
||||||
|
boolean exists = false;
|
||||||
|
|
||||||
|
if(bannerInfo != null && StringUtil.isNotEmpty(bannerInfo.get("fileStreCours")) && StringUtil.isNotEmpty(bannerInfo.get("streFileNm")) && StringUtil.isNotEmpty(bannerInfo.get("orignlFileNm"))) {
|
||||||
|
try {
|
||||||
|
String fileName = bannerInfo.get("fileStreCours") + bannerInfo.get("streFileNm");
|
||||||
|
MimetypesFileTypeMap mimetypesFileTypeMap = new MimetypesFileTypeMap();
|
||||||
|
response.setContentType(mimetypesFileTypeMap.getContentType(bannerInfo.get("orignlFileNm")));
|
||||||
|
response.getOutputStream().write(Files.readAllBytes(Paths.get(fileName)));
|
||||||
|
exists = true;
|
||||||
|
} catch(Exception e) {
|
||||||
|
log.error("메인 화면 배너 관련 파일을 확인할 수 없습니다. : bannerId=" + bannerId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!exists) {
|
||||||
|
try {
|
||||||
|
String fileName = NlibProperty.getString("main.banner.img.path");
|
||||||
|
MimetypesFileTypeMap mimetypesFileTypeMap = new MimetypesFileTypeMap();
|
||||||
|
response.setContentType(mimetypesFileTypeMap.getContentType(bannerInfo.get("orignlFileNm")));
|
||||||
|
response.getOutputStream().write(Files.readAllBytes(Paths.get(fileName)));
|
||||||
|
exists = true;
|
||||||
|
} catch(Exception e) {
|
||||||
|
log.error("메인 화면 배너 기본 배너 파일을 확인할 수 없습니다. : main.banner.img.path=" + NlibProperty.getString("main.banner.img.path"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -64,6 +64,7 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
.antMatchers("/temp/**")
|
.antMatchers("/temp/**")
|
||||||
.antMatchers("/favicon/**")
|
.antMatchers("/favicon/**")
|
||||||
.antMatchers("/html/**")
|
.antMatchers("/html/**")
|
||||||
|
.antMatchers("/banner/**")
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -143,5 +143,53 @@
|
|||||||
LIMIT 10
|
LIMIT 10
|
||||||
]]>
|
]]>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 메인 배너 롤링 : 2021.11.23 추가 -->
|
||||||
|
<select id="listBannerInfos" parameterType="String" resultType="egovMap">
|
||||||
|
<![CDATA[
|
||||||
|
SELECT
|
||||||
|
A.ORDER_SEQ
|
||||||
|
, A.BANNER_ID
|
||||||
|
, A.MNG_ORG_CD
|
||||||
|
, A.TITLE
|
||||||
|
, A.BANNER_DESC
|
||||||
|
, A.URL
|
||||||
|
, A.ATTACH_FILE_ID
|
||||||
|
, B.FILE_STRE_COURS
|
||||||
|
, B.STRE_FILE_NM
|
||||||
|
, B.ORIGNL_FILE_NM
|
||||||
|
, B.FILE_EXTSN
|
||||||
|
FROM BD_NLIB_BANNER A
|
||||||
|
LEFT OUTER JOIN BD_FILEDETAIL B ON (A.ATTACH_FILE_ID = B.ATTACH_FILE_ID AND IFNULL(B.USE_AT,'Y') = 'Y')
|
||||||
|
WHERE A.MNG_ORG_CD = #{mngOrgCd}
|
||||||
|
AND DATE_FORMAT(NOW(), '%Y%m%d%H') BETWEEN IFNULL(A.POST_START_DT, '1901010101') AND IFNULL(A.POST_END_DT , '9999123123')
|
||||||
|
AND IFNULL(USE_YN, 'Y') = 'Y'
|
||||||
|
AND DELETE_YN = 'N'
|
||||||
|
ORDER BY ORDER_SEQ
|
||||||
|
]]>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 메인 배너 롤링 : 2021.11.24 추가 -->
|
||||||
|
<select id="getBannerInfo" parameterType="String" resultType="egovMap">
|
||||||
|
<![CDATA[
|
||||||
|
SELECT
|
||||||
|
A.ORDER_SEQ
|
||||||
|
, A.BANNER_ID
|
||||||
|
, A.MNG_ORG_CD
|
||||||
|
, A.TITLE
|
||||||
|
, A.BANNER_DESC
|
||||||
|
, A.URL
|
||||||
|
, A.ATTACH_FILE_ID
|
||||||
|
, B.FILE_STRE_COURS
|
||||||
|
, B.STRE_FILE_NM
|
||||||
|
, B.ORIGNL_FILE_NM
|
||||||
|
, B.FILE_EXTSN
|
||||||
|
FROM BD_NLIB_BANNER A
|
||||||
|
LEFT OUTER JOIN BD_FILEDETAIL B ON (A.ATTACH_FILE_ID = B.ATTACH_FILE_ID AND IFNULL(B.USE_AT,'Y') = 'Y')
|
||||||
|
WHERE A.BANNER_ID = #{bannerId}
|
||||||
|
AND IFNULL(USE_YN, 'Y') = 'Y'
|
||||||
|
]]>
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -80,6 +80,15 @@ crypto.aria.defaultKey = gdyYs/IZqY86VcWhT8emCYfqY1ahw2vtLG+/FzNqtrQ=
|
|||||||
list.paging.page.size = 10
|
list.paging.page.size = 10
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------
|
||||||
|
# \uba54\uc778\ud654\uba74 \uae30\ubcf8 \ubc30\ub108
|
||||||
|
#----------------------------------------
|
||||||
|
# \uba54\uc778\ud654\uba74 \uae30\ubcf8 \ubc30\ub108 \uc704\uce58
|
||||||
|
# \ub85c\uceec LLLLLLLLLLLLLLL
|
||||||
|
#main.banner.img.path = C:/iams/workspace/nlib/src/main/webapp/images/bg/bg-mainbanner.jpg
|
||||||
|
# \uac1c\ubc1c\uc11c\ubc84
|
||||||
|
main.banner.img.path = /apps/tomcat/apache-tomcat-8.5.46_nlib/webapps/images/bg/bg-mainbanner.jpg
|
||||||
|
|
||||||
#----------------------------------------
|
#----------------------------------------
|
||||||
# \ucca8\ubd80\ud30c\uc77c \uacbd\ub85c \uc815\ubcf4
|
# \ucca8\ubd80\ud30c\uc77c \uacbd\ub85c \uc815\ubcf4
|
||||||
#----------------------------------------
|
#----------------------------------------
|
||||||
|
|||||||
@ -89,30 +89,41 @@ function fn_listPops(typeDivCd) {
|
|||||||
<!-- Swiper -->
|
<!-- Swiper -->
|
||||||
<div class="swiper MainSwiper">
|
<div class="swiper MainSwiper">
|
||||||
<ul class="swiper-wrapper">
|
<ul class="swiper-wrapper">
|
||||||
<li class="swiper-slide">
|
|
||||||
<div class="img"><img src="/images/bg/bg-mainbanner.jpg" alt="슬라이드 이미지 1"></div>
|
<c:if test="${fn:length(listBannerInfos) < 1 }">
|
||||||
<div class="text">
|
<li class="swiper-slide">
|
||||||
<h3>온라인 대출/알람예약 서비스를 통해<br>문화원 소장자료들을 만나보세요.</h3>
|
<div class="img"><img src="/images/bg/bg-mainbanner.jpg" alt="슬라이드 이미지 1"></div>
|
||||||
<p>자료 검색을 통해 원하는 자료를 찾고, 대출/열람 예약 신청까지!<br>온라인에서 쉽고 간편하게 할 수 있습니다.</p>
|
<div class="text">
|
||||||
<p><a href="#" class="eff">자세히 보기 ></a></p>
|
<h3>온라인 대출/알람예약 서비스를 통해<br>문화원 소장자료들을 만나보세요.</h3>
|
||||||
</div>
|
<p>자료 검색을 통해 원하는 자료를 찾고, 대출/열람 예약 신청까지!<br>온라인에서 쉽고 간편하게 할 수 있습니다.</p>
|
||||||
</li>
|
</div>
|
||||||
<li class="swiper-slide">
|
</li>
|
||||||
<div class="img"><img src="/images/bg/bg-mainbanner.jpg" alt="슬라이드 이미지 1"></div>
|
</c:if>
|
||||||
<div class="text">
|
|
||||||
<h3>온라인 대출/알람예약 서비스를 통해<br>문화원 소장자료들을 만나보세요.</h3>
|
<c:if test="${fn:length(listBannerInfos) > 0 }">
|
||||||
<p>자료 검색을 통해 원하는 자료를 찾고, 대출/열람 예약 신청까지!<br>온라인에서 쉽고 간편하게 할 수 있습니다.</p>
|
|
||||||
<p><a href="#" class="eff">자세히 보기 ></a></p>
|
<c:forEach var="bannerItem" items="${listBannerInfos }">
|
||||||
</div>
|
<li class="swiper-slide">
|
||||||
</li>
|
<div class="img">
|
||||||
<li class="swiper-slide">
|
<c:if test="${not empty bannerItem.streFileNm }">
|
||||||
<div class="img"><img src="/images/bg/bg-mainbanner.jpg" alt="슬라이드 이미지 1"></div>
|
<img src="/main/bannerImage.do?bannerId=${bannerItem.bannerId }" alt="메인 슬라이딩 배너 이미지">
|
||||||
<div class="text">
|
</c:if>
|
||||||
<h3>온라인 대출/알람예약 서비스를 통해<br>문화원 소장자료들을 만나보세요.</h3>
|
<c:if test="${empty bannerItem.streFileNm }">
|
||||||
<p>자료 검색을 통해 원하는 자료를 찾고, 대출/열람 예약 신청까지!<br>온라인에서 쉽고 간편하게 할 수 있습니다.</p>
|
<img src="/images/bg/bg-mainbanner.jpg" alt="메인 슬라이딩 배너 이미지">
|
||||||
<p><a href="#" class="eff">자세히 보기 ></a></p>
|
</c:if>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
<div class="text">
|
||||||
|
<h3>${bannerItem.title }</h3>
|
||||||
|
<p>${bannerItem.bannerDesc }</p>
|
||||||
|
<c:if test="${not empty bannerItem.url }">
|
||||||
|
<p><a href="javascript:(0)" onclick="gfn_gotoUrl('${bannerItem.url}')" class="eff">자세히 보기 ></a></p>
|
||||||
|
</c:if>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</c:forEach>
|
||||||
|
</c:if>
|
||||||
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
<div class="swiper-button-next"></div>
|
<div class="swiper-button-next"></div>
|
||||||
<div class="swiper-button-prev"></div>
|
<div class="swiper-button-prev"></div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user