diff --git a/src/main/java/cokr/xit/fims/crdn/Crdn.java b/src/main/java/cokr/xit/fims/crdn/Crdn.java index 98ef52b1..de56d941 100644 --- a/src/main/java/cokr/xit/fims/crdn/Crdn.java +++ b/src/main/java/cokr/xit/fims/crdn/Crdn.java @@ -10,6 +10,8 @@ import lombok.Setter; @Getter @Setter public class Crdn extends AbstractEntity { + public static String INF_TYPE = "100"; + /** * 수정 처리할 정보 */ diff --git a/src/main/java/cokr/xit/fims/crdn/service/Crdn05Service.java b/src/main/java/cokr/xit/fims/crdn/service/Crdn05Service.java index dcc93ba0..3d7745d3 100644 --- a/src/main/java/cokr/xit/fims/crdn/service/Crdn05Service.java +++ b/src/main/java/cokr/xit/fims/crdn/service/Crdn05Service.java @@ -1,7 +1,9 @@ package cokr.xit.fims.crdn.service; +import java.util.List; + +import cokr.xit.base.file.FileInfo; import cokr.xit.fims.crdn.Crdn; -import cokr.xit.fims.crdn.CrdnQuery; /**단속 자료 등록 서비스를 제공한다. * */ - boolean create(Crdn crdn); + boolean create(Crdn crdn, List fileInfoList); } diff --git a/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn05ServiceBean.java b/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn05ServiceBean.java index 3373b700..315368a7 100644 --- a/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn05ServiceBean.java +++ b/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn05ServiceBean.java @@ -6,6 +6,8 @@ import javax.annotation.Resource; import org.springframework.stereotype.Service; +import cokr.xit.base.file.FileInfo; +import cokr.xit.base.file.service.bean.FileBean; import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.service.Crdn05Service; @@ -21,6 +23,8 @@ public class Crdn05ServiceBean extends AbstractServiceBean implements Crdn05Serv /** 단속 자료 등록 Bean */ @Resource(name="crdn05Bean") protected Crdn05Bean crdn05Bean; + @Resource(name="fileBean") + private FileBean fileBean; @Override public List getCrackdownList(CrdnQuery req) { @@ -28,12 +32,15 @@ public class Crdn05ServiceBean extends AbstractServiceBean implements Crdn05Serv } @Override - public boolean create(Crdn crdn) { + public boolean create(Crdn crdn, List fileInfoList) { if(ifEmpty(crdn.getDoGuidance(), () -> "").equals("on")) { } - return crdn05Bean.create(crdn); + boolean saved = crdn05Bean.create(crdn); + fileInfoList.forEach(fileInfo -> fileInfo.setInfoType(Crdn.INF_TYPE).setInfoKey(crdn.getCrdnId())); + fileBean.create(fileInfoList); + return saved; } } 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 41efa035..ec875dfb 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java @@ -12,6 +12,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.service.Crdn05Service; @@ -88,7 +90,10 @@ public class Crdn05Controller extends ApplicationController { @PostMapping(name="단속자료 수기 등록", value="/030/create.do") public ModelAndView createCrdnDataByManual(Crdn crdn, MultipartFile[] uploadFileList) { - boolean saved = crdn05Service.create(crdn); + List fileInfoList = new FileInfoFactory().makeFileInfos(null, uploadFileList); + + boolean saved = crdn05Service.create(crdn, fileInfoList); + return new ModelAndView("jsonView") .addObject("saved", saved); diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn05030-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn05030-info.jsp index df89ac5c..1cf91951 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn05030-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn05030-info.jsp @@ -4,7 +4,7 @@
-
+
@@ -152,8 +152,8 @@
-
- + +
@@ -178,7 +178,7 @@ $(document).ready(function(){ /************************************************************************** * DatasetControl, Dataset, FormFields **************************************************************************/ - $P.formFields = new FimsFormFields("#frm--${pageName}"); + $P.formFields = new FimsFormFields("#frmEdit--${pageName}"); $P.uploadSet = uploadSupport("#uploadFileList--${pageName}"); @@ -198,7 +198,7 @@ $(document).ready(function(){ var item = $P.crdnControl.getCurrent("item"), create = "added" == item.state; - var formData = new FormData(document.getElementById("frmDummy--${pageName}")); + var formData = new FormData(document.getElementById("frmFile--${pageName}")); for(var key in info) { var value = info[key]; formData.append(key,value); @@ -228,7 +228,7 @@ $(document).ready(function(){ }; $P.fnSave = () => { - if (!$("#frm--${pageName} input").validInputs()) return; + if (!$("#frmEdit--${pageName} input").validInputs()) return; dialog.alert({ content:"현재 단속 정보를 저장하시겠습니까?", @@ -247,7 +247,7 @@ $(document).ready(function(){ * 초기화 **************************************************************************/ //달력 초기화 - initDatepicker("frm--${pageName}"); + initDatepicker("frmEdit--${pageName}"); //보안모드 fn_securityModeToggle($("#securityMode--top").is(":checked"));