의견제출 등록 첨부파일 등록 수정.

main
jjh 1 year ago
parent ca31a96639
commit 434f899b85

@ -130,7 +130,7 @@ public class Excl02 extends AbstractEntity {
/**
*
*/
private String atchFileCnt;
private Integer atchFileCnt;
/**
*

@ -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 {
* <li> false</li>
* </ul>
*/
Map<String, String> create(Excl02 excl02);
Map<String, String> create(Excl02 excl02, MultipartFile[] uploadFileList);
/** .
* @param opnnSbmsn
@ -53,7 +55,7 @@ public interface Excl02Service {
* <li> false</li>
* </ul>
*/
Map<String, String> update(Excl02 excl02);
Map<String, String> update(Excl02 excl02, MultipartFile[] uploadFileList);
/** .
* @param opnnSbmsn

@ -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<DataObject> getOpinionSubmissionList(Excl02Query req) {
return excl02Bean.getOpinionSubmissionList(req);
@ -48,11 +56,19 @@ public class Excl02ServiceBean extends AbstractServiceBean implements Excl02Serv
}
@Override
public Map<String, String> create(Excl02 excl02) {
public Map<String, String> create(Excl02 excl02, MultipartFile[] uploadFileList) {
// 변수 선언
boolean retSuccess = false; // DB 처리 결과
Map<String, String> retMap = new HashMap<String, String>(); // 결과 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<FileInfo> 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<String, String> update(Excl02 excl02) {
public Map<String, String> update(Excl02 excl02, MultipartFile[] uploadFileList) {
// 변수 선언
boolean retSuccess = false; // DB 처리 결과
Map<String, String> retMap = new HashMap<String, String>(); // 결과 return
// 의견제출 수정
retSuccess = excl02Bean.update(excl02);
if (!retSuccess) {
retMap.put("retSaved", "false");

@ -108,8 +108,8 @@ public class Excl02Controller extends ApplicationController {
* }</code></pre>
*/
@PostMapping(name="의견제출 대장 등록", value="/020/create.do")
public ModelAndView create(Excl02 excl02) {
Map<String, String> retMap = excl02Service.create(excl02);
public ModelAndView create(Excl02 excl02, MultipartFile[] uploadFileList) {
Map<String, String> 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<String, String> retMap = excl02Service.update(excl02);
Map<String, String> retMap = excl02Service.update(excl02, uploadFileList);
return new ModelAndView("jsonView")
.addObject("retSaved", retMap.get("retSaved"))

Loading…
Cancel
Save