From 8e31a9b47817c1cecc458eec44351700e907f23b Mon Sep 17 00:00:00 2001 From: KNKIM Date: Tue, 21 Dec 2021 10:13:43 +0900 Subject: [PATCH] =?UTF-8?q?=EB=AC=B8=ED=99=94=EC=9B=90=20=EC=8B=9C?= =?UTF-8?q?=EC=9E=91=EC=A2=85=EB=A3=8C=20=EC=8B=9C=EA=B0=84=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EB=B3=B4=EC=99=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../col/service/impl/ReadServiceImpl.java | 574 +++++++++--------- .../mapper/nlib/info/InformDAO_SQL.xml | 120 ++-- 2 files changed, 349 insertions(+), 345 deletions(-) diff --git a/src/main/java/nlib/col/service/impl/ReadServiceImpl.java b/src/main/java/nlib/col/service/impl/ReadServiceImpl.java index b0443b1b..d695e1b3 100644 --- a/src/main/java/nlib/col/service/impl/ReadServiceImpl.java +++ b/src/main/java/nlib/col/service/impl/ReadServiceImpl.java @@ -1,285 +1,289 @@ -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.CollectionVO; -import nlib.col.service.ReadService; -import nlib.info.service.InformService; -import nlib.restful.DataApi; -import nlib.restful.DataApiReqVO; -import nlib.restful.DataApiResVO; -import nlib.util.StringUtil; - -/** - *
- * @Class Name : ReadServiceImpl.java
- * 
- * @Description : 열람신청관리 서비스 구현 클래스 
- * 
- * 
- * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
- *
- * 
- * - * @ ------------ -------- --------------------------- - * @ 수정일 수정자 수정내용 - * @ ------------ -------- --------------------------- - * @ 2021-10-27 KNKIM 최초 생성 - * - * - * @author 이씨플라자 * DIGITALSHIP KNKIM - * @since 2021-10-27 - * @version 1.0 - * - */ -@Service("readService") -public class ReadServiceImpl implements ReadService { - - private static final Logger log = LoggerFactory.getLogger(ReadServiceImpl.class); - - @Resource(name="readDAO") - private ReadDAO readDAO; - - @Resource(name="cartDAO") - private CartDAO cartDAO; - - @Resource(name="informService") - private InformService informService; - - /** RESTFul API 송수신 모듈 */ - @Resource(name = "dataApi") - private DataApi dataApi; - - /** - * 열람신청희망 가능 일자 목록을 조회한다. - * - * @param mbInfoId - * @return - */ - public List> listDates() { - return readDAO.listDates(); - } - - - /** - * 열람을 신청한다. - * - * @param list - * @param mbInfoId - * @param mngOrgCd - * @return - */ - public List insertReadItems(List list, String mbInfoId, CollectionVO readVO, boolean fromCart) throws Exception { - - if(list == null || list.size() < 1) { - log.error("insertReadItems > 열람 신청 대상 목록이 없습니다."); - return null; - } - if(readVO == null) { - log.error("insertReadItems > 매개변수 readVO는 null일 수 없습니다."); - return null; - } - - if(StringUtil.isEmpty(mbInfoId)) { - log.error("insertReadItems > 사용자ID를 확인할 수 없습니다."); - return null; - } - - if(StringUtil.isEmpty(readVO.getMngOrgCd())) { - log.error("insertReadItems > 관리문화원 코드를 확인할 수 없습니다."); - return null; - } - - if(StringUtil.isEmpty(readVO.getHopeReqPridDtmFrom() )) { - log.error("insertReadItems > 방문희망일 시작일자를 확인할 수 없습니다."); - return null; - } - - if(StringUtil.isEmpty(readVO.getHopeReqPridDtmTo() )) { - log.error("insertReadItems > 방문희망일 종료일자를 확인할 수 없습니다."); - return null; - } - - if(readVO.getHopeReqPridDtmFrom().compareTo(readVO.getHopeReqPridDtmTo()) > 0) { - log.error("insertReadItems > 방문희망일 종료일자는 시작일자 이후이어야 합니다."); - return null; - } - - // 해당 문화원의 업무시간 조회 - HashMap operation = informService.selectNCultureOpenTime(readVO.getMngOrgCd()); - - // API 호출 - /* - mngOrgCd 문화원코드 O String SU01 - mbInfoId 사용자아이디 O String "BDCCAF34CF8AA365C660ADB121CE6741 - (ARIAUtil 암호화)" - jsonMasterId 자료번호목록 O String [{"masterId":"xxxx"}, {"masterId":"xxxb"},…] - hopeReqPridDtmFrom 희망열람기간시작일자 O String 202109071300 - hopeReqPridDtmTo 희망열람기간종료일자 O String 202109101400 - purpose 열람목적 String 열람목적 - */ - DataApiReqVO reqVO = new DataApiReqVO("/uac/service/nlib/col/insertReserveItem", HttpMethod.POST); - reqVO.setMbInfoId(mbInfoId); // 통신 시, 암호화되어 송수신됨 - reqVO.putInfoItem("mngOrgCd" , readVO.getMngOrgCd()); - reqVO.putInfoItem("hopeReqPridDtmFrom", readVO.getHopeReqPridDtmFrom().replaceAll("-", "") + StringUtil.getString(operation.get("OPEN_TIME"), "0900").replaceAll(":", "").substring(0, 4)); - reqVO.putInfoItem("hopeReqPridDtmTo" , readVO.getHopeReqPridDtmTo().replaceAll("-", "") + StringUtil.getString(operation.get("CLOSED_TIME"), "1800").replaceAll(":", "").substring(0, 4)); - CollectionVO cVO = null; - DataApiResVO resVO = null; - String jsonMasterId = ""; - - for(int i=0; i 열람 신청 대상으로 생성된 목록이 없습니다."); - return null; - } - - jsonMasterId = "[" + jsonMasterId.substring(1) + "]"; - - reqVO.putInfoItem("jsonMasterId", jsonMasterId); - resVO = dataApi.request(reqVO); - cVO.setResult(resVO.getResultCode(), resVO.getResultMessage()); - - // 카트에서 신청하여 성공한 경우, 카트 처리완료 변경 작업 - if(resVO != null && resVO.getResultCode() != null && resVO.getResultCode().startsWith("S") && fromCart) { - CollectionVO vVO = null; - for(int i=0; i changeCartProcDivCd=" + retUpdateProc); - } - } - } - - readVO.setResultCode(resVO.getResultCode()); - readVO.setResultMessage(resVO.getResultMessage()); - - // 신청 처리 정보 - if(resVO.isSuccess()) { - readVO.setHopeReqPridDtmFrom(StringUtil.formatDateStr(resVO.getInfoItem("hopeReqPridDtmFrom", ""),"")); - readVO.setHopeReqPridDtmTo(StringUtil.formatDateStr(resVO.getInfoItem("hopeReqPridDtmTo", ""),"")); - readVO.setReqId(resVO.getInfoItem("reqId", "")); // 열람신청번호 - readVO.setReqDd(resVO.getInfoItem("reqDd", "")); // 열람신청일자 - readVO.setSelItems(resVO.getInfoItem("masterId")); // 자료번호 - } else { - readVO.setRsrvId(null); // 열람신청번호 - readVO.setRsrvId(null); // 열람신청일자 - } - - return list; - } - - /** - * 사용자의 열람건이 존재하는 문화원 정보 목록을 조회한다. - * - * @param mbInfoId - * @return - */ - public List> listReadMngOrg(String mbInfoId) { - return readDAO.listReadMngOrg(mbInfoId); - } - - /** - * 열람 목록 조회한다. - * - * @param searchVO - * @return - */ - public DataApiResVO listReadItems(CollectionVO searchVO) { - - if(searchVO == null || StringUtil.isEmpty(searchVO.getMbInfoId())) { - log.error("listRentItems > 열람 목록 조회 요청 정보가 없습니다."); - return new DataApiResVO("F", "열람 목록 조회 요청 정보가 없습니다."); - } - - // API 호출 - /* - mngOrgCd 문화원코드 - mbInfoId 사용자아이디 - rows 페이지크기(페이지당최대표출건수) - page 페이지번호 - bookLtRvStatusCd 대출상태구분코드("": 전체, A:신청, B:대출준비완료, C:취소, W:대출중, R0:정상반납, R1:연체반납 P:연체) - */ - DataApiReqVO reqVO = new DataApiReqVO("/uac/service/nlib/col/listReserveItem", HttpMethod.GET); - reqVO.setMbInfoId(searchVO.getMbInfoId()); // 통신 시, 암호화되어 송수신됨 - reqVO.setPageSize(searchVO.getPageSize()); - reqVO.setPageIndex(searchVO.getPageIndex()); - reqVO.putInfoItem("mngOrgCd", searchVO.getMngOrgCd()); - reqVO.putInfoItem("reqStatusDivCd", searchVO.getReqStatusDivCd()); - return dataApi.request(reqVO); - } - - - /** - * 열람신청을 취소한다. - * - * @param searchVO - * @return - */ - public DataApiResVO cancelReadItem(CollectionVO searchVO) { - - String message = null; - - if(searchVO == null || StringUtil.isEmpty(searchVO.getMbInfoId())) { - message = "로그인하신 후, 이용바랍니다."; - log.error("cancelRentItem > " + message); - return new DataApiResVO("E", message); - } - - if(StringUtil.isEmpty(searchVO.getMngOrgCd())) { - message = "문화원정보가 부적합합니다. 다시 요청하여 주시기 바랍니다."; - log.error("cancelRentItem > " + message); - return new DataApiResVO("E", message); - } - - if(StringUtil.isEmpty(searchVO.getReqId())) { - message = "취소할 방문열람신청번호 정보가 부적합합니다. 다시 요청하여 주시기 바랍니다."; - log.error("cancelRentItem > " + message); - return new DataApiResVO("E", message); - } - - if(StringUtil.isEmpty(searchVO.getMasterId())) { - message = "취소할 자료정보 정보가 부적합합니다. 다시 요청하여 주시기 바랍니다."; - log.error("cancelRentItem > " + message); - return new DataApiResVO("E", message); - } - - // API 호출 - /* - mngOrgCd 문화원코드 - mbInfoId 사용자아이디 - reqId 열람신청번호 - masterId 자료번호 - */ - DataApiReqVO reqVO = new DataApiReqVO("/uac/service/nlib/col/deleteReserveItem", HttpMethod.POST); - reqVO.setMbInfoId(searchVO.getMbInfoId()); // 통신 시, 암호화되어 송수신됨 - reqVO.putInfoItem("mngOrgCd", searchVO.getMngOrgCd()); - reqVO.putInfoItem("reqId", searchVO.getReqId()); - reqVO.putInfoItem("masterId", searchVO.getMasterId()); - return dataApi.request(reqVO); - } - -} +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.CollectionVO; +import nlib.col.service.ReadService; +import nlib.info.service.InformService; +import nlib.restful.DataApi; +import nlib.restful.DataApiReqVO; +import nlib.restful.DataApiResVO; +import nlib.util.StringUtil; + +/** + *
+ * @Class Name : ReadServiceImpl.java
+ * 
+ * @Description : 열람신청관리 서비스 구현 클래스 
+ * 
+ * 
+ * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
+ *
+ * 
+ * + * @ ------------ -------- --------------------------- + * @ 수정일 수정자 수정내용 + * @ ------------ -------- --------------------------- + * @ 2021-10-27 KNKIM 최초 생성 + * + * + * @author 이씨플라자 * DIGITALSHIP KNKIM + * @since 2021-10-27 + * @version 1.0 + * + */ +@Service("readService") +public class ReadServiceImpl implements ReadService { + + private static final Logger log = LoggerFactory.getLogger(ReadServiceImpl.class); + + @Resource(name="readDAO") + private ReadDAO readDAO; + + @Resource(name="cartDAO") + private CartDAO cartDAO; + + @Resource(name="informService") + private InformService informService; + + /** RESTFul API 송수신 모듈 */ + @Resource(name = "dataApi") + private DataApi dataApi; + + /** + * 열람신청희망 가능 일자 목록을 조회한다. + * + * @param mbInfoId + * @return + */ + public List> listDates() { + return readDAO.listDates(); + } + + + /** + * 열람을 신청한다. + * + * @param list + * @param mbInfoId + * @param mngOrgCd + * @return + */ + public List insertReadItems(List list, String mbInfoId, CollectionVO readVO, boolean fromCart) throws Exception { + + if(list == null || list.size() < 1) { + log.error("insertReadItems > 열람 신청 대상 목록이 없습니다."); + return null; + } + if(readVO == null) { + log.error("insertReadItems > 매개변수 readVO는 null일 수 없습니다."); + return null; + } + + if(StringUtil.isEmpty(mbInfoId)) { + log.error("insertReadItems > 사용자ID를 확인할 수 없습니다."); + return null; + } + + if(StringUtil.isEmpty(readVO.getMngOrgCd())) { + log.error("insertReadItems > 관리문화원 코드를 확인할 수 없습니다."); + return null; + } + + if(StringUtil.isEmpty(readVO.getHopeReqPridDtmFrom() )) { + log.error("insertReadItems > 방문희망일 시작일자를 확인할 수 없습니다."); + return null; + } + + if(StringUtil.isEmpty(readVO.getHopeReqPridDtmTo() )) { + log.error("insertReadItems > 방문희망일 종료일자를 확인할 수 없습니다."); + return null; + } + + if(readVO.getHopeReqPridDtmFrom().compareTo(readVO.getHopeReqPridDtmTo()) > 0) { + log.error("insertReadItems > 방문희망일 종료일자는 시작일자 이후이어야 합니다."); + return null; + } + + // 해당 문화원의 업무시간 조회 + HashMap operation = informService.selectNCultureOpenTime(readVO.getMngOrgCd()); + if(operation == null) { + log.error("insertReadItems > 지방문화원 정보를 확인할 수 없습니다."); + return null; + } + + // API 호출 + /* + mngOrgCd 문화원코드 O String SU01 + mbInfoId 사용자아이디 O String "BDCCAF34CF8AA365C660ADB121CE6741 + (ARIAUtil 암호화)" + jsonMasterId 자료번호목록 O String [{"masterId":"xxxx"}, {"masterId":"xxxb"},…] + hopeReqPridDtmFrom 희망열람기간시작일자 O String 202109071300 + hopeReqPridDtmTo 희망열람기간종료일자 O String 202109101400 + purpose 열람목적 String 열람목적 + */ + DataApiReqVO reqVO = new DataApiReqVO("/uac/service/nlib/col/insertReserveItem", HttpMethod.POST); + reqVO.setMbInfoId(mbInfoId); // 통신 시, 암호화되어 송수신됨 + reqVO.putInfoItem("mngOrgCd" , readVO.getMngOrgCd()); + reqVO.putInfoItem("hopeReqPridDtmFrom", readVO.getHopeReqPridDtmFrom().replaceAll("-", "") + StringUtil.getString(operation.get("OPEN_TIME"), "0900").replaceAll(":", "").substring(0, 4)); + reqVO.putInfoItem("hopeReqPridDtmTo" , readVO.getHopeReqPridDtmTo().replaceAll("-", "") + StringUtil.getString(operation.get("CLOSED_TIME"), "1800").replaceAll(":", "").substring(0, 4)); + CollectionVO cVO = null; + DataApiResVO resVO = null; + String jsonMasterId = ""; + + for(int i=0; i 열람 신청 대상으로 생성된 목록이 없습니다."); + return null; + } + + jsonMasterId = "[" + jsonMasterId.substring(1) + "]"; + + reqVO.putInfoItem("jsonMasterId", jsonMasterId); + resVO = dataApi.request(reqVO); + cVO.setResult(resVO.getResultCode(), resVO.getResultMessage()); + + // 카트에서 신청하여 성공한 경우, 카트 처리완료 변경 작업 + if(resVO != null && resVO.getResultCode() != null && resVO.getResultCode().startsWith("S") && fromCart) { + CollectionVO vVO = null; + for(int i=0; i changeCartProcDivCd=" + retUpdateProc); + } + } + } + + readVO.setResultCode(resVO.getResultCode()); + readVO.setResultMessage(resVO.getResultMessage()); + + // 신청 처리 정보 + if(resVO.isSuccess()) { + readVO.setHopeReqPridDtmFrom(StringUtil.formatDateStr(resVO.getInfoItem("hopeReqPridDtmFrom", ""),"")); + readVO.setHopeReqPridDtmTo(StringUtil.formatDateStr(resVO.getInfoItem("hopeReqPridDtmTo", ""),"")); + readVO.setReqId(resVO.getInfoItem("reqId", "")); // 열람신청번호 + readVO.setReqDd(resVO.getInfoItem("reqDd", "")); // 열람신청일자 + readVO.setSelItems(resVO.getInfoItem("masterId")); // 자료번호 + } else { + readVO.setRsrvId(null); // 열람신청번호 + readVO.setRsrvId(null); // 열람신청일자 + } + + return list; + } + + /** + * 사용자의 열람건이 존재하는 문화원 정보 목록을 조회한다. + * + * @param mbInfoId + * @return + */ + public List> listReadMngOrg(String mbInfoId) { + return readDAO.listReadMngOrg(mbInfoId); + } + + /** + * 열람 목록 조회한다. + * + * @param searchVO + * @return + */ + public DataApiResVO listReadItems(CollectionVO searchVO) { + + if(searchVO == null || StringUtil.isEmpty(searchVO.getMbInfoId())) { + log.error("listRentItems > 열람 목록 조회 요청 정보가 없습니다."); + return new DataApiResVO("F", "열람 목록 조회 요청 정보가 없습니다."); + } + + // API 호출 + /* + mngOrgCd 문화원코드 + mbInfoId 사용자아이디 + rows 페이지크기(페이지당최대표출건수) + page 페이지번호 + bookLtRvStatusCd 대출상태구분코드("": 전체, A:신청, B:대출준비완료, C:취소, W:대출중, R0:정상반납, R1:연체반납 P:연체) + */ + DataApiReqVO reqVO = new DataApiReqVO("/uac/service/nlib/col/listReserveItem", HttpMethod.GET); + reqVO.setMbInfoId(searchVO.getMbInfoId()); // 통신 시, 암호화되어 송수신됨 + reqVO.setPageSize(searchVO.getPageSize()); + reqVO.setPageIndex(searchVO.getPageIndex()); + reqVO.putInfoItem("mngOrgCd", searchVO.getMngOrgCd()); + reqVO.putInfoItem("reqStatusDivCd", searchVO.getReqStatusDivCd()); + return dataApi.request(reqVO); + } + + + /** + * 열람신청을 취소한다. + * + * @param searchVO + * @return + */ + public DataApiResVO cancelReadItem(CollectionVO searchVO) { + + String message = null; + + if(searchVO == null || StringUtil.isEmpty(searchVO.getMbInfoId())) { + message = "로그인하신 후, 이용바랍니다."; + log.error("cancelRentItem > " + message); + return new DataApiResVO("E", message); + } + + if(StringUtil.isEmpty(searchVO.getMngOrgCd())) { + message = "문화원정보가 부적합합니다. 다시 요청하여 주시기 바랍니다."; + log.error("cancelRentItem > " + message); + return new DataApiResVO("E", message); + } + + if(StringUtil.isEmpty(searchVO.getReqId())) { + message = "취소할 방문열람신청번호 정보가 부적합합니다. 다시 요청하여 주시기 바랍니다."; + log.error("cancelRentItem > " + message); + return new DataApiResVO("E", message); + } + + if(StringUtil.isEmpty(searchVO.getMasterId())) { + message = "취소할 자료정보 정보가 부적합합니다. 다시 요청하여 주시기 바랍니다."; + log.error("cancelRentItem > " + message); + return new DataApiResVO("E", message); + } + + // API 호출 + /* + mngOrgCd 문화원코드 + mbInfoId 사용자아이디 + reqId 열람신청번호 + masterId 자료번호 + */ + DataApiReqVO reqVO = new DataApiReqVO("/uac/service/nlib/col/deleteReserveItem", HttpMethod.POST); + reqVO.setMbInfoId(searchVO.getMbInfoId()); // 통신 시, 암호화되어 송수신됨 + reqVO.putInfoItem("mngOrgCd", searchVO.getMngOrgCd()); + reqVO.putInfoItem("reqId", searchVO.getReqId()); + reqVO.putInfoItem("masterId", searchVO.getMasterId()); + return dataApi.request(reqVO); + } + +} diff --git a/src/main/resources/egovframework/mapper/nlib/info/InformDAO_SQL.xml b/src/main/resources/egovframework/mapper/nlib/info/InformDAO_SQL.xml index 32d2d3b7..76f0d265 100644 --- a/src/main/resources/egovframework/mapper/nlib/info/InformDAO_SQL.xml +++ b/src/main/resources/egovframework/mapper/nlib/info/InformDAO_SQL.xml @@ -1,61 +1,61 @@ - - - - - - - - - - - - + + + + + + + + + + + + \ No newline at end of file