diff --git a/mens-api/src/main/java/kr/xit/biz/cmm/mapper/ICmmEnsFileMapper.java b/mens-api/src/main/java/kr/xit/biz/cmm/mapper/ICmmEnsFileMapper.java index ed3f89b..d37080c 100644 --- a/mens-api/src/main/java/kr/xit/biz/cmm/mapper/ICmmEnsFileMapper.java +++ b/mens-api/src/main/java/kr/xit/biz/cmm/mapper/ICmmEnsFileMapper.java @@ -1,6 +1,8 @@ package kr.xit.biz.cmm.mapper; +import java.util.Optional; import kr.xit.biz.ens.model.cmm.CmmEnsFileInfDTO; +import kr.xit.biz.ens.model.cmm.CmmEnsRequestDTO; import kr.xit.biz.ens.model.cntc.CntcDTO; import org.egovframe.rte.psl.dataaccess.mapper.Mapper; @@ -21,6 +23,7 @@ import org.egovframe.rte.psl.dataaccess.mapper.Mapper; */ @Mapper public interface ICmmEnsFileMapper { + Optional findDeptInfoByTmplId(final String tmplatId); int insertCntcSndngMst(CntcDTO.SndngMst dto); int insertCntcSndngDtl(CntcDTO.SndngDtl dto); int insertCi(CmmEnsFileInfDTO.FmcInfExcelRslt dto); diff --git a/mens-api/src/main/java/kr/xit/biz/cmm/service/CmmEnsFileService.java b/mens-api/src/main/java/kr/xit/biz/cmm/service/CmmEnsFileService.java index 8044f7c..fb6218e 100644 --- a/mens-api/src/main/java/kr/xit/biz/cmm/service/CmmEnsFileService.java +++ b/mens-api/src/main/java/kr/xit/biz/cmm/service/CmmEnsFileService.java @@ -19,6 +19,7 @@ import kr.xit.biz.common.ApiConstants; import kr.xit.biz.ens.model.cmm.CmmEnsFileInfDTO.FmcExcelUpload; import kr.xit.biz.ens.model.cmm.CmmEnsFileInfDTO.FmcInfExcel; import kr.xit.biz.ens.model.cmm.CmmEnsFileInfDTO.FmcInfExcelRslt; +import kr.xit.biz.ens.model.cmm.CmmEnsRequestDTO; import kr.xit.biz.ens.model.cntc.CntcDTO; import kr.xit.biz.ens.model.nice.NiceCiDTO.IpinCiResEncData; import kr.xit.biz.ens.model.nice.NiceCiDTO.NiceCiRequest; @@ -82,8 +83,13 @@ public class CmmEnsFileService extends EgovAbstractServiceImpl implements ICmmEn final List fmcExcels = parsingFmcExcel(fileReq.getFiles()[0]); + CmmEnsRequestDTO tmpDTO = mapper.findDeptInfoByTmplId( + fmcExcels.get(0).getTmplatId()) + .orElseThrow(() -> BizRuntimeException.create("템플릿 정보를 찾을 수 없습니다.")); // TODO :: CI 변환 // Ci 변환 + fileReq.setSignguCode(tmpDTO.getSignguCode()); + fileReq.setFfnlgCode(tmpDTO.getFfnlgCode()); List rslts = getConvertCis(fileReq, fmcExcels); // TODO :: CNTC 테이블 insert @@ -279,6 +285,14 @@ public class CmmEnsFileService extends EgovAbstractServiceImpl implements ICmmEn int errCnt = 0; final int excelCnt = fmcExcels.size(); String unitySndngMastrId = ""; + + for(FmcInfExcelRslt dto : rslts){ + if(StringUtils.isEmpty(String.join("", dto.getCi1(), dto.getCi2()))){ + errCnt++; + } + mapper.insertCi(dto); + } + for(FmcInfExcel dto : fmcExcels){ //최초 1회 CNTC master 생성 if(StringUtils.isNotEmpty(dto.getUnitySndngMastrId()) && mst == 0){ @@ -310,13 +324,6 @@ public class CmmEnsFileService extends EgovAbstractServiceImpl implements ICmmEn ); } - for(FmcInfExcelRslt dto : rslts){ - if(StringUtils.isNotEmpty(dto.getCode())){ - errCnt++; - } - mapper.insertCi(dto); - } - return String.format( "전자고지 대상 %d건 Upload[완료-%d건, 오류-%d건]", rslts.size(), diff --git a/mens-api/src/main/java/kr/xit/biz/mbl/web/MobilePageController.java b/mens-api/src/main/java/kr/xit/biz/mbl/web/MobilePageController.java index 9792c93..3e798ab 100644 --- a/mens-api/src/main/java/kr/xit/biz/mbl/web/MobilePageController.java +++ b/mens-api/src/main/java/kr/xit/biz/mbl/web/MobilePageController.java @@ -81,7 +81,7 @@ public class MobilePageController { .accessToken(token) .build(); - if(uri.contains("me_mblPage")){ + if(uri.contains("meMblPage")){ cfmReqDTO.setSignguCode(SignguCode.FUNERAL.getCode()); } return ApiResponseDTO.success(service.findKtMblPage(cfmReqDTO)); diff --git a/mens-api/src/main/resources/egovframework/mapper/biz/ens-cmm-file-mysql-mapper.xml b/mens-api/src/main/resources/egovframework/mapper/biz/ens-cmm-file-mysql-mapper.xml index 222ee3f..c7e257b 100644 --- a/mens-api/src/main/resources/egovframework/mapper/biz/ens-cmm-file-mysql-mapper.xml +++ b/mens-api/src/main/resources/egovframework/mapper/biz/ens-cmm-file-mysql-mapper.xml @@ -2,6 +2,13 @@ + /** ens-cmm-file-mysql-mapper|insertCntcSndngMst-연계발송마스터 생성|seojh */ diff --git a/mens-core/src/main/java/kr/xit/biz/ens/model/cmm/CmmEnsFileInfDTO.java b/mens-core/src/main/java/kr/xit/biz/ens/model/cmm/CmmEnsFileInfDTO.java index ee5df37..388fcd2 100644 --- a/mens-core/src/main/java/kr/xit/biz/ens/model/cmm/CmmEnsFileInfDTO.java +++ b/mens-core/src/main/java/kr/xit/biz/ens/model/cmm/CmmEnsFileInfDTO.java @@ -106,6 +106,7 @@ public class CmmEnsFileInfDTO { */ @Schema(requiredMode = RequiredMode.AUTO, title = "통합발송마스터ID", example = "0", description = "통합발송마스터ID") private String unitySndngMastrId; + } @Schema(name = "FmcInfExcel", description = "시설관리공단 전자문서 발송대상 엑셀 파일 interface DTO") diff --git a/mens-core/src/main/java/kr/xit/core/spring/util/error/ErrorParse.java b/mens-core/src/main/java/kr/xit/core/spring/util/error/ErrorParse.java index e47b960..6abae4f 100644 --- a/mens-core/src/main/java/kr/xit/core/spring/util/error/ErrorParse.java +++ b/mens-core/src/main/java/kr/xit/core/spring/util/error/ErrorParse.java @@ -32,8 +32,8 @@ public class ErrorParse { String message = Checks.isNotNull(e) ? e.getLocalizedMessage() : StringUtils.EMPTY; HttpStatus httpStatus = null; - if(e instanceof BizRuntimeException) { - BizRuntimeException be = (BizRuntimeException)e; + if(e instanceof BizRuntimeException be) { + //BizRuntimeException be = (BizRuntimeException)e; return ApiResponseDTO.error(be.getCode(), be.getMessage(), HttpStatus.BAD_REQUEST); }