마이페이지 다른문화원 자료 상세조회시 호스트네임바뀌게 수정

This commit is contained in:
JSYOO 2021-12-15 16:38:35 +09:00
parent 4121bef620
commit 11c4231f7f
5 changed files with 96 additions and 22 deletions

View File

@ -106,4 +106,11 @@ public interface CollectionService {
*/ */
public List<CollectionVO> selectSimilarList(CollectionVO vo) throws Exception; public List<CollectionVO> selectSimilarList(CollectionVO vo) throws Exception;
/**
* 문화원 코드 조회
*
* @param vo
* @return
*/
public CollectionVO selectMngOrgInfo(String masterId) throws Exception;
} }

View File

@ -310,4 +310,14 @@ public class CollectionServiceImpl implements CollectionService {
return collectionDAO.selectSimilarList(vo); return collectionDAO.selectSimilarList(vo);
} }
/**
* 문화원 코드 조회
*
* @param vo
* @return
*/
public CollectionVO selectMngOrgInfo(String masterId) throws Exception {
return collectionDAO.selectMngOrgInfo(masterId);
}
} }

View File

@ -102,6 +102,7 @@ public class NlibSearchController extends NlibCommonController {
HttpSession session = request.getSession(); HttpSession session = request.getSession();
String councilCd = (String)session.getAttribute("councilCd"); String councilCd = (String)session.getAttribute("councilCd");
//검색엔진파라미터로 문화원코드 //검색엔진파라미터로 문화원코드
searchVO.setMngOrgCd(councilCd); searchVO.setMngOrgCd(councilCd);
@ -275,8 +276,24 @@ public class NlibSearchController extends NlibCommonController {
, HttpServletRequest request , HttpServletRequest request
, HttpServletResponse res , HttpServletResponse res
) throws Exception { ) throws Exception {
HttpSession session = request.getSession(); String new_addr = "";
String m_url = request.getRequestURL().toString();
String domainUrl = StringUtil.getHostName(m_url);
String masterId = request.getParameter("masterId"); String masterId = request.getParameter("masterId");
CollectionVO collectionVO = collectionService.selectMngOrgInfo(masterId);
new_addr = "https://" + domainUrl + ".nculture.org/search/searchItemDetail.do?masterId=" + masterId;
if(collectionVO != null && StringUtil.isNotEmpty(collectionVO.getDomainHostNm()) && !collectionVO.getDomainHostNm().equals(domainUrl))
{
new_addr = "https://" + collectionVO.getDomainHostNm() + ".nculture.org/search/searchItemDetail.do?masterId=" + masterId;
res.sendRedirect(new_addr);
return null;
}
HttpSession session = request.getSession();
List<String> mngOrgList = new ArrayList<>(); List<String> mngOrgList = new ArrayList<>();
List<String> keywordList = new ArrayList<>(); List<String> keywordList = new ArrayList<>();
@ -370,6 +387,40 @@ public class NlibSearchController extends NlibCommonController {
} }
/** /**
* 소장자료 상세조회
*
* @param req
* @return
*/
@RequestMapping(value = "/search/searchItemGate.do")
public void searchItemGate(
Authentication authentication
, @RequestParam Map<String, String> paramMap
, ModelMap model
, @ModelAttribute("searchVO") NlibSearchVO searchVO
, HttpServletRequest request
, HttpServletResponse res
) throws Exception {
String new_addr = "";
String m_url = request.getRequestURL().toString();
String domainUrl = m_url.substring(m_url.indexOf("//") + 2 , m_url.indexOf("."));
String masterId = request.getParameter("masterId");
CollectionVO collectionVO = collectionService.selectMngOrgInfo(masterId);
new_addr = "https://" + domainUrl + ".nculture.org/search/searchItemDetail.do?masterId=" + masterId;
if(collectionVO == null)
{
res.sendRedirect(new_addr);
}else {
if(StringUtil.isNotEmpty(collectionVO.getDomainHostNm()) && !collectionVO.getDomainHostNm().equals(domainUrl))
{
new_addr = "https://" + collectionVO.getDomainHostNm() + ".nculture.org/search/searchItemDetail.do?masterId=" + masterId;
}
res.sendRedirect(new_addr);
}
}
/**
* YOURLS의 API를 통해서 단축URL 가져오기 * YOURLS의 API를 통해서 단축URL 가져오기
* @param cmmVO * @param cmmVO
* @param model * @param model

View File

@ -6,10 +6,12 @@
<select id="selectMngOrgInfo" parameterType="String" resultType="CollectionVO"> <select id="selectMngOrgInfo" parameterType="String" resultType="CollectionVO">
SELECT SELECT
A.MNG_ORG_CD A.MNG_ORG_CD
, B.DOMAIN_HOST_NM
, B.DEPT_NM AS MNG_ORG_NM , B.DEPT_NM AS MNG_ORG_NM
FROM RG_MASTER A FROM RG_MASTER A
LEFT OUTER JOIN SM_DEPT B ON A.MNG_ORG_CD = B.ORG_CD LEFT OUTER JOIN SM_DEPT B ON A.MNG_ORG_CD = B.ORG_CD
WHERE A.MASTER_ID = #{masterId} WHERE A.MASTER_ID = #{masterId}
LIMIT 1
</select> </select>
<insert id="insertDataInquiryLog" parameterType="CollectionVO"> <insert id="insertDataInquiryLog" parameterType="CollectionVO">

View File

@ -263,6 +263,7 @@ function gfn_changeInterestBtn(masterId,onOff){
if(result != "notLogin") if(result != "notLogin")
{ {
$(".favorit").removeAttr("onclick"); $(".favorit").removeAttr("onclick");
$(".favorit").addClass("on");
$(".favorit").attr("onclick","gfn_changeInterestBtn('" + masterId + "','off')"); $(".favorit").attr("onclick","gfn_changeInterestBtn('" + masterId + "','off')");
} }
@ -290,6 +291,7 @@ function gfn_changeInterestBtn(masterId,onOff){
if( result != "notLogin") if( result != "notLogin")
{ {
$(".favorit").removeAttr("onclick"); $(".favorit").removeAttr("onclick");
$(".favorit").removeClass("on");
$(".favorit").attr("onclick","gfn_changeInterestBtn('" + masterId + "','on')"); $(".favorit").attr("onclick","gfn_changeInterestBtn('" + masterId + "','on')");
} }
@ -310,12 +312,12 @@ function gfn_changeInterest(masterId,onOff){
async: false, async: false,
data: {"masterId" : masterId} data: {"masterId" : masterId}
}).done(function(result){ }).done(function(result){
alert(result); if(result == "notLogin")
if(result == "로그인 후 이용하실 수 있습니다.")
{ {
alert("로그인 후, 이용하실 수 있습니다.");
return false; return false;
} }
if(result == "관심자료에 추가되었습니다.") if(result == "success")
{ {
$("#favorites_"+masterId).removeAttr("onclick"); $("#favorites_"+masterId).removeAttr("onclick");
$("#favorites_"+masterId).attr("onclick","gfn_changeInterest('" + masterId + "','off')"); $("#favorites_"+masterId).attr("onclick","gfn_changeInterest('" + masterId + "','off')");
@ -323,7 +325,9 @@ function gfn_changeInterest(masterId,onOff){
html += "<img src=\"/images/icon/icon-cart-Favorites-on.png\" class=\"off\" alt=\"즐겨찾기 아이콘\">" html += "<img src=\"/images/icon/icon-cart-Favorites-on.png\" class=\"off\" alt=\"즐겨찾기 아이콘\">"
html += "<img src=\"/images/icon/icon-cart-Favorites.png\" class=\"on\" alt=\"즐겨찾기 아이콘\">"; html += "<img src=\"/images/icon/icon-cart-Favorites.png\" class=\"on\" alt=\"즐겨찾기 아이콘\">";
$("#favorites_"+masterId).html(html); $("#favorites_"+masterId).html(html);
alert("관심자료에 추가되었습니다.");
} }
}); });
} }
if(onOff == "off") if(onOff == "off")
@ -335,14 +339,19 @@ function gfn_changeInterest(masterId,onOff){
type : "POST", type : "POST",
async: false, async: false,
data : {"masterIdList" : masterIdArray}, data : {"masterIdList" : masterIdArray},
success : function(){ success : function(result){
alert("선택하신 관심자료가 삭제되었습니다."); if(result == "success")
{
alert("관심자료가 삭제되었습니다.");
$("#favorites_"+masterId).removeAttr("onclick"); $("#favorites_"+masterId).removeAttr("onclick");
$("#favorites_"+masterId).attr("onclick","gfn_changeInterest('" + masterId + "','on')"); $("#favorites_"+masterId).attr("onclick","gfn_changeInterest('" + masterId + "','on')");
$("#favorites_"+masterId).attr("title","관심자료로 등록합니다."); $("#favorites_"+masterId).attr("title","관심자료로 등록합니다.");
html += "<img src=\"/images/icon/icon-cart-Favorites.png\" class=\"off\" alt=\"즐겨찾기 아이콘\">" html += "<img src=\"/images/icon/icon-cart-Favorites.png\" class=\"off\" alt=\"즐겨찾기 아이콘\">"
html += "<img src=\"/images/icon/icon-cart-Favorites-on.png\" class=\"on\" alt=\"즐겨찾기 아이콘\">"; html += "<img src=\"/images/icon/icon-cart-Favorites-on.png\" class=\"on\" alt=\"즐겨찾기 아이콘\">";
$("#favorites_"+masterId).html(html); $("#favorites_"+masterId).html(html);
}else{
alert("관심자료 삭제에 실패하였습니다.");
}
},error : function(){ },error : function(){
} }
}); });
@ -532,15 +541,10 @@ function gfn_gotoUrl(url) {
location.href = url; location.href = url;
} }
function gfn_getDetail(masterId, host) { function gfn_getDetail(masterId) {
var url = "/search/searchItemDetail.do?masterId=" + masterId;
if(gfn_isEmpty(host)) host = "";
else host = "https://" + host + ".nculture.org";
var url = host + "/search/searchItemDetail.do?masterId=" + masterId;
gfn_openNewWindow(url); gfn_openNewWindow(url);
return; return;
} }