상세조회 : 카트담기 기능 연동
This commit is contained in:
parent
93e13849ae
commit
c6bf5fce6c
@ -142,6 +142,91 @@ public class CollectionVO extends PagingVO {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* 대출가능 여부 (1/0)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean canRent() {
|
||||
|
||||
// 원문공개 : 비공개가 아닌 경우
|
||||
if(StringUtil.getString(openDivCd, "3").equals("3")) return false;
|
||||
|
||||
// 대출가능코드
|
||||
if(!StringUtil.getString(operOutRangeCd, "N").equalsIgnoreCase("Y")) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 현재 대출(예약) 신청 가능 여부 (1/0)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean canRentNow() {
|
||||
if(canRent()) return false;
|
||||
|
||||
// 대출신청가능 또는 예약가능
|
||||
if(":01:02:".contains(":" + StringUtil.getString(useStatus, "00") + ":")) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 현재 대출예약만 가능 여부 (1/0)
|
||||
* @return
|
||||
*/
|
||||
public boolean canRentReservationNow() {
|
||||
if(canRent()) return false;
|
||||
|
||||
// 대출신청가능 또는 예약가능
|
||||
if(StringUtil.getString(useStatus, "00").equalsIgnoreCase("02")) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 열람가능 여부 (1/0)
|
||||
* @return
|
||||
*/
|
||||
public boolean canRead() {
|
||||
|
||||
// 원문공개 : 비공개가 아닌 경우
|
||||
if(StringUtil.getString(openDivCd, "3").equals("3")) return false;
|
||||
|
||||
// 열람가능코드 : 열람불가 아닌 경우
|
||||
if(StringUtil.getString(operReadRangeCd, "03").equalsIgnoreCase("03")) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 현재 열람가능 여부 (1/0)
|
||||
* @return
|
||||
*/
|
||||
public boolean canReadNow() {
|
||||
|
||||
if(canRead()) return false;
|
||||
|
||||
if(":01:04:05:06:".contains(":" + StringUtil.getString(useStatus, "00") + ":")) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 온라인열람 여부 (1/0)
|
||||
* @return
|
||||
*/
|
||||
public boolean canView() {
|
||||
|
||||
// 원문공개 : 비공개가 아닌 경우
|
||||
if(StringUtil.getString(openDivCd, "3").equals("3")) return false;
|
||||
|
||||
// TO-DO : 온라인여부 : 추후 API에 추가될 예정 이후 조건 추가 필요 DDDDDDDDDDDDDDDDDDDDDDDDDDDD
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public CollectionVO(String resultCode, String resultMessage) {
|
||||
super();
|
||||
setResult(resultCode, resultMessage);
|
||||
|
||||
@ -214,8 +214,39 @@ public class CartController extends NlibCommonController
|
||||
|
||||
int changedCnt = 0;
|
||||
|
||||
try {
|
||||
if(StringUtil.isEmpty(cartVO.getMasterId())) {
|
||||
code = "F";
|
||||
message = "카트에 추가할 자료 정보가 입력되지 않았습니다.";
|
||||
}
|
||||
|
||||
if(code.charAt(0) == 'S') {
|
||||
// 상세정보 조회
|
||||
cartVO = collectionService.getItemInfo(cartVO);
|
||||
if(cartVO == null || StringUtil.isEmpty(cartVO.getMasterId()) || StringUtil.isEmpty(cartVO.getUseStatus())) {
|
||||
code = "F";
|
||||
message = "카트에 추가할 자료 정보가 부적합합니다. 관리자에게 문의하여 주시기 바랍니다.";
|
||||
}
|
||||
}
|
||||
|
||||
String cartTypeCd = "1";
|
||||
if(code.charAt(0) == 'S') {
|
||||
// 대출, 열람 여부 판단
|
||||
if(cartVO.canRent()) cartTypeCd = "1";
|
||||
else if(cartVO.canRead()) cartTypeCd = "2";
|
||||
else if(cartVO.canView()) {
|
||||
code = "F";
|
||||
message = "해당 자료는 온라인열람만 가능한 자료입니다. 온라인 열람을 통해 자료를 조회하시기 바랍니다.";
|
||||
} else {
|
||||
code = "F";
|
||||
message = "대출 또는 방문열람 자료만 카트에 담을 수 있습니다. 해당 자료는 대출 또는 방문";
|
||||
}
|
||||
}
|
||||
|
||||
if(code.charAt(0) == 'S') {
|
||||
|
||||
cartVO.setCartTypeCd(cartTypeCd);
|
||||
|
||||
try {
|
||||
// 로그인한 경우
|
||||
if(!StringUtil.isEmpty(mbInfoId)) {
|
||||
log.debug("insertCartItemAjax > masterId = " + cartVO.getMasterId());
|
||||
@ -234,6 +265,7 @@ public class CartController extends NlibCommonController
|
||||
message = "정상적으로 추가되었습니다.";
|
||||
} else {
|
||||
code = "F";
|
||||
message = "등록되지 않았습니다. 관리자에게 문의하여 주시기 바랍니다.";
|
||||
}
|
||||
|
||||
} catch(Exception e) {
|
||||
@ -241,6 +273,7 @@ public class CartController extends NlibCommonController
|
||||
message = "등록되지 않았습니다. : " + e.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------
|
||||
// JSON변환 응답 처리
|
||||
@ -252,6 +285,7 @@ public class CartController extends NlibCommonController
|
||||
HashMap<String, Object> retMap = new HashMap<String, Object>();
|
||||
retMap.put("code", code);
|
||||
retMap.put("message", message);
|
||||
retMap.put("cartTypeCd", cartTypeCd);
|
||||
|
||||
return makeResponseEntityJson(retMap);
|
||||
}
|
||||
|
||||
@ -163,10 +163,6 @@ function fn_changeInterest(masterId, onOff) {
|
||||
alert("관심등록/삭제 준비중 : " + masterId + ", " + onOff);
|
||||
}
|
||||
|
||||
function fn_gotoDetail(masterId) {
|
||||
alert("상세보기 준비중 : " + masterId);
|
||||
}
|
||||
|
||||
// 대출신청으로 이동
|
||||
function fn_appRent() {
|
||||
|
||||
@ -311,7 +307,7 @@ $(document).ready(function() {
|
||||
<div class="t-chk"><input type="checkbox" name="chk_item_${cart.mngOrgCd }" id="chk_item_${cart.mngOrgCd }" value="${cart.masterId }" ></div>
|
||||
<div class="t-data">
|
||||
<div class="img">${cart.interestYn }
|
||||
<a href="javascript:void(0)"><img src="${cart.rprsThumbUrl }" alt="" width="60" height="91" title="상세보기" onclick="fn_gotoDetail('${cart.masterId }')"></a>
|
||||
<a href="javascript:void(0)"><img src="${cart.rprsThumbUrl }" alt="" width="60" height="91" title="상세보기" onclick="fn_viewItemDetailInfo('${cart.masterId }')"></a>
|
||||
<sec:authorize access="isAuthenticated()">
|
||||
|
||||
<c:if test='${cart.MUseYn == "Y"}'>
|
||||
@ -342,7 +338,7 @@ $(document).ready(function() {
|
||||
</c:if>
|
||||
|
||||
</div>
|
||||
<div class="title"><a href="javascript:void(0)" onclick="fn_gotoDetail('${cart.masterId }')" title="상세보기">${cart.title }</a></div>
|
||||
<div class="title"><a href="javascript:void(0)" onclick="fn_viewItemDetailInfo('${cart.masterId }')" title="상세보기">${cart.title }</a></div>
|
||||
</div>
|
||||
<div class="t-state <c:if test="${cart.useStatus != '03' and cart.useStatus != '06' }">poss</c:if> <c:if test="${cart.useStatus == '03' or cart.useStatus == '06' }">imposs</c:if>"><p>${cart.useStatusNm }</p></div>
|
||||
<div class="t-date">${cart.rtnExpctDd }</div>
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
* @ 수정일 수정자 수정내용
|
||||
* @ ------------ -------- ---------------------------
|
||||
* @ 2021. 7. 30. JSYOO 최초 생성
|
||||
* @ 2021.10. 28. KNKIM 대출예약, 방문열람신청, 카트담기 연결 처리
|
||||
*
|
||||
*
|
||||
* @author 이씨플라자 * DIGITALSHIP JSYOO
|
||||
@ -146,9 +147,9 @@
|
||||
</ul>
|
||||
</div>
|
||||
<div class="b-btn">
|
||||
<button type="button" class="btn btn-color">대출예약</button>
|
||||
<button type="button" class="btn btn-green">방문열람신청</button>
|
||||
<button type="button" class="btn btn-orange">카트담기</button>
|
||||
<button type="button" class="btn btn-color" onclick="fn_gotoRent()">대출예약</button>
|
||||
<button type="button" class="btn btn-green" onclick="fn_gotoRead()">방문열람신청</button>
|
||||
<button type="button" class="btn btn-orange" onclick="fn_addRentCart('${result.masterId}')">카트담기</button>
|
||||
</div>
|
||||
<div class="keyword">
|
||||
<span class="first">키워드</span>
|
||||
|
||||
@ -126,10 +126,6 @@ function fn_changeInterest(masterId, onOff) {
|
||||
alert("관심등록/삭제 준비중 : " + masterId + ", " + onOff);
|
||||
}
|
||||
|
||||
function fn_gotoDetail(masterId) {
|
||||
alert("상세보기 준비중 : " + masterId);
|
||||
}
|
||||
|
||||
function fn_listCartItems() {
|
||||
$("#frm").attr("action","${pageContext.request.contextPath}/cart/listCartItems.do");
|
||||
$("#frm").submit();
|
||||
@ -241,7 +237,7 @@ $(document).ready(function() {
|
||||
|
||||
<div class="list">
|
||||
<div class="t-data">
|
||||
<div class="img"><a href="javascript:void(0)"><img src="${rent.rprsThumbUrl }" alt="" width="60" height="91" title="상세보기" onclick="fn_gotoDetail('${rent.masterId }')"></a>
|
||||
<div class="img"><a href="javascript:void(0)"><img src="${rent.rprsThumbUrl }" alt="" width="60" height="91" title="상세보기" onclick="fn_viewItemDetailInfo('${rent.masterId }')"></a>
|
||||
<c:if test='${cart.MUseYn == "Y"}'>
|
||||
<span class="favorites" onclick="fn_changeInterest('${rent.masterId }', 'off')" title="관심자료에서 삭제합니다.">
|
||||
<img src="/images/icon/icon-cart-Favorites-on.png" class="off" alt="즐겨찾기 아이콘">
|
||||
@ -268,7 +264,7 @@ $(document).ready(function() {
|
||||
<span class="visit">방문열람</span>
|
||||
</c:if>
|
||||
</div>
|
||||
<div class="title"><a href="javascript:void(0)" onclick="fn_gotoDetail('${rent.masterId }')" title="상세보기">${rent.title }</a></div>
|
||||
<div class="title"><a href="javascript:void(0)" onclick="fn_viewItemDetailInfo('${rent.masterId }')" title="상세보기">${rent.title }</a></div>
|
||||
</div>
|
||||
<div class="t-state <c:if test="${rent.useStatus != '03' and rent.useStatus != '06' }">poss</c:if> <c:if test="${rent.useStatus == '03' or rent.useStatus == '06' }">imposs</c:if>"><p>${rent.useStatusNm }</p></div>
|
||||
<div class="t-date">${rent.rtnExpctDd }</div>
|
||||
|
||||
@ -113,10 +113,6 @@ function fn_changeInterest(masterId, onOff) {
|
||||
alert("관심등록/삭제 준비중 : " + masterId + ", " + onOff);
|
||||
}
|
||||
|
||||
function fn_gotoDetail(masterId) {
|
||||
alert("상세보기 준비중 : " + masterId);
|
||||
}
|
||||
|
||||
function fn_searchHome() {
|
||||
location.href = "/search/searchList.do";
|
||||
}
|
||||
@ -196,7 +192,7 @@ $(document).ready(function() {
|
||||
<!-- 행 : 시작 -->
|
||||
<div class="list">
|
||||
<div class="t-data">
|
||||
<div class="img"><a href="javascript:void(0)"><img src="${rent.rprsThumbUrl }" alt="" width="60" height="91" title="상세보기" onclick="fn_gotoDetail('${rent.masterId }')"></a>
|
||||
<div class="img"><a href="javascript:void(0)"><img src="${rent.rprsThumbUrl }" alt="" width="60" height="91" title="상세보기" onclick="fn_viewItemDetailInfo('${rent.masterId }')"></a>
|
||||
<c:if test='${cart.MUseYn == "Y"}'>
|
||||
<span class="favorites" onclick="fn_changeInterest('${rent.masterId }', 'off')" title="관심자료에서 삭제합니다.">
|
||||
<img src="/images/icon/icon-cart-Favorites-on.png" class="off" alt="즐겨찾기 아이콘">
|
||||
@ -222,7 +218,7 @@ $(document).ready(function() {
|
||||
<span class="visit">방문열람</span>
|
||||
</c:if>
|
||||
</div>
|
||||
<div class="title"><a href="javascript:void(0)" onclick="fn_gotoDetail('${rent.masterId }')" title="상세보기">${rent.title }</a></div>
|
||||
<div class="title"><a href="javascript:void(0)" onclick="fn_viewItemDetailInfo('${rent.masterId }')" title="상세보기">${rent.title }</a></div>
|
||||
</div>
|
||||
<div class="t-state"><p>${rent.useStatusNm }</p></div>
|
||||
<div class="t-date">${rent.rtnExpctDd }</div>
|
||||
|
||||
@ -125,10 +125,6 @@ function fn_listCartItems() {
|
||||
$("#frm").submit();
|
||||
}
|
||||
|
||||
function fn_gotoDetail(masterId) {
|
||||
alert("상세보기 준비중 : " + masterId);
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
/* 탭메뉴 */
|
||||
@ -236,7 +232,7 @@ $(document).ready(function() {
|
||||
|
||||
<div class="list">
|
||||
<div class="t-data">
|
||||
<div class="img"><a href="javascript:void(0)"><img src="${rent.rprsThumbUrl }" alt="" width="60" height="91" title="상세보기" onclick="fn_gotoDetail('${rent.masterId }')"></a>
|
||||
<div class="img"><a href="javascript:void(0)"><img src="${rent.rprsThumbUrl }" alt="" width="60" height="91" title="상세보기" onclick="fn_viewItemDetailInfo('${rent.masterId }')"></a>
|
||||
<c:if test='${cart.MUseYn == "Y"}'>
|
||||
<span class="favorites" onclick="fn_changeInterest('${rent.masterId }', 'off')" title="관심자료에서 삭제합니다.">
|
||||
<img src="/images/icon/icon-cart-Favorites-on.png" class="off" alt="즐겨찾기 아이콘">
|
||||
@ -263,7 +259,7 @@ $(document).ready(function() {
|
||||
<span class="visit">방문열람</span>
|
||||
</c:if>
|
||||
</div>
|
||||
<div class="title"><a href="javascript:void(0)" onclick="fn_gotoDetail('${rent.masterId }')" title="상세보기">${rent.title }</a></div>
|
||||
<div class="title"><a href="javascript:void(0)" onclick="fn_viewItemDetailInfo('${rent.masterId }')" title="상세보기">${rent.title }</a></div>
|
||||
</div>
|
||||
<div class="t-state <c:if test="${rent.useStatus != '03' and rent.useStatus != '06' }">poss</c:if> <c:if test="${rent.useStatus == '03' or rent.useStatus == '06' }">imposs</c:if>"><p>${rent.useStatusNm }</p></div>
|
||||
<div class="t-date">${rent.rtnExpctDd }</div>
|
||||
|
||||
@ -113,10 +113,6 @@ function fn_changeInterest(masterId, onOff) {
|
||||
alert("관심등록/삭제 준비중 : " + masterId + ", " + onOff);
|
||||
}
|
||||
|
||||
function fn_gotoDetail(masterId) {
|
||||
alert("상세보기 준비중 : " + masterId);
|
||||
}
|
||||
|
||||
function fn_searchHome() {
|
||||
location.href = "/search/searchList.do";
|
||||
}
|
||||
@ -194,7 +190,7 @@ $(document).ready(function() {
|
||||
<!-- 행 : 시작 -->
|
||||
<div class="list">
|
||||
<div class="t-data">
|
||||
<div class="img"><a href="javascript:void(0)"><img src="${rent.rprsThumbUrl }" alt="" width="60" height="91" title="상세보기" onclick="fn_gotoDetail('${rent.masterId }')"></a>
|
||||
<div class="img"><a href="javascript:void(0)"><img src="${rent.rprsThumbUrl }" alt="" width="60" height="91" title="상세보기" onclick="fn_viewItemDetailInfo('${rent.masterId }')"></a>
|
||||
<c:if test='${cart.MUseYn == "Y"}'>
|
||||
<span class="favorites" onclick="fn_changeInterest('${rent.masterId }', 'off')" title="관심자료에서 삭제합니다.">
|
||||
<img src="/images/icon/icon-cart-Favorites-on.png" class="off" alt="즐겨찾기 아이콘">
|
||||
@ -220,7 +216,7 @@ $(document).ready(function() {
|
||||
<span class="visit">방문열람</span>
|
||||
</c:if>
|
||||
</div>
|
||||
<div class="title"><a href="javascript:void(0)" onclick="fn_gotoDetail('${rent.masterId }')" title="상세보기">${rent.title }</a></div>
|
||||
<div class="title"><a href="javascript:void(0)" onclick="fn_viewItemDetailInfo('${rent.masterId }')" title="상세보기">${rent.title }</a></div>
|
||||
</div>
|
||||
<div class="t-state"><p>${rent.useStatusNm }</p></div>
|
||||
<div class="t-date">${rent.rtnExpctDd }</div>
|
||||
|
||||
@ -65,5 +65,10 @@ function fn_setPageTitle(title) {
|
||||
<div id="NLIB_LAYER_POPUP" name="NLIB_LAYER_POPUP" style="display:block;">
|
||||
</div>
|
||||
|
||||
<!-- 상세자료 조회용 -->
|
||||
<form name="FRM_ITEM_DETAIL" id="FRM_ITEM_DETAIL" method="post" action="/search/searchList.do" target="_blank">
|
||||
<input type="hidden" id="masterId" name="masterId" value="" />
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -6,80 +6,45 @@
|
||||
*
|
||||
*/
|
||||
|
||||
function fn_addRentCart(masterId, useStatus) {
|
||||
|
||||
/* useStatus
|
||||
01 : 이용가능
|
||||
02 : 대출중 (대기자 0명)
|
||||
03 : 대출중 (대기자 1명)
|
||||
04 : 열람대기(대출가능)
|
||||
05 : 이용가능
|
||||
06 : 열람대기(대출불가능)
|
||||
07 : 온라인열람만"
|
||||
*/
|
||||
fn_addRentCartItem(masterId, useStatus
|
||||
, function(data) {
|
||||
if(data.code == "S") {
|
||||
if(confirm(data.message + "\n카트로 이동하시겠습니까?")) {
|
||||
fn_gotoCart();
|
||||
}
|
||||
} else {
|
||||
alert(data.message);
|
||||
}
|
||||
}
|
||||
, function(error) {
|
||||
alert(error.message);
|
||||
}
|
||||
);
|
||||
|
||||
return false;
|
||||
function fn_gotoCart(cartTypeCd) {
|
||||
location.href = "/cart/listCartItems.do?cartTypeCd=" + cartTypeCd;
|
||||
}
|
||||
|
||||
function fn_gotoCart() {
|
||||
location.href = "/cart/listCartItems.do";
|
||||
function fn_isEmpty(str) {
|
||||
if(typeof str == "undefined" || str == null || str.trim() == "") return true;
|
||||
else false;
|
||||
}
|
||||
|
||||
function fn_addRentCartItem(masterId, useStatus, resolve, reject) {
|
||||
|
||||
function fn_addRentCart(masterId) {
|
||||
|
||||
var cartTypeCd = null;
|
||||
|
||||
if(masterId == "undefined" || masterId == "") {
|
||||
if(fn_isEmpty(masterId)) {
|
||||
reject(new Error("선택된 자료 정보가 없습니다."));
|
||||
return;
|
||||
}
|
||||
|
||||
if(useStatus == "undefined" || useStatus == "") {
|
||||
reject(new Error("선택된 자료의 상태 정보를 확인할 수 없습니다."));
|
||||
return;
|
||||
}
|
||||
|
||||
if("01" <= useStatus && useStatus <= "04") {
|
||||
cartTypeCd = "1"; // 대출
|
||||
} else if("05" <= useStatus && useStatus <= "06") {
|
||||
cartTypeCd = "2"; // 방문열람
|
||||
} else if("07" == useStatus) {
|
||||
reject(new Error("해당 자료는 온라인열람만 가능한 자료입니다. 온라인 열람을 통해 자료를 조회하시기 바랍니다."));
|
||||
return null;
|
||||
} else {
|
||||
reject(new Error("해당 자료의 상태를 확인할 수 없습니다."));
|
||||
return null;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url : "/cart/insertCartItemAjax.do",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
type : "POST",
|
||||
data: JSON.stringify({
|
||||
masterId : masterId,
|
||||
cartTypeCd : cartTypeCd
|
||||
masterId : masterId
|
||||
}),
|
||||
success : function(data) {
|
||||
resolve(JSON.parse(data));
|
||||
var result = JSON.parse(data);
|
||||
if(result.code == "S") {
|
||||
if(confirm(result.message + "\n카트로 이동하시겠습니까?")) {
|
||||
fn_gotoCart(result.cartTypeCd);
|
||||
}
|
||||
} else {
|
||||
alert(result.message);
|
||||
|
||||
}
|
||||
},
|
||||
error : function(error) {
|
||||
reject(error);
|
||||
alert(error.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -91,3 +56,13 @@ function fn_addReserveCart() {
|
||||
function fn_deleteCart() {
|
||||
alert("카트 삭제");
|
||||
}
|
||||
|
||||
function fn_gotoRent() {
|
||||
alert("대출예약 준비중 ");
|
||||
}
|
||||
|
||||
|
||||
function fn_gotoRead() {
|
||||
alert("방문열람 준비중 ");
|
||||
}
|
||||
|
||||
|
||||
@ -283,3 +283,12 @@ function pageLoad(pageIndex, totRecordCount, startPage, endPage, lastPage)
|
||||
$("#paging").append(html);
|
||||
}
|
||||
|
||||
|
||||
// 자료 상세보기
|
||||
function fn_viewItemDetailInfo(masterId){
|
||||
$("#FRM_ITEM_DETAIL input[name=masterId]").val(masterId);
|
||||
$("#FRM_ITEM_DETAIL").attr("action","/search/searchItemDetail.do");
|
||||
$("#FRM_ITEM_DETAIL").submit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user