|
|
|
@ -33,7 +33,6 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
import javax.persistence.EntityManager;
|
|
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
|
|
import java.lang.reflect.Method;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
@ -83,22 +82,26 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService {
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public void saveJudgeData(GnRecallScDto dto) {
|
|
|
|
|
boolean isNew = Checks.isEmpty(dto.getScCode()) || dto.getScCode() == 0L;
|
|
|
|
|
|
|
|
|
|
if(dto.getPicadFiles() != null) {
|
|
|
|
|
setFileInfoAndFileUpload(dto, dto.getPicadFiles(), "setScPicad");
|
|
|
|
|
if(!isNew) changeFileUpload(dto, dto.getPicadFiles());
|
|
|
|
|
else setFileInfoAndFileUpload(dto, dto.getPicadFiles(), "setScPicad");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(dto.getFrecadFiles() != null) {
|
|
|
|
|
setFileInfoAndFileUpload(dto, dto.getFrecadFiles(), "setScFrecad");
|
|
|
|
|
if(!isNew) changeFileUpload(dto, dto.getFrecadFiles());
|
|
|
|
|
else setFileInfoAndFileUpload(dto, dto.getFrecadFiles(), "setScFrecad");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(dto.getContadFiles() != null) {
|
|
|
|
|
setFileInfoAndFileUpload(dto, dto.getContadFiles(), "setScContad");
|
|
|
|
|
if(!isNew) changeFileUpload(dto, dto.getContadFiles());
|
|
|
|
|
else setFileInfoAndFileUpload(dto, dto.getContadFiles(), "setScContad");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GnRecallSc entity = null;
|
|
|
|
|
// 신규
|
|
|
|
|
if (Checks.isEmpty(dto.getScCode()) || dto.getScCode() == 0L) {
|
|
|
|
|
if (isNew) {
|
|
|
|
|
// 접수번호 채번 : 년도 + seq 10자리
|
|
|
|
|
dto.setScSeq(gnReacallRepository.getGnRecallScMaxScSeq(String.valueOf(DateUtil.getCurrentYear()), CtgyConstants.Judge.DATAGB_RESIDENT.getCode()));
|
|
|
|
|
entity = mapstruct.toEntity(dto);
|
|
|
|
@ -116,21 +119,6 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService {
|
|
|
|
|
gnReacallRepository.deleteById(scCode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setFileInfoAndFileUpload(GnRecallScDto dto, MultipartFile[] mfs, String setMethodName) {
|
|
|
|
|
String makePath = fileService.uploadFiles(mfs, rootPath, CtgyConstants.Judge.DATAGB_RESIDENT.getCode().equals(dto.getScDatagb())? uploadPath[0] : uploadPath[1]);
|
|
|
|
|
makePath = makePath + File.separator;
|
|
|
|
|
|
|
|
|
|
for(int idx = 0; idx < mfs.length; idx++){
|
|
|
|
|
MultipartFile mf = mfs[idx];
|
|
|
|
|
try {
|
|
|
|
|
Method method = GnRecallScDto.class.getMethod(setMethodName + (idx+1), String.class);
|
|
|
|
|
method.invoke(dto, StringUtils.cleanPath(makePath + mf.getOriginalFilename()));
|
|
|
|
|
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(readOnly = true)
|
|
|
|
|
public List<JudgeTargetDto> findJudgeTargets(JudgeTargetDto dto) {
|
|
|
|
@ -268,4 +256,24 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService {
|
|
|
|
|
judgeRepository.deleteById(msMaincode);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setFileInfoAndFileUpload(GnRecallScDto dto, MultipartFile[] mfs, String setMethodName) {
|
|
|
|
|
String makePath = fileService.uploadFiles(mfs, rootPath, CtgyConstants.Judge.DATAGB_RESIDENT.getCode().equals(dto.getScDatagb())? uploadPath[0] : uploadPath[1]);
|
|
|
|
|
//makePath = makePath + File.separator;
|
|
|
|
|
|
|
|
|
|
for(int idx = 0; idx < mfs.length; idx++){
|
|
|
|
|
MultipartFile mf = mfs[idx];
|
|
|
|
|
try {
|
|
|
|
|
Method method = GnRecallScDto.class.getMethod(setMethodName + (idx+1), String.class);
|
|
|
|
|
method.invoke(dto, StringUtils.cleanPath(makePath + mf.getOriginalFilename()));
|
|
|
|
|
//method.invoke(dto, StringUtils.cleanPath(makePath + mf.getOriginalFilename()));
|
|
|
|
|
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void changeFileUpload(GnRecallScDto dto, MultipartFile[] mfs) {
|
|
|
|
|
fileService.uploadFiles(mfs, rootPath, CtgyConstants.Judge.DATAGB_RESIDENT.getCode().equals(dto.getScDatagb())? uploadPath[0] : uploadPath[1]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|