자료 목록 조회 기능 추가

This commit is contained in:
KNKIM 2021-10-25 17:09:39 +09:00
parent 291e66bf34
commit 61e271c1e7
5 changed files with 97 additions and 1 deletions

View File

@ -1,10 +1,13 @@
package nlib.col.service; package nlib.col.service;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import nlib.util.StringUtil;
public interface CartService public interface CartService
{ {

View File

@ -56,5 +56,21 @@ public interface CollectionService {
* @throws Exception * @throws Exception
*/ */
public List<CollectionVO> setDetailInfoForList(List<CollectionVO> list, String mbInfoId, String defaultThumbnailUrl) throws Exception; public List<CollectionVO> setDetailInfoForList(List<CollectionVO> list, String mbInfoId, String defaultThumbnailUrl) throws Exception;
/**
* 자료 마스터ID 목록 문자열을 받아 CollectionVO 리스트 생성하여 리턴한다.
*
* @param masterIds
* @return
*/
public List<CollectionVO> makeListOfCollectionVO(String masterIds);
/**
* 자료 마스터ID 목록 문자열을 받아 상세내용을 조회하고, CollectionVO 리스트 생성하여 리턴한다.
*
* @param masterIds
* @return
*/
public List<CollectionVO> makeInfoListOfCollectionVO(String masterIds, String mbInfoId, String defaultThumbnailUrl) throws Exception;
} }

View File

@ -1,5 +1,6 @@
package nlib.col.service.impl; package nlib.col.service.impl;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -204,4 +205,50 @@ public class CollectionServiceImpl implements CollectionService {
return list; return list;
} }
/**
* 자료 마스터ID 목록 문자열을 받아 CollectionVO 리스트 생성하여 리턴한다.
*
* @param masterIds
* @return
*/
public List<CollectionVO> makeListOfCollectionVO(String masterIds) {
if(masterIds == null || StringUtil.isEmpty(masterIds)) return null;
String[] items = masterIds.split(",");
if(items == null || items.length < 1) return null;
List<CollectionVO> retList = new ArrayList<CollectionVO>();
for(String item : items) {
if(StringUtil.isEmpty(item)) continue;
CollectionVO itemVO = new CollectionVO();
itemVO.setMasterId(item);
retList.add(itemVO);
}
if(retList.size() < 1) return null;
return retList;
}
/**
* 자료 마스터ID 목록 문자열을 받아 상세내용을 조회하고, CollectionVO 리스트 생성하여 리턴한다.
*
* @param masterIds
* @return
*/
public List<CollectionVO> makeInfoListOfCollectionVO(String masterIds, String mbInfoId, String defaultThumbnailUrl) throws Exception {
List<CollectionVO> retList = makeListOfCollectionVO(masterIds);
if(retList == null || retList.size() < 1) return null;
return setDetailInfoForList(retList, mbInfoId, defaultThumbnailUrl);
}
} }

View File

@ -8,6 +8,7 @@ import java.util.Map;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -22,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import nlib.cmm.NlibCommonController; import nlib.cmm.NlibCommonController;
import nlib.cmm.service.CodeService; import nlib.cmm.service.CodeService;
import nlib.cmm.service.NlibProperty; import nlib.cmm.service.NlibProperty;
import nlib.col.service.CollectionService;
import nlib.col.service.CollectionVO; import nlib.col.service.CollectionVO;
import nlib.col.service.RentService; import nlib.col.service.RentService;
import nlib.restful.service.DataApiReqVO; import nlib.restful.service.DataApiReqVO;
@ -61,6 +63,9 @@ public class RentController extends NlibCommonController
@Resource(name = "rentService") @Resource(name = "rentService")
private RentService rentService; private RentService rentService;
@Resource(name = "collectionService")
private CollectionService collectionService;
@Resource(name = "codeService") @Resource(name = "codeService")
private CodeService codeService; private CodeService codeService;
@ -148,6 +153,31 @@ public class RentController extends NlibCommonController
return makeResponseEntityJson(retMap); return makeResponseEntityJson(retMap);
} }
@RequestMapping("/rent/confirmRent.do")
public String confirmRent(HttpServletRequest request, CollectionVO rentVO, ModelMap model) throws Exception {
String mbInfoId = getMbInfoId(request);
if(StringUtil.isEmpty(mbInfoId)) {
model.addAttribute("message", "로그인 후, 이용해 주시기 바랍니다.");
return "nlib/rent/confirmRent";
}
if(rentVO == null || StringUtil.isEmpty(rentVO.getSelItems())) {
model.addAttribute("message", "대출(예약)신청할 정보가 없습니다.");
return "nlib/rent/confirmRent";
}
String selItems = rentVO.getSelItems();
List<CollectionVO> list = collectionService.makeInfoListOfCollectionVO(selItems, mbInfoId, NlibProperty.getString("thumbnail.image.url.small"));
model.addAttribute("list", list);
return "nlib/rent/confirmRent";
}
// //
// /** 대출 목록 화면을 호출한다. // /** 대출 목록 화면을 호출한다.
// * @param req // * @param req

View File

@ -173,7 +173,7 @@ function fn_appRent() {
} }
$("#selItems").val(fn_getCheckedCartItemsValues()); $("#selItems").val(fn_getCheckedCartItemsValues());
$("#frm").attr("action","${pageContext.request.contextPath}/cart/confirmRent.do"); $("#frm").attr("action","${pageContext.request.contextPath}/rent/confirmRent.do");
$("#frm").submit(); $("#frm").submit();
</sec:authorize> </sec:authorize>