대출신청 취소 기능 개발, 대출관리 퍼블 적용 외
This commit is contained in:
parent
96ca01d797
commit
f499080c06
@ -123,6 +123,8 @@ public class CollectionVO extends PagingVO {
|
||||
protected String bookLtRvStatusNm; /* 대출상태구분코드명 */
|
||||
protected String rsrvExpctDd; /* 대출예약만료일자 */
|
||||
protected String rtnDd; /* 반납일자 */
|
||||
protected String rsrvDivCd; /* 대출/예약 신청구분코드 */
|
||||
protected String rsrvDivNm; /* 대출/예약 신청구분코드명 */
|
||||
|
||||
//--------------------------------------------
|
||||
// 열람관련
|
||||
@ -739,5 +741,21 @@ public class CollectionVO extends PagingVO {
|
||||
public void setSubjectCode(String subjectCode) {
|
||||
this.subjectCode = subjectCode;
|
||||
}
|
||||
|
||||
public String getRsrvDivCd() {
|
||||
return rsrvDivCd;
|
||||
}
|
||||
|
||||
public void setRsrvDivCd(String rsrvDivCd) {
|
||||
this.rsrvDivCd = rsrvDivCd;
|
||||
}
|
||||
|
||||
public String getRsrvDivNm() {
|
||||
return rsrvDivNm;
|
||||
}
|
||||
|
||||
public void setRsrvDivNm(String rsrvDivNm) {
|
||||
this.rsrvDivNm = rsrvDivNm;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -26,6 +26,15 @@ public interface RentService
|
||||
*/
|
||||
public DataApiResVO listRentItems(CollectionVO searchVO);
|
||||
|
||||
|
||||
/**
|
||||
* 대출(예약)신청을 취소한다.
|
||||
*
|
||||
* @param searchVO
|
||||
* @return
|
||||
*/
|
||||
public DataApiResVO cancelRentItem(CollectionVO searchVO);
|
||||
|
||||
/**
|
||||
* 대출을 신청한다.
|
||||
*
|
||||
@ -34,7 +43,7 @@ public interface RentService
|
||||
* @param mngOrgCd
|
||||
* @return
|
||||
*/
|
||||
public List<CollectionVO> insertRentItems(List<CollectionVO> list, String mbInfoId, String mngOrgCd);
|
||||
public List<CollectionVO> insertRentItems(List<CollectionVO> list, String mbInfoId, String mngOrgCd, boolean fromCart) throws Exception;
|
||||
|
||||
//
|
||||
// /**
|
||||
|
||||
@ -24,4 +24,6 @@ public interface CartDAO {
|
||||
|
||||
public int countCartItems(@Param("mbInfoId") String mbInfoId, @Param("cartTypeCd") String cartTypeCd) throws Exception;
|
||||
|
||||
public int changeCartProcDivCd(CollectionVO cartVO) throws Exception;
|
||||
|
||||
}
|
||||
@ -10,6 +10,9 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.fasterxml.jackson.databind.deser.std.ReferenceTypeDeserializer;
|
||||
|
||||
import nlib.col.service.CartService;
|
||||
import nlib.col.service.CollectionVO;
|
||||
import nlib.col.service.RentService;
|
||||
import nlib.restful.DataApi;
|
||||
@ -26,6 +29,10 @@ public class RentServiceImpl implements RentService
|
||||
@Resource(name="rentDAO")
|
||||
private RentDAO rentDAO;
|
||||
|
||||
@Resource(name="cartDAO")
|
||||
private CartDAO cartDAO;
|
||||
|
||||
|
||||
/** RESTFul API 송수신 모듈 */
|
||||
@Resource(name = "dataApi")
|
||||
private DataApi dataApi;
|
||||
@ -72,6 +79,48 @@ public class RentServiceImpl implements RentService
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 대출(예약)신청을 취소한다.
|
||||
*
|
||||
* @param searchVO
|
||||
* @return
|
||||
*/
|
||||
public DataApiResVO cancelRentItem(CollectionVO searchVO) {
|
||||
|
||||
String message = null;
|
||||
|
||||
if(searchVO == null || StringUtil.isEmpty(searchVO.getMbInfoId())) {
|
||||
message = "대출(예약)신청 취소 요청 정보가 부적합합니다 (MbInfoId)";
|
||||
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.getRsrvId())) {
|
||||
message = "취소할 대출(예약)선청번호 정보가 부적합합니다. 다시 요청하여 주시기 바랍니다.";
|
||||
log.error("cancelRentItem > " + message);
|
||||
return new DataApiResVO("E", message);
|
||||
}
|
||||
|
||||
// API 호출
|
||||
/*
|
||||
mngOrgCd 문화원코드
|
||||
mbInfoId 사용자아이디
|
||||
rsrvId 대출신청예약번호
|
||||
*/
|
||||
DataApiReqVO reqVO = new DataApiReqVO("/uac/service/nlib/rent/deleteRentItem", HttpMethod.POST);
|
||||
reqVO.setMbInfoId(searchVO.getMbInfoId()); // 통신 시, 암호화되어 송수신됨
|
||||
reqVO.putInfoItem("mngOrgCd", searchVO.getMngOrgCd());
|
||||
reqVO.putInfoItem("rsrvId", searchVO.getRsrvId());
|
||||
return dataApi.request(reqVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 대출을 신청한다.
|
||||
*
|
||||
@ -80,7 +129,7 @@ public class RentServiceImpl implements RentService
|
||||
* @param mngOrgCd
|
||||
* @return
|
||||
*/
|
||||
public List<CollectionVO> insertRentItems(List<CollectionVO> list, String mbInfoId, String mngOrgCd) {
|
||||
public List<CollectionVO> insertRentItems(List<CollectionVO> list, String mbInfoId, String mngOrgCd, boolean fromCart) throws Exception {
|
||||
|
||||
if(list == null || list.size() < 1) return null;
|
||||
|
||||
@ -122,12 +171,18 @@ public class RentServiceImpl implements RentService
|
||||
if(StringUtil.startsWithIgnoreCase(resVO.getResultCode(), "S")) {
|
||||
cVO.setRsrvId(resVO.getInfoItem("rsrvId", ""));
|
||||
cVO.setRsrvDd(StringUtil.formatDateStr(resVO.getInfoItem("rsrvDd", ""), ""));
|
||||
cVO.setRsrvDivCd(resVO.getInfoItem("rsrvDivCd")); // 대출상태구분코드
|
||||
if("1".equals(cVO.getRsrvDivCd())) cVO.setRsrvDivNm("대출신청");
|
||||
else if("2".equals(cVO.getRsrvDivCd())) cVO.setRsrvDivNm("대출예약");
|
||||
|
||||
// 대출신청, 대출예약 구분 : API 팀에서 처리완료시까지 임시 데이터 설정 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDd
|
||||
cVO.setBookLtRvStatusCd("1"); // 대출상태구분코드
|
||||
cVO.setBookLtRvStatusNm("대출신청"); // 대출상태구분코드명
|
||||
//cVO.setBookLtRvStatusCd("2"); // 대출상태구분코드
|
||||
//cVO.setBookLtRvStatusNm("대출예약"); // 대출상태구분코드명
|
||||
// 카트에서의 처리 여부 업데이트
|
||||
if(fromCart) {
|
||||
cVO.setMbInfoId(mbInfoId);
|
||||
cVO.setCartProcDivCd("R"); // 대출신청완료
|
||||
cVO.setModId(mbInfoId);
|
||||
int retUpdateProc = cartDAO.changeCartProcDivCd(cVO);
|
||||
log.debug("insertRentItems > retUpdateProc=" + retUpdateProc);
|
||||
}
|
||||
|
||||
} else {
|
||||
cVO.setRsrvId(null);
|
||||
|
||||
@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import nlib.cmm.NlibCommonController;
|
||||
import nlib.cmm.service.CodeService;
|
||||
import nlib.cmm.service.NlibProperty;
|
||||
import nlib.cmm.service.PagingVO;
|
||||
import nlib.col.service.CollectionService;
|
||||
import nlib.col.service.CollectionVO;
|
||||
import nlib.col.service.RentService;
|
||||
@ -95,8 +96,7 @@ public class RentController extends NlibCommonController
|
||||
List<HashMap<String, String>> rentMngOrgList = rentService.listRentMngOrg(mbInfoId);
|
||||
model.addAttribute("rentMngOrgList" , rentMngOrgList);
|
||||
|
||||
model.addAttribute("bookLtRvStatusCd", searchVO.getBookLtRvStatusCd());
|
||||
model.addAttribute("pageSize" , searchVO.getPageSize());
|
||||
model.addAttribute("bookLtRvStatusCd", StringUtil.getString(searchVO.getBookLtRvStatusCd(), "A"));
|
||||
model.addAttribute("pageSize" , searchVO.getPageSize());
|
||||
model.addAttribute("pageIndex" , searchVO.getPageIndex());
|
||||
model.addAttribute("message" , message);
|
||||
@ -117,11 +117,16 @@ public class RentController extends NlibCommonController
|
||||
|
||||
String message = null;
|
||||
String mbInfoId = getMbInfoId(request);
|
||||
int totCount = 0;
|
||||
|
||||
if(StringUtil.isEmpty(mbInfoId)) {
|
||||
message = "로그인하신 후, 이용바랍니다.";
|
||||
}
|
||||
|
||||
if(StringUtil.isEmpty(searchVO.getBookLtRvStatusCd())) {
|
||||
searchVO.setBookLtRvStatusCd("A"); // 신청/예약 기본 설정
|
||||
}
|
||||
|
||||
//-------------------------------
|
||||
// JSON변환 응답 처리
|
||||
//-------------------------------
|
||||
@ -135,21 +140,75 @@ public class RentController extends NlibCommonController
|
||||
|
||||
// 로그인 사용자 정보 설정
|
||||
searchVO.setMbInfoId(mbInfoId);
|
||||
// TO-DO : DDDDDDDDDDDDDDDDDDDddd
|
||||
// 기본값은 전체이나, API 반영전까지 문화원 코드 전송
|
||||
// if(StringUtil.isEmpty(searchVO.getMngOrgCd())) searchVO.setMngOrgCd(getCurCouncilCd(request));
|
||||
searchVO.setMngOrgCd("KCCF");
|
||||
|
||||
// 조회
|
||||
// 대출상태구분코드("": 전체, A:신청, B:대출준비완료, C:취소, W:대출중, R0:정상반납, R1:연체반납, P:연체)
|
||||
// TO-DO : api 코드 변경 요청. 변경 처리된 것 확인할 것
|
||||
DataApiResVO resVO = rentService.listRentItems(searchVO);
|
||||
totCount = resVO.getRecordTotCount();
|
||||
retMap.put("data" , resVO.getRecordList());
|
||||
retMap.put("itemsCount", resVO.getRecordTotCount());
|
||||
retMap.put("pageIndex" , resVO.getPageIndex());
|
||||
} else {
|
||||
retMap.put("pageIndex" , searchVO.getPageIndex());
|
||||
retMap.put("message" , "로그인하신 후, 이용바랍니다.");
|
||||
}
|
||||
retMap.put("itemsCount", totCount);
|
||||
|
||||
PagingVO pageVO = new PagingVO();
|
||||
pageVO.setPagingVO(totCount, searchVO.getPageIndex(), searchVO.getPageSize());
|
||||
retMap.put("pagingPageIndex" , pageVO.getPageIndex());
|
||||
retMap.put("pagingTotRecordCount", pageVO.getTotRecordCount());
|
||||
retMap.put("pagingStartPage" , pageVO.getStartPage());
|
||||
retMap.put("pagingEndPage" , pageVO.getEndPage());
|
||||
retMap.put("pagingLastPage" , pageVO.getLastPage());
|
||||
|
||||
return makeResponseEntityJson(retMap);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value="/rent/cancelRentItemAjax.do")
|
||||
public ResponseEntity<String> cancelRentItemAjax(
|
||||
HttpServletRequest request,
|
||||
@RequestBody CollectionVO searchVO) {
|
||||
|
||||
String resultMessage = null;
|
||||
String resultCode = "F";
|
||||
String mbInfoId = getMbInfoId(request);
|
||||
int totCount = 0;
|
||||
|
||||
if(StringUtil.isEmpty(mbInfoId)) {
|
||||
resultMessage = "로그인하신 후, 이용바랍니다.";
|
||||
}
|
||||
|
||||
if(StringUtil.isEmpty(searchVO.getMngOrgCd())) {
|
||||
resultMessage = "문화원정보가 부적합합니다. 다시 요청하여 주시기 바랍니다.";
|
||||
}
|
||||
|
||||
if(StringUtil.isEmpty(searchVO.getRsrvId())) {
|
||||
resultMessage = "취소할 대출(예약)선청번호 정보가 부적합합니다. 다시 요청하여 주시기 바랍니다.";
|
||||
}
|
||||
|
||||
//-------------------------------
|
||||
// JSON변환 응답 처리
|
||||
//-------------------------------
|
||||
// JS-GRID 페이징 처리를 포함한 응답값 처리
|
||||
// {data: [{...}],
|
||||
// itemsCount: 255
|
||||
// }
|
||||
HashMap<String, Object> retMap = new HashMap<String, Object>();
|
||||
|
||||
if(resultMessage == null) {
|
||||
|
||||
// 로그인 사용자 정보 설정
|
||||
searchVO.setMbInfoId(mbInfoId);
|
||||
|
||||
// 대출취소신청
|
||||
DataApiResVO resVO = rentService.cancelRentItem(searchVO);
|
||||
resultCode = resVO.getResultCode();
|
||||
resultMessage = resVO.getResultMessage();
|
||||
}
|
||||
|
||||
retMap.put("resultCode" , resultCode);
|
||||
retMap.put("resultMessage" , resultMessage);
|
||||
|
||||
return makeResponseEntityJson(retMap);
|
||||
}
|
||||
@ -208,8 +267,7 @@ public class RentController extends NlibCommonController
|
||||
|
||||
List<CollectionVO> list = collectionService.makeListOfCollectionVO(selItems);
|
||||
|
||||
// 임시 막음 DDDDDDDDDDDDDDDDDDDDDDDdd
|
||||
//list = rentService.insertRentItems(list, mbInfoId, rentVO.getMngOrgCd());
|
||||
list = rentService.insertRentItems(list, mbInfoId, rentVO.getMngOrgCd(), fromCart);
|
||||
list = collectionService.setDetailInfoForList(list, mbInfoId, NlibProperty.getString("thumbnail.image.url.small"));
|
||||
|
||||
model.addAttribute("rentVO", rentVO);
|
||||
|
||||
@ -30,6 +30,15 @@
|
||||
ORDER BY B.MNG_ORG_CD
|
||||
</select>
|
||||
|
||||
<update id="changeCartProcDivCd" parameterType="CollectionVO">
|
||||
<![CDATA[
|
||||
UPDATE MB_CART SET CART_PROC_DIV_CD = #{cartProcDivCd}, MOD_ID = #{modId}, MOD_DD = NOW()
|
||||
WHERE MB_INFO_ID = #{mbInfoId}
|
||||
AND MASTER_ID = #{masterId}
|
||||
AND DELETE_YN = 'N'
|
||||
]]>
|
||||
</update>
|
||||
|
||||
<select id="countCartItems" parameterType="String" resultType="Integer">
|
||||
SELECT COUNT(A.MB_CART_ID) AS CNT
|
||||
FROM MB_CART A
|
||||
|
||||
@ -104,7 +104,7 @@
|
||||
console.log(jsonObj.itemsCount);
|
||||
|
||||
// 건수
|
||||
if(jsonObj.itemsCount == undefined) {
|
||||
if(typeof jsonObj.itemsCount == 'undefined') {
|
||||
$("#itemsCount").text("0");
|
||||
$("#searchItemsCount").text("0");
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ $( document ).ready(function() {
|
||||
console.log(jsonObj.itemsCount);
|
||||
|
||||
// 건수
|
||||
if(jsonObj.itemsCount == undefined) {
|
||||
if(typeof jsonObj.itemsCount == 'undefined') {
|
||||
$("#itemsCount").text("0");
|
||||
$("#searchItemsCount").text("0");
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@
|
||||
console.log(jsonObj.itemsCount);
|
||||
|
||||
// 건수
|
||||
if(jsonObj.itemsCount == undefined) {
|
||||
if(typeof jsonObj.itemsCount == 'undefined') {
|
||||
$("#itemsCount").text("0");
|
||||
$("#searchItemsCount").text("0");
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
* @ ------------ -------- ---------------------------
|
||||
* @ 2021. 7. 21. JSYOO 최초 생성
|
||||
* @ 2021.10. 14. KNKIM 변경API 및 화면설계서 반영
|
||||
*
|
||||
* @ 2021.11. 08. KNKIM 퍼블 템플릿 적용 작업
|
||||
*
|
||||
* @author 이씨플라자 * DIGITALSHIP JSYOO
|
||||
* @since 2021. 7. 21.
|
||||
@ -31,180 +31,251 @@
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
|
||||
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
|
||||
<%@ taglib prefix="validator"
|
||||
uri="http://www.springmodules.org/tags/commons-validator"%>
|
||||
<%@ taglib prefix="sec"
|
||||
uri="http://www.springframework.org/security/tags"%>
|
||||
<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator"%>
|
||||
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
|
||||
|
||||
<c:set var="pageTitle">대출관리</c:set>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>${pageTitle}</title>
|
||||
|
||||
<!-- GRID -->
|
||||
<link type="text/css" rel="stylesheet"
|
||||
href="${pageContext.request.contextPath}/js/jsgrid/nlib-jsgrid.css" />
|
||||
<link type="text/css" rel="stylesheet"
|
||||
href="${pageContext.request.contextPath}/js/jsgrid/nlib-jsgrid-theme.css" />
|
||||
<script
|
||||
src="${pageContext.request.contextPath}/js/jsgrid/nlib-jsgrid.js"></script>
|
||||
|
||||
<script type="text/javaScript" language="javascript">
|
||||
|
||||
window.onload = function() {
|
||||
//=======================================================
|
||||
// 그리드 생성 환경설정
|
||||
//=======================================================
|
||||
$("#jsGrid").jsGrid({
|
||||
pageSize : $("#pageSize").val(),
|
||||
controller: {
|
||||
loadData: function (filter) { // 그리드에 데이터를 가져올 때 실팽되는 함수
|
||||
var data = $.Deferred();
|
||||
//======================================
|
||||
// 요청 정보 구성 : 시작 (각 요청에 맞게 조정)
|
||||
//======================================
|
||||
var reqUrl = "${pageContext.request.contextPath}/rent/listRentItemsAjax.do";
|
||||
var pageIndex = ( filter && filter.pageIndex ? filter.pageIndex : $("#pageIndex").val());
|
||||
var pageSize = ( filter && filter.pageSize ? filter.pageSize : $("#pageSize").val());
|
||||
$( document ).ready(function() {
|
||||
|
||||
$("#pageIndex").val(pageIndex);
|
||||
// 메시지 표출
|
||||
if(!fn_isEmpty('${message}')) {
|
||||
alert("${message}");
|
||||
}
|
||||
|
||||
var inputData = {
|
||||
"pageIndex" : pageIndex
|
||||
, "pageSize" : pageSize
|
||||
, "bookLtRvStatusCd" : $("#bookLtRvStatusCd").val()
|
||||
, "mngOrgCd" : $("#mngOrgCd").val()
|
||||
};
|
||||
$("#mngOrgCd").on("change", function(e) {
|
||||
fn_searchArticle($("#pageSize").val(), 1);
|
||||
});
|
||||
|
||||
<sec:authorize access="isAuthenticated()">
|
||||
//초기 자료 조회
|
||||
fn_searchArticle(1);
|
||||
</sec:authorize>
|
||||
|
||||
//--------------------------------------
|
||||
// 요청 처리
|
||||
//--------------------------------------
|
||||
$.ajax({
|
||||
type: "post",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
url: reqUrl,
|
||||
dataType: "json",
|
||||
data: JSON.stringify(inputData),
|
||||
}).done(function(data){
|
||||
<%// 그리드 데이터 예시 :
|
||||
// (1) 페이징 클라이언트에서 수행하는 경우(pageloading = false) : [{ "articleNo": 1, "articleType": "01" }, { "articleNo": 2, "articleType": "02" }]
|
||||
// (2) 페이징 서버에서 수행하는 경우(pageloading = true) : {data: [{...}], itemsCount: 255}%>
|
||||
var retObj = JSON.parse(response);
|
||||
}); // document ready
|
||||
|
||||
if(retObj.data == null) {
|
||||
retObj.data = [];
|
||||
}
|
||||
data.resolve(retObj);
|
||||
}).fail(function (jqXHR, textStatus, errorThrown) {
|
||||
alert("오류 : " + textStatus);
|
||||
});
|
||||
|
||||
} // loadData
|
||||
},
|
||||
|
||||
//======================================
|
||||
// 그리드 컬럼 정의 (각 요청에 맞게 조정)
|
||||
//======================================
|
||||
fields: [
|
||||
{ title:"번호", name: "no" , type: "text" , width: 50, align: "center"},
|
||||
{ title:"masterId", name: "masterId" , type: "text" , width: 50, align: "center"},
|
||||
{ title:"문화원", name: "mngOrgNm", type: "text" , width: 200, align: "center" },
|
||||
{ title:"자료정보", name: "title", type: "text", width: 50, align: "center" },
|
||||
{ title:"신청/예약일", name: "rsrvDd", type: "text", width: 100, align: "center"},
|
||||
{ title:"신청/예약만료일", name: "rsrvExpctDd", type: "text", width: 100, align: "center"},
|
||||
{ title:"반납예정일", name: "rtnExpctDd", type: "text", width: 100, align: "center"},
|
||||
{ title:"반납일", name: "rtnDd", type: "text", width: 100, align: "center"},
|
||||
{ title:"대출상태", name: "useStatus", type: "text", width: 100, align: "center"},
|
||||
{ title:"대출상태구분코드", name: "bookLtRvStatusCd", type: "text", width: 100, align: "center"},
|
||||
{ title:"대출상태구분코드명", name: "bookLtRvStatusNm", type: "text", width: 100, align: "center"},
|
||||
{ title:"취소", name: "loanExtension", type: "text", width: 80, align: "center" , itemTemplate: function (_, item) {
|
||||
var btn = $("<button type='button'>").text("취소").click(function (e) {
|
||||
alert("Clicked!");
|
||||
e.stopPropagation();
|
||||
});
|
||||
return $("<div>").append(item.loanExtension).append(" ").append(btn);
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
$("#mngOrgCd").on("change", function(e) {
|
||||
fn_search_article($("#pageSize").val(), 1);
|
||||
});
|
||||
|
||||
<sec:authorize access="isAuthenticated()">
|
||||
//초기 자료 조회
|
||||
fn_search_article();
|
||||
</sec:authorize>
|
||||
|
||||
|
||||
}; // window.onload
|
||||
|
||||
// 그리드 데이터 조회 호출
|
||||
function fn_search_article(pageSize, pageIndex) {
|
||||
$("#jsGrid").jsGrid("search"
|
||||
, {'pageSize' : (pageSize ? pageSize : fn_getIntValue("pageSize", ${pageSize})),
|
||||
'pageIndex': (pageIndex ? pageIndex : fn_getIntValue("pageIndex", 1))
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
function fn_search(bookLtRvStatusCd) {
|
||||
$("#bookLtRvStatusCd").val(bookLtRvStatusCd);
|
||||
fn_search_article();
|
||||
fn_searchArticle(1);
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
// 선택한 글 상세 보기로 이동
|
||||
function fn_viewDetail(masterId) {
|
||||
$("#masterId").val(masterId);
|
||||
$("#frm").attr("action", "/search/searchItemDetail.do");
|
||||
$("#frm").attr("target", "_blank");
|
||||
$("#frm").submit();
|
||||
}
|
||||
|
||||
<body>
|
||||
// 그리드 데이터 조회 호출
|
||||
function fn_searchArticle(pageIndex) {
|
||||
|
||||
<h1>${pageTitle }</h1>
|
||||
if(fn_isEmpty(pageIndex)) pageIndex = $("#pageIndex").val();
|
||||
if(fn_isEmpty(pageIndex)) pageIndex = "1";
|
||||
$("#pageIndex").val(pageIndex);
|
||||
|
||||
<br /> 메시지 :
|
||||
<span style="color: red !important;">${message }</span>
|
||||
<br />
|
||||
<br />
|
||||
var reqUrl = "${pageContext.request.contextPath}/rent/listRentItemsAjax.do";
|
||||
|
||||
<form name="frm" id="frm" method="post">
|
||||
총 <span name="totRecordCount" id="totRecordCount">0</span> 건
|
||||
var inputData = {
|
||||
"pageIndex" : $("#pageIndex").val()
|
||||
, "pageSize" : $("#pageSize").val()
|
||||
, "bookLtRvStatusCd" : $("#bookLtRvStatusCd").val()
|
||||
, "mngOrgCd" : $("#mngOrgCd").val()
|
||||
};
|
||||
|
||||
|
||||
bookLtRvStatusCd <input type="text" name="bookLtRvStatusCd"
|
||||
id="bookLtRvStatusCd" value="${bookLtRvStatusCd }" title="대출상태구분" />
|
||||
<br> <a href="javascript:void(0);" onclick="fn_search('')"> <span
|
||||
id="bookLtRvStatusCd" style="color: red">전체</span></a> | <a
|
||||
href="javascript:void(0);" onclick="fn_search('A')"><span
|
||||
id="bookLtRvStatusCdA" style="color: red">신청/예약</span></a> | <a
|
||||
href="javascript:void(0);" onclick="fn_search('C')"><span
|
||||
id="bookLtRvStatusCdC" style="color: red">취소</span></a> | <a
|
||||
href="javascript:void(0);" onclick="fn_search('W')"><span
|
||||
id="bookLtRvStatusCdW" style="color: red">대출중</span></a> | <a
|
||||
href="javascript:void(0);" onclick="fn_search('R')"><span
|
||||
id="bookLtRvStatusCdR" style="color: red">반납</span></a> | <a
|
||||
href="javascript:void(0);" onclick="fn_search('P')"><span
|
||||
id="bookLtRvStatusCdP" style="color: red">연체</span></a> <select
|
||||
name="mngOrgCd" id="mngOrgCd" title="문화원 선택">
|
||||
<option value="">전체</option>
|
||||
<c:forEach var="orgItem" items="${rentMngOrgList}" varStatus="status">
|
||||
<option value="<c:out value="${orgItem.mngOrgCd }" />"
|
||||
<c:if test="${orgItem.mngOrgCd == mngOrgCd }">selected</c:if>><c:out
|
||||
value="${orgItem.mngOrgNm }" /></option>
|
||||
</c:forEach>
|
||||
</select> pageIndex <input type="text" name="pageIndex" id="pageIndex"
|
||||
title="페이지번호" value="${pageIndex }" size="5" maxlength="5" />
|
||||
//--------------------------------------
|
||||
// 요청 처리
|
||||
//--------------------------------------
|
||||
$.ajax({
|
||||
type: "post",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
url: reqUrl,
|
||||
dataType: "json",
|
||||
data: JSON.stringify(inputData),
|
||||
}).done(function(data){
|
||||
<%
|
||||
// 그리드 데이터 예시 :
|
||||
// (1) 페이징 클라이언트에서 수행하는 경우(pageloading = false) : [{ "articleNo": 1, "articleType": "01" }, { "articleNo": 2, "articleType": "02" }]
|
||||
// (2) 페이징 서버에서 수행하는 경우(pageloading = true) : {data: [{...}], itemsCount: 255}
|
||||
%>
|
||||
|
||||
<div id="jsGrid" name="jsGrid" style="height: 100%"></div>
|
||||
<input type="button" value="대출 취소목록"
|
||||
onClick="location.href='${pageContext.request.contextPath}/rent/listCanceledRentItems.do'">
|
||||
<input type="button" value="반납 연기"
|
||||
onClick="location.href='${pageContext.request.contextPath}/rent/listPostpones.do'">
|
||||
var jsonObj = JSON.parse(data);
|
||||
|
||||
// 건수
|
||||
if(typeof jsonObj.itemsCount == 'undefined') {
|
||||
$("#itemsCount").text("0");
|
||||
}
|
||||
else {
|
||||
$("#itemsCount").text(jsonObj.itemsCount);
|
||||
}
|
||||
|
||||
// 기존 데이터 CLEAR
|
||||
$("div.list-data div.list").not('.t-tit-line').not('.no-result').remove();
|
||||
|
||||
if(!jsonObj.data || jsonObj.data.length <= 0 ) {
|
||||
$("div.list-data div.no-result").show();
|
||||
} else {
|
||||
$("div.list-data div.no-result").hide();
|
||||
|
||||
// 출력
|
||||
$.each(jsonObj.data,function(key,obj) {
|
||||
var div = $(document.createElement('div'));
|
||||
div.attr('class', 'list');
|
||||
div.append($('<div />').attr('class', 'n-cultural').html("[" + obj.mngOrgNm + "]"));
|
||||
div.append($('<div />').attr('class', 'n-data').html("<a href=\"javascript:void(0)\" onclick=\"fn_viewDetail('" + obj.masterId + "')\">" + obj.title + "</a>"));
|
||||
div.append($('<div />').attr('class', 'n-reservation').html(fn_formatDateStr(obj.rsrvDd,"-"))); /* 대출신청예약일자 */
|
||||
div.append($('<div />').attr('class', 'n-expiry').html(fn_formatDateStr(obj.rsrvExpctDd,"-"))); /* 대출예약만료일자 */
|
||||
div.append($('<div />').attr('class', 'n-return').html(fn_formatDateStr(obj.rtnExpctDd,"-"))); /* 반납일자 */
|
||||
|
||||
var statusHtml = "";
|
||||
if(obj.bookLtRvStatusCd == null) {
|
||||
statusHtml = "";
|
||||
} else if(obj.bookLtRvStatusCd.startsWith("A")) {
|
||||
statusHtml = "<button type='button' onclick='fn_cancel(\"" + obj.title + "\",\"" + obj.bookLtRvStatusNm + "\",\"" + obj.mngOrgCd + "\", \"" + obj.rsrvId + "\")'>취소</button>";
|
||||
} else if(obj.bookLtRvStatusCd.startsWith("R")) {
|
||||
statusHtml = " <span>" + fn_formatDateStr(obj.rtnDd,"-") + "</span>";
|
||||
}
|
||||
|
||||
div.append($('<div />').attr('class', 'n-use').html("<span>" + obj.bookLtRvStatusNm + "</span>" + statusHtml));
|
||||
|
||||
$("div.list-data").append(div);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
pageLoad("fn_searchArticle", jsonObj.pagingPageIndex, jsonObj.pagingTotRecordCount, jsonObj.pagingStartPage, jsonObj.pagingEndPage, jsonObj.pagingLastPage);
|
||||
|
||||
}).fail(function (jqXHR, textStatus, errorThrown) {
|
||||
alert("조회에 실패하였습니다. 관리자에게 문의 바랍니다.");
|
||||
});
|
||||
}
|
||||
|
||||
function fn_cancel(title, bookLtRvStatusNm, mngOrgCd, rsrvId) {
|
||||
|
||||
if(!confirm(title + " " + bookLtRvStatusNm + "을 취소하시겠습니까?")) return;
|
||||
|
||||
var reqUrl = "${pageContext.request.contextPath}/rent/cancelRentItemAjax.do";
|
||||
|
||||
var inputData = {
|
||||
"mngOrgCd" : mngOrgCd
|
||||
, "rsrvId" : rsrvId
|
||||
, "bookLtRvStatusNm" : bookLtRvStatusNm
|
||||
};
|
||||
|
||||
//--------------------------------------
|
||||
// 요청 처리
|
||||
//--------------------------------------
|
||||
$.ajax({
|
||||
type: "post",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
url: reqUrl,
|
||||
dataType: "json",
|
||||
data: JSON.stringify(inputData),
|
||||
}).done(function(data){
|
||||
<%
|
||||
// 그리드 데이터 예시 :
|
||||
// (1) 페이징 클라이언트에서 수행하는 경우(pageloading = false) : [{ "articleNo": 1, "articleType": "01" }, { "articleNo": 2, "articleType": "02" }]
|
||||
// (2) 페이징 서버에서 수행하는 경우(pageloading = true) : {data: [{...}], itemsCount: 255}
|
||||
%>
|
||||
var jsonObj = JSON.parse(data);
|
||||
// 자료 신청(or 예약)이 취소되었습니다.
|
||||
if(jsonObj.resultCode == "S") {
|
||||
fn_searchArticle(1);
|
||||
alert(jsonObj.resultMessage);
|
||||
} else {
|
||||
alert(jsonObj.resultMessage);
|
||||
}
|
||||
|
||||
}).fail(function (jqXHR, textStatus, errorThrown) {
|
||||
alert("처리에 실패하였습니다. 관리자에게 문의 바랍니다.");
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- 대출관리 섹션 -->
|
||||
<div class="location loan-data">
|
||||
<h2 class="blind">대출관리 섹션영역</h2>
|
||||
<div class="inner">
|
||||
<div class="row-top">
|
||||
<div class="location-box">
|
||||
<ul class="loc">
|
||||
<li>HOME</li>
|
||||
<li>마이페이지</li>
|
||||
<li class="on">${pageTitle }</li>
|
||||
</ul>
|
||||
<ul class="tit">
|
||||
<li><span>대출</span>관리</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="arr"><img src="/images/icon/icon-join-arr2.png" alt="화살표 아이콘"></div>
|
||||
</div>
|
||||
<div class="contents row-bottom">
|
||||
<div class="list-box loan-box">
|
||||
<form name="frm" id="frm" method="post">
|
||||
<input type="hidden" name="bookLtRvStatusCd" id="bookLtRvStatusCd" value="${bookLtRvStatusCd }" />
|
||||
<input type="hidden" name="pageIndex" id="pageIndex" title="페이지번호" value="${pageIndex }" size="5" maxlength="5" />
|
||||
<input type="hidden" name="pageSize" id="pageSize" title="페이지크기" value="${pageSize }" size="5" maxlength="5" />
|
||||
<input type="hidden" name="masterId" id="masterId" title="페이지크기" value="" />
|
||||
|
||||
<div class="tab">
|
||||
<ul class="tabs">
|
||||
<li><a href="javascript:void(0);" onclick="fn_search('A')">신청/예약</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="fn_search('C')">취소</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="fn_search('W')">대출중</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="fn_search('R')"><!-- <img src="/images/icon/icon-new.png" alt="뉴 아이콘"> -->반납</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="fn_search('P')">연체</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="title">
|
||||
<span class="count">총 <em name="itemsCount" id="itemsCount">0</em>건</span>
|
||||
<div class="list-search-wrap list-top">
|
||||
<div class="list-select">
|
||||
<select name="mngOrgCd" id="mngOrgCd" title="문화원 선택">
|
||||
<option value="">문화원 전체</option>
|
||||
<c:forEach var="orgItem" items="${rentMngOrgList}" varStatus="status">
|
||||
<option value="<c:out value="${orgItem.mngOrgCd }" />"
|
||||
<c:if test="${orgItem.mngOrgCd == mngOrgCd }">selected</c:if>><c:out
|
||||
value="${orgItem.mngOrgNm }" /></option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab_content">
|
||||
<div class="tabs_item">
|
||||
<div class="inner">
|
||||
|
||||
<div class="list-wrap">
|
||||
<div class="list-data">
|
||||
<div class="list t-tit-line">
|
||||
<div class="n-cultural">문화원</div>
|
||||
<div class="n-data">자료정보</div>
|
||||
<div class="n-reservation">신청/예약일</div>
|
||||
<div class="n-expiry">신청/예약 만료일</div>
|
||||
<div class="n-return">반납예정일</div>
|
||||
<div class="n-use">이용</div>
|
||||
</div>
|
||||
<div class="no-result" style="display:none;">
|
||||
<span>자료가 없습니다.</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<ul id="paging" class="paging"></ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -320,4 +320,15 @@ function fn_viewItemDetailInfo(masterId){
|
||||
$("#FRM_ITEM_DETAIL").submit();
|
||||
}
|
||||
|
||||
function fn_formatDateStr(yyyymmdd, defVal) {
|
||||
if(fn_isEmpty(yyyymmdd)) return defVal;
|
||||
if(yyyymmdd.length == 8) {
|
||||
return yyyymmdd.substr(0, 4) + "-" + yyyymmdd.substr(4,2) + "-" + yyyymmdd.substr(6);
|
||||
} else if(yyyymmdd.length == 6) {
|
||||
return yyyymmdd.substr(0, 4) + "-" + yyyymmdd.substr(4,2);
|
||||
} else if(yyyymmdd.length == 4) {
|
||||
return yyyymmdd;
|
||||
}
|
||||
|
||||
return defVal;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user