You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
789 lines
37 KiB
Java
789 lines
37 KiB
Java
package cokr.xit.fims.rent.web;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import org.apache.poi.ss.usermodel.CellStyle;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
import cokr.xit.applib.AppCmmnUtil;
|
|
import cokr.xit.base.code.CommonCode;
|
|
import cokr.xit.base.docs.xls.CellDef;
|
|
import cokr.xit.base.docs.xls.Format;
|
|
import cokr.xit.base.docs.xls.Style;
|
|
import cokr.xit.base.docs.xls.XLSWriter;
|
|
import cokr.xit.base.file.FileInfo;
|
|
import cokr.xit.base.file.web.FileInfoFactory;
|
|
import cokr.xit.base.web.ApplicationController;
|
|
import cokr.xit.fims.base.FimsUser;
|
|
import cokr.xit.fims.cmmn.service.bean.StngBean;
|
|
import cokr.xit.fims.cmmn.xls.FormatMaker;
|
|
import cokr.xit.fims.cmmn.xls.StyleMaker;
|
|
import cokr.xit.fims.rent.Lsct;
|
|
import cokr.xit.fims.rent.LsctAprv;
|
|
import cokr.xit.fims.rent.LsctMpng;
|
|
import cokr.xit.fims.rent.RentQuery;
|
|
import cokr.xit.fims.rent.dao.LsctAprvMapper;
|
|
import cokr.xit.fims.rent.dao.LsctMpngMapper;
|
|
import cokr.xit.fims.rent.service.LsctMpngService;
|
|
import cokr.xit.fims.rent.service.LsctService;
|
|
import cokr.xit.fims.rent.service.RentEntService;
|
|
import cokr.xit.fims.rent.service.bean.LsctMpngBean;
|
|
import cokr.xit.fims.task.Task;
|
|
import cokr.xit.foundation.data.DataObject;
|
|
|
|
/**임대차계약 대장 서비스의 웹 컨트롤러
|
|
*
|
|
* <p>상세 설명:
|
|
*
|
|
* <pre>
|
|
* ============ 변경 이력 ============
|
|
* 2024-08-27 JoJH 최초 작성
|
|
* ================================
|
|
* </pre>
|
|
*/
|
|
@Controller
|
|
@RequestMapping(name = "임대차계약 운전자 정보", value=Rent02Controller.CLASS_URL)
|
|
public class Rent02Controller extends ApplicationController {
|
|
|
|
public static final String CLASS_URL = "/rent/rent02";
|
|
|
|
public class METHOD_URL {
|
|
public static final String
|
|
crackdownLeaseContractMain = "/010/main.do" // 단속 임대차계약 대장 등록 메인 화면
|
|
, getCrackdownLeaseContractList = "/010/list.do" // 단속 임대차계약 대장 등록 목록 조회
|
|
, removeLeaseContractMapping = "/010/removeLsctMpng.do" // 임대차계약 매핑 대장 삭제
|
|
, getCrackdownLeaseContractInfo = "/020/info.do" // 단속 임대차계약 대장 등록 상세 화면
|
|
, getCrackdownLeaseContract = "/020/list.do" // 단속 임대차계약 대장 등록 상세 조회
|
|
, leaseContractMain = "/030/main.do" // 임대차계약 대장 메인 화면
|
|
, getLeaseContractList = "/030/list.do" // 임대차계약 대장 목록 조회
|
|
, createLeaseContractMapping = "/030/createLsctMpng.do" // 임대차계약 매핑 대장 등록
|
|
, removeLeaseContract = "/030/removeLsct.do" // 임대차계약 대장 삭제
|
|
, getLeaseContractInfo = "/040/info.do" // 임대차계약 대장 상세 화면
|
|
, getLeaseContract = "/040/list.do" // 임대차계약 대장 상세 정보 조회
|
|
, createLeaseContract = "/040/createLsct.do" // 임대차계약 대장 등록
|
|
, updateLeaseContract = "/040/updateLsct.do" // 임대차계약 대장 수정
|
|
, removeAttachmentFile = "/040/removeAtchFile.do" // 임대차계약 첨부 파일 삭제
|
|
, leaseContractMappingMain = "/050/main.do" // 임대차계약 매핑 대장 관리 메인 화면
|
|
, getLeaseContractMappingList = "/050/list.do" // 임대차계약 매핑 대장 관리 대장 목록 조회
|
|
, getLeaseContractMappingNumberList = "/050/nocsList.do" // 임대차계약 매핑 대장 건수 조회
|
|
, createLeaseContractApproval = "/050/createAprv.do" // 임대차계약 승인 대장 등록
|
|
, removeLeaseContractApproval = "/050/removeAprv.do" // 임대차계약 승인 대장 삭제
|
|
, getLeaseContractMappingInfo = "/060/info.do" // 임대차계약 매핑 대장 관리 상세 화면
|
|
, getLeaseContractMapping = "/060/list.do" // 임대차계약 매핑 대장 관리 상세 정보 조회
|
|
;
|
|
}
|
|
|
|
/**임대차계약 대장 서비스*/
|
|
@Resource(name = "lsctMpngService")
|
|
private LsctMpngService lsctMpngService;
|
|
|
|
/**임차인 정보 서비스*/
|
|
@Resource(name = "lsctService")
|
|
private LsctService lsctService;
|
|
|
|
/**임대 기업 대장 서비스*/
|
|
@Resource(name = "rentEntService")
|
|
private RentEntService rentEntService;
|
|
|
|
/**설정 정보 Bean */
|
|
@Resource(name = "stngBean")
|
|
private StngBean stngBean;
|
|
|
|
@Resource(name = "lsctMpngBean")
|
|
private LsctMpngBean lsctMpngBean;
|
|
|
|
@Resource(name = "lsctMpngMapper")
|
|
private LsctMpngMapper lsctMpngMapper;
|
|
|
|
@Resource(name = "lsctAprvMapper")
|
|
private LsctAprvMapper lsctAprvMapper;
|
|
|
|
/**단속 임대차계약 대장 등록 메인 화면(fims/rent/rent02010-main)을 연다.
|
|
* @return fims/rent/rent02010-main
|
|
*/
|
|
@RequestMapping(name = "단속 임대차계약 대장 등록 메인 화면", value=METHOD_URL.crackdownLeaseContractMain)
|
|
public ModelAndView crackdownLeaseContractMain() {
|
|
ModelAndView mav = new ModelAndView("fims/rent/rent02010-main");
|
|
|
|
// 사용자 정보
|
|
FimsUser fimsUser = (FimsUser)currentUser().getUser();
|
|
|
|
// 사용자와 매핑되어있는 임대업체 정보 조회
|
|
RentQuery req = new RentQuery();
|
|
req.setUserId(fimsUser.getId());
|
|
|
|
List<DataObject> entRegNoList = rentEntService.getUserRentEntMpngs(req);
|
|
|
|
return mav
|
|
.addObject("pageName", "rent02010") // View(jsp)에서 사용할 id 뒤에 붙일 suffix
|
|
.addObject("prefixUrl", CLASS_URL) // prefixUrl
|
|
.addObject("userId", fimsUser.getId()) // 사용자 ID(USER_ID)
|
|
.addObject("entRegNoList", entRegNoList) // 임대업체 목록
|
|
;
|
|
}
|
|
|
|
/**단속 임대차계약 대장 등록 목록 조회하여 반환한다.
|
|
* {@link LsctMpngService#getLsctList(LsctQuery)} 참고
|
|
* @param req 임대차계약 대장 조회 조건
|
|
* @return jsonView
|
|
* <pre><code> {
|
|
* "List": [임대차계약 대장 목록]
|
|
* "Start": 임대차계약 대장 목록 시작 인덱스
|
|
* "Fetch": 한 번에 가져오는 임대차계약 대장 목록 수
|
|
* "Total": 조회 결과 찾은 전체 임대차계약 대장 수
|
|
* }</code></pre>
|
|
*/
|
|
|
|
@Task("CMN")
|
|
@RequestMapping(name = "단속 임대차계약 대장 등록 목록 조회", value=METHOD_URL.getCrackdownLeaseContractList)
|
|
public ModelAndView getCrackdownLeaseContractList(RentQuery req) {
|
|
|
|
// 과태료 시스템 조회하여 변경 내역 등록 및 수정.
|
|
if (("Y").equals(req.getFfnlgSysInqYn())) {
|
|
List<DataObject> mmList = lsctMpngBean.getMmList(req);
|
|
String rtnMsg = lsctMpngBean.saveFfnlgMainList(req,mmList);
|
|
if (!rtnMsg.contains("[S]")) {
|
|
throw new RuntimeException(rtnMsg);
|
|
}
|
|
}
|
|
|
|
if (!"xls".equals(req.getDownload())) {
|
|
List<?> result = lsctMpngService.getCrdnLsctMpngList(setFetchSize(req));
|
|
return setPagingInfo(new ModelAndView("jsonView"), result, "");
|
|
} else {
|
|
// 현재 날짜 구하기
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
String dateTime = dateFormat.format(System.currentTimeMillis());
|
|
|
|
List<CellDef> cellDefs = fromJson(req.getCellDefs(), CellDef.listType());
|
|
|
|
XLSWriter xlsx = new XLSWriter().worksheet(0);
|
|
Format format = new Format(xlsx);
|
|
CellStyle center = format.cellStyle(Style.CENTER);
|
|
CellStyle numeric = format.n_nn0();
|
|
CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss();
|
|
|
|
List<DataObject> list = lsctMpngService.getCrdnLsctMpngList(req.setFetchSize(0));
|
|
|
|
Map<String,Object> valueMap = new HashMap<String,Object>();
|
|
|
|
valueMap.put("업무구분", format.of("TASK_SE_NM").style(center));
|
|
valueMap.put("대상여부", format.of("TRGT_STTS_NM").style(center));
|
|
valueMap.put("단속일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CRDN_DT").style(dateDT));
|
|
valueMap.put("자동차등록번호", format.of("VHRNO"));
|
|
valueMap.put("납부자구분", format.of("RTPYR_SE_NM").style(center));
|
|
valueMap.put("납부자번호", format.of("RTPYR_NO").style(center));
|
|
valueMap.put("납부자명", format.of("RTPYR_NM"));
|
|
valueMap.put("단속법정동", format.of("CRDN_STDG_NM").style(center));
|
|
valueMap.put("단속장소", format.of("CRDN_PLC"));
|
|
valueMap.put("위반항목", format.of("VLTN_ARTCL"));
|
|
valueMap.put("단속원금", format.of("FFNLG_CRDN_AMT").style(numeric));
|
|
valueMap.put("처리상태", format.of("CRDN_STTS_NM"));
|
|
valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT));
|
|
valueMap.put("등록사용자", format.of("RGTR_NM").style(center));
|
|
valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT));
|
|
valueMap.put("수정사용자", format.of("MDFR_NM").style(center));
|
|
|
|
CellDef.setValues(cellDefs, valueMap);
|
|
|
|
xlsx.cell(0, 0).value("임대차계약등록").value(center).merge(0, cellDefs.size() - 1)
|
|
.cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx)))
|
|
.cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> { if(i.getValue() instanceof Format) { i.setField(null); }; return i; }).toList()));
|
|
|
|
return new ModelAndView("downloadView")
|
|
.addObject("download", xlsx.getDownloadable().setFilename("임대차계약등록" + "_목록_" + dateTime + ".xlsx"));
|
|
}
|
|
}
|
|
|
|
/**단속 임대차계약 대장 등록 상세 화면(fims/rent/rent02020-info)을 연다.
|
|
* 조건없는 {@link #getCrackdownLeaseContract(RentQuery) 단속 임대차계약 대장 조회 결과}를 포함시킨다.
|
|
* @return fims/rent/rent02020-info
|
|
*/
|
|
@Task("CMN")
|
|
@RequestMapping(name = "단속 임대차계약 대장 등록 상세 화면", value=METHOD_URL.getCrackdownLeaseContractInfo)
|
|
public ModelAndView getCrackdownLeaseContractInfo(HttpServletRequest hReq, RentQuery req) {
|
|
boolean json = jsonResponse();
|
|
ModelAndView mav = new ModelAndView(json ? "jsonView" : "fims/rent/rent02020-info");
|
|
|
|
// 상세 정보 조회
|
|
DataObject info = getCrackdownLeaseContract(req);
|
|
mav.addObject("Info", json ? info : toJson(info));
|
|
|
|
if (!json) {
|
|
// View(jsp)에서 사용할 공통코드를 조회
|
|
Map<String, List<CommonCode>> commonCodes = getCodesOf("FIM089");
|
|
|
|
mav.addObject("callPurpose", req.getCallPurpose()) // 호출 용도
|
|
.addObject("pageName", "rent02020") // jsp pageName
|
|
.addObject("prefixUrl", CLASS_URL) // prefixUrl
|
|
.addObject("FIM089List", commonCodes.get("FIM089")) // 임차인 구분 코드(HIRER_SE_CD)
|
|
.addObject("mainQuery", toJson(req)) // main 검색 조건
|
|
;
|
|
}
|
|
|
|
return mav;
|
|
}
|
|
|
|
@Task("CMN")
|
|
@RequestMapping(name = "단속 임대차계약 대장 등록 상세 조회", value=METHOD_URL.getCrackdownLeaseContract)
|
|
public DataObject getCrackdownLeaseContract(RentQuery req) {
|
|
// 상세 정보 조회
|
|
return lsctMpngService.getCrdnLsctMpngInfo(req);
|
|
}
|
|
|
|
/**임대차계약 매핑 대장를 등록한다.
|
|
* @param lsctMpng 임대차계약 매핑 대장 정보
|
|
* @return jsonView
|
|
* <pre><code> {
|
|
* "saved": 등록되었으면 true, 그렇지 않으면 false
|
|
* }</code></pre>
|
|
*/
|
|
@Task("CMN")
|
|
@RequestMapping(name = "임대차계약 매핑 대장 등록", value = METHOD_URL.createLeaseContractMapping)
|
|
public ModelAndView createLeaseContractMapping(LsctMpng lsctMpng) {
|
|
boolean saved = false;
|
|
String rtnMsg = lsctMpngService.createLsctMpng(lsctMpng);
|
|
|
|
if (rtnMsg.contains("[S]")) {
|
|
saved = true;
|
|
} else {
|
|
saved = false;
|
|
}
|
|
|
|
return new ModelAndView("jsonView")
|
|
.addObject("saved", saved)
|
|
.addObject("rtnMsg", rtnMsg);
|
|
}
|
|
|
|
/**지정한 임대차계약 매핑 대장를 제거한다.
|
|
* @param lsctMpngIds 임대차계약 매핑 대장 아이디s
|
|
* @return jsonView
|
|
* <pre><code> {
|
|
* "affected": 저장된 정보수
|
|
* "saved": 저장되었으면 true, 그렇지 않으면 false
|
|
* }</code></pre>
|
|
*/
|
|
@Task("CMN")
|
|
@RequestMapping(name = "임대차계약 매핑 대장 제거", value = METHOD_URL.removeLeaseContractMapping)
|
|
public ModelAndView removeLeaseContractMapping(LsctMpng lsctMpng) {
|
|
boolean saved = false;
|
|
String rtnMsg = lsctMpngService.removeLsctMpng(lsctMpng);
|
|
|
|
if (rtnMsg.contains("[S]")) {
|
|
saved = true;
|
|
} else {
|
|
saved = false;
|
|
}
|
|
|
|
return new ModelAndView("jsonView")
|
|
.addObject("saved", saved)
|
|
.addObject("rtnMsg", rtnMsg);
|
|
}
|
|
|
|
/**임대차계약(임차인) 대장 메인 화면(fims/rent/rent02030-main)을 연다.
|
|
* @return fims/rent/rent02030-main
|
|
*/
|
|
@RequestMapping(name = "임대차계약 대장 메인 화면", value=METHOD_URL.leaseContractMain)
|
|
public ModelAndView leaseContractMain(RentQuery req) {
|
|
ModelAndView mav = new ModelAndView("fims/rent/rent02030-main");
|
|
|
|
return mav
|
|
.addObject("pageName", "rent02030") // jsp pageName
|
|
.addObject("prefixUrl", CLASS_URL) // prefixUrl
|
|
.addObject("crdnId", req.getCrdnId()) // 단속 ID
|
|
.addObject("schEntRegNo", req.getSchEntRegNo()) // 기업 등록 번호
|
|
.addObject("schCtrtYmd", req.getSchCtrtYmd()) // 계약일자 = 단속일자
|
|
.addObject("schVhrno", req.getSchVhrno()) // 자동차등록번호
|
|
;
|
|
}
|
|
|
|
/**임대차계약(임차인) 대장 목록을 조회하여 반환한다.
|
|
* {@link LsctService#getHirerList(RentQuery)} 참고
|
|
* @param req 임대차계약 조회 조건
|
|
* @return jsonView
|
|
* <pre><code> {
|
|
* "List": [임대차계약 대장 목록]
|
|
* "Start": 임대차계약 대장 목록 시작 인덱스
|
|
* "Fetch": 한 번에 가져오는 임대차계약 대장 목록 수
|
|
* "Total": 조회 결과 찾은 전체 임대차계약 대장 수
|
|
* }</code></pre>
|
|
*/
|
|
@Task("CMN")
|
|
@RequestMapping(name = "임대차계약 대장 목록 조회", value=METHOD_URL.getLeaseContractList)
|
|
public ModelAndView getLeaseContractList(RentQuery req) {
|
|
if (!"xls".equals(req.getDownload())) {
|
|
List<?> result = lsctService.getLsctList(setFetchSize(req));
|
|
return setPagingInfo(new ModelAndView("jsonView"), result, "");
|
|
} else {
|
|
// 현재 날짜 구하기
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
String dateTime = dateFormat.format(System.currentTimeMillis());
|
|
|
|
List<CellDef> cellDefs = fromJson(req.getCellDefs(), CellDef.listType());
|
|
|
|
XLSWriter xlsx = new XLSWriter().worksheet(0);
|
|
Format format = new Format(xlsx);
|
|
CellStyle center = format.cellStyle(Style.CENTER);
|
|
CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss();
|
|
|
|
List<DataObject> list = lsctService.getLsctList(req.setFetchSize(0));
|
|
|
|
Map<String,Object> valueMap = new HashMap<String,Object>();
|
|
valueMap.put("기업구분", format.of("ENT_SE_NM").style(center));
|
|
valueMap.put("기업명", format.of("ENT_NM"));
|
|
valueMap.put("법인(사업자)번호", format.of("ENT_REG_NO").style(center));
|
|
valueMap.put("대표자명", format.of("RPRSV_NM").style(center));
|
|
valueMap.put("전화번호", format.of("ENT_TELNO").style(center));
|
|
valueMap.put("팩스번호", format.of("ENT_FXNO").style(center));
|
|
valueMap.put("이메일주소", format.of("ENT_EML_ADDR"));
|
|
valueMap.put("우편번호", format.of("ENT_ZIP").style(center));
|
|
valueMap.put("주소", format.of("ENT_ADDR"));
|
|
valueMap.put("상세주소", format.of("ENT_DTL_ADDR"));
|
|
valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT));
|
|
valueMap.put("등록사용자", format.of("RGTR_NM").style(center));
|
|
|
|
CellDef.setValues(cellDefs, valueMap);
|
|
|
|
xlsx.cell(0, 0).value("임대기업").value(center).merge(0, cellDefs.size() - 1)
|
|
.cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx)))
|
|
.cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> { if(i.getValue() instanceof Format) { i.setField(null); }; return i; }).toList()));
|
|
|
|
return new ModelAndView("downloadView")
|
|
.addObject("download", xlsx.getDownloadable().setFilename("임대기업" + "_목록_" + dateTime + ".xlsx"));
|
|
}
|
|
}
|
|
|
|
/**임대차계약(임차인) 대장 상세 화면(fims/rent/rent02040-info)을 연다.
|
|
* 조건없는 {@link #getRentEntList(RentEntQuery) 임대 기업 대장 조회 결과}를 포함시킨다.
|
|
* @return fims/rent/rent02040-info
|
|
*/
|
|
@Task("CMN")
|
|
@RequestMapping(name = "임대차계약 대장 상세 화면", value=METHOD_URL.getLeaseContractInfo)
|
|
public ModelAndView getLeaseContractInfo(HttpServletRequest hReq, RentQuery req) {
|
|
boolean json = jsonResponse();
|
|
ModelAndView mav = new ModelAndView(json ? "jsonView" : "fims/rent/rent02040-info");
|
|
|
|
DataObject info = getLeaseContract(req); // 임대차계약 상세 정보 조회
|
|
mav.addObject("Info", json ? info : toJson(info));
|
|
|
|
if (!json) {
|
|
// View(jsp)에서 사용할 공통코드를 조회
|
|
Map<String, List<CommonCode>> commonCodes = getCodesOf("FIM089");
|
|
|
|
mav.addObject("callPurpose", req.getCallPurpose()) // 호출 용도
|
|
.addObject("pageName", "rent02040") // jsp pageName
|
|
.addObject("prefixUrl", CLASS_URL) // prefixUrl
|
|
.addObject("FIM089List", commonCodes.get("FIM089")) // 임차인 구분 코드(HIRER_SE_CD)
|
|
.addObject("crdnId", req.getCrdnId()) // 단속 ID
|
|
;
|
|
}
|
|
|
|
return mav;
|
|
}
|
|
|
|
@Task("CMN")
|
|
@RequestMapping(name = "임대차계약 대장 상세 정보 조회", value=METHOD_URL.getLeaseContract)
|
|
public DataObject getLeaseContract(RentQuery req) {
|
|
// 상세 정보 조회
|
|
return lsctService.getLsctInfo(req);
|
|
}
|
|
|
|
/**임대차계약 대장을 등록한다.
|
|
* @param lsct 임대차계약 대장 정보, uploadFiles 임대차계약 첨부 파일
|
|
* @return jsonView
|
|
* <pre><code> {
|
|
* "saved": 등록되었으면 true, 그렇지 않으면 false
|
|
* }</code></pre>
|
|
*/
|
|
@Task("CMN")
|
|
@RequestMapping(name = "임대차계약 대장 등록", value=METHOD_URL.createLeaseContract)
|
|
public ModelAndView createLeaseContract(Lsct lsct, MultipartFile[] uploadFiles) {
|
|
boolean saved = false;
|
|
|
|
// 첨부 파일
|
|
List<FileInfo> fileInfoList = new ArrayList<FileInfo>();
|
|
if (uploadFiles != null && uploadFiles.length > 0) {
|
|
fileInfoList = new FileInfoFactory().makeFileInfos(null, uploadFiles);
|
|
}
|
|
|
|
String rtnMsg = lsctService.createLsct(lsct, fileInfoList);
|
|
|
|
if (rtnMsg.contains("[S]")) {
|
|
saved = true;
|
|
} else {
|
|
saved = false;
|
|
}
|
|
|
|
return new ModelAndView("jsonView")
|
|
.addObject("saved", saved)
|
|
.addObject("rtnMsg", rtnMsg);
|
|
}
|
|
|
|
/**임대차계약 대장 정보를 수정한다.
|
|
* @param lsct 임대차계약 대장 정보, uploadFiles 임대차계약 첨부 파일
|
|
* @return jsonView
|
|
* <pre><code> {
|
|
* "saved": 수정되었으면 true, 그렇지 않으면 false
|
|
* }</code></pre>
|
|
*/
|
|
@Task("CMN")
|
|
@RequestMapping(name = "임대차계약 대장 수정", value=METHOD_URL.updateLeaseContract)
|
|
public ModelAndView updateLeaseContract(Lsct lsct, MultipartFile[] uploadFiles) {
|
|
boolean saved = false;
|
|
|
|
// 첨부 파일
|
|
List<FileInfo> fileInfoList = new ArrayList<FileInfo>();
|
|
if (uploadFiles != null && uploadFiles.length > 0) {
|
|
fileInfoList = new FileInfoFactory().makeFileInfos(null, uploadFiles);
|
|
}
|
|
|
|
String rtnMsg = lsctService.updateLsct(lsct, fileInfoList);
|
|
|
|
if (rtnMsg.contains("[S]")) {
|
|
saved = true;
|
|
} else {
|
|
saved = false;
|
|
}
|
|
|
|
return new ModelAndView("jsonView")
|
|
.addObject("saved", saved)
|
|
.addObject("rtnMsg", rtnMsg);
|
|
}
|
|
|
|
/**임대차계약 파일 정보를 삭제하고, 임차인 대장 첨부파일수를 수정한다.
|
|
* @param lsct 임대차계약 대장 정보
|
|
* @return jsonView
|
|
* <pre><code> {
|
|
* "saved": 수정되었으면 true, 그렇지 않으면 false
|
|
* }</code></pre>
|
|
*/
|
|
@Task("CMN")
|
|
@RequestMapping(name = "임대차계약 대장 첨부파일 삭제", value=METHOD_URL.removeAttachmentFile)
|
|
public ModelAndView removeAttachmentFile(Lsct lsct) {
|
|
boolean saved = false;
|
|
String rtnMsg = lsctService.removeAtchFile(lsct);
|
|
|
|
if (rtnMsg.contains("[S]")) {
|
|
saved = true;
|
|
} else {
|
|
saved = false;
|
|
}
|
|
|
|
return new ModelAndView("jsonView")
|
|
.addObject("saved", saved)
|
|
.addObject("rtnMsg", rtnMsg);
|
|
}
|
|
|
|
/**지정한 임대차계약 대장를 삭제한다.
|
|
* @param lsct 임대차계약 대장
|
|
* @return jsonView
|
|
* <pre><code> {
|
|
* "affected": 저장된 정보수
|
|
* "saved": 저장되었으면 true, 그렇지 않으면 false
|
|
* }</code></pre>
|
|
*/
|
|
@Task("CMN")
|
|
@RequestMapping(name = "임대차계약 대장 삭제", value=METHOD_URL.removeLeaseContract)
|
|
public ModelAndView removeLeaseContract(Lsct lsct) {
|
|
boolean saved = false;
|
|
String rtnMsg = lsctService.removeLsct(lsct);
|
|
|
|
if (rtnMsg.contains("[S]")) {
|
|
saved = true;
|
|
} else {
|
|
saved = false;
|
|
}
|
|
|
|
return new ModelAndView("jsonView")
|
|
.addObject("saved", saved)
|
|
.addObject("rtnMsg", rtnMsg);
|
|
}
|
|
|
|
/**임대차계약 대장 관리 메인화면(fims/rent/rent02050-main)을 연다.
|
|
* 조건없는 {@link #getLsctList(LsctQuery) 임대차계약 대장 조회 결과}를 포함시킨다.
|
|
* @return fims/rent/rent02050-main
|
|
*/
|
|
@RequestMapping(name = "임대차계약 매핑 대장 관리 메인", value=METHOD_URL.leaseContractMappingMain)
|
|
public ModelAndView leaseContractMappingMain() {
|
|
ModelAndView mav = new ModelAndView("fims/rent/rent02050-main");
|
|
|
|
// 사용자 정보
|
|
FimsUser fimsUser = (FimsUser)currentUser().getUser();
|
|
|
|
// 사용자와 매핑되어있는 임대업체 정보 조회
|
|
RentQuery req = new RentQuery();
|
|
req.setUserId(fimsUser.getId());
|
|
|
|
List<DataObject> entRegNoList = rentEntService.getUserRentEntMpngs(req);
|
|
|
|
return mav
|
|
.addObject("pageName", "rent02050") // View(jsp)에서 사용할 id 뒤에 붙일 suffix
|
|
.addObject("prefixUrl", CLASS_URL) // prefixUrl
|
|
.addObject("userId", fimsUser.getId()) // 사용자 ID(USER_ID)
|
|
.addObject("entRegNoList", entRegNoList) // 임대업체 목록
|
|
;
|
|
}
|
|
|
|
/**임대차계약 대장 목록을 조회하여 반환한다.<br />
|
|
* {@link LsctMpngService#getLsctList(LsctQuery)} 참고
|
|
* @param req 임대차계약 대장 조회 조건
|
|
* @return jsonView
|
|
* <pre><code> {
|
|
* "lsctList": [임대차계약 대장 목록]
|
|
* "lsctStart": 임대차계약 대장 목록 시작 인덱스
|
|
* "lsctFetch": 한 번에 가져오는 임대차계약 대장 목록 수
|
|
* "lsctTotal": 조회 결과 찾은 전체 임대차계약 대장 수
|
|
* }</code></pre>
|
|
*/
|
|
@Task("CMN")
|
|
@RequestMapping(name = "임대차계약 매핑 대장 관리 조회", value=METHOD_URL.getLeaseContractMappingList)
|
|
public ModelAndView getLeaseContractMappingList(RentQuery req) {
|
|
|
|
|
|
int rtnNocs = -1;
|
|
|
|
if (!"xls".equals(req.getDownload())) {
|
|
setFetchSize(req);
|
|
} else {
|
|
req.setFetchSize(0);
|
|
}
|
|
|
|
List<DataObject> lsctMpngList1 = lsctMpngMapper.selectLsctMpngList(req);
|
|
// 변경 승인 여부를 확인 한다.
|
|
for (DataObject lsctMpng: lsctMpngList1) {
|
|
if (lsctMpng.string("DMND_YN").equals("Y") && lsctMpng.string("CHG_APRV_STTS_CD").equals("RQ")) {
|
|
RentQuery lsctAprvReq = new RentQuery();
|
|
lsctAprvReq.setLsctLinkTblNm(lsctMpng.string("LSCT_LINK_TBL_NM"));
|
|
lsctAprvReq.setAprvId(lsctMpng.string("LSCT_APRV_ID"));
|
|
lsctAprvReq.setLsctMpngId(lsctMpng.string("LSCT_MPNG_ID"));
|
|
lsctAprvReq.setDelYn("N");
|
|
|
|
DataObject lsctAprv = lsctAprvMapper.selectLsctAprvInfo(lsctAprvReq);
|
|
|
|
if (!lsctAprv.string("CHG_APRV_STTS_CD").equals("")) {
|
|
LsctMpng updtLsctMpng = new LsctMpng();
|
|
|
|
updtLsctMpng.setLsctMpngId(lsctAprv.string("LSCT_MPNG_ID")); // 임대차계약 매핑 ID
|
|
updtLsctMpng.setChgAprvSttsCd(lsctAprv.string("CHG_APRV_STTS_CD")); // 변경 승인 상태 코드
|
|
updtLsctMpng.setChgAprvDt(lsctAprv.string("CHG_APRV_DT")); // 변경 승인 일시
|
|
updtLsctMpng.setChgAutzrNm(lsctAprv.string("CHG_AUTZR_NM")); // 변경 승인자 명
|
|
updtLsctMpng.setChgAprvRsn(lsctAprv.string("CHG_APRV_RSN")); // 변경 승인 사유
|
|
updtLsctMpng.setChgAprvIp(lsctAprv.string("CHG_APRV_IP")); // 변경 승인 IP
|
|
|
|
rtnNocs = lsctMpngMapper.updateLsctMpngChgAprv(updtLsctMpng);
|
|
if (rtnNocs < 1) {
|
|
throw new RuntimeException("[F] 임대차계약 승인 여부 수정 작업에 실패하였습니다."); // 예외를 발생시켜서 DB Rollback
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
if (!"xls".equals(req.getDownload())) {
|
|
List<?> result = lsctMpngMapper.selectLsctMpngList(req);
|
|
return setPagingInfo(new ModelAndView("jsonView"), result, "");
|
|
} else {
|
|
// 현재 날짜 구하기
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
String dateTime = dateFormat.format(System.currentTimeMillis());
|
|
|
|
List<CellDef> cellDefs = fromJson(req.getCellDefs(), CellDef.listType());
|
|
|
|
XLSWriter xlsx = new XLSWriter().worksheet(0);
|
|
Format format = new Format(xlsx);
|
|
CellStyle center = format.cellStyle(Style.CENTER);
|
|
CellStyle numeric = format.n_nn0();
|
|
CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss();
|
|
|
|
List<DataObject> list = lsctMpngMapper.selectLsctMpngList(req);
|
|
|
|
Map<String,Object> valueMap = new HashMap<String,Object>();
|
|
|
|
valueMap.put("업무구분", format.of("TASK_SE_NM").style(center));
|
|
valueMap.put("대상여부", format.of("TRGT_STTS_NM").style(center));
|
|
valueMap.put("요청일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CHG_DMND_DT").style(dateDT));
|
|
valueMap.put("요청자", format.of("CHG_DMND_RGTR_NM").style(center));
|
|
valueMap.put("승인여부", format.of("CHG_APRV_NM").style(center));
|
|
valueMap.put("승인일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CHG_APRV_DT").style(dateDT));
|
|
valueMap.put("승인자", format.of("CHG_AUTZR_NM").style(center));
|
|
valueMap.put("승인사유", format.of("CHG_APRV_RSN"));
|
|
valueMap.put("기업명", format.of("ENT_NM"));
|
|
valueMap.put("법인(사업자)번호", format.of("ENT_REG_NO").style(center));
|
|
valueMap.put("단속일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CRDN_DT").style(dateDT));
|
|
valueMap.put("자동차등록번호", format.of("VHRNO"));
|
|
valueMap.put("계약시작일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CTRT_BGNG_DT").style(dateDT));
|
|
valueMap.put("계약종료일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CTRT_END_DT").style(dateDT));
|
|
valueMap.put("임차인구분", format.of("HIRER_SE_NM").style(center));
|
|
valueMap.put("임차인번호", format.of("HIRER_REG_NO").style(center));
|
|
valueMap.put("임차인명", format.of("HIRER_NM"));
|
|
valueMap.put("전화번호", format.of("HIRER_TELNO").style(center));
|
|
valueMap.put("휴대전화번호", format.of("HIRER_MBL_TELNO").style(center));
|
|
valueMap.put("단속법정동", format.of("CRDN_STDG_NM").style(center));
|
|
valueMap.put("단속장소", format.of("CRDN_PLC"));
|
|
valueMap.put("단속원금", format.of("FFNLG_CRDN_AMT").style(numeric));
|
|
valueMap.put("처리상태", format.of("CRDN_STTS_NM"));
|
|
valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT));
|
|
valueMap.put("등록사용자", format.of("RGTR_NM").style(center));
|
|
valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT));
|
|
valueMap.put("수정사용자", format.of("MDFR_NM").style(center));
|
|
|
|
CellDef.setValues(cellDefs, valueMap);
|
|
|
|
xlsx.cell(0, 0).value("임대차계약 관리").value(center).merge(0, cellDefs.size() - 1)
|
|
.cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx)))
|
|
.cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> { if(i.getValue() instanceof Format) { i.setField(null); }; return i; }).toList()));
|
|
|
|
return new ModelAndView("downloadView")
|
|
.addObject("download", xlsx.getDownloadable().setFilename("임대차계약관리" + "_목록_" + dateTime + ".xlsx"));
|
|
}
|
|
}
|
|
|
|
@Task("CMN")
|
|
@RequestMapping(name = "임대차계약 매핑 대장 건수 조회", value=METHOD_URL.getLeaseContractMappingNumberList)
|
|
public ModelAndView getLeaseContractMappingNumberList(RentQuery req) {
|
|
ModelAndView mav = new ModelAndView("jsonView");
|
|
|
|
setFetchSize(req);
|
|
|
|
List<DataObject> list = lsctMpngService.getLsctMpngNocs(req);
|
|
|
|
return setPagingInfo(mav, list, "");
|
|
}
|
|
|
|
/**임대차계약 승인 대장를 등록한다.
|
|
* @param lsctAprv 임대차계약 승인 대장 정보
|
|
* @return jsonView
|
|
* <pre><code> {
|
|
* "saved": 등록되었으면 true, 그렇지 않으면 false
|
|
* }</code></pre>
|
|
*/
|
|
@Task("CMN")
|
|
@RequestMapping(name = "임대차계약 승인 대장 등록", value = METHOD_URL.createLeaseContractApproval)
|
|
public ModelAndView createLeaseContractApproval(HttpServletRequest hreq, LsctAprv lsctAprv) {
|
|
boolean saved = false;
|
|
String rtnMsg = "";
|
|
|
|
// 클라이언트 IP 확인
|
|
String remoteAddr = AppCmmnUtil.getClientIpAddr(hreq);
|
|
lsctAprv.setChgDmndIp(remoteAddr); // 변경 요청 IP
|
|
|
|
// 단건
|
|
if (lsctAprv.getLsctMpngIds() == null || lsctAprv.getLsctMpngIds().length < 1) {
|
|
rtnMsg = lsctMpngService.createLsctAprv(lsctAprv); // 등록
|
|
} else {
|
|
// Ids 만큼 반복 등록
|
|
for (String lsctMpngId : lsctAprv.getLsctMpngIds()) {
|
|
LsctAprv createAprv = new LsctAprv();
|
|
createAprv.setLsctMpngId(lsctMpngId);
|
|
|
|
rtnMsg = lsctMpngService.createLsctAprv(createAprv); // 등록
|
|
if (!rtnMsg.contains("[S]")) { // 오류가 발생하였으면 종료..
|
|
saved = false;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (rtnMsg.contains("[S]")) {
|
|
saved = true;
|
|
} else {
|
|
saved = false;
|
|
}
|
|
|
|
return new ModelAndView("jsonView")
|
|
.addObject("saved", saved)
|
|
.addObject("rtnMsg", rtnMsg);
|
|
}
|
|
|
|
/**지정한 임대차계약 승인 대장를 삭제한다.
|
|
* @param lsctAprvIDs 임대차계약 승인 대장 아이디
|
|
* @return jsonView
|
|
* <pre><code> {
|
|
* "saved": 등록되었으면 true, 그렇지 않으면 false
|
|
* }</code></pre>
|
|
*/
|
|
@Task("CMN")
|
|
@RequestMapping(name = "임대차계약 승인 대장 삭제", value = METHOD_URL.removeLeaseContractApproval)
|
|
public ModelAndView removeLeaseContractApproval(HttpServletRequest hreq, LsctAprv lsctAprv) {
|
|
boolean saved = false;
|
|
String rtnMsg = "";
|
|
|
|
// 클라이언트 IP 확인
|
|
String remoteAddr = AppCmmnUtil.getClientIpAddr(hreq);
|
|
lsctAprv.setChgDmndIp(remoteAddr); // 변경 요청 IP
|
|
|
|
// 단건
|
|
if (lsctAprv.getLsctMpngIds() == null || lsctAprv.getLsctMpngIds().length < 1) {
|
|
rtnMsg = lsctMpngService.removeLsctAprv(lsctAprv); // 삭제
|
|
} else {
|
|
// Ids 만큼 반복 등록
|
|
for (String lsctMpngId : lsctAprv.getLsctMpngIds()) {
|
|
LsctAprv deltAprv = new LsctAprv();
|
|
deltAprv.setLsctMpngId(lsctMpngId);
|
|
deltAprv.setChgDmndIp(remoteAddr);
|
|
|
|
rtnMsg = lsctMpngService.removeLsctAprv(deltAprv); // 삭제
|
|
if (!rtnMsg.contains("[S]")) // 오류가 발생하였으면 종료..
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (rtnMsg.contains("[S]")) {
|
|
saved = true;
|
|
} else {
|
|
saved = false;
|
|
}
|
|
|
|
return new ModelAndView("jsonView")
|
|
.addObject("saved", saved)
|
|
.addObject("rtnMsg", rtnMsg);
|
|
}
|
|
|
|
/**임대차계약 매핑 대장 상세 정보 화면(fims/rent/rent02060-info)을 연다.
|
|
* 조건없는 {@link #getRentEntList(RentEntQuery) 사용자 임대 기업 대장 조회 결과}를 포함시킨다.
|
|
* @return /rentEnt/rentEnt-main
|
|
*/
|
|
@Task("CMN")
|
|
@RequestMapping(name = "임대차계약 매핑 상세 화면", value=METHOD_URL.getLeaseContractMappingInfo)
|
|
public ModelAndView getLeaseContractMappingInfo(HttpServletRequest hReq, RentQuery req) {
|
|
boolean json = jsonResponse();
|
|
ModelAndView mav = new ModelAndView(json ? "jsonView" : "fims/rent/rent02060-info");
|
|
|
|
// 상세 정보 조회
|
|
DataObject info = getLeaseContractMapping(req);
|
|
mav.addObject("Info", json ? info : toJson(info));
|
|
|
|
if (!json) {
|
|
// View(jsp)에서 사용할 공통코드를 조회
|
|
Map<String, List<CommonCode>> commonCodes = getCodesOf("FIM089");
|
|
|
|
mav.addObject("callPurpose", req.getCallPurpose()) // 호출 용도
|
|
.addObject("pageName", "rent02060") // jsp pageName
|
|
.addObject("prefixUrl", CLASS_URL) // prefixUrl
|
|
.addObject("FIM089List", commonCodes.get("FIM089")) // 임차인 구분 코드(HIRER_SE_CD)
|
|
.addObject("mainQuery", toJson(req)) // main 검색 조건
|
|
;
|
|
}
|
|
|
|
return mav;
|
|
}
|
|
|
|
@Task("CMN")
|
|
@RequestMapping(name = "임대차계약 매핑 상세정보 조회", value=METHOD_URL.getLeaseContractMapping)
|
|
public DataObject getLeaseContractMapping(RentQuery req) {
|
|
// 상세 정보 조회
|
|
return lsctMpngService.getLsctMpngInfo(req);
|
|
}
|
|
|
|
}
|