카트 및 자료조회 관련 - 소스 복원
This commit is contained in:
parent
499fcb0a52
commit
8cd0a4ebd0
47
src/main/java/nlib/col/service/CollectionService.java
Normal file
47
src/main/java/nlib/col/service/CollectionService.java
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
package nlib.col.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* @Class Name : CollectionService.java
|
||||||
|
*
|
||||||
|
* @Description : 소장자료 정보를 조회하는 서비스 인터페이스
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @ ------------ -------- ---------------------------
|
||||||
|
* @ 수정일 수정자 수정내용
|
||||||
|
* @ ------------ -------- ---------------------------
|
||||||
|
* @ 2021. 10. 6. KNKIM 최초 생성
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author 이씨플라자 * DIGITALSHIP KNKIM
|
||||||
|
* @since 2021. 10. 6.
|
||||||
|
* @version 1.0
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface CollectionService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 자료 상세정보를 조회한다.
|
||||||
|
*
|
||||||
|
* @param searchVO
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public CollectionVO getItemInfo(CollectionVO searchVO) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 목록의 자료정보에 상세정보를 조회하여 설정한 후 리턴한다.
|
||||||
|
*
|
||||||
|
* @param list
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public List<CollectionVO> setDetailInfoForList(List<CollectionVO> list) throws Exception;
|
||||||
|
}
|
||||||
@ -1,8 +1,10 @@
|
|||||||
package nlib.col.service;
|
package nlib.col.service;
|
||||||
|
|
||||||
import nlib.cmm.service.PagingVO;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import nlib.cmm.service.NlibProperty;
|
||||||
|
import nlib.cmm.service.PagingVO;
|
||||||
|
import nlib.util.StringUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@ -19,8 +21,7 @@ import java.io.Serializable;
|
|||||||
* @ 수정일 수정자 수정내용
|
* @ 수정일 수정자 수정내용
|
||||||
* @ ------------ -------- ---------------------------
|
* @ ------------ -------- ---------------------------
|
||||||
* @ 2021. 9. 23. JSYOO 최초 생성
|
* @ 2021. 9. 23. JSYOO 최초 생성
|
||||||
* @ 2021.10. 06. KKN 자료에 대한 세부 항목 추가
|
* @ 2021.10. 06. KKN 자료에 대한 세부 항목, 생성자 함수 추가
|
||||||
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author 이씨플라자 * DIGITALSHIP JSYOO
|
* @author 이씨플라자 * DIGITALSHIP JSYOO
|
||||||
@ -28,19 +29,22 @@ import java.io.Serializable;
|
|||||||
* @version 1.0
|
* @version 1.0
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public class CollectionVO extends PagingVO {
|
public class CollectionVO extends PagingVO {
|
||||||
|
|
||||||
|
// 기본 썸네일 (썸네일 존재하지 않는 경우, default url)
|
||||||
|
public final String THUMBNAIL_IMG_URL = NlibProperty.getString("item.thumbnail.image.url");
|
||||||
|
|
||||||
|
//--------------------------------------------
|
||||||
|
// 자료항목
|
||||||
|
//--------------------------------------------
|
||||||
private String masterId; /* 마스터id */
|
private String masterId; /* 마스터id */
|
||||||
private int mbInterestId; /* 관심 id */
|
|
||||||
private String mbInfoId; /* 회원 id */
|
|
||||||
private String title; /* 제목 */
|
private String title; /* 제목 */
|
||||||
private String rprsThumbUrl; /* 대표썸네일URL */
|
private String rprsThumbUrl; /* 대표썸네일URL */
|
||||||
private String useYn; /* 사용여부 */
|
private String useYn; /* 사용여부 */
|
||||||
private String regDd; /* 등록일자 */
|
private String regDd; /* 등록일자 */
|
||||||
private String mngOrgNm; /* 관리처리과명 */
|
private String mngOrgNm; /* 관리처리과명 */
|
||||||
private String mngOrgCd; /* 관리처리과코드 */
|
private String mngOrgCd; /* 관리처리과코드 */
|
||||||
|
|
||||||
// 상세항목 추가 (2021.10. 06.)
|
|
||||||
private String typeDivCd; /* 자료유형코드 */
|
private String typeDivCd; /* 자료유형코드 */
|
||||||
private String typeCodeNm; /* 자료유형명 (도서간행물/문서/도면 등) */
|
private String typeCodeNm; /* 자료유형명 (도서간행물/문서/도면 등) */
|
||||||
private String subjectNm; /* 주제분야명 */
|
private String subjectNm; /* 주제분야명 */
|
||||||
@ -97,7 +101,43 @@ public class CollectionVO extends PagingVO {
|
|||||||
private String museMeterialCd; /* 박물재질 */
|
private String museMeterialCd; /* 박물재질 */
|
||||||
private String museMeterialNm; /* 박물재질명 */
|
private String museMeterialNm; /* 박물재질명 */
|
||||||
private String assetLink; /* 자산링크 */
|
private String assetLink; /* 자산링크 */
|
||||||
|
private String regId; /* 등록자ID */
|
||||||
|
private String modId; /* 변경자ID */
|
||||||
|
|
||||||
|
//--------------------------------------------
|
||||||
|
// 기타 연관기능 항목
|
||||||
|
//--------------------------------------------
|
||||||
|
private int mbInterestId; /* 관심 id */
|
||||||
|
private String mbInfoId; /* 회원 id */
|
||||||
|
private String mbCartId; /* 카트ID */
|
||||||
|
private String cartTypeCd; /* 카트유형코드 */
|
||||||
|
private String rsrvId; /* 카트관련대출예약ID */
|
||||||
|
private String reqId; /* 카트관련열람예약ID */
|
||||||
|
private String cartProcDivCd; /* 카트처리구분코드 */
|
||||||
|
|
||||||
|
//--------------------------------------------
|
||||||
|
// 기타 및 처리결과 항목
|
||||||
|
//--------------------------------------------
|
||||||
|
private String selItems; /* 다건선택된 카트ID 목록 ","로 구분 */
|
||||||
|
private String resultCode; /* 결과코드 */
|
||||||
|
private String resultMessage; /* 결과메시지 */
|
||||||
|
|
||||||
|
// 생성자
|
||||||
|
public CollectionVO() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CollectionVO(String resultCode, String resultMessage) {
|
||||||
|
super();
|
||||||
|
setResult(resultCode, resultMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResult(String resultCode, String resultMessage) {
|
||||||
|
this.resultCode = resultCode;
|
||||||
|
this.resultMessage = resultMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET & SET
|
||||||
|
|
||||||
public String getMasterId() {
|
public String getMasterId() {
|
||||||
return masterId;
|
return masterId;
|
||||||
@ -127,7 +167,7 @@ public class CollectionVO extends PagingVO {
|
|||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
public String getRprsThumbUrl() {
|
public String getRprsThumbUrl() {
|
||||||
return rprsThumbUrl;
|
return rprsThumbUrl == null ? THUMBNAIL_IMG_URL : rprsThumbUrl;
|
||||||
}
|
}
|
||||||
public void setRprsThumbUrl(String rprsThumbUrl) {
|
public void setRprsThumbUrl(String rprsThumbUrl) {
|
||||||
this.rprsThumbUrl = rprsThumbUrl;
|
this.rprsThumbUrl = rprsThumbUrl;
|
||||||
@ -211,6 +251,11 @@ public class CollectionVO extends PagingVO {
|
|||||||
this.operReadRangeCd = operReadRangeCd;
|
this.operReadRangeCd = operReadRangeCd;
|
||||||
}
|
}
|
||||||
public String getOperReadRangeNm() {
|
public String getOperReadRangeNm() {
|
||||||
|
/* 01:전체열람 02: 목록열람 03:열람불가 */
|
||||||
|
if("01".equals(operReadRangeCd)) return "전체열람";
|
||||||
|
else if("02".equals(operReadRangeCd)) return "목록열람";
|
||||||
|
else if("03".equals(operReadRangeCd)) return "열람불가";
|
||||||
|
|
||||||
return operReadRangeNm;
|
return operReadRangeNm;
|
||||||
}
|
}
|
||||||
public void setOperReadRangeNm(String operReadRangeNm) {
|
public void setOperReadRangeNm(String operReadRangeNm) {
|
||||||
@ -223,6 +268,10 @@ public class CollectionVO extends PagingVO {
|
|||||||
this.operOutRangeCd = operOutRangeCd;
|
this.operOutRangeCd = operOutRangeCd;
|
||||||
}
|
}
|
||||||
public String getOperOutRangeNm() {
|
public String getOperOutRangeNm() {
|
||||||
|
/* 01:대출가능 02: 대출불가 */
|
||||||
|
if("01".equals(operOutRangeCd)) return "대출가능";
|
||||||
|
else if("02".equals(operOutRangeCd)) return "대출불가";
|
||||||
|
|
||||||
return operOutRangeNm;
|
return operOutRangeNm;
|
||||||
}
|
}
|
||||||
public void setOperOutRangeNm(String operOutRangeNm) {
|
public void setOperOutRangeNm(String operOutRangeNm) {
|
||||||
@ -235,6 +284,23 @@ public class CollectionVO extends PagingVO {
|
|||||||
this.useStatus = useStatus;
|
this.useStatus = useStatus;
|
||||||
}
|
}
|
||||||
public String getUseStatusNm() {
|
public String getUseStatusNm() {
|
||||||
|
|
||||||
|
/* 01 : 이용가능
|
||||||
|
02 : 대출중 (대기자 0명)
|
||||||
|
03 : 대출중 (대기자 1명)
|
||||||
|
04 : 열람대기(대출가능)
|
||||||
|
05 : 이용가능
|
||||||
|
06 : 열람대기(대출불가능)
|
||||||
|
07 : 온라인열람만"
|
||||||
|
*/
|
||||||
|
if("01".equals(useStatus)) return "이용가능";
|
||||||
|
else if("02".equals(useStatus)) return String.format("대출중 (대기자 %s명)", awaiterCnt);
|
||||||
|
else if("03".equals(useStatus)) return String.format("대출중 (대기자 %s명)", awaiterCnt);
|
||||||
|
else if("04".equals(useStatus)) return "열람대기(대출가능)";
|
||||||
|
else if("05".equals(useStatus)) return "이용가능";
|
||||||
|
else if("06".equals(useStatus)) return "열람대기(대출불가능)";
|
||||||
|
else if("07".equals(useStatus)) return "온라인열람만";
|
||||||
|
|
||||||
return useStatusNm;
|
return useStatusNm;
|
||||||
}
|
}
|
||||||
public void setUseStatusNm(String useStatusNm) {
|
public void setUseStatusNm(String useStatusNm) {
|
||||||
@ -492,6 +558,82 @@ public class CollectionVO extends PagingVO {
|
|||||||
public void setAssetLink(String assetLink) {
|
public void setAssetLink(String assetLink) {
|
||||||
this.assetLink = assetLink;
|
this.assetLink = assetLink;
|
||||||
}
|
}
|
||||||
|
public String getResultCode() {
|
||||||
|
return resultCode;
|
||||||
|
}
|
||||||
|
public void setResultCode(String resultCode) {
|
||||||
|
this.resultCode = resultCode;
|
||||||
|
}
|
||||||
|
public String getResultMessage() {
|
||||||
|
return resultMessage;
|
||||||
|
}
|
||||||
|
public void setResultMessage(String resultMessage) {
|
||||||
|
this.resultMessage = resultMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMbCartId() {
|
||||||
|
return mbCartId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMbCartId(String mbCartId) {
|
||||||
|
this.mbCartId = mbCartId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCartTypeCd() {
|
||||||
|
return cartTypeCd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCartTypeCd(String cartTypeCd) {
|
||||||
|
this.cartTypeCd = cartTypeCd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRsrvId() {
|
||||||
|
return rsrvId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRsrvId(String rsrvId) {
|
||||||
|
this.rsrvId = rsrvId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReqId() {
|
||||||
|
return reqId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReqId(String reqId) {
|
||||||
|
this.reqId = reqId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCartProcDivCd() {
|
||||||
|
return cartProcDivCd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCartProcDivCd(String cartProcDivCd) {
|
||||||
|
this.cartProcDivCd = cartProcDivCd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRegId() {
|
||||||
|
return regId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegId(String regId) {
|
||||||
|
this.regId = regId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getModId() {
|
||||||
|
return modId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setModId(String modId) {
|
||||||
|
this.modId = modId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSelItems() {
|
||||||
|
return selItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelItems(String selItems) {
|
||||||
|
this.selItems = selItems;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,9 +10,9 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import nlib.col.service.CartService;
|
import nlib.col.service.CartService;
|
||||||
|
import nlib.col.service.CollectionService;
|
||||||
import nlib.col.service.CollectionVO;
|
import nlib.col.service.CollectionVO;
|
||||||
import nlib.util.StringUtil;
|
import nlib.util.StringUtil;
|
||||||
import nlib.col.service.CollectionService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
|
|||||||
293
src/main/java/nlib/col/service/impl/CollectionServiceImpl.java
Normal file
293
src/main/java/nlib/col/service/impl/CollectionServiceImpl.java
Normal file
@ -0,0 +1,293 @@
|
|||||||
|
package nlib.col.service.impl;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import nlib.col.service.CollectionService;
|
||||||
|
import nlib.col.service.CollectionVO;
|
||||||
|
import nlib.restful.DataApi;
|
||||||
|
import nlib.restful.service.DataApiReqVO;
|
||||||
|
import nlib.restful.service.DataApiResVO;
|
||||||
|
import nlib.restful.service.XmlConverter;
|
||||||
|
import nlib.util.StringUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* @Class Name : CollectionServiceImpl.java
|
||||||
|
*
|
||||||
|
* @Description : 소장자료 정보를 조회하는 서비스
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @ ------------ -------- ---------------------------
|
||||||
|
* @ 수정일 수정자 수정내용
|
||||||
|
* @ ------------ -------- ---------------------------
|
||||||
|
* @ 2021. 10. 6. KNKIM 최초 생성
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author 이씨플라자 * DIGITALSHIP KNKIM
|
||||||
|
* @since 2021. 10. 6.
|
||||||
|
* @version 1.0
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Service("collectionService")
|
||||||
|
public class CollectionServiceImpl implements CollectionService {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(CollectionServiceImpl.class);
|
||||||
|
|
||||||
|
/** RESTFul API 송수신 모듈 */
|
||||||
|
@Resource(name = "dataApi")
|
||||||
|
private DataApi dataApi;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 자료 상세정보를 조회한다.
|
||||||
|
*
|
||||||
|
* @param searchVO
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public CollectionVO getItemInfo(CollectionVO searchVO) throws Exception {
|
||||||
|
|
||||||
|
String message = null;
|
||||||
|
|
||||||
|
// 입력값 확인
|
||||||
|
String mngOrgCd = searchVO.getMngOrgCd();
|
||||||
|
String masterId = searchVO.getMasterId();
|
||||||
|
String typeDivCd = searchVO.getTypeDivCd();
|
||||||
|
String mbInfoId = searchVO.getMbInfoId();
|
||||||
|
|
||||||
|
if(StringUtil.isEmpty(mngOrgCd)) {
|
||||||
|
message = "[필수값 미입력] 지방문화원정보가 입력되지 않았습니다.";
|
||||||
|
return new CollectionVO("E101", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StringUtil.isEmpty(masterId)) {
|
||||||
|
message = "[필수값 미입력] 자료 ID 정보가 입력되지 않았습니다.";
|
||||||
|
return new CollectionVO("E102", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StringUtil.isEmpty(typeDivCd)) {
|
||||||
|
message = "[필수값 미입력] 자료유형코드가 입력되지 않았습니다.";
|
||||||
|
return new CollectionVO("E103", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 변수 설정
|
||||||
|
DataApiReqVO reqVO = new DataApiReqVO("/uac/service/nlib/col/getItemInfo", HttpMethod.GET);
|
||||||
|
reqVO.putInfoItem("mngOrgCd", mngOrgCd);
|
||||||
|
reqVO.putInfoItem("masterId", masterId);
|
||||||
|
reqVO.putInfoItem("typeDivCd", typeDivCd);
|
||||||
|
reqVO.setMbInfoId(mbInfoId); // 통신 시, 암호화되어 송수신됨
|
||||||
|
|
||||||
|
// API 호출
|
||||||
|
DataApiResVO resVO = dataApi.request(reqVO);
|
||||||
|
|
||||||
|
// 결과값 전달
|
||||||
|
CollectionVO retVO = (CollectionVO)XmlConverter.convertMapToObject(resVO.getInfo(), CollectionVO.class);
|
||||||
|
retVO.setResultCode(resVO.getResultCode());
|
||||||
|
retVO.setResultMessage(resVO.getResultMessage());
|
||||||
|
|
||||||
|
return retVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 목록의 자료정보에 상세정보를 조회하여 설정한 후 리턴한다.
|
||||||
|
*
|
||||||
|
* @param list
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public List<CollectionVO> setDetailInfoForList_BK(List<CollectionVO> list) throws Exception {
|
||||||
|
|
||||||
|
if(list == null || list.size() < 1) return list;
|
||||||
|
|
||||||
|
final int MAX_CNT_FOR_ONE_QUERY = 10;
|
||||||
|
int cnt = list.size();
|
||||||
|
HashMap<String, String> orgCdMasterIdMap = new HashMap<String, String>();
|
||||||
|
HashMap<String, CollectionVO> collectionMap = new HashMap<String, CollectionVO>();
|
||||||
|
String mbInfoId = null;
|
||||||
|
|
||||||
|
// 문화원별 자료ID 항목값 생성
|
||||||
|
for(int i=0; i<cnt; i++) {
|
||||||
|
CollectionVO vo = list.get(i);
|
||||||
|
String orgCd = vo.getMngOrgCd();
|
||||||
|
String jsonMasterId = orgCdMasterIdMap.get(orgCd);
|
||||||
|
|
||||||
|
if(jsonMasterId == null) jsonMasterId = "";
|
||||||
|
|
||||||
|
if(mbInfoId == null) mbInfoId = vo.getMbInfoId();
|
||||||
|
|
||||||
|
// [{"masterId":"xxxx"}, {"masterId":"xxxb"},…]
|
||||||
|
if(jsonMasterId.length() > 0) jsonMasterId += ",";
|
||||||
|
jsonMasterId += "{'masterId':'" + vo.getMasterId() + "}";
|
||||||
|
|
||||||
|
orgCdMasterIdMap.put(orgCd, jsonMasterId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 문화원별 API 요청 처리
|
||||||
|
for(String orgCd : orgCdMasterIdMap.keySet()) {
|
||||||
|
|
||||||
|
String jsonMasterId = orgCdMasterIdMap.get(orgCd);
|
||||||
|
if(StringUtil.isEmpty(jsonMasterId)) continue;
|
||||||
|
|
||||||
|
jsonMasterId = "[" + jsonMasterId + "]";
|
||||||
|
|
||||||
|
// API 호출
|
||||||
|
DataApiReqVO reqVO = new DataApiReqVO("/uac/service/nlib/col/listItemInfo", HttpMethod.GET);
|
||||||
|
reqVO.putInfoItem("mngOrgCd", orgCd);
|
||||||
|
reqVO.putInfoItem("jsonMasterId", jsonMasterId);
|
||||||
|
|
||||||
|
reqVO.setMbInfoId(mbInfoId); // 통신 시, 암호화되어 송수신됨
|
||||||
|
DataApiResVO resVO = dataApi.request(reqVO);
|
||||||
|
|
||||||
|
// 결과 처리
|
||||||
|
if(resVO.getResultCode().charAt(0) == 'S') {
|
||||||
|
List<HashMap<String, String>> recordList = resVO.getList("record");
|
||||||
|
if(recordList == null || recordList.size() < 1) continue;
|
||||||
|
|
||||||
|
for(HashMap<String, String> record : recordList) {
|
||||||
|
CollectionVO cVO = (CollectionVO)XmlConverter.convertMapToObject(record, CollectionVO.class);
|
||||||
|
if(cVO != null && StringUtil.isNotEmpty(cVO.getMasterId())) {
|
||||||
|
collectionMap.put(cVO.getMasterId(), cVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.error("setDetailInfoForCartItems > 소장자료 다건 메타정보 조회 오류(API) : " + resVO.getResultCode() + " : " + resVO.getResultMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 목록에 업데이트 설정
|
||||||
|
for(int i=0; i<cnt; i++) {
|
||||||
|
CollectionVO vo = list.get(i);
|
||||||
|
String masterId = vo.getMasterId();
|
||||||
|
CollectionVO cVO = collectionMap.get(masterId);
|
||||||
|
|
||||||
|
if(cVO == null) continue;
|
||||||
|
|
||||||
|
vo.setTitle (cVO.getTitle());
|
||||||
|
vo.setTypeDivCd (cVO.getTypeDivCd());
|
||||||
|
vo.setTypeCodeNm (cVO.getTypeCodeNm());
|
||||||
|
vo.setSubjectNm (cVO.getSubjectNm());
|
||||||
|
vo.setOrgNm (cVO.getOrgNm());
|
||||||
|
vo.setCreatYyyy (cVO.getCreatYyyy());
|
||||||
|
vo.setRprsThumbUrl (cVO.getRprsThumbUrl());
|
||||||
|
vo.setInterfaceId (cVO.getInterfaceId());
|
||||||
|
vo.setOpenDivCd (cVO.getOpenDivCd());
|
||||||
|
vo.setOperReadRangeCd(cVO.getOperReadRangeCd());
|
||||||
|
vo.setOperOutRangeCd (cVO.getOperOutRangeCd());
|
||||||
|
vo.setUseStatus (cVO.getUseStatus());
|
||||||
|
vo.setRtnExpctDd (cVO.getRtnExpctDd());
|
||||||
|
vo.setAwaiterCnt (cVO.getAwaiterCnt());
|
||||||
|
vo.setBookLentPsblYn (cVO.getBookLentPsblYn());
|
||||||
|
vo.setRsrvPsblYn (cVO.getRsrvPsblYn());
|
||||||
|
vo.setReqPsblYn (cVO.getReqPsblYn());
|
||||||
|
vo.setInterestYn (cVO.getInterestYn());
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 목록의 자료정보에 상세정보를 조회하여 설정한 후 리턴한다.
|
||||||
|
*
|
||||||
|
* @param list
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public List<CollectionVO> setDetailInfoForList(List<CollectionVO> list) throws Exception {
|
||||||
|
|
||||||
|
if(list == null || list.size() < 1) return list;
|
||||||
|
|
||||||
|
int cnt = list.size();
|
||||||
|
HashMap<String, CollectionVO> collectionMap = new HashMap<String, CollectionVO>();
|
||||||
|
String mbInfoId = null;
|
||||||
|
|
||||||
|
// 문화원별 API 요청 처리
|
||||||
|
String jsonMasterId = "";
|
||||||
|
for(int i=0; i<cnt; i++) {
|
||||||
|
|
||||||
|
CollectionVO vo = list.get(i);
|
||||||
|
|
||||||
|
if(StringUtil.isEmpty(vo.getMasterId())) continue;
|
||||||
|
if(mbInfoId == null) mbInfoId = vo.getMbInfoId();
|
||||||
|
|
||||||
|
// [{"masterId":"xxxx"}, {"masterId":"xxxb"},…]
|
||||||
|
if(jsonMasterId.length() > 0) jsonMasterId += ",";
|
||||||
|
jsonMasterId += "{\"masterId\":\"" + vo.getMasterId() + "\"}";
|
||||||
|
}
|
||||||
|
if(StringUtil.isEmpty(jsonMasterId)) return list;
|
||||||
|
jsonMasterId = "[" + jsonMasterId + "]";
|
||||||
|
|
||||||
|
// API 호출
|
||||||
|
DataApiReqVO reqVO = new DataApiReqVO("/uac/service/nlib/col/listItemInfo", HttpMethod.GET);
|
||||||
|
reqVO.setMbInfoId(mbInfoId); // 통신 시, 암호화되어 송수신됨
|
||||||
|
reqVO.putInfoItem("jsonMasterId", jsonMasterId);
|
||||||
|
reqVO.putInfoItem("mngOrgCd", "KCCF"); // DDDDDDDDDDDDDDDDDd API 개발서버 반영전까지 임시 처리
|
||||||
|
|
||||||
|
DataApiResVO resVO = dataApi.request(reqVO);
|
||||||
|
|
||||||
|
// 결과 처리
|
||||||
|
if(resVO.getResultCode().charAt(0) == 'S') {
|
||||||
|
List<HashMap<String, String>> recordList = resVO.getList("record");
|
||||||
|
if(recordList == null || recordList.size() < 1) return list;
|
||||||
|
|
||||||
|
for(HashMap<String, String> record : recordList) {
|
||||||
|
CollectionVO cVO = (CollectionVO)XmlConverter.convertMapToObject(record, CollectionVO.class);
|
||||||
|
if(cVO != null && StringUtil.isNotEmpty(cVO.getMasterId())) {
|
||||||
|
collectionMap.put(cVO.getMasterId(), cVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.error("setDetailInfoForCartItems > 소장자료 다건 메타정보 조회 오류(API) : " + resVO.getResultCode() + " : " + resVO.getResultMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 목록에 업데이트 설정
|
||||||
|
for(int i=0; i<cnt; i++) {
|
||||||
|
CollectionVO vo = list.get(i);
|
||||||
|
String masterId = vo.getMasterId();
|
||||||
|
CollectionVO cVO = collectionMap.get(masterId);
|
||||||
|
|
||||||
|
if(cVO == null) continue;
|
||||||
|
|
||||||
|
vo.setTitle (cVO.getTitle());
|
||||||
|
vo.setTypeDivCd (cVO.getTypeDivCd());
|
||||||
|
vo.setTypeCodeNm (cVO.getTypeCodeNm());
|
||||||
|
vo.setSubjectNm (cVO.getSubjectNm());
|
||||||
|
vo.setOrgNm (cVO.getOrgNm());
|
||||||
|
vo.setCreatYyyy (cVO.getCreatYyyy());
|
||||||
|
vo.setRprsThumbUrl (cVO.getRprsThumbUrl());
|
||||||
|
vo.setInterfaceId (cVO.getInterfaceId());
|
||||||
|
vo.setOpenDivCd (cVO.getOpenDivCd());
|
||||||
|
vo.setOperReadRangeCd(cVO.getOperReadRangeCd());
|
||||||
|
vo.setOperOutRangeCd (cVO.getOperOutRangeCd());
|
||||||
|
vo.setUseStatus (cVO.getUseStatus());
|
||||||
|
vo.setRtnExpctDd (cVO.getRtnExpctDd());
|
||||||
|
vo.setAwaiterCnt (cVO.getAwaiterCnt());
|
||||||
|
vo.setBookLentPsblYn (cVO.getBookLentPsblYn());
|
||||||
|
vo.setRsrvPsblYn (cVO.getRsrvPsblYn());
|
||||||
|
vo.setReqPsblYn (cVO.getReqPsblYn());
|
||||||
|
vo.setInterestYn (cVO.getInterestYn());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// DDDDDDDDDDDDDDDDDd 문화원 멀티 처리를 위해 테스트용으로 데이터 변경
|
||||||
|
CollectionVO vo = list.get(cnt-2);
|
||||||
|
vo.setMngOrgCd("SU01");
|
||||||
|
vo.setMngOrgNm("마포문화원");
|
||||||
|
CollectionVO vo2 = list.get(cnt-1);
|
||||||
|
vo2.setMngOrgCd("SU01");
|
||||||
|
vo2.setMngOrgNm("마포문화원");
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,7 +2,6 @@ package nlib.col.web;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@ -14,16 +13,12 @@ import org.springframework.stereotype.Controller;
|
|||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|
||||||
|
|
||||||
import nlib.bbs.service.ArticleVO;
|
|
||||||
import nlib.cmm.NlibCommonController;
|
import nlib.cmm.NlibCommonController;
|
||||||
import nlib.cmm.service.CodeService;
|
|
||||||
import nlib.cmm.service.NlibProperty;
|
import nlib.cmm.service.NlibProperty;
|
||||||
import nlib.col.service.CartService;
|
import nlib.col.service.CartService;
|
||||||
import nlib.col.service.CollectionService;
|
import nlib.col.service.CollectionService;
|
||||||
import nlib.col.service.CollectionVO;
|
import nlib.col.service.CollectionVO;
|
||||||
import nlib.user.service.NlibLoginVO;
|
|
||||||
import nlib.util.StringUtil;
|
import nlib.util.StringUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
25
src/main/java/nlib/col/web/CollectionController.java
Normal file
25
src/main/java/nlib/col/web/CollectionController.java
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package nlib.col.web;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import nlib.cmm.NlibCommonController;
|
||||||
|
import nlib.cmm.service.CodeService;
|
||||||
|
import nlib.cmm.service.NlibProperty;
|
||||||
|
import nlib.col.service.CartService;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class CollectionController extends NlibCommonController {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(CollectionController.class);
|
||||||
|
static final String DEFUALT_PAGE_SIZE = NlibProperty.getProperty("list.paging.page.size");
|
||||||
|
|
||||||
|
@Resource(name = "cartService")
|
||||||
|
private CartService cartService;
|
||||||
|
|
||||||
|
@Resource(name = "codeService")
|
||||||
|
private CodeService codeService;
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,9 +1,6 @@
|
|||||||
package nlib.restful.service;
|
package nlib.restful.service;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -17,7 +14,9 @@ import javax.xml.stream.events.XMLEvent;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import nlib.sample.web.SampleEncoderController;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
import nlib.util.StringUtil;
|
import nlib.util.StringUtil;
|
||||||
|
|
||||||
public class XmlConverter {
|
public class XmlConverter {
|
||||||
@ -176,6 +175,13 @@ public class XmlConverter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Object convertMapToObject(HashMap<String, String> map, Class voClass) {
|
||||||
|
final ObjectMapper mapper = new ObjectMapper(); // jackson's objectmapper
|
||||||
|
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
||||||
|
final Object voObj = mapper.convertValue(map, voClass);
|
||||||
|
return voObj;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public static void main(String argv[]) throws Exception {
|
public static void main(String argv[]) throws Exception {
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package nlib.util;
|
package nlib.util;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.net.URLEncoder;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
@ -121,6 +122,26 @@ public class StringUtil extends StringUtils {
|
|||||||
return rtnStr;
|
return rtnStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base64로 인코딩한다.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String encodeUrl(String str) {
|
||||||
|
|
||||||
|
if(isEmpty(str)) return "";
|
||||||
|
|
||||||
|
String encodedStr = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
encodedStr = URLEncoder.encode(str, "UTF-8");
|
||||||
|
} catch(Exception e) {
|
||||||
|
log.error("encodeUrl > Error while encoding for [" + str + "] " + e.toString());
|
||||||
|
encodedStr = str;
|
||||||
|
}
|
||||||
|
return encodedStr;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base64로 인코딩한다.
|
* Base64로 인코딩한다.
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user