From 940342cc48407d31c59e49477c470dd53f453ef4 Mon Sep 17 00:00:00 2001 From: sjh88 Date: Fri, 27 Oct 2023 16:00:51 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=97=91=EC=85=80=20=EC=97=85=EB=A1=9C?= =?UTF-8?q?=EB=93=9C=20=EC=A0=84=EC=9E=90=EC=9A=B0=ED=8E=B8=EC=9D=BC=20?= =?UTF-8?q?=EA=B2=BD=EC=9A=B0=20tb=5Fens=5Fpost=5Fplus=5Fjson=20=ED=85=8C?= =?UTF-8?q?=EC=9D=B4=EB=B8=94=20insert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/biz/cmm/mapper/ICmmEnsFileMapper.java | 1 + .../biz/cmm/service/CmmEnsFileService.java | 145 +++++++++++++++--- .../mapper/biz/ens-cmm-file-mysql-mapper.xml | 40 +++++ .../biz/ens/model/cmm/CmmEnsRequestDTO.java | 7 + .../kr/xit/biz/ens/model/cntc/CntcDTO.java | 64 ++++++++ 5 files changed, 237 insertions(+), 20 deletions(-) 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 d37080c..6c81460 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 @@ -27,4 +27,5 @@ public interface ICmmEnsFileMapper { int insertCntcSndngMst(CntcDTO.SndngMst dto); int insertCntcSndngDtl(CntcDTO.SndngDtl dto); int insertCi(CmmEnsFileInfDTO.FmcInfExcelRslt dto); + int insertPostPlusJson(CntcDTO.PostPlusJson 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 9d7bad8..2ea6b13 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 @@ -77,29 +77,26 @@ public class CmmEnsFileService extends EgovAbstractServiceImpl implements ICmmEn public String fmcExcelUpload(FmcExcelUpload fileReq) { final Set> errors = validator.validate(fileReq); if (!errors.isEmpty()) { - throw BizRuntimeException.create(errors.stream() .map(row -> String.format("%s=%s", row.getPropertyPath(), row.getMessageTemplate())) .toList().toString()); } - + // 템플릿 정보 조회 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()); + fileReq.setTry1(tmpDTO.getTry1()); List rslts = getConvertCis(fileReq, fmcExcels); - // TODO :: CNTC 테이블 insert + // CNTC 테이블 insert String msg = makeCntc(rslts, fmcExcels, fileReq); - // TODO :: POST-PLUS(전자우편) 일 경우 tb_ens_post_plus_json 테이블 insert - fileReq.setSndngCo(fmcExcels.size()); fileReq.setUnitySndngMastrId(UUID.randomUUID().toString().replaceAll("-", "")); @@ -289,9 +286,10 @@ public class CmmEnsFileService extends EgovAbstractServiceImpl implements ICmmEn private String makeCntc(final List rslts, final List fmcExcels, FmcExcelUpload fileReq){ int mst = 0; int errCnt = 0; + String mpc = null; final int excelCnt = fmcExcels.size(); + final String register = StringUtils.defaultString(fileReq.getRegister(),""); String unitySndngMastrId = ""; - String register = StringUtils.defaultString(fileReq.getRegister(),""); for(FmcInfExcelRslt dto : rslts){ if(StringUtils.isEmpty(String.join("", dto.getCi1(), dto.getCi2()))){ @@ -315,19 +313,42 @@ public class CmmEnsFileService extends EgovAbstractServiceImpl implements ICmmEn .register(register) .build() ); - mst++; } - String mpc = ""; - switch (StringUtils.defaultString(fileReq.getSignguCode(), "")) { - case "88328": - mpc = jsonCn1(dto); - break; - case "88316": - mpc = jsonCn2(dto); - break; - default: - break; - + mst++; + + // POST-PLUS(전자우편) 일 경우 tb_ens_post_plus_json 테이블 insert + if("POST-PLUS".equals(fileReq.getTry1())){ + String ppJson[] = PPJson(Integer.toString(mst),dto); + mapper.insertPostPlusJson( + CntcDTO.PostPlusJson.builder() + .unitySndngDetailId(dto.getUnitySndngDetailId()) + .signguCode(fileReq.getSignguCode()) + .ffnlgCode(fileReq.getFfnlgCode()) + .serviceCd("PST") + .conKey(unitySndngMastrId) + .sn(Integer.toString(mst)) + .masterCols(ppJson[0]) + .masterRows(ppJson[1]) + .detailCols(ppJson[2]) + .detailRows(ppJson[3]) + .taxNum1(dto.getTaxNum1()) + .taxNum2(dto.getTaxNum2()) + .taxNum3(dto.getTaxNum3()) + .taxNum4(dto.getTaxNum4()) + .register(register) + .build() + ); + }else { + switch (fileReq.getSignguCode()) { + case "88328": + mpc = jsonCn1(dto); + break; + case "88316": + mpc = jsonCn2(dto); + break; + default: + break; + } } //CNTC detail 생성 mapper.insertCntcSndngDtl( @@ -662,4 +683,88 @@ public class CmmEnsFileService extends EgovAbstractServiceImpl implements ICmmEn +"}"; return jsonCn; } + + private String[] PPJson(String no, FmcInfExcel dto){ + String[] returnJson = new String[4]; + returnJson[0] = "[" + + "\"버전\",\"테스트여부\",\"서비스\",\"연계식별키\",\"봉투\"," + + "\"봉투창\",\"흑백칼라\",\"단면양면\",\"배달\",\"템플릿코드\"," + + "\"템플릿출력여부\",\"페이지수\",\"동봉물페이지수\",\"수취인수\",\"주소페이지유무\"," + + "\"맞춤자제유무\",\"메일머지유무\",\"반송여부\",\"스테이플러유무\",\"발송인명\"," + + "\"발송인우편번호\",\"발송인주소\",\"발송인상세주소\",\"발송인전화번호\"" + + "]"; + returnJson[1] = "[" + + "\"v1.10\"," + + "\"Y\"," + + "\"PST\"," + + "\"TEST20230221_000001\"," + + "\"소봉투\"," + + "\"이중창\"," + + "\"칼라\"," + + "\"양면\"," + + "\"일반\"," + + "\"001\"," + + "\"Y\"," + + "1," + + "0," + + "1," + + "\"N\"," + + "\"Y\"," + + "\"N\"," + + "\"N\"," + + "\"N\"," + + "\""+ Checks.checkVal(dto.getSenderNm(),"") +"\"," + + "\""+ Checks.checkVal(dto.getSenderZipNo(),"") +"\"," + + "\""+ Checks.checkVal(dto.getSenderAddr(),"") +"\"," + + "\""+ Checks.checkVal(dto.getSenderDetailAddr(),"") +"\"," + + "\""+ Checks.checkVal(dto.getSenderTelno(),"") +"\"" + + "]"; + + returnJson[2] = "[" + + "\"순번\",\"수취인 명\",\"수취인 우편번호\",\"수취인 주소\",\"수취인 상세주소\"," + + "\"수취인 전화번호\",\"고지서 구분명\",\"고지서 명\",\"고지서 상세명\",\"QR 바코드\"," + + "\"부과대상\",\"기관번호\",\"세목\",\"납세년월기\",\"과세번호\"," + + "\"부과내역1\",\"부과내역2\",\"납부금액명1\",\"납부금액상세명1\",\"납부금액상세명2\"," + + "\"납부금액상세명3\",\"납기구분1\",\"납기구분2\",\"납기내기한\",\"납기내금액1\"," + + "\"납기내금액2\",\"납기내금액3\",\"납기내금액4\",\"납기내합계액\",\"출력일자\"," + + "\"담당자\",\"우리가상계좌\",\"신한가상계좌\",\"하나가상계좌\"" + + "]"; + returnJson[3] = "[" + + "\""+ no +"\"," + + "\""+ Checks.checkVal(dto.getRecevNm(),"") +"\"," + + "\""+ Checks.checkVal(dto.getRecevZipNo(),"") +"\"," + + "\""+ Checks.checkVal(dto.getRecevAddr(),"") +"\"," + + "\""+ Checks.checkVal(dto.getRecevDetailAddr(),"") +"\"," + + "\""+ Checks.checkVal(dto.getRecevTelno(),"") +"\"," + + "\""+ Checks.checkVal(dto.getGojiGubun(),"") +"\"," + + "\""+ Checks.checkVal(dto.getGojiNm(),"") +"\"," + + "\""+ Checks.checkVal(dto.getGojiDetailNm(),"") +"\"," + + "\""+ Checks.checkVal(dto.getQrBarcode(),"") +"\"," + + "\""+ Checks.checkVal(dto.getBuTarget(),"") +"\"," + + "\""+ Checks.checkVal(dto.getTaxNum1(),"") +"\"," + + "\""+ Checks.checkVal(dto.getTaxNum2(),"") +"\"," + + "\""+ Checks.checkVal(dto.getTaxNum3(),"") +"\"," + + "\""+ Checks.checkVal(dto.getTaxNum4(),"") +"\"," + + "\""+ Checks.checkVal(dto.getBuContent1(),"") +"\"," + + "\""+ Checks.checkVal(dto.getBuContent2(),"") +"\"," + + "\""+ Checks.checkVal(dto.getNapAmountNm1(),"") +"\"," + + "\""+ Checks.checkVal(dto.getNapAmountDetailNm1(),"") +"\"," + + "\""+ Checks.checkVal(dto.getNapAmountDetailNm2(),"") +"\"," + + "\""+ Checks.checkVal(dto.getNapAmountDetailNm3(),"") +"\"," + + "\""+ Checks.checkVal(dto.getNapGubun1(),"") +"\"," + + "\""+ Checks.checkVal(dto.getNapGubun2(),"") +"\"," + + "\""+ Checks.checkVal(dto.getNapPd(),"") +"\"," + + "\""+ Checks.checkVal(dto.getNapAmount1(),"") +"\"," + + "\""+ Checks.checkVal(dto.getNapAmount2(),"") +"\"," + + "\""+ Checks.checkVal(dto.getNapAmount3(),"") +"\"," + + "\""+ Checks.checkVal(dto.getNapAmount4(),"") +"\"," + + "\""+ Checks.checkVal(dto.getNapAmountTotal(),"") +"\"," + + "\""+ Checks.checkVal(dto.getPrtDe(),"") +"\"," + + "\""+ Checks.checkVal(dto.getWorker(),"") +"\"," + + "\""+ Checks.checkVal(dto.getWVacct(),"") +"\"," + + "\""+ Checks.checkVal(dto.getSVacct(),"") +"\"," + + "\""+ Checks.checkVal(dto.getHVacct(),"") +"\"" + + "]"; + return returnJson; + } } 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 839b821..f289033 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 @@ -6,6 +6,7 @@ /** ens-cmm-file-mysql-mapper|findDeptInfoByTmplId-템플릿ID로 부서정보 조회|seojh */ SELECT tetm.signgu_code , tetm.ffnlg_code + , tetm.try1 FROM tb_ens_tmplat_manage tetm WHERE tmplat_id = #{tmplatId} @@ -85,5 +86,44 @@ , #{register} ) + + /** ens-cmm-file-mysql-mapper|insertPostPlusJson-포스트 플러스 json 생성|seojh */ + INSERT + INTO tb_ens_post_plus_json( + unity_sndng_detail_id, + signgu_code, + ffnlg_code, + service_cd, + con_key, + sn, + master_cols, + master_rows, + detail_cols, + detail_rows, + tax_num1, + tax_num2, + tax_num3, + tax_num4, + regist_dt, + register + ) VALUES ( + #{unitySndngDetailId} + , #{signguCode} + , #{ffnlgCode} + , #{serviceCd} + , #{conKey} + , #{sn} + , #{masterCols} + , #{masterRows} + , #{detailCols} + , #{detailRows} + , #{taxNum1} + , #{taxNum2} + , #{taxNum3} + , #{taxNum4} + , now() + , #{register} + ) + diff --git a/mens-core/src/main/java/kr/xit/biz/ens/model/cmm/CmmEnsRequestDTO.java b/mens-core/src/main/java/kr/xit/biz/ens/model/cmm/CmmEnsRequestDTO.java index 6e3be0e..b2fbf5a 100644 --- a/mens-core/src/main/java/kr/xit/biz/ens/model/cmm/CmmEnsRequestDTO.java +++ b/mens-core/src/main/java/kr/xit/biz/ens/model/cmm/CmmEnsRequestDTO.java @@ -55,4 +55,11 @@ public class CmmEnsRequestDTO { @Schema(requiredMode = RequiredMode.AUTO, title = "profile", example = "local") @JsonProperty("profile") private String profile; + + /** + * 1차 발송 + */ + @Schema(requiredMode = RequiredMode.AUTO, title = "1차 발송", example = "KKO-MY-DOC") + @JsonProperty("try1") + private String try1; } diff --git a/mens-core/src/main/java/kr/xit/biz/ens/model/cntc/CntcDTO.java b/mens-core/src/main/java/kr/xit/biz/ens/model/cntc/CntcDTO.java index b4f0d3b..efd630e 100644 --- a/mens-core/src/main/java/kr/xit/biz/ens/model/cntc/CntcDTO.java +++ b/mens-core/src/main/java/kr/xit/biz/ens/model/cntc/CntcDTO.java @@ -201,4 +201,68 @@ public class CntcDTO { */ private String documentBinderUuid; } + + @Data + @NoArgsConstructor + @AllArgsConstructor + @SuperBuilder + @EqualsAndHashCode(callSuper = false) + public static class PostPlusJson extends AuditFields implements Serializable { + /** + * 통합 발송 상세 id + */ + private String unitySndngDetailId; + /** + * 시군구 코드 + */ + private String signguCode; + /** + * 과태료 코드 + */ + private String ffnlgCode; + /** + * 서비스 코드 + */ + private String serviceCd; + /** + * 연계 식별 키 + */ + private String conKey; + /** + * 순번 + */ + private String sn; + /** + * master_cols + */ + private String masterCols; + /** + * master_rows + */ + private String masterRows; + /** + * detail_cols + */ + private String detailCols; + /** + * detail_rows + */ + private String detailRows; + /** + * 기관번호 + */ + private String taxNum1; + /** + * 세목 + */ + private String taxNum2; + /** + * 납세년월기 + */ + private String taxNum3; + /** + * 과세번호 + */ + private String taxNum4; + } }