Leeyh1121 5 months ago
commit ae1793574d

@ -16,6 +16,7 @@ import cokr.xit.base.file.service.FileQuery;
import cokr.xit.foundation.data.paging.MapperSupport;
@Intercepts({
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class}),
@Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class})
})
public class AddsMapperSupport extends MapperSupport {

@ -42,7 +42,7 @@ public interface BizNimsService {
// NIMS BIZ
//------------------------------------------------------------------------------------------------------
BizNimsRequest.DsuseMgtReceiptReq saveDsuseMgtReceipt(final BizNimsRequest.DsuseMgtReceiptReq dto, final List<BizNimsDto.DsuseMgtDtl> dtls, List<MultipartFile> files);
BizNimsRequest.DsuseMgtRsltReq saveDsuseMgtRslt(final BizNimsRequest.DsuseMgtRsltReq dto, List<MultipartFile> files);
BizNimsRequest.DsuseMgtRsltReq saveDsuseMgtRslt(final BizNimsRequest.DsuseMgtRsltReq dto, final List<MultipartFile> files, final String fileChangeYn);
List<BizNimsResponse.DsuseMgtRes> getDsuseMgts(final BizNimsRequest.DsuseMgtInqReq dto, final boolean isForDoc);
void modifyPrgsSttsOfDsuseMgt(final BizNimsDto.DsuseMgt dto);
NimsApiDto.ProductInfoKd getPrdMnfSeqInfoOfBarcode(final String barcodeStr);

@ -288,7 +288,8 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
dtlCnt = dtlCnt + bizNimsMapper.insertDsuseMgtDtl(d);
// FIXME: 파일 갯수 확인 - 프론트 파일 처리 완료시 까지 comment 처리
d.setFileId(uploadFileAndSave(Constants.FILE_INF_TYPE.DSUSE_PRD_IMG.getCode(), reqDto.getDscdmngId(), sn, files.get(dtlCnt-1)));
d.setFileId(
uploadFileDeleteAndSave(Constants.FILE_INF_TYPE.DSUSE_PRD_IMG.getCode(), reqDto.getDscdmngId(), sn, files.get(dtlCnt-1)));
}
if(dtls.size() != dtlCnt) throw ApiCustomException.create("폐기 관리 상세 등록 실패");
} else {
@ -304,15 +305,25 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
* @return BizNimsRequest.DsuseMgtRslt
* </pre>
*/
public BizNimsRequest.DsuseMgtRsltReq saveDsuseMgtRslt(final BizNimsRequest.DsuseMgtRsltReq reqDto, final List<MultipartFile> files) {
public BizNimsRequest.DsuseMgtRsltReq saveDsuseMgtRslt(final BizNimsRequest.DsuseMgtRsltReq reqDto, final List<MultipartFile> files, final String fileChangeYn) {
ApiUtil.validate(reqDto, null, validator);
reqDto.setRgtr(reqDto.getUserId());
if(bizNimsMapper.updateDsuseMgtRslt(reqDto) == 1){
int idx = 1;
for (MultipartFile mf : files) {
uploadFileAndSave(Constants.FILE_INF_TYPE.DSUSE_IMG.getCode(), reqDto.getDscdmngId(), String.valueOf(idx), mf);
idx++;
if("Y".equals(fileChangeYn)) {
// 파일 삭제
List<String> fileIds = bizNimsMapper.selectFileId(
Map.of("infType", Constants.FILE_INF_TYPE.DSUSE_IMG.getCode(), "infKey", reqDto.getDscdmngId()));
if (!fileIds.isEmpty()) {
fileService.delete(fileIds.toArray(new String[0]));
}
int idx = 1;
for (MultipartFile mf : files) {
uploadFileSave(Constants.FILE_INF_TYPE.DSUSE_IMG.getCode(), reqDto.getDscdmngId(),
String.valueOf(idx), mf);
idx++;
}
}
} else {
@ -894,12 +905,28 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
* @return fileId
* </pre>
*/
private String uploadFileAndSave(String infType, String infKey, String subType, MultipartFile mf) {
private String uploadFileDeleteAndSave(String infType, String infKey, String subType, MultipartFile mf) {
List<String> fileIds = bizNimsMapper.selectFileId(Map.of("infType", infType, "infKey", infKey, "subType", subType));
if(!fileIds.isEmpty()){
fileService.delete(fileIds.toArray(new String[0]));
}
return uploadFileSave(infType, infKey, subType, mf);
}
/**
* <pre>
* file
* @param infType : : Constants.FILE_INFO_TYPE
* @param infKey : - ID
* @param subType :
* -> :
* -> :
* @param mf : MultipartFile
* @return fileId
* </pre>
*/
private String uploadFileSave(String infType, String infKey, String subType, MultipartFile mf) {
MultipartFile[] uploads = Collections.singletonList(mf).toArray(new MultipartFile[0]);
List<FileInfo> files = (new FileInfoFactory()).makeFileInfos((new FileInfo.Relation()).setInfoType(infType).setInfoKey(infKey).setSubType(subType), uploads);
fileService.create(files);

@ -151,11 +151,12 @@ public class BizNimsController {
@PostMapping(value = "/saveDsuseMgtRslt")
public ApiBaseResponse<BizNimsRequest.DsuseMgtRsltReq> saveDsuseMgtRslt(
@RequestParam("dsuseMgtRsltJsonStr") String dsuseMgtRsltJsonStr,
@RequestParam(value = "dsuseDsuseImgFiles", required = false) List<MultipartFile> dsuseDsuseImgFiles
@RequestParam(value = "dsuseDsuseImgFiles", required = false) List<MultipartFile> dsuseDsuseImgFiles,
@RequestParam("fileChangeYn") String fileChangeYn
) {
JSON json = new JSON();
BizNimsRequest.DsuseMgtRsltReq rsltDto = json.parse(dsuseMgtRsltJsonStr, new TypeReference<>() {});
return ApiBaseResponse.of(bizNimsService.saveDsuseMgtRslt(rsltDto, dsuseDsuseImgFiles));
return ApiBaseResponse.of(bizNimsService.saveDsuseMgtRslt(rsltDto, dsuseDsuseImgFiles, fileChangeYn));
}
@Operation(summary = "폐기 보고 조회(NIMS API 폐기보고 조회)", description = "업체의 폐기 보고 정보 목록 조회<br><br>NIMS API 호출 결과를 DB에 저장후 Return", tags = { "BIZ NIMS API" })

@ -725,7 +725,9 @@
FROM tb_file
WHERE INF_TYPE = #{infType}
AND INF_KEY = #{infKey}
<if test="subType != null and subType != ''">
AND SUB_TYPE = #{subType}
</if>
</select>

Loading…
Cancel
Save