feat: 엑셀 양식 파일 등록 Init

- CntcDTO batch에서 core로 이동
dev
sjh88 1 year ago
parent 0ea0a57ca2
commit b161e10497

@ -0,0 +1,27 @@
package kr.xit.biz.cmm.mapper;
import kr.xit.biz.ens.model.cmm.CmmEnsFileInfDTO;
import kr.xit.biz.ens.model.cntc.CntcDTO;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
/**
* <pre>
* description : File mapper
*
* packageName : kr.xit.biz.cmm.mapper
* fileName : ICmmEnsFileMapper
* author : seojh
* date : 2023-10-19
* ======================================================================
*
* ----------------------------------------------------------------------
* 2023-10-19 seojh
*
* </pre>
*/
@Mapper
public interface ICmmEnsFileMapper {
int insertCntcSndngMst(CntcDTO.SndngMst dto);
int insertCntcSndngDtl(CntcDTO.SndngDtl dto);
int insertCi(CmmEnsFileInfDTO.FmcInfExcelRslt dto);
}

@ -12,13 +12,18 @@ import javax.transaction.Transactional;
import javax.validation.ConstraintViolation; import javax.validation.ConstraintViolation;
import javax.validation.Validation; import javax.validation.Validation;
import javax.validation.Validator; import javax.validation.Validator;
import kr.xit.biz.cmm.mapper.ICmmEnsFileMapper;
import kr.xit.biz.common.ApiConstants;
import kr.xit.biz.ens.model.cmm.CmmEnsFileInfDTO.FmcExcelUpload; 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.FmcInfExcel;
import kr.xit.biz.ens.model.cmm.CmmEnsFileInfDTO.FmcInfExcelRslt; import kr.xit.biz.ens.model.cmm.CmmEnsFileInfDTO.FmcInfExcelRslt;
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.IpinCiResEncData;
import kr.xit.biz.ens.model.nice.NiceCiDTO.NiceCiRequest; import kr.xit.biz.ens.model.nice.NiceCiDTO.NiceCiRequest;
import kr.xit.core.exception.BizRuntimeException; import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.spring.util.ApiWebClientUtil; import kr.xit.core.spring.util.ApiWebClientUtil;
import kr.xit.core.support.utils.Checks;
import kr.xit.core.support.xlsx.StreamingReader; import kr.xit.core.support.xlsx.StreamingReader;
import kr.xit.ens.nice.service.INiceCiService; import kr.xit.ens.nice.service.INiceCiService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -29,6 +34,9 @@ import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import static egovframework.com.cmm.util.EgovDateUtil.formatDate;
import static egovframework.com.cmm.util.EgovDateUtil.formatTime;
/** /**
* <pre> * <pre>
* description : * description :
@ -53,6 +61,8 @@ public class CmmEnsFileService extends EgovAbstractServiceImpl implements ICmmEn
private final INiceCiService niceCiService; private final INiceCiService niceCiService;
private final ICmmEnsFileMapper mapper;
private final ApiWebClientUtil webClient; private final ApiWebClientUtil webClient;
private static final Validator validator = Validation.buildDefaultValidatorFactory().getValidator(); private static final Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
@ -75,7 +85,7 @@ public class CmmEnsFileService extends EgovAbstractServiceImpl implements ICmmEn
List<FmcInfExcelRslt> rslts = getConvertCis(fileReq, fmcExcels); List<FmcInfExcelRslt> rslts = getConvertCis(fileReq, fmcExcels);
// TODO :: CNTC 테이블 insert // TODO :: CNTC 테이블 insert
String msg = makeCntc(rslts); String msg = makeCntc(rslts, fmcExcels, fileReq.getRegister());
@ -262,17 +272,45 @@ public class CmmEnsFileService extends EgovAbstractServiceImpl implements ICmmEn
* @return String * @return String
* </pre> * </pre>
*/ */
private String makeCntc(final List<FmcInfExcelRslt> rslts){ private String makeCntc(final List<FmcInfExcelRslt> rslts, final List<FmcInfExcel> fmcExcels, String register){
int Mst = 0;
int errCnt = 0; int errCnt = 0;
int excelCnt = fmcExcels.size();
String unitySndngMastrId = "";
for(FmcInfExcel dto : fmcExcels){
//최초 1회 CNTC master 생성
if(StringUtils.isNotEmpty(dto.getUnitySndngMastrId()) && Mst == 0){
unitySndngMastrId = dto.getUnitySndngMastrId();
mapper.insertCntcSndngMst(
CntcDTO.SndngMst.builder()
.unitySndngMastrId(dto.getUnitySndngMastrId())
.tmplatId(dto.getTmplatId())
.sndngDt(dto.getSndngDt())
.sndngCo(excelCnt)
.sndngProcessSttus(ApiConstants.SndngProcessStatus.ACCEPT.getCode())
.register(register)
.build()
);
Mst++;
}
String mpc = jsonCn1(dto);
//CNTC detail 생성
mapper.insertCntcSndngDtl(
CntcDTO.SndngDtl.builder()
.unitySndngMastrId(unitySndngMastrId)
.unitySndngDetailId(dto.getUnitySndngDetailId())
.tmplatId(dto.getTmplatId())
.mobilePageCn(mpc)
.register(register)
.build()
);
}
// TODO::CNTC master 생성
// TODO : CNTC detail 생성
for(FmcInfExcelRslt dto : rslts){ for(FmcInfExcelRslt dto : rslts){
if(StringUtils.isNotEmpty(dto.getCode())){ if(StringUtils.isNotEmpty(dto.getCode())){
errCnt++; errCnt++;
} }
mapper.insertCi(dto);
} }
return String.format( return String.format(
@ -281,4 +319,75 @@ public class CmmEnsFileService extends EgovAbstractServiceImpl implements ICmmEn
rslts.size()-errCnt, rslts.size()-errCnt,
errCnt); errCnt);
} }
private String jsonCn1(FmcInfExcel dto){
String jsonCn = "{"
+ "\"details\": ["
+ "{"
+ "\"title\": \"서울시설공단 고지서\","
+ "\"item_type\": \"SUBJECT_TEXT\","
+ "\"elements\": ["
+ "\"\""
+ "]"
+ "},"
+ "{"
+ "\"title\": \"내용\","
+ "\"item_type\": \"KEY_VALUE\","
+ "\"properties\": {"
+ "},"
+ "\"elements\": ["
+ "{"
+ "\"key\": \"수취인\","
+ "\"value\": \""+ Checks.checkVal(dto.getRecevNm(),"") +"\","
+ "\"level\": 1"
+ "},"
+ "{"
+ "\"key\": \"고지서\","
+ "\"value\": \""+ Checks.checkVal(dto.getGojiNm(),"") +"("+ Checks.checkVal(dto.getGojiGubun(),"") +")"+"\","
+ "\"level\": 1"
+ "},"
+ "{"
+ "\"key\": \"고지서 상세\","
+ "\"value\": \""+ Checks.checkVal(dto.getGojiDetailNm(),"") +"\","
+ "\"level\": 1"
+ "},"
+ "{"
+ "\"key\": \"납세번호\","
+ "\"value\": \""+ Checks.checkVal(dto.getTaxNum1(),"") + Checks.checkVal(dto.getTaxNum2(),"") + Checks.checkVal(dto.getTaxNum3(),"") + Checks.checkVal(dto.getTaxNum4(),"") +"\","
+ "\"level\": 1"
+ "},"
+ "{"
+ "\"key\": \""+ Checks.checkVal(dto.getNapAmountNm1(),"") +"\","
+ "\"value\": \""+ Checks.checkVal(dto.getNapAmount1(),"") +"\","
+ "\"level\": 1"
+ "},"
+ "{"
+ "\"key\": \""+ Checks.checkVal(dto.getNapGubun1(),"") +"\","
+ "\"value\": \""+ Checks.checkVal(formatDate(dto.getNapPd().substring(0,8), "-"),"") +"까지\","
+ "\"level\": 1"
+ "}"
+ "]"
+ "},"
+ "{"
+ "\"title\": \"세외수입 납부방법 안내\","
+ "\"item_type\": \"TABLE\","
+ "\"elements\": {"
+ "\"head\": ["
+ "\"가상계좌\\\\납부\","
+ "\"모바일\\\\n어플\""
+ "],"
+ "\"rows\": ["
+ "["
+ "\"고지서에 기재된 가상계좌로 이체,납부\\\\n고지서 금액과 일치해야 이체 가능\""
+ "],"
+ "["
+ "\"앱,PLAY스토어에서 (서울시 세금납부) 앱 설치\\\\n계좌이체(전 은행), 신용카드, 간편결제 납부\""
+ "]"
+ "]"
+ "}"
+ "}"
+ "]"
+"}";
return jsonCn;
}
} }

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="kr.xit.biz.cmm.mapper.ICmmEnsFileMapper">
<insert id="insertCntcSndngMst">
/** ens-cmm-file-mysql-mapper|insertCntcSndngMst-연계발송마스터 생성|seojh */
INSERT
INTO tb_cntc_sndng_mastr (
unity_sndng_mastr_id, /* 통합발송마스터 id */
signgu_code, /* 시군구코드 */
ffnlg_code, /* 과태료코드 */
tmplat_id, /* 템플릿ID */
sndng_ty_code, /* 발송유형 코드 */
sndng_co, /* 발송 건수 */
sndng_process_sttus, /* 발송처리 상태 */
sndng_dt, /* 발송일시 */
clos_dt, /* 마감일시 */
regist_dt,
register
)
SELECT #{unitySndngMastrId}
, tetm.signgu_code
, tetm.ffnlg_code
, tetm.tmplat_id
, tetm.sndng_ty_code
, #{sndngCo}
, #{sndngProcessSttus}
, #{sndngDt}
, date_format(date_add(#{sndngDt}, interval +1 day), '%Y%m%d%H%i%S')
, now()
, #{register}
FROM tb_ens_tmplat_manage tetm
WHERE tmplat_id = #{tmplatId}
</insert>
<insert id="insertCntcSndngDtl">
/** ens-cmm-file-mysql-mapper|insertCntcSndngDtl-연계발송상세 생성|seojh */
INSERT
INTO tb_cntc_sndng_detail (
unity_sndng_detail_id, /* 통합발송 상세ID */
unity_sndng_mastr_id, /* 통합발송 마스터ID */
signgu_code, /* 시군구 코드 */
ffnlg_code, /* 과태료 코드 */
mobile_page_cn, /* 모바일 페이지 내용 */
regist_dt,
register
)
SELECT #{unitySndngDetailId}
, #{unitySndngMastrId}
, tetm.signgu_code
, tetm.ffnlg_code
, #{mobilePageCn}
, now()
, #{register}
FROM tb_ens_tmplat_manage tetm
WHERE tmplat_id = #{tmplatId}
</insert>
<insert id="insertCi">
/** ens-cmm-file-mysql-mapper|insertCi-CI자료 생성|seojh */
INSERT
INTO tb_ens_ci (
unity_sndng_detail_id,
ci,
result_cd,
regist_dt,
register
) VALUES (
#{unitySndngDetailId}
, NVL(#{ci1}, #{ci2})
, #{code}
, now()
, #{register}
)
</insert>
</mapper>

@ -3,11 +3,11 @@ package kr.xit.biz.ens.mapper;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import kr.xit.biz.ens.model.cntc.CntcDTO;
import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkStatus; import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkStatus;
import kr.xit.biz.ens.model.kakao.KkopayDocDTO.OneTimeToken; import kr.xit.biz.ens.model.kakao.KkopayDocDTO.OneTimeToken;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper; import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import kr.xit.biz.ens.model.CntcDTO;
import kr.xit.biz.ens.model.EnsDTO; import kr.xit.biz.ens.model.EnsDTO;
/** /**

@ -20,9 +20,9 @@ import javax.validation.Validator;
import kr.xit.biz.common.ApiConstants; import kr.xit.biz.common.ApiConstants;
import kr.xit.biz.common.ApiConstants.SndngSeCode; import kr.xit.biz.common.ApiConstants.SndngSeCode;
import kr.xit.biz.ens.mapper.IEnsBatchMapper; import kr.xit.biz.ens.mapper.IEnsBatchMapper;
import kr.xit.biz.ens.model.CntcDTO;
import kr.xit.biz.ens.model.EnsDTO; import kr.xit.biz.ens.model.EnsDTO;
import kr.xit.biz.ens.model.EnsDTO.SendKakaoTgt; import kr.xit.biz.ens.model.EnsDTO.SendKakaoTgt;
import kr.xit.biz.ens.model.cntc.CntcDTO;
import kr.xit.biz.ens.model.kakao.KkopayDocAttrDTO.Receiver; import kr.xit.biz.ens.model.kakao.KkopayDocAttrDTO.Receiver;
import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO; import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO;
import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkSendReq; import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkSendReq;

@ -1,7 +1,10 @@
package kr.xit.biz.ens.model.cmm; package kr.xit.biz.ens.model.cmm;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode; import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
@ -14,6 +17,8 @@ import lombok.experimental.SuperBuilder;
import org.hibernate.validator.constraints.NotEmpty; import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.time.LocalDateTime;
/** /**
* <pre> * <pre>
* description : DTO * description : DTO
@ -46,27 +51,35 @@ public class CmmEnsFileInfDTO {
* : * :
* | * |
*/ */
@Schema(requiredMode = RequiredMode.REQUIRED, title = "시스템구분코드", example = "???", description = "시스템구분코드") // @Schema(requiredMode = RequiredMode.REQUIRED, title = "시스템구분코드", example = "???", description = "시스템구분코드")
@NotEmpty(message = "시스템 구분은 필수 입니다") // @NotEmpty(message = "시스템 구분은 필수 입니다")
@Size(max = 5) // @Size(max = 5)
private String sysSeCode; // private String sysSeCode;
/** /**
* : * :
* KKO-MY-DOC|KT-SMS|E-GREEN * KKO-MY-DOC|KT-SMS|E-GREEN
*/ */
@Schema(requiredMode = RequiredMode.REQUIRED, title = "발송구분코드", example = "KKO-MY-DOC", description = "KKO-MY-DOC|KT-SMS|E-GREEN") // @Schema(requiredMode = RequiredMode.REQUIRED, title = "발송구분코드", example = "KKO-MY-DOC", description = "KKO-MY-DOC|KT-SMS|E-GREEN")
@NotEmpty(message = "발송구분은 필수 입니다") // @NotEmpty(message = "발송구분은 필수 입니다")
@Size(max = 10) // @Size(max = 10)
private String sndngSeCode; // private String sndngSeCode;
/** /**
* : * :
* - yyyyMMdd * - yyyyMMdd
*/ */
@Schema(requiredMode = RequiredMode.REQUIRED, title = "발송일시", example = "20230905", description = "발송일시") // @Schema(requiredMode = RequiredMode.REQUIRED, title = "발송일시", example = "20230905", description = "발송일시")
@Size(min = 8, max = 8, message = "발송일은 필수 입니다") // @Size(min = 8, max = 8, message = "발송일은 필수 입니다")
private String sndngDt; // private String sndngDt;
/**
* :
* - yyyyMMdd
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "등록자", example = "userid", description = "등록자")
@Size(message = "등록자는 필수 입니다")
private String register;
/** /**
* excel file : * excel file :
@ -511,5 +524,16 @@ public class CmmEnsFileInfDTO {
*/ */
@Schema(requiredMode = RequiredMode.REQUIRED, title = "message") @Schema(requiredMode = RequiredMode.REQUIRED, title = "message")
private String message; private String message;
/**
*
*/
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonFormat(pattern = "yyyy-MM-dd kk:mm:ss")
private LocalDateTime registDt;
/**
*
*/
private String register;
} }
} }

@ -1,12 +1,14 @@
package kr.xit.biz.ens.model; package kr.xit.biz.ens.model.cntc;
import java.io.Serializable; import kr.xit.biz.common.AuditFields;
import lombok.AllArgsConstructor;
import kr.xit.core.biz.model.AuditFields; import lombok.Data;
import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO; import lombok.EqualsAndHashCode;
import lombok.*; import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import java.io.Serializable;
/** /**
* <pre> * <pre>
* description : tb_cntc_ Entity DTO * description : tb_cntc_ Entity DTO
@ -143,6 +145,11 @@ public class CntcDTO {
* *
*/ */
private String externalDocumentUuid; private String externalDocumentUuid;
/**
* 릿 ID
*/
private String tmplatId;
} }
@Data @Data
Loading…
Cancel
Save