diff --git a/src/main/java/cokr/xit/fims/crdn/Crdn.java b/src/main/java/cokr/xit/fims/crdn/Crdn.java index 65f5825f..a3e6093d 100644 --- a/src/main/java/cokr/xit/fims/crdn/Crdn.java +++ b/src/main/java/cokr/xit/fims/crdn/Crdn.java @@ -22,6 +22,11 @@ public class Crdn extends AbstractEntity { */ private String[] deleteFileKeyList; + /** + * 파일 변경 건수 + */ + private int fileChgCnt; + /** * 수정 처리할 정보 */ diff --git a/src/main/java/cokr/xit/fims/crdn/dao/Crdn01Mapper.java b/src/main/java/cokr/xit/fims/crdn/dao/Crdn01Mapper.java index b9369a1b..c27b3161 100644 --- a/src/main/java/cokr/xit/fims/crdn/dao/Crdn01Mapper.java +++ b/src/main/java/cokr/xit/fims/crdn/dao/Crdn01Mapper.java @@ -69,4 +69,10 @@ public interface Crdn01Mapper extends AbstractMapper { */ DataObject selectCivilComplaintReceiptInitialDataInfo(CrdnQuery req); + /** 민원접수 초기자료를 수정한다. TODO : mybatis작성 + * @param crdn 민원정보 + * @return 저장된 정보 수 + */ + int saveCivilComplaint(Crdn crdn); + } diff --git a/src/main/java/cokr/xit/fims/crdn/dao/Crdn06Mapper.java b/src/main/java/cokr/xit/fims/crdn/dao/Crdn06Mapper.java index 55cf9e03..f0090458 100644 --- a/src/main/java/cokr/xit/fims/crdn/dao/Crdn06Mapper.java +++ b/src/main/java/cokr/xit/fims/crdn/dao/Crdn06Mapper.java @@ -66,5 +66,12 @@ public interface Crdn06Mapper extends AbstractMapper { List selectCrackdowns(CrdnQuery req); + /**단속정보를 변경한다.
+ * {@link cokr.xit.fims.crdn.service.bean.Crdn06Bean#update(Crdn)} 참고 + * @param crdn 단속정보 + * @return 저장된 정보수 + */ + int update(Crdn crdn); + } diff --git a/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn01ServiceBean.java b/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn01ServiceBean.java index adc457b3..5b736b2d 100644 --- a/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn01ServiceBean.java +++ b/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn01ServiceBean.java @@ -12,8 +12,10 @@ import org.springframework.stereotype.Service; import org.springframework.util.ResourceUtils; 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.FileService; +import cokr.xit.base.file.service.bean.FileBean; import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.hwp.AddingParagraphBetweenHWPFile; import cokr.xit.fims.cmmn.hwp.InsertingImageCell; @@ -40,10 +42,16 @@ public class Crdn01ServiceBean extends AbstractServiceBean implements CrdnServic @Resource(name="crdn01Mapper") protected Crdn01Mapper crdn01Mapper; + @Resource(name="fileBean") + private FileBean fileBean; + /** 민원관리 Bean */ @Resource(name="crdn01Bean") protected Crdn01Bean crdn01Bean; + @Resource(name="crdn06Bean") + protected Crdn06Bean crdn06Bean; + @Override public List getCrackdownList(CrdnQuery req) { @@ -200,6 +208,31 @@ public class Crdn01ServiceBean extends AbstractServiceBean implements CrdnServic return dataObject; } + public boolean saveCivilComplaint(Crdn crdn, List newFileInfoList) { + + int fileInsertEffected = 0; + int fileDeleteEffected = 0; + + if(newFileInfoList != null && !newFileInfoList.isEmpty()) { + fileInsertEffected = fileBean.create(newFileInfoList); + } + + if(crdn.getDeleteFileKeyList() != null) { + fileDeleteEffected = fileBean.remove(crdn.getDeleteFileKeyList()); + } + + crdn.setFileChgCnt(fileInsertEffected - fileDeleteEffected); + + return saveCivilComplaint(crdn); + + } + + public boolean saveCivilComplaint(Crdn crdn) { + //TODO : crdn01Mapper.saveCivilComplaint(crdn); + + return crdn06Bean.update(crdn); + } + } diff --git a/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn06Bean.java b/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn06Bean.java index 8a1b8ebb..699de2b1 100644 --- a/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn06Bean.java +++ b/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn06Bean.java @@ -29,7 +29,7 @@ public class Crdn06Bean extends AbstractComponent { case "tagInformationUndefinedData": return crdn06Mapper.updateTagInformation(crdn) == 1 ? true : false; default: - return false; //crdn06Mapper.update(crdn); + return crdn06Mapper.update(crdn) == 1 ? true : false; } } 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 d0e4c4f9..988dd5ea 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn01Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn01Controller.java @@ -1,7 +1,9 @@ package cokr.xit.fims.crdn.web; +import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.stream.Stream; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; @@ -11,6 +13,9 @@ 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.FileInfo.Relation; +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; @@ -197,7 +202,33 @@ public class Crdn01Controller extends ApplicationController { @RequestMapping(name="민원자료 저장", value="/020/save.do") public ModelAndView saveCivilComplaint(Crdn crdn, MultipartFile[] newFileList, MultipartFile[] modifyFileList) { - boolean saved = true;// TODO : crdn01Service.saveCivilComplaint + boolean saved = false; + + List newFileInfoList = new ArrayList(); + if(newFileList != null || modifyFileList != null) { + + Relation relation = new Relation(); + relation.setInfoType(crdn.INF_TYPE); + relation.setInfoKey(crdn.getCrdnId()); + + if(newFileList != null) { + newFileInfoList = new FileInfoFactory().makeFileInfos(relation, newFileList); + } + if(modifyFileList != null) { + newFileInfoList.addAll(new FileInfoFactory().makeFileInfos(relation, modifyFileList)); + + if(crdn.getDeleteFileKeyList() == null) { + crdn.setDeleteFileKeyList(crdn.getModifyFileKeyList()); + } else { + String[] arr1 = crdn.getDeleteFileKeyList(); + String[] arr2 = crdn.getModifyFileKeyList(); + String[] sumArr = Stream.of(arr1, arr2).flatMap(Stream::of).toArray(String[]::new); + crdn.setDeleteFileKeyList(sumArr); + } + } + } + + saved = crdn01Service.saveCivilComplaint(crdn, newFileInfoList); return new ModelAndView("jsonView") .addObject("saved", saved); diff --git a/src/main/resources/sql/mapper/fims/crdn/crdn06-mapper.xml b/src/main/resources/sql/mapper/fims/crdn/crdn06-mapper.xml index 7ffa445f..6dbd61e6 100644 --- a/src/main/resources/sql/mapper/fims/crdn/crdn06-mapper.xml +++ b/src/main/resources/sql/mapper/fims/crdn/crdn06-mapper.xml @@ -461,6 +461,14 @@ SELECT C.CRDN_ID - + + /* 단속정보 수정(crdn06Mapper.update) */ + UPDATE TB_CRDN + SET ATCH_FILE_CNT = ATCH_FILE_CNT + (#{fileChgCnt}) + + , MDFCN_DT = /* 수정일시 */ + , MDFR = #{modifiedBy} /* 수정자 */ + WHERE CRDN_ID = #{crdnId} /* 단속 ID */ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn01020-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn01020-info.jsp index 39808873..1fe6e236 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn01020-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn01020-info.jsp @@ -36,11 +36,11 @@ placeholder="시:분:초" />
-