package kcc.kccadr.accdnt.ai.web; import java.time.DayOfWeek; import java.time.LocalDate; import java.time.format.TextStyle; import java.util.ArrayList; import java.util.List; import java.util.Locale; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import egovframework.rte.fdl.idgnr.EgovIdGnrService; import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper; import egovframework.rte.psl.dataaccess.util.EgovMap; import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; import kcc.com.cmm.LoginVO; import kcc.com.cmm.service.EgovFileMngService; import kcc.com.cmm.service.FileVO; import kcc.com.cmm.util.StringUtil; import kcc.com.utl.fcc.service.EgovStringUtil; import kcc.com.utl.user.service.CheckAdrProcessUtil; import kcc.kccadr.accdnt.ai.service.AdjstIncidentService; import kcc.kccadr.accdnt.ai.service.AdjstIncidentVO; import kcc.kccadr.adjPgrMgr.apm.service.ApmService; import kcc.kccadr.adjPgrMgr.apm.service.ApmVO; import kcc.kccadr.adjPgrMgr.cmm.service.PgrCmmService; import kcc.kccadr.adjreqmgr.service.AdjReqMgrService; import kcc.kccadr.adjreqmgr.service.AdjReqMgrVO; import kcc.kccadr.cmm.KccadrConstants; import kcc.kccadr.kccadrCom.service.KccadrMgrUdtService; import kcc.let.utl.fcc.service.EgovCryptoUtil; /** * 대국민(사용자) * 조정사건 관한 controller 클래스를 정의한다. * @author 김봉호 * @since 2021.08.23 * @version 1.0 * @see * *
 * << 개정이력(Modification Information) >>
 *
 *   수정일      수정자           수정내용
 *  -------    --------    ---------------------------
 *   2021.08.23  김봉호          최초 생성
 *
 * 
*/ @Controller public class AdjstIncidentController { private static final Logger LOGGER = LoggerFactory.getLogger(AdjstIncidentController.class); @Resource(name="adjstIncidentService") private AdjstIncidentService adjstIncidentService; // 조정신청 서비스단 @Resource(name = "checkAdrProcessUtil") private CheckAdrProcessUtil checkAdrProcessUtil; @Resource(name = "EgovFileMngService") private EgovFileMngService fileService; @Resource(name="KccadrMgrUdtService") private KccadrMgrUdtService kccadrMgrUdtService; //암복호화 유틸 @Resource(name = "egovCryptoUtil") EgovCryptoUtil egovCryptoUtil; @Resource(name = "AdjReqMgrService") private AdjReqMgrService adjReqMgrService; @Resource(name = "pgrCmmService") private PgrCmmService cmmService; @Resource(name = "apmService") private ApmService apmService; //조정사건 이력관리 일련번호 @Resource(name="adrHstryMgrSeqGnrService") private EgovIdGnrService adrHstryMgrSeqGnrService; /** * 대국민 대시보드 화면 */ @RequestMapping("/web/kccadr/accdnt/ai/adjstIncidentDashList.do") public String adjstIncidentDashList(@ModelAttribute("adjstIncidentVO") AdjstIncidentVO adjstIncidentVO, ModelMap model, HttpServletRequest request) throws Exception { String auth = EgovUserDetailsHelper.isAuthenticated() ? null : EgovUserDetailsHelper.getAuthenticatedUser().toString(); LoginVO loginVO = "anonymousUser".equals(auth) ? null : (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); if (loginVO == null) { model.addAttribute("msg", "로그인 해주세요."); return "redirect:/web/user/login/ssoLogin.do"; } adjstIncidentVO.setFrstRegisterId(loginVO.getUniqId()); if("".equals(adjstIncidentVO.getSearchSortCnd())){ //최초조회시 최신것 조회List adjstIncidentVO.setSearchSortCnd("RS.ADR_SEQ"); adjstIncidentVO.setSearchSortOrd("desc"); } //최신 5건 조회 adjstIncidentVO.setFirstIndex(0); adjstIncidentVO.setRecordCountPerPage(5); //List list = adjstIncidentService.selectAdjstIncidentDashList(adjstIncidentVO); //대시보드 > 조정목록 쿼리로 사용 List list = adjstIncidentService.selectAdjstIncidentList(adjstIncidentVO); decryptInfomation(list, null); model.addAttribute("list", list); //수량 가져오기 EgovMap resultMap = adjstIncidentService.selectAdjstIncidentDashSummary(adjstIncidentVO); model.addAttribute("resultMap", resultMap); //오늘 날짜 가져오기 LocalDate now = LocalDate.now(); int year = now.getYear(); //년 int month = now.getMonthValue(); //월 int day = now.getDayOfMonth(); //일 DayOfWeek dayOfWeek = now.getDayOfWeek(); String today = dayOfWeek.getDisplayName(TextStyle.FULL, Locale.KOREAN); //요일 model.addAttribute("year", year); model.addAttribute("month", month); model.addAttribute("day", day); model.addAttribute("today", today); return "/web/kccadr/accdnt/ai/adjstIncidentDashList"; } /** * 조정사건 목록 화면 */ @RequestMapping("/web/kccadr/accdnt/ai/adjstIncidentList.do") public String adjstDeputyReqList(@ModelAttribute("adjstIncidentVO") AdjstIncidentVO adjstIncidentVO, ModelMap model, HttpServletRequest request) throws Exception { String auth = EgovUserDetailsHelper.isAuthenticated() ? null : EgovUserDetailsHelper.getAuthenticatedUser().toString(); LoginVO loginVO = "anonymousUser".equals(auth) ? null : (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); if (loginVO == null) { model.addAttribute("msg", "로그인 해주세요."); return "redirect:/web/user/login/ssoLogin.do"; } adjstIncidentVO.setFrstRegisterId(loginVO.getUniqId()); if(adjstIncidentVO.getPageUnit() != 10) { adjstIncidentVO.setPageUnit(adjstIncidentVO.getPageUnit()); } if("".equals(adjstIncidentVO.getSearchSortCnd())){ //최초조회시 최신것 조회List adjstIncidentVO.setSearchSortCnd("RS.ADR_SEQ"); adjstIncidentVO.setSearchSortOrd("desc"); } // 키워드가 있다면 일단 암호화 하여 암호화 컬럼에 셋 if(StringUtils.isNotBlank(adjstIncidentVO.getSearchKeyword())){ adjstIncidentVO.setSearchEncKeyword(egovCryptoUtil.encrypt(adjstIncidentVO.getSearchKeyword())); } /** paging */ PaginationInfo paginationInfo = new PaginationInfo(); paginationInfo.setCurrentPageNo(adjstIncidentVO.getPageIndex()); paginationInfo.setRecordCountPerPage(adjstIncidentVO.getPageUnit()); paginationInfo.setPageSize(adjstIncidentVO.getPageSize()); adjstIncidentVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); adjstIncidentVO.setLastIndex(paginationInfo.getLastRecordIndex()); adjstIncidentVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); paginationInfo.setTotalRecordCount(adjstIncidentService.selectAdjstIncidentCount(adjstIncidentVO)); model.addAttribute("paginationInfo", paginationInfo); List list = adjstIncidentService.selectAdjstIncidentList(adjstIncidentVO); decryptInfomation(list, null); model.addAttribute("list", list); return "/web/kccadr/accdnt/ai/adjstIncidentList"; } /** * 조정사건 상세페이지 * @param adjstIncidentVO AdjstIncidentVO * @return String * @exception Exception */ @RequestMapping(value = "/web/kccadr/accdnt/ai/adjstIncidentDetail.do") public String adjstIncidentDetail(@ModelAttribute("adjstIncidentVO") AdjstIncidentVO adjstIncidentVO , ModelMap model) throws Exception { AdjstIncidentVO master = adjstIncidentService.selectAdjstIncidentMaster(adjstIncidentVO); model.addAttribute("master", master); List relatedPerson = adjstIncidentService.selectAdjstIncidentrelatedPersonList(adjstIncidentVO); decryptInfomation(relatedPerson, null); model.addAttribute("relatedPerson", relatedPerson); List piSinList = new ArrayList(); for(AdjstIncidentVO tmpVO : relatedPerson) { if("20".equals(tmpVO.getRpplTy())) { piSinList.add(tmpVO); } } model.addAttribute("piSinList", piSinList); if(StringUtils.isNotBlank(master.getAtchFileId())){ FileVO fileVO = new FileVO(); fileVO.setAtchFileId(master.getAtchFileId()); List fileList = fileService.selectFileInfs(fileVO); model.addAttribute("fileList", fileList); } return "/web/kccadr/accdnt/ai/adjstIncidentDetail"; } /** * 조정사건 상세페이지 * @param adjstIncidentVO AdjstIncidentVO * @return String * @exception Exception */ @RequestMapping(value = "/web/kccadr/accdnt/ai/adjstIncidentEndDetail.do") public String adjstIncidentEndDetail(@ModelAttribute("adjstIncidentVO") AdjstIncidentVO adjstIncidentVO , ModelMap model) throws Exception { AdjstIncidentVO master = adjstIncidentService.selectAdjstIncidentMaster(adjstIncidentVO); model.addAttribute("master", master); List relatedPerson = adjstIncidentService.selectAdjstIncidentrelatedPersonList(adjstIncidentVO); decryptInfomation(relatedPerson, null); model.addAttribute("relatedPerson", relatedPerson); List piSinList = new ArrayList(); for(AdjstIncidentVO tmpVO : relatedPerson) { if("20".equals(tmpVO.getRpplTy())) { piSinList.add(tmpVO); } } model.addAttribute("piSinList", piSinList); if(StringUtils.isNotBlank(master.getAtchFileId())){ FileVO fileVO = new FileVO(); fileVO.setAtchFileId(master.getAtchFileId()); List fileList = fileService.selectFileInfs(fileVO); model.addAttribute("fileList", fileList); } return "/web/kccadr/accdnt/ai/adjstIncidentEndDetail"; } @RequestMapping(value = "/web/kccadr/accdnt/ai/popup/adjstIncidentReqViewPop.do") public String adjstIncidentReqViewPop(@ModelAttribute("adjstIncidentVO") AdjstIncidentVO adjstIncidentVO , ModelMap model) throws Exception { AdjReqMgrVO param = new AdjReqMgrVO(); param.setAdrSeq(adjstIncidentVO.getAdrSeq()); param.setEdtSn(adjstIncidentVO.getEdtSn()); model.addAttribute("security", adjReqMgrService.selectAdjstReqSecurityInfo(param)); return "/web/kccadr/accdnt/ai/popup/adjstIncidentReqViewPop"; } //반려사유 팝업 @RequestMapping(value = "/web/kccadr/accdnt/ai/popup/adjstIncidentRejectCnPop.do") public String adjstIncidentRejectCnPop(@ModelAttribute("adjstIncidentVO") AdjstIncidentVO adjstIncidentVO, ModelMap model) throws Exception { return "/web/kccadr/accdnt/ai/popup/adjstIncidentRejectCnPop"; } /** * 조정사건 수정요청 팝업 * @param adjstIncidentVO AdjstIncidentVO * @return String * @exception Exception */ @RequestMapping(value = "/web/kccadr/accdnt/ai/popup/adjstIncidentReqEdit.do") public String adjstIncidentReqEdit(@ModelAttribute("adjstIncidentVO") AdjstIncidentVO adjstIncidentVO , ModelMap model) throws Exception { return "/web/kccadr/accdnt/ai/popup/adjstIncidentReqEdit"; } /** * 조정사건 수정요청 등록 * @param adjstIncidentVO adjstIncidentVO * @return String * @exception Exception */ @RequestMapping(value="/web/kccadr/accdnt/ai/popup/adjstIncidentReqSave.do") public ModelAndView adjustDeptManagerSave(HttpServletRequest request , AdjstIncidentVO adjstIncidentVO) throws Exception { ModelAndView modelAndView = new ModelAndView(); modelAndView.setViewName("jsonView"); LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null; String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId()); if (loginVO == null) { modelAndView.addObject("result", "FAIL"); modelAndView.addObject("message", "로그인 해주세요."); return modelAndView; } String statCd = KccadrConstants.ADR_UPDT_REQ; if(!"E".equals(adjstIncidentVO.getEdtTy())){ statCd = KccadrConstants.ADR_SUPP_REQ; adjstIncidentVO.setApprYn("Y"); } //step11.상태 체크(정상 프로세스인지 확인한다.) - adr_mgr_master 테이블 변경시 체크를 위해 String s_process_check_result = checkAdrProcessUtil.processCheck(adjstIncidentVO.getAdrSeq(), statCd); if (!"".equals(s_process_check_result)) { modelAndView.addObject("result", "FAIL"); modelAndView.addObject("message", s_process_check_result); return modelAndView; } adjstIncidentVO.setLastUpdusrId(userId); adjstIncidentVO.setLastUpdusrId(userId); adjstIncidentVO.setEdtStatus("01"); // 수정,보완 요청상태 //이력관리를 위한 adr_hstry_mgr_detail - 2022-09-07 controller #1 String s_adrHstryMgrSeq = adrHstryMgrSeqGnrService.getNextStringId(); int rs = adjstIncidentService.insertAdjstIncidentReq(adjstIncidentVO); if(rs > 0 ){ AdjReqMgrVO arv = new AdjReqMgrVO(); arv.setAdrSeq(adjstIncidentVO.getAdrSeq()); //조정일련번호 arv.setStatCd(statCd); //최종 변경 상태값 //arv.setLastUpdusrId(loginVO.getId()); //최종 변경자 arv.setLastUpdusrId(loginVO.getUniqId()); //최종 변경자 //arv.setAdrSn("1"); //조정회차(필수) 접수 및 기일되지 않았더라도 1회차로 전달 kccadrMgrUdtService.updateAdrMgrUdt(arv , s_adrHstryMgrSeq ); } modelAndView.addObject("rs", rs); modelAndView.addObject("result", "SUCCESS"); return modelAndView; } //사건 상세정보 팝업 @RequestMapping(value = "/web/kccadr/accdnt/ai/popup/adjstIncidentDetailPop.do") public String adjstIncidentDetailPop(@ModelAttribute("apmVO") ApmVO apmVO, ModelMap model) throws Exception { //조정 사건 정보 불러오기 model.addAttribute("info", cmmService.selectPgrCmm(apmVO)); //신청인, 피신청인, 대리인 정보 불러오기 model.addAttribute("rppList", apmService.selectAdrRpplList(apmVO)); return "/web/kccadr/accdnt/ai/popup/adjstIncidentDetailPop"; } /** * 조정사건 기록열람 신청 페이지 * @param adjstIncidentVO AdjstIncidentVO * @return String * @exception Exception */ @RequestMapping(value = "/web/kccadr/accdnt/ai/adjstIncidentRequest.do") public String adjstIncidentRequest(@ModelAttribute("adjstIncidentVO") AdjstIncidentVO adjstIncidentVO , ModelMap model) throws Exception { return "/web/kccadr/accdnt/ai/adjstIncidentRequest"; } /** * 조정사건 목록 화면 */ @RequestMapping("/web/kccadr/accdnt/ai/adjstIncidentEndList.do") public String adjstIncidentEndList(@ModelAttribute("adjstIncidentVO") AdjstIncidentVO adjstIncidentVO, ModelMap model, HttpServletRequest request) throws Exception { String auth = EgovUserDetailsHelper.isAuthenticated() ? null : EgovUserDetailsHelper.getAuthenticatedUser().toString(); LoginVO loginVO = "anonymousUser".equals(auth) ? null : (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); if (loginVO == null) { model.addAttribute("msg", "로그인 해주세요."); return "redirect:/web/user/login/ssoLogin.do"; } adjstIncidentVO.setFrstRegisterId(loginVO.getUniqId()); if(adjstIncidentVO.getPageUnit() != 10) { adjstIncidentVO.setPageUnit(adjstIncidentVO.getPageUnit()); } if("".equals(adjstIncidentVO.getSearchSortCnd())){ //최초조회시 최신것 조회List adjstIncidentVO.setSearchSortCnd("RS.ADR_SEQ"); adjstIncidentVO.setSearchSortOrd("desc"); } //종결 사건 검색 조건 adjstIncidentVO.setSearchStatus("C"); // 키워드가 있다면 일단 암호화 하여 암호화 컬럼에 셋 if(StringUtils.isNotBlank(adjstIncidentVO.getSearchKeyword())){ adjstIncidentVO.setSearchEncKeyword(egovCryptoUtil.encrypt(adjstIncidentVO.getSearchKeyword())); } /** paging */ PaginationInfo paginationInfo = new PaginationInfo(); paginationInfo.setCurrentPageNo(adjstIncidentVO.getPageIndex()); paginationInfo.setRecordCountPerPage(adjstIncidentVO.getPageUnit()); paginationInfo.setPageSize(adjstIncidentVO.getPageSize()); adjstIncidentVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); adjstIncidentVO.setLastIndex(paginationInfo.getLastRecordIndex()); adjstIncidentVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); paginationInfo.setTotalRecordCount(adjstIncidentService.selectAdjstIncidentCount(adjstIncidentVO)); model.addAttribute("paginationInfo", paginationInfo); List list = adjstIncidentService.selectAdjstIncidentList(adjstIncidentVO); decryptInfomation(list, null); model.addAttribute("list", list); return "/web/kccadr/accdnt/ai/adjstIncidentEndList"; } public void decryptInfomation(List list, AdjstIncidentVO info){ if(CollectionUtils.isNotEmpty(list)){ for(AdjstIncidentVO model : list){ model.setRpplNm(egovCryptoUtil.decrypt(model.getRpplNm())); model.setRpplAddr(egovCryptoUtil.decrypt(model.getRpplAddr())); model.setRpplAddrDtl(egovCryptoUtil.decrypt(model.getRpplAddrDtl())); model.setRpplPost(egovCryptoUtil.decrypt(model.getRpplPost())); model.setRpplEmail(egovCryptoUtil.decrypt(model.getRpplEmail())); model.setRpplPhone(egovCryptoUtil.decrypt(model.getRpplPhone())); model.setRpplRealPost(egovCryptoUtil.decrypt(model.getRpplRealPost())); model.setRpplRealAddr(egovCryptoUtil.decrypt(model.getRpplRealAddr())); model.setRpplRealAddrDtl(egovCryptoUtil.decrypt(model.getRpplRealAddrDtl())); model.setDepuTyNm(egovCryptoUtil.decrypt(model.getDepuTyNm())); // model.setResPonDentNm(egovCryptoUtil.decrypt(model.getResPonDentNm())); System.out.println("model.getResPonDentNm()"); System.out.println(model.getResPonDentNm()); //피신청인 명수 표시 '외 N명' 처리_이준호_220801 if (!StringUtil.isEmpty(model.getResPonDentNm())) { //String tmpStr = ""; model.setResPonDentNm( EgovStringUtil.checkNPerson( model.getResPonDentNm() , egovCryptoUtil ) ); /* if(model.getResPonDentNm().contains("외")) { String s_tmp1 = ""; String s_tmp2 = ""; s_tmp1 = model.getResPonDentNm().substring(model.getResPonDentNm().length()-3); s_tmp2 = model.getResPonDentNm().substring(0, model.getResPonDentNm().length()-3); model.setResPonDentNm(egovCryptoUtil.decrypt(s_tmp2) + " " + s_tmp1); }else { model.setResPonDentNm(egovCryptoUtil.decrypt(model.getResPonDentNm())); } */ //model.setResPonDentNm(egovCryptoUtil.decrypt(model.getResPonDentNm()) + " " + tmpStr); } model.setAppliCantNm(egovCryptoUtil.decrypt(model.getAppliCantNm())); } } if(info != null){ info.setRpplNm(egovCryptoUtil.decrypt(info.getRpplNm())); info.setRpplAddr(egovCryptoUtil.decrypt(info.getRpplAddr())); info.setRpplAddrDtl(egovCryptoUtil.decrypt(info.getRpplAddrDtl())); info.setRpplPost(egovCryptoUtil.decrypt(info.getRpplPost())); info.setRpplEmail(egovCryptoUtil.decrypt(info.getRpplEmail())); info.setRpplPhone(egovCryptoUtil.decrypt(info.getRpplPhone())); info.setDepuTyNm(egovCryptoUtil.decrypt(info.getDepuTyNm())); info.setResPonDentNm(egovCryptoUtil.decrypt(info.getResPonDentNm())); info.setAppliCantNm(egovCryptoUtil.decrypt(info.getAppliCantNm())); info.setRpplRealPost(egovCryptoUtil.decrypt(info.getRpplRealPost())); info.setRpplRealAddr(egovCryptoUtil.decrypt(info.getRpplRealAddr())); info.setRpplRealAddrDtl(egovCryptoUtil.decrypt(info.getRpplRealAddrDtl())); } } }