diff --git a/src/main/java/cokr/xit/fims/crdn/service/CrdnService.java b/src/main/java/cokr/xit/fims/crdn/service/CrdnService.java index d055ccfe..346e2679 100644 --- a/src/main/java/cokr/xit/fims/crdn/service/CrdnService.java +++ b/src/main/java/cokr/xit/fims/crdn/service/CrdnService.java @@ -1,9 +1,7 @@ package cokr.xit.fims.crdn.service; import java.util.List; - -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.servlet.ModelAndView; +import java.util.Map; import cokr.xit.base.file.FileInfo; import cokr.xit.fims.crdn.Crdn; @@ -31,19 +29,22 @@ public interface CrdnService { * @param crdn 단속정보, newFileList 업로드 파일 목록 * @return 저장여부 */ - boolean create(Crdn crdn, MultipartFile[] newFileList); + boolean create(Crdn crdn, List newFileInfoList); - /** 단속 자료를 저장한다. + /** 단속 자료를 수정한다. * @param crdn 단속정보, newFileInfoList 업로드 파일 목록 * @return 저장여부 */ - boolean save(Crdn crdn, List newFileInfoList); + boolean update(Crdn crdn, List newFileInfoList); /** 한글 서식 출력물을 생성한다. * @param crdnQuery 출력 요청 - * @return mav + * @return map 출력 요청 결과 + *
  • filePath: 결과 파일 경로
  • + *
  • fileName: 다운로드 파일명
  • + *
*/ - ModelAndView makeFileFromHwpFormat(CrdnQuery crdnQuery); + Map makeFileFromHwpFormat(CrdnQuery crdnQuery); DataObject getCivilComplaintOriginalInfo(CrdnQuery req); diff --git a/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnServiceBean.java b/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnServiceBean.java index 1ffba405..0b7addc4 100644 --- a/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnServiceBean.java +++ b/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnServiceBean.java @@ -6,6 +6,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; import javax.annotation.Resource; @@ -13,13 +14,10 @@ import javax.annotation.Resource; import org.assertj.core.util.Arrays; import org.springframework.stereotype.Service; import org.springframework.util.ResourceUtils; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.servlet.ModelAndView; import cokr.xit.base.file.FileInfo; import cokr.xit.base.file.service.FileQuery; import cokr.xit.base.file.service.bean.FileBean; -import cokr.xit.base.file.web.FileInfoFactory; import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.CrdnSttsHstry; import cokr.xit.fims.cmmn.hwp.AddingParagraphBetweenHWPFile; @@ -161,7 +159,7 @@ public class CrdnServiceBean extends AbstractServiceBean implements CrdnService } @Override - public ModelAndView makeFileFromHwpFormat(CrdnQuery crdnQuery) { + public Map makeFileFromHwpFormat(CrdnQuery crdnQuery) { String baseFormatFilePath = ("classpath:format/cvlcptOrgnl_text.hwp"); String attachFormatFilePath = ("classpath:format/cvlcptOrgnl_photo.hwp"); @@ -225,7 +223,7 @@ public class CrdnServiceBean extends AbstractServiceBean implements CrdnService } else if(linkTblNm.equals("TB_SAEOL")) { fileQuery.setInfoType("020"); } else { - return new ModelAndView("errorView"); + throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다."); } fileQuery.setInfoKeys(dataObject.string("LINK_ID")); @@ -258,14 +256,16 @@ public class CrdnServiceBean extends AbstractServiceBean implements CrdnService } String downlaodFileName = "민원내역원본_" + currentTime + ".hwp"; - ModelAndView mav = new ModelAndView("jsonView"); - mav.addObject("filePath", resultPath); - mav.addObject("fileName", downlaodFileName); - return mav; + Map result = Map.of( + "filePath", resultPath, + "fileName", downlaodFileName + ); + + return result; } catch (Exception e) { - return new ModelAndView("errorView"); + throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다."); } } @@ -318,7 +318,7 @@ public class CrdnServiceBean extends AbstractServiceBean implements CrdnService } @Override - public boolean save(Crdn crdn, List newFileInfoList) { + public boolean update(Crdn crdn, List newFileInfoList) { boolean saved; int fileInsertEffected = 0; @@ -340,10 +340,9 @@ public class CrdnServiceBean extends AbstractServiceBean implements CrdnService } @Override - public boolean create(Crdn crdn, MultipartFile[] newFileList) { - List fileInfoList = new ArrayList(); - if(newFileList != null) { - fileInfoList = new FileInfoFactory().makeFileInfos(null, newFileList); + public boolean create(Crdn crdn, List fileInfoList) { + + if(fileInfoList != null && !fileInfoList.isEmpty()) { crdn.setAtchFileCnt(fileInfoList.size()); } else { crdn.setAtchFileCnt(0); @@ -406,7 +405,7 @@ public class CrdnServiceBean extends AbstractServiceBean implements CrdnService } - if(!fileInfoList.isEmpty()) { + if(fileInfoList != null && !fileInfoList.isEmpty()) { fileInfoList.forEach(fileInfo -> fileInfo.setInfoType(Crdn.INF_TYPE).setInfoKey(crdn.getCrdnId())); fileBean.create(fileInfoList); } diff --git a/src/main/java/cokr/xit/fims/crdn/web/Crdn01Controller.java b/src/main/java/cokr/xit/fims/crdn/web/Crdn01Controller.java index a3089ede..2a9f9a3c 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn01Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn01Controller.java @@ -229,7 +229,7 @@ public class Crdn01Controller extends ApplicationController { } } - saved = crdnService.save(crdn, newFileInfoList); + saved = crdnService.update(crdn, newFileInfoList); return new ModelAndView("jsonView") .addObject("saved", saved); @@ -241,9 +241,10 @@ public class Crdn01Controller extends ApplicationController { @RequestMapping(name="민원내역 원본 한글 파일 생성", value="/050/makeFileFromHwpFormat.do") public ModelAndView makeFileFromHwpFormat(CrdnQuery crdnQuery, HttpServletRequest request) { - - - return crdnService.makeFileFromHwpFormat(crdnQuery); + Map result = crdnService.makeFileFromHwpFormat(crdnQuery); + ModelAndView mav = new ModelAndView("jsonView"); + mav.addAllObjects(result); + return mav; } /** 민원답변내용 미리보기 화면을 연다. diff --git a/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java b/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java index 17cfb542..f67017ff 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java @@ -1,5 +1,6 @@ package cokr.xit.fims.crdn.web; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -12,6 +13,8 @@ import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; import cokr.xit.base.code.CommonCode; +import cokr.xit.base.file.FileInfo; +import cokr.xit.base.file.web.FileInfoFactory; import cokr.xit.base.web.ApplicationController; import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.CrdnQuery; @@ -126,7 +129,12 @@ public class Crdn05Controller extends ApplicationController { crdn.setCrdnRegSeCd("01"); crdn.setCrdnInptSeCd("03");//TODO : 사용자 기관의 시청,구청 구분 - saved = crdnService.create(crdn, newFileList); + List fileInfoList = new ArrayList(); + if(newFileList != null && newFileList.length > 0) { + fileInfoList = new FileInfoFactory().makeFileInfos(null, newFileList); + } + + saved = crdnService.create(crdn, fileInfoList); return new ModelAndView("jsonView") diff --git a/src/main/java/cokr/xit/fims/task/web/DpvController.java b/src/main/java/cokr/xit/fims/task/web/DpvController.java index ace707a1..1f4791cc 100644 --- a/src/main/java/cokr/xit/fims/task/web/DpvController.java +++ b/src/main/java/cokr/xit/fims/task/web/DpvController.java @@ -60,7 +60,7 @@ public class DpvController { @PostMapping(name = "표지정보 미확인 자료 수정", value = "/030/update.do") public ModelAndView update(Crdn crdn) { crdn.setUpdateInfomation("tagInformationUndefinedData"); - boolean saved = crdnService.save(crdn, null); + boolean saved = crdnService.update(crdn, null); return new ModelAndView("jsonView") .addObject("saved", saved); }