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; /** *
* @Class Name : CollectionServiceImpl.java * * @Description : 소장자료 정보를 조회하는 서비스 * * * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021) * ** * @ ------------ -------- --------------------------- * @ 수정일 수정자 수정내용 * @ ------------ -------- --------------------------- * @ 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; @Resource(name="collectionDAO") private CollectionDAO collectionDAO; /** * 자료 상세정보를 조회한다. * * @param searchVO * @return * @throws Exception */ public CollectionVO getItemInfo(CollectionVO searchVO) throws Exception { String message = null; // 입력값 확인 String masterId = searchVO.getMasterId(); String mbInfoId = searchVO.getMbInfoId(); if(StringUtil.isEmpty(masterId)) { message = "[필수값 미입력] 자료 ID 정보가 입력되지 않았습니다."; return new CollectionVO("E102", message); } // 변수 설정 DataApiReqVO reqVO = new DataApiReqVO("/uac/service/nlib/col/getItemInfo", HttpMethod.GET); reqVO.putInfoItem("masterId", masterId); 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