단속자료 등록 메소드 수정

main
이범준 1 year ago
parent 1545cb1a6a
commit 31dad95ca5

@ -1,15 +1,18 @@
package cokr.xit.fims.crdn.service.bean; package cokr.xit.fims.crdn.service.bean;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import cokr.xit.base.file.FileInfo; import cokr.xit.base.file.FileInfo;
import cokr.xit.base.file.service.bean.FileBean; import cokr.xit.base.file.service.bean.FileBean;
import cokr.xit.base.file.web.FileInfoFactory;
import cokr.xit.fims.cmmn.CrdnSttsHstry; import cokr.xit.fims.cmmn.CrdnSttsHstry;
import cokr.xit.fims.cmmn.service.bean.CrdnSttsHstryBean; import cokr.xit.fims.cmmn.service.bean.CrdnSttsHstryBean;
import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.Crdn;
@ -51,16 +54,12 @@ public class Crdn05ServiceBean extends AbstractServiceBean implements CrdnServic
return crdn05Mapper.selectCrackdownList(req); return crdn05Mapper.selectCrackdownList(req);
} }
public boolean create(Crdn crdn, List<FileInfo> fileInfoList) { public boolean create(Crdn crdn, MultipartFile[] newFileList) {
crdn.setAtchFileCnt(fileInfoList.size()); List<FileInfo> fileInfoList = new ArrayList<FileInfo>();
boolean saved = this.create(crdn); if(newFileList != null) {
fileInfoList.forEach(fileInfo -> fileInfo.setInfoType(Crdn.INF_TYPE).setInfoKey(crdn.getCrdnId())); fileInfoList = new FileInfoFactory().makeFileInfos(null, newFileList);
fileBean.create(fileInfoList); crdn.setAtchFileCnt(fileInfoList.size());
return saved; } else {
}
public boolean create(Crdn crdn) {
if(ifEmpty(crdn.getAtchFileCnt(), () -> 0) == 0) {
crdn.setAtchFileCnt(0); crdn.setAtchFileCnt(0);
} }
@ -120,8 +119,13 @@ public class Crdn05ServiceBean extends AbstractServiceBean implements CrdnServic
return false; return false;
} }
if(!fileInfoList.isEmpty()) {
fileInfoList.forEach(fileInfo -> fileInfo.setInfoType(Crdn.INF_TYPE).setInfoKey(crdn.getCrdnId()));
fileBean.create(fileInfoList);
}
return result; return result;
} }
} }

@ -12,8 +12,6 @@ import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.code.CommonCode; 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.base.web.ApplicationController;
import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.Crdn;
import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.CrdnQuery;
@ -127,12 +125,8 @@ public class Crdn05Controller extends ApplicationController {
crdn.setCrdnRegSeCd("01"); crdn.setCrdnRegSeCd("01");
crdn.setCrdnInptSeCd("03");//TODO : 사용자 기관의 시청,구청 구분 crdn.setCrdnInptSeCd("03");//TODO : 사용자 기관의 시청,구청 구분
if(newFileList != null) { saved = crdn05Service.create(crdn, newFileList);
List<FileInfo> fileInfoList = new FileInfoFactory().makeFileInfos(null, newFileList);
saved = crdn05Service.create(crdn, fileInfoList);
} else {
saved = crdn05Service.create(crdn);
}
return new ModelAndView("jsonView") return new ModelAndView("jsonView")
.addObject("saved", saved); .addObject("saved", saved);

@ -6,13 +6,13 @@ import javax.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.Crdn;
import cokr.xit.fims.crdn.service.bean.Crdn05ServiceBean; import cokr.xit.fims.crdn.service.bean.Crdn05ServiceBean;
import cokr.xit.fims.excl.Excl03; import cokr.xit.fims.excl.Excl03;
import cokr.xit.fims.excl.Excl03Query; import cokr.xit.fims.excl.Excl03Query;
import cokr.xit.fims.excl.service.Excl03Service; import cokr.xit.fims.excl.service.Excl03Service;
import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject;
/** . /** .
* *
@ -120,7 +120,7 @@ public class Excl03ServiceBean extends AbstractServiceBean implements Excl03Serv
crdn.setDelYn("N"); crdn.setDelYn("N");
// 단속 대장 입력 // 단속 대장 입력
retSuccess = crdn05Service.create(crdn); retSuccess = crdn05Service.create(crdn, null);
if (!retSuccess) { if (!retSuccess) {
// 예외를 발생시켜서 오류메세지를 보내고 DB Rollback // 예외를 발생시켜서 오류메세지를 보내고 DB Rollback
throw new RuntimeException("재부과 등록 중 단속대장 등록에 실패하였습니다."); throw new RuntimeException("재부과 등록 중 단속대장 등록에 실패하였습니다.");

Loading…
Cancel
Save