|
|
@ -77,29 +77,26 @@ public class CmmEnsFileService extends EgovAbstractServiceImpl implements ICmmEn
|
|
|
|
public String fmcExcelUpload(FmcExcelUpload fileReq) {
|
|
|
|
public String fmcExcelUpload(FmcExcelUpload fileReq) {
|
|
|
|
final Set<ConstraintViolation<FmcExcelUpload>> errors = validator.validate(fileReq);
|
|
|
|
final Set<ConstraintViolation<FmcExcelUpload>> errors = validator.validate(fileReq);
|
|
|
|
if (!errors.isEmpty()) {
|
|
|
|
if (!errors.isEmpty()) {
|
|
|
|
|
|
|
|
|
|
|
|
throw BizRuntimeException.create(errors.stream()
|
|
|
|
throw BizRuntimeException.create(errors.stream()
|
|
|
|
.map(row -> String.format("%s=%s", row.getPropertyPath(), row.getMessageTemplate()))
|
|
|
|
.map(row -> String.format("%s=%s", row.getPropertyPath(), row.getMessageTemplate()))
|
|
|
|
.toList().toString());
|
|
|
|
.toList().toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 템플릿 정보 조회
|
|
|
|
final List<FmcInfExcel> fmcExcels = parsingFmcExcel(fileReq.getFiles()[0]);
|
|
|
|
final List<FmcInfExcel> fmcExcels = parsingFmcExcel(fileReq.getFiles()[0]);
|
|
|
|
|
|
|
|
|
|
|
|
CmmEnsRequestDTO tmpDTO = mapper.findDeptInfoByTmplId(
|
|
|
|
CmmEnsRequestDTO tmpDTO = mapper.findDeptInfoByTmplId(
|
|
|
|
fmcExcels.get(0).getTmplatId())
|
|
|
|
fmcExcels.get(0).getTmplatId())
|
|
|
|
.orElseThrow(() -> BizRuntimeException.create("템플릿 정보를 찾을 수 없습니다."));
|
|
|
|
.orElseThrow(() -> BizRuntimeException.create("템플릿 정보를 찾을 수 없습니다."));
|
|
|
|
// TODO :: CI 변환
|
|
|
|
|
|
|
|
// Ci 변환
|
|
|
|
// Ci 변환
|
|
|
|
fileReq.setSignguCode(tmpDTO.getSignguCode());
|
|
|
|
fileReq.setSignguCode(tmpDTO.getSignguCode());
|
|
|
|
fileReq.setFfnlgCode(tmpDTO.getFfnlgCode());
|
|
|
|
fileReq.setFfnlgCode(tmpDTO.getFfnlgCode());
|
|
|
|
|
|
|
|
fileReq.setTry1(tmpDTO.getTry1());
|
|
|
|
List<FmcInfExcelRslt> rslts = getConvertCis(fileReq, fmcExcels);
|
|
|
|
List<FmcInfExcelRslt> rslts = getConvertCis(fileReq, fmcExcels);
|
|
|
|
|
|
|
|
|
|
|
|
// TODO :: CNTC 테이블 insert
|
|
|
|
// CNTC 테이블 insert
|
|
|
|
String msg = makeCntc(rslts, fmcExcels, fileReq);
|
|
|
|
String msg = makeCntc(rslts, fmcExcels, fileReq);
|
|
|
|
|
|
|
|
|
|
|
|
// TODO :: POST-PLUS(전자우편) 일 경우 tb_ens_post_plus_json 테이블 insert
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fileReq.setSndngCo(fmcExcels.size());
|
|
|
|
fileReq.setSndngCo(fmcExcels.size());
|
|
|
|
fileReq.setUnitySndngMastrId(UUID.randomUUID().toString().replaceAll("-", ""));
|
|
|
|
fileReq.setUnitySndngMastrId(UUID.randomUUID().toString().replaceAll("-", ""));
|
|
|
|
|
|
|
|
|
|
|
@ -289,9 +286,10 @@ public class CmmEnsFileService extends EgovAbstractServiceImpl implements ICmmEn
|
|
|
|
private String makeCntc(final List<FmcInfExcelRslt> rslts, final List<FmcInfExcel> fmcExcels, FmcExcelUpload fileReq){
|
|
|
|
private String makeCntc(final List<FmcInfExcelRslt> rslts, final List<FmcInfExcel> fmcExcels, FmcExcelUpload fileReq){
|
|
|
|
int mst = 0;
|
|
|
|
int mst = 0;
|
|
|
|
int errCnt = 0;
|
|
|
|
int errCnt = 0;
|
|
|
|
|
|
|
|
String mpc = null;
|
|
|
|
final int excelCnt = fmcExcels.size();
|
|
|
|
final int excelCnt = fmcExcels.size();
|
|
|
|
|
|
|
|
final String register = StringUtils.defaultString(fileReq.getRegister(),"");
|
|
|
|
String unitySndngMastrId = "";
|
|
|
|
String unitySndngMastrId = "";
|
|
|
|
String register = StringUtils.defaultString(fileReq.getRegister(),"");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(FmcInfExcelRslt dto : rslts){
|
|
|
|
for(FmcInfExcelRslt dto : rslts){
|
|
|
|
if(StringUtils.isEmpty(String.join("", dto.getCi1(), dto.getCi2()))){
|
|
|
|
if(StringUtils.isEmpty(String.join("", dto.getCi1(), dto.getCi2()))){
|
|
|
@ -315,10 +313,33 @@ public class CmmEnsFileService extends EgovAbstractServiceImpl implements ICmmEn
|
|
|
|
.register(register)
|
|
|
|
.register(register)
|
|
|
|
.build()
|
|
|
|
.build()
|
|
|
|
);
|
|
|
|
);
|
|
|
|
mst++;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String mpc = "";
|
|
|
|
mst++;
|
|
|
|
switch (StringUtils.defaultString(fileReq.getSignguCode(), "")) {
|
|
|
|
|
|
|
|
|
|
|
|
// 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":
|
|
|
|
case "88328":
|
|
|
|
mpc = jsonCn1(dto);
|
|
|
|
mpc = jsonCn1(dto);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -327,7 +348,7 @@ public class CmmEnsFileService extends EgovAbstractServiceImpl implements ICmmEn
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//CNTC detail 생성
|
|
|
|
//CNTC detail 생성
|
|
|
|
mapper.insertCntcSndngDtl(
|
|
|
|
mapper.insertCntcSndngDtl(
|
|
|
@ -662,4 +683,88 @@ public class CmmEnsFileService extends EgovAbstractServiceImpl implements ICmmEn
|
|
|
|
+"}";
|
|
|
|
+"}";
|
|
|
|
return jsonCn;
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|