diff --git a/src/main/java/cokr/xit/fims/excl/Excl02.java b/src/main/java/cokr/xit/fims/excl/Excl02.java index 5857140b..2a3906da 100644 --- a/src/main/java/cokr/xit/fims/excl/Excl02.java +++ b/src/main/java/cokr/xit/fims/excl/Excl02.java @@ -130,7 +130,7 @@ public class Excl02 extends AbstractEntity { /** * 첨부 파일 수 */ - private String atchFileCnt; + private Integer atchFileCnt; /** * 문서 번호 diff --git a/src/main/java/cokr/xit/fims/excl/service/Excl02Service.java b/src/main/java/cokr/xit/fims/excl/service/Excl02Service.java index 0004a3e9..39f3bb2b 100644 --- a/src/main/java/cokr/xit/fims/excl/service/Excl02Service.java +++ b/src/main/java/cokr/xit/fims/excl/service/Excl02Service.java @@ -3,6 +3,8 @@ package cokr.xit.fims.excl.service; import java.util.List; import java.util.Map; +import org.springframework.web.multipart.MultipartFile; + import cokr.xit.fims.excl.Excl02; import cokr.xit.fims.excl.Excl02Query; import cokr.xit.foundation.data.DataObject; @@ -44,7 +46,7 @@ public interface Excl02Service { *
  • 그렇지 않으면 false
  • * */ - Map create(Excl02 excl02); + Map create(Excl02 excl02, MultipartFile[] uploadFileList); /**의견제출 대장 정보를 수정한다. * @param opnnSbmsn 의견제출 대장 @@ -53,7 +55,7 @@ public interface Excl02Service { *
  • 그렇지 않으면 false
  • * */ - Map update(Excl02 excl02); + Map update(Excl02 excl02, MultipartFile[] uploadFileList); /**의견제출 대장 정보를 삭제한다. * @param opnnSbmsn 의견제출 대장 diff --git a/src/main/java/cokr/xit/fims/excl/service/bean/Excl02ServiceBean.java b/src/main/java/cokr/xit/fims/excl/service/bean/Excl02ServiceBean.java index b4c5835c..5d03ed16 100644 --- a/src/main/java/cokr/xit/fims/excl/service/bean/Excl02ServiceBean.java +++ b/src/main/java/cokr/xit/fims/excl/service/bean/Excl02ServiceBean.java @@ -1,5 +1,6 @@ package cokr.xit.fims.excl.service.bean; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -7,8 +8,11 @@ import java.util.Map; import javax.annotation.Resource; import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; -import cokr.xit.fims.cmmn.CrdnSttsHstry; +import cokr.xit.base.file.FileInfo; +import cokr.xit.base.file.service.bean.FileBean; +import cokr.xit.base.file.web.FileInfoFactory; import cokr.xit.fims.excl.Excl02; import cokr.xit.fims.excl.Excl02Query; import cokr.xit.fims.excl.service.Excl02Service; @@ -32,6 +36,10 @@ public class Excl02ServiceBean extends AbstractServiceBean implements Excl02Serv @Resource(name = "excl02Bean") protected Excl02Bean excl02Bean; + /** 첨부파일 Bean */ + @Resource(name="fileBean") + private FileBean fileBean; + @Override public List getOpinionSubmissionList(Excl02Query req) { return excl02Bean.getOpinionSubmissionList(req); @@ -48,11 +56,19 @@ public class Excl02ServiceBean extends AbstractServiceBean implements Excl02Serv } @Override - public Map create(Excl02 excl02) { + public Map create(Excl02 excl02, MultipartFile[] uploadFileList) { // 변수 선언 boolean retSuccess = false; // DB 처리 결과 Map retMap = new HashMap(); // 결과 return + // 파일 갯수 입력 + if (uploadFileList != null) { + excl02.setAtchFileCnt(uploadFileList.length); + } else { + excl02.setAtchFileCnt(0); + } + + // 의견제출 등록 retSuccess = excl02Bean.create(excl02); if (!retSuccess) { // 등록 되지 않았다면.. @@ -63,6 +79,15 @@ public class Excl02ServiceBean extends AbstractServiceBean implements Excl02Serv throw new RuntimeException(retMap.get("retMessage")); } + // 파일 첨부하기 + if (uploadFileList != null) { + List fileInfoList = new FileInfoFactory().makeFileInfos(null, uploadFileList); + + fileInfoList.forEach(fileInfo -> fileInfo.setInfoType(Excl02.INF_TYPE).setInfoKey(excl02.getOpnnId())); + + fileBean.create(fileInfoList); + } + // 처리 성공 retMap.put("retSaved", "true"); retMap.put("retMessage", "저장 되었습니다."); @@ -71,11 +96,12 @@ public class Excl02ServiceBean extends AbstractServiceBean implements Excl02Serv } @Override - public Map update(Excl02 excl02) { + public Map update(Excl02 excl02, MultipartFile[] uploadFileList) { // 변수 선언 boolean retSuccess = false; // DB 처리 결과 Map retMap = new HashMap(); // 결과 return + // 의견제출 수정 retSuccess = excl02Bean.update(excl02); if (!retSuccess) { retMap.put("retSaved", "false"); diff --git a/src/main/java/cokr/xit/fims/excl/web/Excl02Controller.java b/src/main/java/cokr/xit/fims/excl/web/Excl02Controller.java index c8d733d2..bb416c90 100644 --- a/src/main/java/cokr/xit/fims/excl/web/Excl02Controller.java +++ b/src/main/java/cokr/xit/fims/excl/web/Excl02Controller.java @@ -108,8 +108,8 @@ public class Excl02Controller extends ApplicationController { * } */ @PostMapping(name="의견제출 대장 등록", value="/020/create.do") - public ModelAndView create(Excl02 excl02) { - Map retMap = excl02Service.create(excl02); + public ModelAndView create(Excl02 excl02, MultipartFile[] uploadFileList) { + Map retMap = excl02Service.create(excl02, uploadFileList); return new ModelAndView("jsonView") .addObject("retSaved", retMap.get("retSaved")) @@ -125,7 +125,7 @@ public class Excl02Controller extends ApplicationController { */ @PostMapping(name="의견제출 대장 수정", value="/020/update.do") public ModelAndView update(Excl02 excl02, MultipartFile[] uploadFileList) { - Map retMap = excl02Service.update(excl02); + Map retMap = excl02Service.update(excl02, uploadFileList); return new ModelAndView("jsonView") .addObject("retSaved", retMap.get("retSaved"))