refactor: iup 모듈외 제거

main
Jonguk. Lim 3 months ago
parent f41e66e7cb
commit ad66abf3df

@ -1,4 +1,5 @@
### 프로젝트 실행 오류 처리 ### 프로젝트 실행 오류 처리
```text ```text
import static cokr.xit.ens.modules.common.ctgy.sys.mng.domain.QOrgMng.orgMng; import static cokr.xit.ens.modules.common.ctgy.sys.mng.domain.QOrgMng.orgMng;
관련해서 못찾는 경우가 발생 관련해서 못찾는 경우가 발생
@ -10,12 +11,14 @@ annotations, java 폴더가 Excluded 상태인데 마우스 우클릭해서 Sour
``` ```
### 배포 ### 배포
```text ```text
[민자] [민자]
mvn clean package -P prod-iup mvn clean package -P prod
``` ```
### 업무 ### 업무
```text ```text
[전자고지] [전자고지]
- 나이스 CI 소켓 - 나이스 CI 소켓
@ -30,6 +33,7 @@ mvn clean package -P prod-iup
``` ```
### 연계 ### 연계
```text ```text
[나이스 CI 소켓] [나이스 CI 소켓]
- /doc/NICE_CI모듈.zip - /doc/NICE_CI모듈.zip

@ -386,16 +386,16 @@
WEB-INF/classes/**/ens/batch/**, WEB-INF/classes/**/ens/batch/**,
WEB-INF/classes/**/ens/modules/**, WEB-INF/classes/**/ens/modules/**,
<!-- WEB-INF/classes/**/ens/biz/iup/**,--> <!-- WEB-INF/classes/**/ens/biz/iup/**,-->
WEB-INF/classes/application-local*.yml, WEB-INF/classes/application-local.yml,
</packageIncludesByProfile> </packageIncludesByProfile>
<packageExcludesByProfile> <packageExcludesByProfile>
</packageExcludesByProfile> </packageExcludesByProfile>
</properties> </properties>
</profile> </profile>
<profile> <profile>
<id>prod-iup</id> <id>prod</id>
<properties> <properties>
<spring.profiles.active>prod-iup</spring.profiles.active> <spring.profiles.active>prod</spring.profiles.active>
<packageIncludesByProfile> <packageIncludesByProfile>
${package.include.base} ${package.include.base}
WEB-INF/classes/**/ens/modules/**, WEB-INF/classes/**/ens/modules/**,
@ -403,7 +403,7 @@
<!-- WEB-INF/classes/**/ens/modules/kkomydoc/**,--> <!-- WEB-INF/classes/**/ens/modules/kkomydoc/**,-->
<!-- WEB-INF/classes/**/ens/modules/nvsigntalk/**,--> <!-- WEB-INF/classes/**/ens/modules/nvsigntalk/**,-->
WEB-INF/classes/**/ens/biz/iup/**, WEB-INF/classes/**/ens/biz/iup/**,
WEB-INF/classes/application-prod-iup.yml, WEB-INF/classes/application-prod.yml,
WEB-INF/classes/mybatis-mapper/**, WEB-INF/classes/mybatis-mapper/**,
</packageIncludesByProfile> </packageIncludesByProfile>
<packageExcludesByProfile> <packageExcludesByProfile>
@ -414,57 +414,5 @@
</packageExcludesByProfile> </packageExcludesByProfile>
</properties> </properties>
</profile> </profile>
<profile>
<id>prod-traffic-cc</id>
<properties>
<spring.profiles.active>prod-traffic</spring.profiles.active>
<packageIncludesByProfile>
${package.include.base}
WEB-INF/classes/**/ens/batch/**/EnsKkoMydocScheduler.class,
WEB-INF/classes/**/ens/modules/common/**,
WEB-INF/classes/**/ens/modules/kkomydoc/**,
WEB-INF/classes/**/ens/biz/traffic/chuncheon/**,
WEB-INF/classes/application-prod-traffic.yml,
</packageIncludesByProfile>
<packageExcludesByProfile>
${package.exclude.base}
WEB-INF/classes/**/ens/modules/common/ctgy/intgrnnoti/**,
</packageExcludesByProfile>
</properties>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>mybatis-mapper/**</exclude>
</excludes>
</resource>
</resources>
</build>
</profile>
<profile>
<id>prod-traffic-cheonan</id>
<properties>
<spring.profiles.active>prod-traffic-cheonan</spring.profiles.active>
<packageIncludesByProfile>
${package.include.base}
WEB-INF/classes/**/ens/batch/**/EnsIntgrnScheduler.class,
WEB-INF/classes/**/ens/batch/**/EnsKkoMydocScheduler.class,
WEB-INF/classes/**/ens/batch/**/EnsKtGibisScheduler.class,
WEB-INF/classes/**/ens/modules/**,
<!-- WEB-INF/classes/**/ens/modules/common/**,-->
<!-- WEB-INF/classes/**/ens/modules/kkomydoc/**,-->
<!-- WEB-INF/classes/**/ens/modules/ktsigntalk/gibis/**,-->
<!-- WEB-INF/classes/**/ens/modules/ktsigntalk/common/**,-->
WEB-INF/classes/**/ens/biz/traffic/cheonan/**,
WEB-INF/classes/application-prod-traffic-cheonan.yml,
WEB-INF/classes/mybatis-mapper/**,
</packageIncludesByProfile>
<packageExcludesByProfile>
${package.exclude.base}
</packageExcludesByProfile>
<webapp.lib.jdbc.oracle>ojdbc6</webapp.lib.jdbc.oracle>
</properties>
</profile>
</profiles> </profiles>
</project> </project>

@ -25,7 +25,7 @@ public class ModulePostApplication {
if (Checks.isEmpty(System.getProperty("spring.profiles.active"))) { if (Checks.isEmpty(System.getProperty("spring.profiles.active"))) {
log.error("===================================================================="); log.error("====================================================================");
log.error(">>>>>>>>>>>>>> Undefined start option <<<<<<<<<<<<<<"); log.error(">>>>>>>>>>>>>> Undefined start option <<<<<<<<<<<<<<");
log.error(">>>>>>>>>>>>>> -Dspring.profiles.active=local|dev|prod-traffic/prod-traffic-cheonan/prod-iup <<<<<<<<<<<<<<"); log.error(">>>>>>>>>>>>>> -Dspring.profiles.active=local|dev|prod <<<<<<<<<<<<<<");
log.error("============== ENS Application start fail ==============="); log.error("============== ENS Application start fail ===============");
log.error("===================================================================="); log.error("====================================================================");
System.exit(-1); System.exit(-1);

@ -1,20 +1,22 @@
package cokr.xit.ens.biz.iup.init; package cokr.xit.ens.biz.iup.init;
import cokr.xit.ens.core.init.InitJpaRunner; import java.util.ArrayList;
import cokr.xit.ens.modules.common.code.PostSeCd; import java.util.List;
import cokr.xit.ens.modules.common.ctgy.sys.mng.model.OrgMngDTO; import java.util.Map;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Profile; import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.List;
import java.util.Map; import cokr.xit.ens.core.init.InitJpaRunner;
import cokr.xit.ens.modules.common.code.PostSeCd;
import cokr.xit.ens.modules.common.ctgy.sys.mng.model.OrgMngDTO;
@Component @Component
@Transactional @Transactional
@Profile({"prod-iup", "local-maria", "local-oracle"}) @Profile({"prod", "local"})
public class IupJpaRunner extends InitJpaRunner { public class IupJpaRunner extends InitJpaRunner {
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();

@ -1,40 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.code;
import cokr.xit.ens.core.code.CodeMapperType;
/**
*
*/
public enum SndngProcessSttusCd implements CodeMapperType {
accept("접수")
, acptok("접수성공")
, acptfail("접수실패")
, ensmake("제작")
, ensstart("전송시작")
, ensok("전송성공")
, ensfail("전송실패")
, ensopen("열람중")
, ensclose("조회기간마감")
;
private final String code;
private final String codeNm;
SndngProcessSttusCd(String codeNm) {
this.code = this.name();
this.codeNm = codeNm;
}
@Override
public String getCode() {
return this.code;
}
@Override
public String getCodeNm() {
return this.codeNm;
}
}

@ -1,66 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.code;
import cokr.xit.ens.core.code.CodeMapperType;
/**
*
*/
public enum SndngResultSttusCd implements CodeMapperType {
UNKNOWN("알수없음")
, REG("등록")
, MAKING("제작")
, ACPT_OK("접수요청성공")
, ACPT_FAIL("접수실패")
, ACPT_CMPLT("접수완료")
, UNIDENTIFIED_USER("비회원")
, FORBIDDEN("수신거부")
, INVALID_VALUE("파라미터 오류")
, INTERNAL_ERROR("API 서버 내부 오류")
, INVALID_REQUEST("유효하지 않은 요청")
, FORBIDDEN_USER("허용되지 않은 사용자")
, FAIL("전송실패")
, SENT("송신")
, RECEIVED("수신")
, READ("열람")
, EXPIRED("만료")
;
private final String code;
private final String codeNm;
SndngResultSttusCd(String codeNm) {
this.code = this.name();
this.codeNm = codeNm;
}
@Override
public String getCode() {
return this.code;
}
@Override
public String getCodeNm() {
return this.codeNm;
}
public static SndngResultSttusCd valueOfEnum(String statCd) {
if (statCd == null)
return SndngResultSttusCd.UNKNOWN;
SndngResultSttusCd sndngResultSttusCd = null;
try {
sndngResultSttusCd = SndngResultSttusCd.valueOf(statCd);
} catch (IllegalArgumentException e) {
sndngResultSttusCd = SndngResultSttusCd.UNKNOWN;
}
return sndngResultSttusCd;
}
}

@ -1,49 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.code;
import cokr.xit.ens.core.code.CodeMapperType;
/**
*
*/
public enum SndngSeCd implements CodeMapperType {
UNKNOWN("알수없음")
,intgrnNoti("통합 전자고지")
,kkoMydoc("카카오페이 내문서함(인증톡)")
,kkoAlimtalk("카카오페이 알림톡")
,nvSigntalk("네이버 고지서(인증톡)")
,ktSigntalk("KT 인증톡")
,ktGibis("KT 인증톡(지비스)");
;
private final String code;
private final String codeNm;
SndngSeCd(String codeNm) {
this.code = this.name();
this.codeNm = codeNm;
}
@Override
public String getCode() {
return this.code;
}
@Override
public String getCodeNm() {
return this.codeNm;
}
public static SndngSeCd valueOfEnum(String statCd) {
if (statCd == null)
return SndngSeCd.UNKNOWN;
SndngSeCd SndngSeCd = null;
try {
SndngSeCd = SndngSeCd.valueOf(statCd);
} catch (IllegalArgumentException e) {
SndngSeCd = SndngSeCd.UNKNOWN;
}
return SndngSeCd;
}
}

@ -1,130 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.init;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.repository.TcaNhtTmplatManageRepository;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.repository.TcaRlaybsnmManageRepository;
import cokr.xit.ens.core.init.InitJpaRunner;
import cokr.xit.ens.modules.common.code.PostSeCd;
import cokr.xit.ens.modules.common.ctgy.sys.mng.model.OrgMngDTO;
import cokr.xit.ens.modules.ktsigntalk.common.code.MTypeCd;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* -
*/
//TODO: 데이터초기화 목적으로 사용. ex) 최초 배포 시
//@Component
@Transactional
@Profile({"prod-traffic-cheonan", "local-test"})
public class TrafficCaJpaRunner extends InitJpaRunner {
ObjectMapper mapper = new ObjectMapper();
// @Value("${contract.custom.dng.nice.dici.rest.client-id}")
// private String DNG_NICE_CD_CLIENT_ID;
// @Value("${contract.custom.dng.nice.dici.rest.client-secret}")
// private String DNG_NICE_CD_CLIENT_SECRET;
// @Value("${contract.custom.dng.kakao.pay.mydoc.access-token}")
// private String DNG_KKO_MD_ACCESS_TOKEN;
// @Value("${contract.custom.dng.kakao.pay.mydoc.contract-uuid}")
// private String DNG_KKO_MD_CONTRACT_UUID;
//
// @Value("${contract.custom.sbg.nice.dici.rest.client-id}")
// private String SBG_NICE_CD_CLIENT_ID;
// @Value("${contract.custom.sbg.nice.dici.rest.client-secret}")
// private String SBG_NICE_CD_CLIENT_SECRET;
// @Value("${contract.custom.sbg.kakao.pay.mydoc.access-token}")
// private String SBG_KKO_MD_ACCESS_TOKEN;
// @Value("${contract.custom.sbg.kakao.pay.mydoc.contract-uuid}")
// private String SBG_KKO_MD_CONTRACT_UUID;
@Autowired
private TcaRlaybsnmManageRepository tcaRlaybsnmManageRepository;
@Autowired
private TcaNhtTmplatManageRepository tcaNhtTmplatManageRepository;
@Override
protected List<OrgMngDTO> createOrgMngDTO() {
// List<OrgMngDTO> list = new ArrayList<>();
// list.add(createOrgMngDTO("TCA01", "", "천안-동남구", "N", null, null, DNG_NICE_CD_CLIENT_ID, DNG_NICE_CD_CLIENT_SECRET, DNG_KKO_MD_ACCESS_TOKEN, DNG_KKO_MD_CONTRACT_UUID));
// list.add(createOrgMngDTO("TCA02", "", "천안-서북구", "N", null, null, SBG_NICE_CD_CLIENT_ID, SBG_NICE_CD_CLIENT_SECRET, SBG_KKO_MD_ACCESS_TOKEN, SBG_KKO_MD_CONTRACT_UUID));
// return list;
return tcaRlaybsnmManageRepository.findAll().stream()
.map(entity -> OrgMngDTO.builder()
.orgCd(entity.getSignguCode())
.orgNm(entity.getSignguNm())
.kkoMdAccessToken(entity.getKakaoAccessToken())
.kkoMdContractUuid(entity.getKakaoContractUuid())
.kkoBpCsignYn("N")
// .kkoBpBillerCode(KKO_BP_BILLER_CODE)
// .kkoBpAuthorization(KKO_BP_AUTHORIZATION)
// .kkoBpCsignPrepayApi(kkoBpPrepayApi)
// .kkoBpCsignPayResultApi(kkoBpPayResultApi)
// .kkoAtBsid(KKO_AT_BSID)
// .kkoAtPasswd(KKO_AT_PASSWD)
// .kkoAtSenderKey(KKO_AT_SENDER_KEY)
.niceCdSiteCode(null)
.niceCdSitePw(entity.getNiceSiteCode())
.niceCdClientId(entity.getNiceClientId())
.niceCdClientSercet(entity.getNiceClientSecret())
// .nvStXNaverClientId(NV_ST_X_NAVER_CLIENT_ID)
// .nvStXNaverClientSecret(NV_ST_X_NAVER_CLIENT_SECRET)
// .nvStOrgId(nvOrgId)
// .ktStAccessToken(null)
// .ktStServiceCd(null)
// .ktStServiceKey(null)
.ktStClientId(entity.getKtClientId())
.ktStClientSecret(entity.getKtClientSecret())
.build())
.collect(Collectors.toList());
}
@Override
protected List<Map<String, Object>> createTmpltMngDTO() {
// List<Map<String, Object>> list = new ArrayList<>();
// list.add(mapper.convertValue(createTmpltMngIntgrn(PostSeCd.kkoMydoc, PostSeCd.ktGibis, null, "TCA01", "TCA0001", "주정차단속-천안-동남구", "[천안-동남구] 소유차량(#{CAR_NO})의 주정차과태료", "Y"
// , null
// , createTmpltMngKkoMydoc(null, null, null, null, null, "044-211-3377", "문의처", "Y", "Y", "Y")
// , null
// , null
// , createTmpltMngKtGibis(null, null, null, null, null, "MC001", MTypeCd.mms, 1, "044-211-3377", "044-211-3377", "Y", "Y", "Y")
// )
// , Map.class));
// list.add(mapper.convertValue(createTmpltMngIntgrn(PostSeCd.kkoMydoc, PostSeCd.ktGibis, null, "TCA02", "TCA0001", "주정차단속-천안-서북구", "[천안-서북구] 소유차량(#{CAR_NO})의 주정차과태료", "Y"
// , null
// , createTmpltMngKkoMydoc(null, null, null, null, null, "044-211-3377", "문의처", "Y", "Y", "Y")
// , null
// , null
// , createTmpltMngKtGibis(null, null, null, null, null, "MC001", MTypeCd.mms, 1, "044-211-3377", "044-211-3377", "Y", "Y", "Y")
// )
// , Map.class));
// return list;
return tcaNhtTmplatManageRepository.findAll().stream()
.map(entity -> createTmpltMngIntgrn(PostSeCd.kkoMydoc, PostSeCd.ktGibis, null, entity.getSignguCode(), entity.getNhtTmplatId(), entity.getNhtSj(), entity.getNhtCn(), "Y"
, null
, createTmpltMngKkoMydoc(null, null, null, null, null, entity.getCstmrCnterTlphonNo(), entity.getCstmrCnterNm() == null ? "문의처" : entity.getCstmrCnterNm(), "Y", "Y", "Y")
, null
, null
, createTmpltMngKtGibis(null, null, null, null, null, "?????", MTypeCd.mms, "2", 1, entity.getCstmrCnterTlphonNo(), entity.getCstmrCnterTlphonNo(), "Y", "Y", "Y")
))
.map(tmpltMngIntgrnDTO -> (Map<String, Object>) mapper.convertValue(tmpltMngIntgrnDTO, Map.class))
.collect(Collectors.toList());
}
}

@ -1,70 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.domain;
import cokr.xit.ens.biz.traffic.cheonan.code.SndngProcessSttusCd;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.embeded.FieldCreate;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.embeded.FieldUpdate;
import lombok.*;
import javax.persistence.*;
/**
*
*/
@Getter
@ToString
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "tb_elctrn_ntic_sndng")
public class TcaElctrnNticSndng {
@Id
@Column(name = "elctrn_ntic_sndng_id", length = 20)
private String elctrnNticSndngId;
@Column(name = "signgu_code", length = 5)
private String signguCode;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "nht_tmplat_id")
private TcaNhtTmplatManage tcaNhtTmplatManage;
@Column(name = "sndng_ty_code", length = 5)
private String sndngTyCode;
@Column(name = "sndng_co", length = 10)
private Integer sndngCo;
@Column(name = "sndng_process_sttus", length = 2)
@Setter
@Enumerated(EnumType.STRING)
private SndngProcessSttusCd sndngProcessSttus;
@Column(name = "sndng_dt", length = 14)
private String sndngDt;
@Column(name = "clos_dt", length = 14)
private String closDt;
@Embedded
private FieldCreate create;
@Embedded
@Setter
private FieldUpdate update;
@Column(name = "error_cn", length = 1000)
@Setter
private String errorCn;
@Lob
@Setter
@Column(name = "error_dtls")
private String errorDtls;
@Column(name = "ffnlg_code", length = 2)
private String ffnlgCode;
}

@ -1,82 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.domain;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.embeded.FieldCreate;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.embeded.FieldUpdate;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
/**
*
*/
@Getter
@ToString
@Builder
@DynamicUpdate
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "tb_elctrn_ntic_sndng_detail", schema = "", catalog = "", indexes = {
@Index(name = "idx_tca_ens_detail_01", columnList = "main_code"),
// @Index(name = "idx_tca_ens_detail_02", columnList = "external_document_uuid"),
})
public class TcaElctrnNticSndngDetail {
@Id
@Column(name = "elctrn_ntic_sndng_detail_id", length = 20)
private String elctrnNticSndngDetailId;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "elctrn_ntic_sndng_id")
private TcaElctrnNticSndng elctrnNticSndng;
@Column(name = "signgu_code", length = 5)
private String signguCode;
@Column(name = "main_code", length = 20)
private String mainCode;
@Column(name = "ihidnum", length = 100, updatable = false)
private String ihidnum;
// @Lob
// @Column(name = "cn_detail")
// private String cnDetail;
@Lob
@Column(name = "tmplt_msg_data")
private String tmpltMsgData;
@Lob
@Column(name = "mobile_page_cn")
private String mobilePageCn;
@Embedded
private FieldCreate create;
@Embedded
private FieldUpdate update;
@Column(name = "external_document_uuid", length = 40)
@Setter
private String externalDocumentUuid;
@Column(name = "ffnlg_code", length = 2)
private String ffnlgCode;
@Column(name = "use_instt_idntfc_id")
private Integer useInsttIdntfcId;
}

@ -1,65 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.domain;
import cokr.xit.ens.biz.traffic.cheonan.code.SndngResultSttusCd;
import cokr.xit.ens.biz.traffic.cheonan.code.SndngSeCd;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.embeded.FieldCreate;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import org.hibernate.annotations.UpdateTimestamp;
import javax.persistence.*;
import java.time.LocalDateTime;
/**
*
*/
@Getter
@ToString
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "tb_elctrn_ntic_sndng_result")
public class TcaElctrnNticSndngResult {
@Id
@Column(name = "elctrn_ntic_sndng_detail_id", length = 20)
private String elctrnNticSndngDetailId;
@Column(name = "sndng_result_sttus", length = 20)
@Enumerated(EnumType.STRING)
private SndngResultSttusCd sndngResultSttus;
@Column(name = "requst_dt", length = 14)
private String requstDt;
@Column(name = "inqire_dt", length = 14)
private String inqireDt;
@Column(name = "readng_dt", length = 14)
private String readngDt;
@Column(name = "error_cn", length = 1000)
private String errorCn;
@Embedded
private FieldCreate create;
@UpdateTimestamp
@Column(name = "last_updt_dt", nullable = true)
private LocalDateTime lastUpdtDt;
@Column(name = "sndng_se", length = 10)
@Enumerated(EnumType.STRING)
private SndngSeCd sndngSe;
}

@ -1,69 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.domain;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.embeded.FieldCreate;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.embeded.FieldUpdate;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import javax.persistence.*;
/**
* 릿
*/
@Getter
@ToString
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "tb_nht_tmplat_manage")
public class TcaNhtTmplatManage {
@Id
@Column(name = "nht_tmplat_id", length = 5)
private String nhtTmplatId;
@Column(name = "signgu_code", length = 5)
private String signguCode;
@Column(name = "sndng_ty_code", length = 1)
private String sndngTyCode;
@Column(name = "nht_nm", length = 1000)
private String nhtNm;
@Column(name = "nht_sj", length = 1000)
private String nhtSj;
@Column(name = "nhtCn", length = 4000)
private String nhtCn;
@Column(name = "cstmr_cnter_nm", length = 100)
private String cstmrCnterNm;
@Column(name = "cstmr_cnter_tlphon_no", length = 14)
private String cstmrCnterTlphonNo;
@Column(name = "redirect_url", length = 255)
private String redirectUrl;
@Column(name = "use_at", length = 1)
private String useAt;
@Embedded
private FieldCreate create;
@Embedded
private FieldUpdate update;
}

@ -1,70 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.domain;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.embeded.FieldCreate;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.embeded.FieldUpdate;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import javax.persistence.*;
/**
*
*/
@Getter
@ToString
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "tb_rlaybsnm_manage")
public class TcaRlaybsnmManage {
@Id
@Column(name = "signgu_code", length = 5)
private String signguCode;
@Column(name = "ffnlg_code")
private String ffnlgCode;
@Column(name = "signgu_nm")
private String signguNm;
@Column(name = "kakao_access_token")
private String kakaoAccessToken;
@Column(name = "kakao_contract_uuid")
private String kakaoContractUuid;
@Column(name = "nice_site_code")
private String niceSiteCode;
@Column(name = "nice_client_id")
private String niceClientId;
@Column(name = "nice_client_secret")
private String niceClientSecret;
@Column(name = "kt_client_id")
private String ktClientId;
@Column(name = "kt_client_secret")
private String ktClientSecret;
@Embedded
private FieldCreate create;
@Embedded
private FieldUpdate update;
}

@ -1,37 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.embeded;
import lombok.Builder;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.PrePersist;
import java.time.LocalDateTime;
@Embeddable
@Getter
@RequiredArgsConstructor
public class FieldCreate {
// @CreationTimestamp
// @Temporal(TemporalType.TIMESTAMP)
@Column(name = "regist_dt")
private LocalDateTime registDt;
@Column(name = "register", length = 50)
private String register;
@PrePersist
public void preUpdate() {
this.registDt = LocalDateTime.now();
}
@Builder(builderMethodName = "builder")
public FieldCreate(String register, LocalDateTime registDt) {
this.register = register;
this.registDt = registDt;
}
}

@ -1,34 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.embeded;
import lombok.Builder;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.PreUpdate;
import java.time.LocalDateTime;
@Embeddable
@Getter
@RequiredArgsConstructor
public class FieldUpdate {
// @UpdateTimestamp
// @Temporal(TemporalType.TIMESTAMP)
@Column(name = "updt_dt")
private LocalDateTime updtDt;
@Column(name = "updusr", length = 50)
private String updusr;
@PreUpdate
public void preUpdate() {
this.updtDt = LocalDateTime.now();
}
@Builder(builderMethodName = "builder")
public FieldUpdate(String updusr, LocalDateTime updtDt) {
this.updusr = updusr;
this.updtDt = updtDt;
}
}

@ -1,13 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.repository;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.TcaElctrnNticSndngDetail;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.Optional;
public interface TcaElctrnNticSndngDetailRepository extends JpaRepository<TcaElctrnNticSndngDetail, String>, TcaElctrnNticSndngDetailRepositoryCustom {
Optional<TcaElctrnNticSndngDetail> findByExternalDocumentUuid(String externalDocumentUuid);
}

@ -1,20 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.repository;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.TcaElctrnNticSndng;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.TcaElctrnNticSndngDetail;
import java.util.List;
import java.util.Optional;
public interface TcaElctrnNticSndngDetailRepositoryCustom {
List<TcaElctrnNticSndngDetail> findAllDecByElctrnNticSndng(TcaElctrnNticSndng elctrnNticSndng);
List<TcaElctrnNticSndngDetail> findAllFetchByElctrnNticSndngId(String elctrnNticSndngId);
Optional<Long> findLastSendMastIdByElctrnNticSndngId(String elctrnNticSndngId);
String findIhidnumDecByElctrnNticSndngDetailId(String elctrnNticSndngDetailId);
}

@ -1,86 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.repository;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.TcaElctrnNticSndng;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.TcaElctrnNticSndngDetail;
import com.querydsl.core.types.Projections;
import com.querydsl.core.types.dsl.Expressions;
import com.querydsl.jpa.impl.JPAQueryFactory;
import lombok.RequiredArgsConstructor;
import java.util.List;
import java.util.Optional;
import static cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.QTcaElctrnNticSndng.tcaElctrnNticSndng;
import static cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.QTcaElctrnNticSndngDetail.tcaElctrnNticSndngDetail;
import static cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.QTcaNhtTmplatManage.tcaNhtTmplatManage;
import static cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.QIntgrnSendDetail.intgrnSendDetail;
@RequiredArgsConstructor
public class TcaElctrnNticSndngDetailRepositoryImpl implements TcaElctrnNticSndngDetailRepositoryCustom {
private final JPAQueryFactory query;
@Override
public List<TcaElctrnNticSndngDetail> findAllDecByElctrnNticSndng(TcaElctrnNticSndng elctrnNticSndng) {
return query.select(Projections.fields(TcaElctrnNticSndngDetail.class
, tcaElctrnNticSndngDetail.elctrnNticSndngDetailId
, tcaElctrnNticSndngDetail.elctrnNticSndng
, tcaElctrnNticSndngDetail.signguCode
, tcaElctrnNticSndngDetail.mainCode
, Expressions.stringTemplate("ECL_DECRYPT({0})", tcaElctrnNticSndngDetail.ihidnum).as("ihidnum")
, tcaElctrnNticSndngDetail.tmpltMsgData
, tcaElctrnNticSndngDetail.mobilePageCn
, tcaElctrnNticSndngDetail.create
, tcaElctrnNticSndngDetail.update
, tcaElctrnNticSndngDetail.externalDocumentUuid
, tcaElctrnNticSndngDetail.ffnlgCode
, tcaElctrnNticSndngDetail.useInsttIdntfcId
))
.from(tcaElctrnNticSndngDetail)
.where(tcaElctrnNticSndngDetail.elctrnNticSndng.eq(elctrnNticSndng))
.fetch();
}
@Override
public List<TcaElctrnNticSndngDetail> findAllFetchByElctrnNticSndngId(String elctrnNticSndngId) {
return query.selectFrom(tcaElctrnNticSndngDetail)
.innerJoin(tcaElctrnNticSndngDetail.elctrnNticSndng, tcaElctrnNticSndng)
.fetchJoin()
.innerJoin(tcaElctrnNticSndng.tcaNhtTmplatManage, tcaNhtTmplatManage)
.fetchJoin()
.where(tcaElctrnNticSndngDetail.elctrnNticSndng.elctrnNticSndngId.eq(elctrnNticSndngId))
.fetch();
}
@Override
public Optional<Long> findLastSendMastIdByElctrnNticSndngId(String elctrnNticSndngId) {
return Optional.ofNullable(query.select(intgrnSendDetail.intgrnSendMast.intSendMastId)
.from(intgrnSendDetail)
// .where(intgrnSendDetail.linkedUuid.in(findExternalDocumentUuidsByLnkInputId(elctrnNticSndngId)))
.innerJoin(tcaElctrnNticSndngDetail).on(intgrnSendDetail.linkedUuid.eq(tcaElctrnNticSndngDetail.externalDocumentUuid))
.where(tcaElctrnNticSndngDetail.elctrnNticSndng.elctrnNticSndngId.eq(elctrnNticSndngId))
.groupBy(intgrnSendDetail.intgrnSendMast.intSendMastId)
.orderBy(intgrnSendDetail.intgrnSendMast.intSendMastId.desc())
.fetchFirst());
}
private List<String> findExternalDocumentUuidsByLnkInputId(String elctrnNticSndngId) {
return query.select(tcaElctrnNticSndngDetail.externalDocumentUuid)
.from(tcaElctrnNticSndngDetail)
.where(tcaElctrnNticSndngDetail.elctrnNticSndng.elctrnNticSndngId.eq(elctrnNticSndngId))
.fetch();
}
@Override
public String findIhidnumDecByElctrnNticSndngDetailId(String tcaElctrnNticSndngDetailId) {
return query.select(Expressions.stringTemplate("ECL_DECRYPT({0})", tcaElctrnNticSndngDetail.ihidnum).as("ihidnum"))
.from(tcaElctrnNticSndngDetail)
.where(tcaElctrnNticSndngDetail.elctrnNticSndngDetailId.eq(tcaElctrnNticSndngDetailId))
.fetchOne();
}
}

@ -1,16 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.repository;
import cokr.xit.ens.biz.traffic.cheonan.code.SndngProcessSttusCd;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.TcaElctrnNticSndng;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface TcaElctrnNticSndngRepository extends JpaRepository<TcaElctrnNticSndng, String> {
List<TcaElctrnNticSndng> findAllBySndngProcessSttus(SndngProcessSttusCd sndngProcessSttus);
List<TcaElctrnNticSndng> findAllBySndngProcessSttusIn(List<SndngProcessSttusCd> sndngProcessSttuss);
}

@ -1,8 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.repository;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.TcaElctrnNticSndngResult;
import org.springframework.data.jpa.repository.JpaRepository;
public interface TcaElctrnNticSndngResultRepository extends JpaRepository<TcaElctrnNticSndngResult, String>, TcaElctrnNticSndngResultRepositoryCustom {
}

@ -1,11 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.repository;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.TcaElctrnNticSndngResult;
import java.util.List;
public interface TcaElctrnNticSndngResultRepositoryCustom {
void modifyByElctrnNticSndngResults(List<TcaElctrnNticSndngResult> tcaElctrnNticSndngResults);
}

@ -1,35 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.repository;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.TcaElctrnNticSndngResult;
import com.querydsl.jpa.impl.JPAQueryFactory;
import lombok.RequiredArgsConstructor;
import java.time.LocalDateTime;
import java.util.List;
import static cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.QTcaElctrnNticSndngResult.tcaElctrnNticSndngResult;
@RequiredArgsConstructor
public class TcaElctrnNticSndngResultRepositoryImpl implements TcaElctrnNticSndngResultRepositoryCustom {
private final JPAQueryFactory query;
@Override
public void modifyByElctrnNticSndngResults(List<TcaElctrnNticSndngResult> tcaElctrnNticSndngResults) {
tcaElctrnNticSndngResults.forEach(data ->
query.update(tcaElctrnNticSndngResult)
.set(tcaElctrnNticSndngResult.sndngSe, data.getSndngSe())
.set(tcaElctrnNticSndngResult.sndngResultSttus, data.getSndngResultSttus())
.set(tcaElctrnNticSndngResult.requstDt, data.getRequstDt())
.set(tcaElctrnNticSndngResult.inqireDt, data.getInqireDt())
.set(tcaElctrnNticSndngResult.readngDt, data.getReadngDt())
.set(tcaElctrnNticSndngResult.errorCn, data.getErrorCn())
// .set(tcaElctrnNticSndngResult.create, FieldCreate.builder().build())
.set(tcaElctrnNticSndngResult.lastUpdtDt, LocalDateTime.now())
.where(tcaElctrnNticSndngResult.elctrnNticSndngDetailId.eq(data.getElctrnNticSndngDetailId()))
.execute()
);
}
}

@ -1,8 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.repository;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.TcaNhtTmplatManage;
import org.springframework.data.jpa.repository.JpaRepository;
public interface TcaNhtTmplatManageRepository extends JpaRepository<TcaNhtTmplatManage, String> {
}

@ -1,8 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.repository;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.TcaRlaybsnmManage;
import org.springframework.data.jpa.repository.JpaRepository;
public interface TcaRlaybsnmManageRepository extends JpaRepository<TcaRlaybsnmManage, String> {
}

@ -1,12 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
@Getter
@Schema(name = "TrafficCaSigntalkReqDTO")
public class TrafficCaSigntalkReqDTO {
@Schema(required = true, title = "전자 고지 발송 Id", example = " ")
private String elctrnNticSndngId;
}

@ -1,53 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.presentation;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.model.TrafficCaSigntalkReqDTO;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.service.TrafficCaSigntalkService;
import cokr.xit.ens.core.aop.EnsResponseVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
@Tag(name = "TrafficCaSigntalkController")
@Slf4j
@Controller
@RequiredArgsConstructor
public class TrafficCaSigntalkController {
private final TrafficCaSigntalkService trafficCaSigntalkService;
@Operation(summary = "접수")
@PostMapping(value = "/traffic/ca/signtalk/accept", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EnsResponseVO> accept(@RequestBody TrafficCaSigntalkReqDTO reqDTO) {
EnsResponseVO responseVO = trafficCaSigntalkService.accept(reqDTO.getElctrnNticSndngId());
return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
}
@Operation(summary = "제작")
@PutMapping(value = "/traffic/ca/signtalk/re/make", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EnsResponseVO> reMake(@RequestBody TrafficCaSigntalkReqDTO reqDTO) {
EnsResponseVO responseVO = trafficCaSigntalkService.reMake(reqDTO.getElctrnNticSndngId());
return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
}
@Operation(summary = "전송")
@PutMapping(value = "/traffic/ca/signtalk/re/send", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EnsResponseVO> reSend(@RequestBody TrafficCaSigntalkReqDTO reqDTO) {
EnsResponseVO responseVO = trafficCaSigntalkService.reSend(reqDTO.getElctrnNticSndngId());
return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
}
@Operation(summary = "전송결과가져오기")
@PostMapping(value = "/traffic/ca/signtalk/fetch", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EnsResponseVO> fetch(@RequestBody TrafficCaSigntalkReqDTO reqDTO) {
EnsResponseVO responseVO = trafficCaSigntalkService.fetch(reqDTO.getElctrnNticSndngId());
return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
}
}

@ -1,46 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.sched;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.service.TrafficCaSigntalkService;
import cokr.xit.ens.core.aop.EnsResponseVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Slf4j
@Component
@Profile("prod-traffic-cheonan")
@RequiredArgsConstructor
public class TrafficCaSigntalkScheduler {
private final TrafficCaSigntalkService trafficCaSigntalkService;
/**
*
* -. TRAFFIC ENS .
*/
@Scheduled(cron = "0 */1 7-22 * * *")
public void accepted(){
EnsResponseVO responseVO = trafficCaSigntalkService.acceptAll();
log.info("=======================================================");
log.info("[TRAFFIC] 인증톡 접수처리 결과");
log.info(responseVO.toString());
log.info("=======================================================");
}
/**
*
* -. (/) ENS -> TRAFFIC DB .
*/
@Scheduled(cron = "0 */15 7-22 * * *")
public void fetched(){
EnsResponseVO responseVO = trafficCaSigntalkService.fetchAll();
log.info("=======================================================");
log.info("[TRAFFIC] 인증톡 요청문서정보 Fetch 결과");
log.info(responseVO.toString());
log.info("=======================================================");
}
}

@ -1,169 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.service;
import cokr.xit.ens.biz.traffic.cheonan.code.SndngProcessSttusCd;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.TcaElctrnNticSndng;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.repository.TcaElctrnNticSndngRepository;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.service.support.TrafficCaSigntalkAcceptor;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.service.support.TrafficCaSigntalkFetcher;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.service.support.TrafficCaSigntalkMaker;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.service.support.TrafficCaSigntalkSender;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.core.exception.EnsException;
import cokr.xit.ens.core.exception.code.EnsErrCd;
import cokr.xit.ens.core.utils.CmmnUtil;
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.service.event.IntgrnNotiSendReserveEvent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@Service
@RequiredArgsConstructor
@Transactional
public class TrafficCaSigntalkService {
private final TcaElctrnNticSndngRepository tcaElctrnNticSndngRepository;
private final TrafficCaSigntalkAcceptor trafficCaSigntalkAcceptor;
private final TrafficCaSigntalkMaker trafficCaSigntalkMaker;
private final TrafficCaSigntalkSender trafficCaSigntalkSender;
private final TrafficCaSigntalkFetcher trafficCaSigntalkFetcher;
private final ApplicationEventPublisher applicationEventPublisher;
/**
* (TRAFFIC -> ENS)
*/
public EnsResponseVO accept(String elctrnNticSndngId) {
try {
TcaElctrnNticSndng elctrnNticSndng = tcaElctrnNticSndngRepository.findById(elctrnNticSndngId)
.orElseThrow(() -> new EnsException(EnsErrCd.ACPT404, "일치하는 자료가 없습니다."));
if (!SndngProcessSttusCd.accept.equals(elctrnNticSndng.getSndngProcessSttus()))
throw new EnsException(EnsErrCd.ACPT405, String.format("\"%s(%s)\" 상태가 아닙니다.", SndngProcessSttusCd.accept.getCodeNm(), SndngProcessSttusCd.accept));
return this.accept(Arrays.asList(elctrnNticSndng)).getResultInfo().get(0);
} catch (EnsException e) {
return EnsResponseVO.errBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
}
}
/**
* (TRAFFIC -> ENS)
*/
public EnsResponseVO<List<EnsResponseVO>> acceptAll() {
try {
List<TcaElctrnNticSndng> tcaElctrnNticSndngs = tcaElctrnNticSndngRepository.findAllBySndngProcessSttus(SndngProcessSttusCd.accept);
if (CmmnUtil.isEmpty(tcaElctrnNticSndngs))
throw new EnsException(EnsErrCd.ACPT404, String.format("\"%s(%s)\" 상태의 자료가 없습니다.", SndngProcessSttusCd.accept.getCodeNm(), SndngProcessSttusCd.accept));
return this.accept(tcaElctrnNticSndngs);
} catch (EnsException e) {
return EnsResponseVO.<List<EnsResponseVO>>errBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
}
}
private EnsResponseVO<List<EnsResponseVO>> accept(List<TcaElctrnNticSndng> tcaElctrnNticSndngs) {
EnsResponseVO responseVO = trafficCaSigntalkAcceptor.statReady(tcaElctrnNticSndngs.stream()
.map(row -> row.getElctrnNticSndngId())
.collect(Collectors.toList()));
if (!EnsErrCd.OK.equals(responseVO.getErrCode()))
return responseVO;
List<EnsResponseVO> resultInfo = tcaElctrnNticSndngs.stream()
.map(row -> trafficCaSigntalkAcceptor.execute(row.getElctrnNticSndngId()))
.collect(Collectors.toList());
List<Long> sendMastIds = resultInfo.stream()
.filter(ensResponseVO -> EnsErrCd.OK.equals(ensResponseVO.getErrCode()))
.map(ensResponseVO -> (Long) ((Map<String, Object>) ensResponseVO.getResultInfo()).get("intSendMastId"))
.collect(Collectors.toList());
IntgrnNotiSendReserveEvent event = IntgrnNotiSendReserveEvent.builder()
.sendMastIds(sendMastIds)
.callback(() -> this.fetch(tcaElctrnNticSndngs))
.build();
applicationEventPublisher.publishEvent(event);
return EnsResponseVO.<List<EnsResponseVO>>okBuilder().resultInfo(resultInfo).build();
}
/**
*
*
* @param elctrnNticSndngId
* @return
*/
public EnsResponseVO reMake(String elctrnNticSndngId) {
return trafficCaSigntalkMaker.execute(elctrnNticSndngId);
}
/**
*
*
* @param elctrnNticSndngId
* @return
*/
public EnsResponseVO reSend(String elctrnNticSndngId) {
return trafficCaSigntalkSender.execute(elctrnNticSndngId);
}
/**
* (/)
*/
public EnsResponseVO fetch(String elctrnNticSndngId) {
TcaElctrnNticSndng elctrnNticSndng = null;
try {
elctrnNticSndng = tcaElctrnNticSndngRepository.findById(elctrnNticSndngId)
.orElseThrow(() -> new EnsException(EnsErrCd.ERR404, String.format("[ elctrnNticSndngId %s ]와 일치하는 자료가 없습니다.", elctrnNticSndngId)));
} catch (EnsException e) {
return EnsResponseVO.errBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
}
return this.fetch(Arrays.asList(elctrnNticSndng));
}
/**
* (/)
*/
public EnsResponseVO fetchAll() {
List<TcaElctrnNticSndng> tcaElctrnNticSndngs = tcaElctrnNticSndngRepository.findAllBySndngProcessSttusIn(Arrays.asList(SndngProcessSttusCd.acptok, SndngProcessSttusCd.ensmake, SndngProcessSttusCd.ensstart, SndngProcessSttusCd.ensok, SndngProcessSttusCd.ensopen));
return this.fetch(tcaElctrnNticSndngs);
}
private EnsResponseVO fetch(List<TcaElctrnNticSndng> tcaElctrnNticSndngs) {
return EnsResponseVO.okBuilder()
.resultInfo(
tcaElctrnNticSndngs.stream()
.map(row -> trafficCaSigntalkFetcher.execute(row.getElctrnNticSndngId()))
.collect(Collectors.toList())
)
.build();
}
}

@ -1,247 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.service.support;
import cokr.xit.ens.biz.traffic.cheonan.code.SndngProcessSttusCd;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.TcaElctrnNticSndng;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.TcaElctrnNticSndngDetail;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.embeded.FieldUpdate;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.repository.TcaElctrnNticSndngDetailRepository;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.repository.TcaElctrnNticSndngRepository;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.service.support.accept.AcptDocKkoMd;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.service.support.accept.AcptDocKtGbs;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.core.exception.EnsException;
import cokr.xit.ens.core.exception.code.EnsErrCd;
import cokr.xit.ens.core.utils.Checks;
import cokr.xit.ens.core.utils.CmmnUtil;
import cokr.xit.ens.core.utils.MapDeserailizer;
import cokr.xit.ens.modules.common.biztmplt.EnsPhaseProcSupport;
import cokr.xit.ens.modules.common.code.VenderCd;
import cokr.xit.ens.core.model.EnsBillAcptReqDTO;
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.model.IntgrnNotiAcceptReqDTO;
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.model.config.AcptData;
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.model.config.Document;
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.model.config.Receiver;
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.model.config.XitProperty;
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.service.IntgrnNotiService;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.bytebuddy.utility.RandomString;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@Slf4j
@Component
@RequiredArgsConstructor
public class TrafficCaSigntalkAcceptor implements EnsPhaseProcSupport<EnsResponseVO, String> {
private final TcaElctrnNticSndngRepository tcaElctrnNticSndngRepository;
private final TcaElctrnNticSndngDetailRepository elctrnNticSndngDetailRepository;
private final IntgrnNotiService intgrnNotiService;
private Gson gson = new GsonBuilder().registerTypeAdapter(Map.class, new MapDeserailizer()).serializeNulls().create();
@Value("${xit.mblpage.postse.intgrn.url}")
private String MBLPAGE_URL;
@Value("${xit.mblpage.postse.intgrn.path}")
private String MBLPAGE_PATH;
/**
* Accept
*
* @param elctrnNticSndngIds
* @return
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statReady(List<String> elctrnNticSndngIds) {
try {
AtomicInteger index = new AtomicInteger();
String prefixExternalDocumentUuid = String.format("B-%s%s", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")), RandomString.make(5));
elctrnNticSndngIds.stream()
.map(elctrnNticSndngId -> tcaElctrnNticSndngRepository.findById(elctrnNticSndngId).get())
.map(elctrnNticSndng -> elctrnNticSndngDetailRepository.findAllDecByElctrnNticSndng(elctrnNticSndng))
.forEach(list -> {
list.stream()
.forEach(row -> {
row.setExternalDocumentUuid(String.format("%s%09d", prefixExternalDocumentUuid, index.getAndIncrement() + 1));
});
elctrnNticSndngDetailRepository.saveAll(list);
}
);
return EnsResponseVO.okBuilder().build();
} catch (Exception e) {
return EnsResponseVO.errBuilder()
.errCode(EnsErrCd.ACPT500)
.errMsg(String.format("문서식별번호(외부) 생성에 실패 했습니다. %s", e.getMessage()))
.build();
}
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statBegin(String elctrnNticSndngId) {
log.info("no process");
return null;
}
/**
*
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO execute(String elctrnNticSndngId) {
Map<String, Object> resultInfo = new HashMap<>();
resultInfo.put("elctrnNticSndngId", elctrnNticSndngId);
EnsResponseVO responseVO = null;
TcaElctrnNticSndng elctrnNticSndng = null;
try {
elctrnNticSndng = tcaElctrnNticSndngRepository.findById(elctrnNticSndngId)
.orElseThrow(() -> new EnsException(EnsErrCd.ACPT404, String.format("일치하는 TB_ELCTRN_NTIC_SNDNG 데이터가 없습니다. [ elctrnNticSndngId %s ]", elctrnNticSndngId)));
IntgrnNotiAcceptReqDTO reqDTO = this.convertTbInputDataToAcceptReqDTO(elctrnNticSndngDetailRepository.findAllFetchByElctrnNticSndngId(elctrnNticSndng.getElctrnNticSndngId()));
EnsResponseVO reqResp = intgrnNotiService.accept(reqDTO);
if (EnsErrCd.OK.equals(reqResp.getErrCode())) {
resultInfo.put("intSendMastId", (Long) ((Map<String, Object>) reqResp.getResultInfo()).get("intSendMastId"));
responseVO = EnsResponseVO.okBuilder().resultInfo(resultInfo).build();
} else {
responseVO = EnsResponseVO.errRsltBuilder()
.errCode(reqResp.getErrCode())
.errMsg(reqResp.getErrMsg())
.resultInfo(reqResp.getResultInfo())
.build();
}
} catch (EnsException e) {
responseVO = EnsResponseVO.errRsltBuilder()
.errCode(e.getErrCd())
.errMsg(String.format("인증톡 \"접수\" 처리 실패. [%s] %s", e.getErrCd().getCode(), e.getMessage()))
.resultInfo(resultInfo)
.build();
} catch (Exception e) {
responseVO = EnsResponseVO.errRsltBuilder()
.errCode(EnsErrCd.ACPT500)
.errMsg(String.format("인증톡 \"접수\" 처리 실패. %s", e.getMessage()))
.resultInfo(resultInfo)
.build();
} finally {
if (EnsErrCd.OK.equals(responseVO.getErrCode())) {
elctrnNticSndng.setUpdate(FieldUpdate.builder()
.updusr("ENS_SYS")
.updtDt(LocalDateTime.now())
.build());
elctrnNticSndng.setSndngProcessSttus(SndngProcessSttusCd.acptok);
elctrnNticSndng.setErrorCn(null);
} else {
elctrnNticSndng.setUpdate(FieldUpdate.builder()
.updusr("ENS_SYS")
.updtDt(LocalDateTime.now())
.build());
elctrnNticSndng.setSndngProcessSttus(SndngProcessSttusCd.acptfail);
elctrnNticSndng.setErrorCn(responseVO.getErrMsg());
if (responseVO.getResultInfo() != null && (responseVO.getResultInfo() instanceof List || responseVO.getResultInfo() instanceof Map))
elctrnNticSndng.setErrorDtls(gson.toJson(responseVO.getResultInfo()));
}
}
return responseVO;
}
private IntgrnNotiAcceptReqDTO convertTbInputDataToAcceptReqDTO(List<TcaElctrnNticSndngDetail> list) {
return IntgrnNotiAcceptReqDTO.builder()
.vender(VenderCd.none.getCode())
.org_cd(list.get(0).getElctrnNticSndng().getSignguCode())
.tmplt_cd(list.get(0).getElctrnNticSndng().getTcaNhtTmplatManage().getNhtTmplatId())
.post_bundle_title(
String.format("%s(%s건)-%s"
, list.get(0).getElctrnNticSndng().getTcaNhtTmplatManage().getNhtNm()
, list.get(0).getElctrnNticSndng().getSndngCo()
, LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))
)
)
.send_dt(list.get(0).getElctrnNticSndng().getSndngDt())
.close_dt(list.get(0).getElctrnNticSndng().getClosDt())
.documents(
list.stream()
.map(row -> this.createDocument(row))
.collect(Collectors.toList())
)
.build();
}
private Document createDocument(TcaElctrnNticSndngDetail data) throws EnsException {
String jid = elctrnNticSndngDetailRepository.findIhidnumDecByElctrnNticSndngDetailId(data.getElctrnNticSndngDetailId());
jid = Checks.isCheckJid(jid) ? jid : "1111111111111";
Map<String, String> tmpltMsgData = null;
if (!CmmnUtil.isEmpty(data.getTmpltMsgData()))
try {
tmpltMsgData = gson.fromJson(data.getTmpltMsgData(), Map.class);
} catch (Exception e) {
throw new EnsException(EnsErrCd.ACPT411, "템플릿메시지데이터의 값은 JSON 포맷만 가능 합니다.");
}
return Document.builder()
.linked_uuid(data.getExternalDocumentUuid())
.receiver(Receiver.builder()
.ci(null)
// .jid(data.getIhidnum())
.jid(jid)
.mblphon_no(null)
.build())
.acpt_data(AcptData.builder()
.kko_md(new AcptDocKkoMd(data, MBLPAGE_URL + MBLPAGE_PATH).createDocument())
.kko_at(null)
.nv_st(null)
.kt_gbs(new AcptDocKtGbs(data, MBLPAGE_URL + MBLPAGE_PATH).createDocument())
.build())
.xit_property(XitProperty.builder()
.bill_acpt_data(this.createBillAcptData(data))
.tmplt_msg_data(tmpltMsgData)
.mbl_page_data(this.createDetails(data))
.build())
.build();
}
private EnsBillAcptReqDTO createBillAcptData(TcaElctrnNticSndngDetail data) {
return null;
}
private Map<String, List<Map<String, Object>>> createDetails(TcaElctrnNticSndngDetail data) {
try {
Map<String, List<Map<String, Object>>> m = gson.fromJson(data.getMobilePageCn(), Map.class);
return m;
} catch (Exception e) {
log.error("\"mobilePageCn\" Json Parse 실패. {}", data.getMobilePageCn());
return null;
}
}
}

@ -1,179 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.service.support;
import cokr.xit.ens.biz.traffic.cheonan.code.SndngProcessSttusCd;
import cokr.xit.ens.biz.traffic.cheonan.code.SndngResultSttusCd;
import cokr.xit.ens.biz.traffic.cheonan.code.SndngSeCd;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.TcaElctrnNticSndng;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.TcaElctrnNticSndngDetail;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.TcaElctrnNticSndngResult;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.embeded.FieldCreate;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.embeded.FieldUpdate;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.repository.TcaElctrnNticSndngDetailRepository;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.repository.TcaElctrnNticSndngRepository;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.repository.TcaElctrnNticSndngResultRepository;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.core.exception.EnsException;
import cokr.xit.ens.core.exception.code.EnsErrCd;
import cokr.xit.ens.core.utils.CmmnUtil;
import cokr.xit.ens.modules.common.biztmplt.EnsPhaseProcSupport;
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.model.IntgrnDetailStatVO;
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.model.IntgrnNotiRsltRespDTO;
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.service.IntgrnNotiService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@Component
@RequiredArgsConstructor
public class TrafficCaSigntalkFetcher implements EnsPhaseProcSupport<EnsResponseVO, String> {
private final TcaElctrnNticSndngRepository tcaElctrnNticSndngRepository;
private final TcaElctrnNticSndngDetailRepository elctrnNticSndngDetailRepository;
private final TcaElctrnNticSndngResultRepository tcaElctrnNticSndngResultRepository;
private final IntgrnNotiService intgrnNotiService;
/**
* Fetch
*
* @param elctrnNticSndngIds
* @return
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statReady(List<String> elctrnNticSndngIds) {
log.info("no process");
return null;
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statBegin(String elctrnNticSndngId) {
log.info("no process");
return null;
}
/**
* (/)
*
* @param elctrnNticSndngId
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO execute(String elctrnNticSndngId) {
EnsResponseVO responseVO = null;
Map<String, Object> resultInfo = new HashMap<>();
resultInfo.put("elctrnNticSndngId", elctrnNticSndngId);
IntgrnNotiRsltRespDTO respDTO = null;
try {
Long intSendMastId = elctrnNticSndngDetailRepository.findLastSendMastIdByElctrnNticSndngId(elctrnNticSndngId)
.orElseThrow(() -> new EnsException(EnsErrCd.RSLT404, "일치하는 ENS 접수자료가 없습니다."));
resultInfo.put("intSendMastId", intSendMastId);
EnsResponseVO apiRespVO = intgrnNotiService.sendResultProvide(intSendMastId);
respDTO = (IntgrnNotiRsltRespDTO) apiRespVO.getResultInfo();
List<TcaElctrnNticSndngResult> tcaElctrnNticSndngResults = respDTO.getDocuments().stream()
.map(row -> {
return TcaElctrnNticSndngResult.builder()
.sndngSe(SndngSeCd.valueOfEnum(row.getCurPostSe().getCode()))
.elctrnNticSndngDetailId(elctrnNticSndngDetailRepository.findByExternalDocumentUuid(row.getLinkedUuid())
.orElse(new TcaElctrnNticSndngDetail())
.getElctrnNticSndngDetailId())
.sndngResultSttus(this.sndngResultSttus(row))
.requstDt(row.getDocSentDt())
.inqireDt(row.getDocReceivedDt())
.readngDt(row.getDocReadFrstDt())
.errorCn(CmmnUtil.isEmpty(row.getErrorMessage()) ? null : row.getErrorMessage())
.create(FieldCreate.builder()
.register("ENS_SYS")
.registDt(LocalDateTime.now())
.build())
.build();
})
.collect(Collectors.toList());
if (tcaElctrnNticSndngResultRepository.findById(tcaElctrnNticSndngResults.get(0).getElctrnNticSndngDetailId()).isPresent())
tcaElctrnNticSndngResultRepository.modifyByElctrnNticSndngResults(tcaElctrnNticSndngResults);
else
tcaElctrnNticSndngResultRepository.saveAll(tcaElctrnNticSndngResults);
responseVO = EnsResponseVO.okBuilder().resultInfo(resultInfo).build();
} catch (EnsException e) {
responseVO = EnsResponseVO.errBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
} catch (Exception e) {
responseVO = EnsResponseVO.errBuilder()
.errCode(EnsErrCd.RSLT999)
.errMsg(String.format("[elctrnNticSndngId %s]에 대한 전송결과 FETCH 처리 실패. %s", elctrnNticSndngId, e.getMessage()))
.build();
} finally {
TcaElctrnNticSndng elctrnNticSndng = tcaElctrnNticSndngRepository.findById(elctrnNticSndngId).orElseThrow(() -> new EnsException(EnsErrCd.RSLT404, "일치하는 tbInputXit 자료가 없습니다."));
if (EnsErrCd.OK.equals(responseVO.getErrCode())) {
elctrnNticSndng.setUpdate(FieldUpdate.builder()
.updusr("ENS_SYS")
.updtDt(LocalDateTime.now())
.build());
elctrnNticSndng.setSndngProcessSttus(this.sndngProcessSttus(respDTO, elctrnNticSndng.getSndngProcessSttus()));
elctrnNticSndng.setErrorCn(null);
} else {
elctrnNticSndng.setUpdate(FieldUpdate.builder()
.updusr("ENS_SYS")
.updtDt(LocalDateTime.now())
.build());
elctrnNticSndng.setSndngProcessSttus(SndngProcessSttusCd.ensfail);
elctrnNticSndng.setErrorCn(responseVO.getErrMsg());
}
}
return responseVO;
}
private SndngProcessSttusCd sndngProcessSttus(IntgrnNotiRsltRespDTO respDTO, SndngProcessSttusCd sndngProcessSttus) {
switch (respDTO.getStatCd()) {
case accept:
return sndngProcessSttus;
case makefail:
case sendfail:
return SndngProcessSttusCd.ensfail;
case makerdy:
case making:
case makeok:
return SndngProcessSttusCd.ensmake;
case sendrdy:
case sending:
return SndngProcessSttusCd.ensstart;
case sendok:
case sendcmplt:
return SndngProcessSttusCd.ensok;
case open:
return SndngProcessSttusCd.ensopen;
case close:
return SndngProcessSttusCd.ensclose;
default:
return sndngProcessSttus;
}
}
private SndngResultSttusCd sndngResultSttus(IntgrnDetailStatVO row) {
return SndngResultSttusCd.valueOfEnum(row.getCurStatCd().getIntgrnDtlStatCd().getCode());
}
}

@ -1,64 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.service.support;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.repository.TcaElctrnNticSndngDetailRepository;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.core.exception.EnsException;
import cokr.xit.ens.core.exception.code.EnsErrCd;
import cokr.xit.ens.modules.common.biztmplt.EnsPhaseProcSupport;
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.service.IntgrnNotiService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Slf4j
@Component
@RequiredArgsConstructor
public class TrafficCaSigntalkMaker implements EnsPhaseProcSupport<EnsResponseVO, String> {
private final TcaElctrnNticSndngDetailRepository elctrnNticSndngDetailRepository;
private final IntgrnNotiService intgrnNotiService;
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statReady(List<String> elctrnNticSndngIds) {
log.info("no process");
return null;
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statBegin(String elctrnNticSndngId) {
log.info("no process");
return null;
}
/**
*
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO execute(String elctrnNticSndngId) {
EnsResponseVO responseVO = null;
try {
Long intSendMastId = elctrnNticSndngDetailRepository.findLastSendMastIdByElctrnNticSndngId(elctrnNticSndngId)
.orElseThrow(() -> new EnsException(EnsErrCd.MAKE404, "일치하는 ENS 접수자료가 없습니다."));
responseVO = intgrnNotiService.remake(intSendMastId);
} catch (EnsException e) {
responseVO = EnsResponseVO.errBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
}
return responseVO;
}
}

@ -1,64 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.service.support;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.repository.TcaElctrnNticSndngDetailRepository;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.core.exception.EnsException;
import cokr.xit.ens.core.exception.code.EnsErrCd;
import cokr.xit.ens.modules.common.biztmplt.EnsPhaseProcSupport;
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.service.IntgrnNotiService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Slf4j
@Component
@RequiredArgsConstructor
public class TrafficCaSigntalkSender implements EnsPhaseProcSupport<EnsResponseVO, String> {
private final TcaElctrnNticSndngDetailRepository elctrnNticSndngDetailRepository;
private final IntgrnNotiService intgrnNotiService;
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statReady(List<String> elctrnNticSndngIds) {
log.info("no process");
return null;
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statBegin(String elctrnNticSndngId) {
log.info("no process");
return null;
}
/**
*
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO execute(String elctrnNticSndngId) {
EnsResponseVO responseVO = null;
try {
Long intSendMastId = elctrnNticSndngDetailRepository.findLastSendMastIdByElctrnNticSndngId(elctrnNticSndngId)
.orElseThrow(() -> new EnsException(EnsErrCd.SEND404, "일치하는 ENS 접수자료가 없습니다."));
responseVO = intgrnNotiService.sendBulk(intSendMastId);
} catch (EnsException e) {
responseVO = EnsResponseVO.errBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
}
return responseVO;
}
}

@ -1,5 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.service.support.accept;
public interface Accept<T> {
T createDocument();
}

@ -1,40 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.service.support.accept;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.TcaElctrnNticSndngDetail;
import cokr.xit.ens.core.utils.DateUtil;
import cokr.xit.ens.modules.kkomydoc.model.config.DocumentConfKkoMd;
import cokr.xit.ens.modules.kkomydoc.model.config.Property;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
@RequiredArgsConstructor
public class AcptDocKkoMd implements Accept<DocumentConfKkoMd> {
private final TcaElctrnNticSndngDetail tcaElctrnNticSndngDetail;
private final String redirectUrl;
@Override
public DocumentConfKkoMd createDocument() {
return DocumentConfKkoMd.builder()
.hash(null)
.common_categories(Arrays.asList("NOTICE"))
.read_expired_at(DateUtil.dateToAbsTimeSec(tcaElctrnNticSndngDetail.getElctrnNticSndng().getClosDt()))
// .read_expired_sec()
.property(this.createProperty())
.bridge(null)
.build();
}
private Property createProperty() {
return Property.builder()
.link(this.redirectUrl)
.payload(null)
.message(null)
.cs_name(null)
.cs_number(null)
.build();
}
}

@ -1,26 +0,0 @@
package cokr.xit.ens.biz.traffic.cheonan.signtalk.service.support.accept;
import cokr.xit.ens.biz.traffic.cheonan.signtalk.domain.TcaElctrnNticSndngDetail;
import cokr.xit.ens.modules.ktsigntalk.gibis.model.config.DocumentConfKtGbs;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
public class AcptDocKtGbs implements Accept<DocumentConfKtGbs> {
private final TcaElctrnNticSndngDetail tcaElctrnNticSndngDetail;
private final String redirectUrl;
@Override
public DocumentConfKtGbs createDocument() {
return DocumentConfKtGbs.builder()
.hash(null)
.srcSeq(null)
.mmsDtlCnts(null)
// .mmsTitle()
.rcsDtlCnts(null)
.url(redirectUrl)
.mdn(null)
.build();
}
}

@ -1,125 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.init;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.repository.NhtTmplatManageRepository;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.modules.common.ctgy.sys.mng.model.OrgMngDTO;
import cokr.xit.ens.modules.common.ctgy.sys.mng.service.OrgMngService;
import cokr.xit.ens.modules.common.ctgy.sys.mng.service.TmpltMngService;
import cokr.xit.ens.modules.kkomydoc.model.TmpltMngKkoMydocDTO;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* -
*/
@Component
@Transactional
@Profile({"prod-traffic"})
public class TrafficCcJpaRunner implements ApplicationRunner {
@Autowired
private OrgMngService orgMngService;
@Autowired
private TmpltMngService tmpltMngService;
ObjectMapper mapper = new ObjectMapper();
@Value("${contract.kakao.pay.mydoc.access-token}")
private String KKO_MD_ACCESS_TOKEN = "b40d3c623d1011ecbceae6cf4630da62";
@Value("${contract.kakao.pay.mydoc.contract-uuid}")
private String KKO_MD_CONTRACT_UUID = "CON-b4126c833d1011ecbceae6cf4630da62";
private String KKO_BP_BILLER_CODE = null;
private String KKO_BP_AUTHORIZATION = null;
private String KKO_AT_BSID = null;
private String KKO_AT_PASSWD = null;
private String KKO_AT_SENDER_KEY = null;
@Value("${contract.nice.dici.socket.site-code}")
private final String NICE_CD_SITE_CODE = "EQ00";
@Value("${contract.nice.dici.socket.site-pw}")
private String NICE_CD_SITE_PW = "76646885";
private String NV_ST_X_NAVER_CLIENT_ID = null;
private String NV_ST_X_NAVER_CLIENT_SECRET = null;
@Autowired
private NhtTmplatManageRepository nhtTmplatManageRepository;
@Override
public void run(ApplicationArguments args) throws Exception {
List<EnsResponseVO> orgMngResult = createOrgMngDTO().stream().map(dto -> orgMngService.add(dto)).collect(Collectors.toList());
List<EnsResponseVO> tmpltMngResult = createTmpltMngDTO().stream().map(map -> tmpltMngService.add(map, (String) map.get("dtype"))).collect(Collectors.toList());
System.out.println("============================================================================================================");
System.out.println("======== Initailize Information [OrgMng & TmpltMng] :: active profiles - " + System.getProperty("spring.profiles.active") + " ========");
System.out.println(orgMngResult.toString());
System.out.println(tmpltMngResult.toString());
System.out.println("============================================================================================================");
}
private List<OrgMngDTO> createOrgMngDTO() {
List<OrgMngDTO> list = nhtTmplatManageRepository.findAll()
.stream()
.map(data -> createOrgMngDTO(data.getSignguCode(), "주정차웹CC-" + data.getSignguCode()))
.collect(Collectors.toList());
return list;
}
private List<Map<String, Object>> createTmpltMngDTO() {
List<Map<String, Object>> list = nhtTmplatManageRepository.findAll()
.stream()
.map(data -> createTmpltMngKkoMydoc(data.getSignguCode(), data.getNhtTmplatId(), data.getNhtSj(), data.getNhtCn(), "Y", data.getCstmrCnterTlphonNo(), data.getCstmrCnterNm(), "Y", "Y", "Y"))
.collect(Collectors.toList());
return list;
}
final private OrgMngDTO createOrgMngDTO(String orgCd, String orgNm) {
return OrgMngDTO.builder()
.orgCd(orgCd)
.orgNm(orgNm)
.kkoMdAccessToken(KKO_MD_ACCESS_TOKEN)
.kkoMdContractUuid(KKO_MD_CONTRACT_UUID)
.kkoBpBillerCode(KKO_BP_BILLER_CODE)
.kkoBpAuthorization(KKO_BP_AUTHORIZATION)
.kkoBpCsignYn("N")
.kkoBpPrepayApi(null)
.kkoBpPayResultApi(null)
.kkoAtBsid(KKO_AT_BSID)
.kkoAtPasswd(KKO_AT_PASSWD)
.kkoAtSenderKey(KKO_AT_SENDER_KEY)
.niceCdSiteCode(NICE_CD_SITE_CODE)
.niceCdSitePw(NICE_CD_SITE_PW)
.nvStXNaverClientId(NV_ST_X_NAVER_CLIENT_ID)
.nvStXNaverClientSecret(NV_ST_X_NAVER_CLIENT_SECRET)
.nvStOrgId(null)
.build();
}
final private Map<String, Object> createTmpltMngKkoMydoc(String orgCd, String tmpltCd, String title, String message, String useYn, String csNumber, String csName, String ciTransUseYn, String tmpltMsgUseYn, String tmpltCsInfoUseYn) {
return mapper.convertValue(TmpltMngKkoMydocDTO.builder()
.dtype("kkomd")
.orgCd(orgCd)
.tmpltCd(tmpltCd)
.title(title)
.message(message)
.useYn(useYn == null ? "Y" : useYn)
.csNumber(csNumber)
.csName(csName)
.ciTransUseYn(ciTransUseYn)
.tmpltMsgUseYn(tmpltMsgUseYn)
.tmpltCsInfoUseYn(tmpltCsInfoUseYn)
.build(), Map.class);
}
}

@ -1,73 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.embeded.FieldCreate;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.embeded.FieldUpdate;
import lombok.*;
import org.springframework.context.annotation.Profile;
import javax.persistence.*;
/**
* <ul>
* <li> : </li>
* <li> : </li>
* <li>: 2021. 12. 22. 5:44:32
* </ul>
*
* @author
*/
@Getter
@ToString
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "tb_elctrn_ntic_sndng")
@Profile("prod-traffic")
public class ElctrnNticSndng {
@Id
@Column(name = "elctrn_ntic_sndng_id", length = 20)
private String elctrnNticSndngId;
@Column(name = "signgu_code", length = 5)
private String signguCode;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "nht_tmplat_id")
private NhtTmplatManage nhtTmplatManage;
@Column(name = "sndng_ty_code", length = 5)
private String sndngTyCode;
@Column(name = "sndng_co", length = 10)
private Integer sndngCo;
@Column(name = "sndng_process_sttus", length = 2)
@Setter
private String sndngProcessSttus;
@Column(name = "sndng_dt", length = 14)
private String sndngDt;
@Column(name = "clos_dt", length = 14)
private String closDt;
@Embedded
private FieldCreate create;
@Embedded
@Setter
private FieldUpdate update;
@Column(name = "error_cn", length = 1000)
@Setter
private String errorCn;
@Lob
@Setter
@Column(name = "error_dtls")
private String errorDtls;
}

@ -1,68 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.embeded.FieldCreate;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.embeded.FieldUpdate;
import lombok.*;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.context.annotation.Profile;
import javax.persistence.*;
/**
* <ul>
* <li> : </li>
* <li> : </li>
* <li>: 2021. 12. 22. 5:45:01
* </ul>
*
* @author mk1126sj
*/
@Getter
@ToString
@Builder
@DynamicUpdate
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "tb_elctrn_ntic_sndng_detail", schema = "", catalog = "", indexes = {
@Index(name = "idx_tcc_ens_detail_01", columnList = "external_document_uuid")
})
@Profile("prod-traffic")
public class ElctrnNticSndngDetail {
@Id
@Column(name = "elctrn_ntic_sndng_detail_id", length = 20)
private String elctrnNticSndngDetailId;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "elctrn_ntic_sndng_id")
private ElctrnNticSndng elctrnNticSndng;
@Column(name = "signgu_code", length = 5, columnDefinition = "char")
private String signguCode;
@Column(name = "main_code", length = 20)
private String mainCode;
@Column(name = "ihidnum", length = 100, updatable = false)
private String ihidnum;
@Lob
@Column(name = "cn_detail")
private String cnDetail;
@Lob
@Column(name = "mobile_page_cn")
private String mobilePageCn;
@Embedded
private FieldCreate create;
@Embedded
private FieldUpdate update;
@Column(name = "external_document_uuid", length = 40)
@Setter
private String externalDocumentUuid;
}

@ -1,52 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.embeded.FieldCreate;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import org.hibernate.annotations.UpdateTimestamp;
import org.springframework.context.annotation.Profile;
import javax.persistence.*;
import java.time.LocalDateTime;
/**
* <ul>
* <li> : </li>
* <li> : </li>
* <li>: 2021. 12. 22. 5:45:14
* </ul>
*
* @author mk1126sj
*/
@Getter
@ToString
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "tb_elctrn_ntic_sndng_result")
@Profile("prod-traffic")
public class ElctrnNticSndngResult {
@Id
@Column(name = "elctrn_ntic_sndng_detail_id", length = 20)
private String elctrnNticSndngDetailId;
@Column(name = "sndng_result_code", length = 4)
private String sndngResultCode;
@Column(name = "requst_dt", length = 14)
private String requstDt;
@Column(name = "inqire_dt", length = 14)
private String inqireDt;
@Column(name = "readng_dt", length = 14)
private String readngDt;
@Column(name = "error_cn", length = 1000)
private String errorCn;
@Embedded
private FieldCreate create;
@UpdateTimestamp
@Column(name = "last_updt_dt", nullable = true)
private LocalDateTime lastUpdtDt;
}

@ -1,68 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.embeded.FieldCreate;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.embeded.FieldUpdate;
import lombok.*;
import org.springframework.context.annotation.Profile;
import javax.persistence.*;
/**
* <ul>
* <li> : 릿 </li>
* <li> : </li>
* <li>: 2021. 12. 22. 5:44:32
* </ul>
*
* @author
*/
@Getter
@ToString
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "tb_nht_tmplat_manage")
@Profile("prod-traffic")
public class NhtTmplatManage {
@Id
@Column(name = "nht_tmplat_id", length = 5)
private String nhtTmplatId;
@Column(name = "signgu_code", columnDefinition = "char(5)")
private String signguCode;
@Column(name = "sndng_ty_code", length = 1)
private String sndngTyCode;
@Column(name = "nht_nm", length = 1000)
private String nhtNm;
@Column(name = "nht_sj", length = 1000)
private String nhtSj;
@Column(name = "nhtCn", length = 4000)
private String nhtCn;
@Column(name = "cstmr_cnter_nm", length = 100)
private String cstmrCnterNm;
@Column(name = "cstmr_cnter_tlphon_no", length = 14)
private String cstmrCnterTlphonNo;
@Column(name = "redirect_url", length = 255)
private String redirectUrl;
@Column(name = "use_at", length = 1)
private String useAt;
@Embedded
private FieldCreate create;
@Embedded
private FieldUpdate update;
}

@ -1,35 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.embeded;
import lombok.*;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.PrePersist;
import java.time.LocalDateTime;
@Embeddable
@Getter
@RequiredArgsConstructor
public class FieldCreate {
// @CreationTimestamp
// @Temporal(TemporalType.TIMESTAMP)
@Column(name = "regist_dt")
private LocalDateTime registDt;
@Column(name = "register", length = 50)
private String register;
@PrePersist
public void preUpdate() {
this.registDt = LocalDateTime.now();
}
@Builder(builderMethodName = "builder")
public FieldCreate(String register, LocalDateTime registDt) {
this.register = register;
this.registDt = registDt;
}
}

@ -1,34 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.embeded;
import lombok.Builder;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.PreUpdate;
import java.time.LocalDateTime;
@Embeddable
@Getter
@RequiredArgsConstructor
public class FieldUpdate {
// @UpdateTimestamp
// @Temporal(TemporalType.TIMESTAMP)
@Column(name = "updt_dt")
private LocalDateTime updtDt;
@Column(name = "updusr", length = 50)
private String updusr;
@PreUpdate
public void preUpdate() {
this.updtDt = LocalDateTime.now();
}
@Builder(builderMethodName = "builder")
public FieldUpdate(String updusr, LocalDateTime updtDt) {
this.updusr = updusr;
this.updtDt = updtDt;
}
}

@ -1,12 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.repository;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.ElctrnNticSndngDetail;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.Optional;
public interface ElctrnNticSndngDetailRepository extends JpaRepository<ElctrnNticSndngDetail, String>, ElctrnNticSndngDetailRepositoryCustom {
Optional<ElctrnNticSndngDetail> findByExternalDocumentUuid(String externalDocumentUuid);
}

@ -1,20 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.repository;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.ElctrnNticSndng;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.ElctrnNticSndngDetail;
import java.util.List;
import java.util.Optional;
public interface ElctrnNticSndngDetailRepositoryCustom {
List<ElctrnNticSndngDetail> findAllDecByElctrnNticSndng(ElctrnNticSndng elctrnNticSndng);
List<ElctrnNticSndngDetail> findAllFetchByElctrnNticSndngId(String elctrnNticSndngId);
Optional<Long> findLastSendMastIdByElctrnNticSndngId(String elctrnNticSndngId);
String findIhidnumDecByElctrnNticSndngDetailId(String elctrnNticSndngDetailId);
}

@ -1,83 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.repository;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.ElctrnNticSndng;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.ElctrnNticSndngDetail;
import com.querydsl.core.types.Projections;
import com.querydsl.core.types.dsl.Expressions;
import com.querydsl.jpa.impl.JPAQueryFactory;
import lombok.RequiredArgsConstructor;
import java.util.List;
import java.util.Optional;
import static cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.QElctrnNticSndng.elctrnNticSndng;
import static cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.QElctrnNticSndngDetail.elctrnNticSndngDetail;
import static cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.QNhtTmplatManage.nhtTmplatManage;
import static cokr.xit.ens.modules.kkomydoc.domain.QSendDetailKkoMydoc.sendDetailKkoMydoc;
@RequiredArgsConstructor
public class ElctrnNticSndngDetailRepositoryImpl implements ElctrnNticSndngDetailRepositoryCustom {
private final JPAQueryFactory query;
@Override
public List<ElctrnNticSndngDetail> findAllDecByElctrnNticSndng(ElctrnNticSndng elctrnNticSndng) {
return query.select(Projections.fields(ElctrnNticSndngDetail.class
, elctrnNticSndngDetail.elctrnNticSndngDetailId
, elctrnNticSndngDetail.elctrnNticSndng
, elctrnNticSndngDetail.signguCode
, elctrnNticSndngDetail.mainCode
, Expressions.stringTemplate("ECL_DECRYPT({0})", elctrnNticSndngDetail.ihidnum).as("ihidnum")
, elctrnNticSndngDetail.cnDetail
, elctrnNticSndngDetail.mobilePageCn
, elctrnNticSndngDetail.create
, elctrnNticSndngDetail.update
, elctrnNticSndngDetail.externalDocumentUuid))
.from(elctrnNticSndngDetail)
.where(elctrnNticSndngDetail.elctrnNticSndng.eq(elctrnNticSndng))
.fetch();
}
@Override
public List<ElctrnNticSndngDetail> findAllFetchByElctrnNticSndngId(String elctrnNticSndngId) {
return query.selectFrom(elctrnNticSndngDetail)
.innerJoin(elctrnNticSndngDetail.elctrnNticSndng, elctrnNticSndng)
.fetchJoin()
.innerJoin(elctrnNticSndng.nhtTmplatManage, nhtTmplatManage)
.fetchJoin()
.where(elctrnNticSndngDetail.elctrnNticSndng.elctrnNticSndngId.eq(elctrnNticSndngId))
.fetch();
}
@Override
public Optional<Long> findLastSendMastIdByElctrnNticSndngId(String elctrnNticSndngId) {
return Optional.ofNullable(query.select(sendDetailKkoMydoc.sendMast.sendMastId)
.from(sendDetailKkoMydoc)
// .where(sendDetailKkoMydoc.propExternalDocumentUuid.in(findExternalDocumentUuidsByLnkInputId(elctrnNticSndngId)))
.innerJoin(elctrnNticSndngDetail).on(sendDetailKkoMydoc.propExternalDocumentUuid.eq(elctrnNticSndngDetail.externalDocumentUuid))
.where(elctrnNticSndngDetail.elctrnNticSndng.elctrnNticSndngId.eq(elctrnNticSndngId))
.groupBy(sendDetailKkoMydoc.sendMast.sendMastId)
.orderBy(sendDetailKkoMydoc.sendMast.sendMastId.desc())
.fetchFirst());
}
private List<String> findExternalDocumentUuidsByLnkInputId(String elctrnNticSndngId) {
return query.select(elctrnNticSndngDetail.externalDocumentUuid)
.from(elctrnNticSndngDetail)
.where(elctrnNticSndngDetail.elctrnNticSndng.elctrnNticSndngId.eq(elctrnNticSndngId))
.fetch();
}
@Override
public String findIhidnumDecByElctrnNticSndngDetailId(String elctrnNticSndngDetailId) {
return query.select(Expressions.stringTemplate("ECL_DECRYPT({0})", elctrnNticSndngDetail.ihidnum).as("ihidnum"))
.from(elctrnNticSndngDetail)
.where(elctrnNticSndngDetail.elctrnNticSndngDetailId.eq(elctrnNticSndngDetailId))
.fetchOne();
}
}

@ -1,15 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.repository;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.ElctrnNticSndng;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface ElctrnNticSndngRepository extends JpaRepository<ElctrnNticSndng, String> {
List<ElctrnNticSndng> findAllBySndngProcessSttus(String sndngProcessSttus);
List<ElctrnNticSndng> findAllBySndngProcessSttusIn(List<String> sndngProcessSttuss);
}

@ -1,8 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.repository;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.ElctrnNticSndngResult;
import org.springframework.data.jpa.repository.JpaRepository;
public interface ElctrnNticSndngResultRepository extends JpaRepository<ElctrnNticSndngResult, String>, ElctrnNticSndngResultRepositoryCustom {
}

@ -1,13 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.repository;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.ElctrnNticSndngResult;
import java.util.List;
public interface ElctrnNticSndngResultRepositoryCustom {
void modifyByElctrnNticSndngResults(List<ElctrnNticSndngResult> elctrnNticSndngResults);
}

@ -1,34 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.repository;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.ElctrnNticSndngResult;
import com.querydsl.jpa.impl.JPAQueryFactory;
import lombok.RequiredArgsConstructor;
import java.time.LocalDateTime;
import java.util.List;
import static cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.QElctrnNticSndngResult.elctrnNticSndngResult;
@RequiredArgsConstructor
public class ElctrnNticSndngResultRepositoryImpl implements ElctrnNticSndngResultRepositoryCustom {
private final JPAQueryFactory query;
@Override
public void modifyByElctrnNticSndngResults(List<ElctrnNticSndngResult> elctrnNticSndngResults) {
elctrnNticSndngResults.forEach(data ->
query.update(elctrnNticSndngResult)
.set(elctrnNticSndngResult.sndngResultCode, data.getSndngResultCode())
.set(elctrnNticSndngResult.requstDt, data.getRequstDt())
.set(elctrnNticSndngResult.inqireDt, data.getInqireDt())
.set(elctrnNticSndngResult.readngDt, data.getReadngDt())
.set(elctrnNticSndngResult.errorCn, data.getErrorCn())
// .set(elctrnNticSndngResult.create, FieldCreate.builder().build())
.set(elctrnNticSndngResult.lastUpdtDt, LocalDateTime.now())
.where(elctrnNticSndngResult.elctrnNticSndngDetailId.eq(data.getElctrnNticSndngDetailId()))
.execute()
);
}
}

@ -1,9 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.repository;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.NhtTmplatManage;
import org.springframework.data.jpa.repository.JpaRepository;
public interface NhtTmplatManageRepository extends JpaRepository<NhtTmplatManage, String> {
}

@ -1,32 +0,0 @@
//package cokr.xit.ens.biz.traffic.chuncheon.mydoc.v1.mq;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.kafka.core.KafkaTemplate;
//import org.springframework.stereotype.Component;
//
//import lombok.extern.slf4j.Slf4j;
//
//@Slf4j
//@Component
//public class UserElctrnNticProducer {
//
// @Autowired
// private KafkaTemplate<String, String> kafkaTemplate;
//
//
// public void pubBulkSend(String message) {
// final String topicName = "kkomydoc-send-bulk";
//
// log.info(String.format("[%s] pub message : %s", topicName, message));
//
// this.kafkaTemplate.send(topicName, message);
// }
//
// public void pubBulkStatus(String message) {
// final String topicName = "kkomydoc-status-bulk";
//
// log.info(String.format("[%s] pub message : %s", topicName, message));
//
// this.kafkaTemplate.send(topicName, message);
// }
//}

@ -1,55 +0,0 @@
//package cokr.xit.ens.biz.traffic.chuncheon.mydoc.v1.sched;
//
//import cokr.xit.ens.biz.traffic.chuncheon.mydoc.v1.service.UserElctrnNticService;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.context.annotation.Profile;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//
//@Slf4j
//@Component
////@Profile("!local")
//@Profile("prod-traffic")
//public class TrafficKkoMydocScheduler {
//
// @Resource
// private UserElctrnNticService service;
//
// /**
// * 인증톡 전송요청
// */
// @Scheduled(cron = "0 */1 * * * *")
// public void runSend() {
// log.info("[Schduler]KkoMydoc \"send\" run...");
// service.send();
// }
//
// /**
// * 인증톡 전송결과 갱신
// */
// @Scheduled(cron = "0 */3 * * * *")
// public void runResult() {
// log.info("[Schduler]KkoMydoc \"result\" run...");
// service.result();
// }
//
// /**
// * 인증톡 상태 갱신
// */
// @Scheduled(cron = "0 0 */1 * * *")
// public void runStatus() {
// log.info("[Schduler]KkoMydoc \"status\" run...");
// service.status();
// }
//
// /**
// * 인증톡 상태 가져오기
// */
// @Scheduled(cron = "0 */30 * * * *")
// public void runFetchStatus() {
// log.info("[Schduler]KkoMydoc \"fetchStatus\" run...");
// service.fetchStatus();
// }
//}

@ -1,296 +0,0 @@
//package cokr.xit.ens.biz.traffic.chuncheon.mydoc.v1.service;
//
//import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.ElctrnNticSndng;
//import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.ElctrnNticSndngDetail;
//import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.ElctrnNticSndngResult;
//import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.repository.ElctrnNticSndngDetailRepository;
//import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.repository.ElctrnNticSndngRepository;
//import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.repository.ElctrnNticSndngResultRepository;
//import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.repository.NhtTmplatManageRepository;
//import cokr.xit.ens.biz.traffic.chuncheon.mydoc.v1.mq.UserElctrnNticProducer;
//import cokr.xit.ens.core.aop.EnsResponseVO;
//import cokr.xit.ens.core.exception.EnsException;
//import cokr.xit.ens.core.exception.code.EnsErrCd;
//import cokr.xit.ens.core.utils.CmmnUtil;
//import cokr.xit.ens.core.utils.crypto.SHA256;
//import cokr.xit.ens.modules.kkomydoc.v1.domain.repository.SendDetailKkoMydocRepository;
//import cokr.xit.ens.modules.kkomydoc.v1.model.BulkSendReqDTO;
//import cokr.xit.ens.modules.kkomydoc.v1.model.child.Document;
//import cokr.xit.ens.modules.kkomydoc.v1.model.child.NotiDocument;
//import cokr.xit.ens.modules.kkomydoc.v1.model.child.Property;
//import cokr.xit.ens.modules.kkomydoc.v1.model.child.Receiver;
//import cokr.xit.ens.modules.nicedici.service.NiceDiCiService;
//import com.fasterxml.jackson.databind.ObjectMapper;
//import lombok.RequiredArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import net.bytebuddy.utility.RandomString;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.util.StringUtils;
//
//import java.text.SimpleDateFormat;
//import java.util.*;
//
//@Slf4j
//@Service
//@RequiredArgsConstructor
//public class UserElctrnNticService {
// private final ElctrnNticSndngRepository elctrnNticSndngRepository;
// private final ElctrnNticSndngDetailRepository elctrnNticSndngDetailRepository;
// private final ElctrnNticSndngResultRepository elctrnNticSndngResultRepository;
// private final NhtTmplatManageRepository nhtTmplatManageRepository;
// private final SendDetailKkoMydocRepository sendDetailKkoMydocRepository;
// private final NiceDiCiService nicedDiCiService;
//
//
// @Autowired
// private UserElctrnNticProducer userElctrnNticProducer;
//
// @Value("${contract.nice.dici.socket.site-code}")
// private String SITE_CODE;
// @Value("${contract.nice.dici.socket.site-pw}")
// private String SITE_PW;
// @Value("${contract.kakao.pay.mydoc.access-token}")
// private String ACCESS_TOKEN;
// @Value("${contract.kakao.pay.mydoc.contract-uuid}")
// private String CONTRACT_UUID;
//
//
// /**
// * 발송
// */
// @Transactional
// public void send() {
//
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmm");
// String yyyyMMddHHmm = dateFormat.format(new Date());
// String beginSndngDt = String.format("%s00", yyyyMMddHHmm);
// String endSndngDt = String.format("%s59", yyyyMMddHHmm);
// this.send(beginSndngDt, endSndngDt);
// }
// /**
// * 발송
// */
// @Transactional
// public void send(String beginSndngDt, String endSndngDt) {
//
// List<ElctrnNticSndng> list = elctrnNticSndngRepository.findAllBySndngProcessSttusAndSndngDtBetween("01", beginSndngDt, endSndngDt);
// for(ElctrnNticSndng row : list) {
// List<ElctrnNticSndngDetail> detailList = elctrnNticSndngDetailRepository.findAllDecByElctrnNticSndng(row);
//
// List<String> jsonStrList = new ArrayList<>();
// try {
// jsonStrList = makeMessage(row, detailList);
// } catch (Exception e) {
// row.setSndngProcessSttus("99");
// row.setErrorCn(e.getMessage());
// elctrnNticSndngRepository.save(row);
// continue;
// }
//
// for(String jsonStr : jsonStrList) {
// Map<String, String> m = new HashMap<>();
// m.put("accessToken", ACCESS_TOKEN);
// m.put("contractUuid", CONTRACT_UUID);
// m.put("jsonStr", jsonStr);
// userElctrnNticProducer.pubBulkSend(CmmnUtil.toJsonString(m));
// }
//
//
// elctrnNticSndngDetailRepository.saveAll(detailList);
// }
//
//
// }
//
//
// /**
// * 메시지포맷 작성
// */
// @SuppressWarnings("deprecation")
// private List<String> makeMessage(ElctrnNticSndng sndng, List<ElctrnNticSndngDetail> sndngDetails) throws EnsException {
// List<String> jsonStrList = new ArrayList<>();
//
// List<Document> documents = new ArrayList<>();
// List<NotiDocument> notidocuments = new ArrayList<>();
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
// String prefixExternalDocumentUuid = String.format("B-%s%s", simpleDateFormat.format(new Date()), RandomString.make(5));
// int seq = 0;
// for(ElctrnNticSndngDetail row : sndngDetails) {
//
// String siteCode = SITE_CODE;
// String sitePw = SITE_PW;
// String payload = row.getMainCode();
// String hash = null;
// try {
// if(StringUtils.isEmpty(row.getCnDetail()))
// hash = SHA256.encrypt(row.getMainCode());
// else
// hash = SHA256.encrypt(row.getCnDetail());
//// } catch (NoSuchAlgorithmException e) {
// } catch (Exception e) {
// log.error(String.format("Hash 값 생성에 실패 하였습니다. [%s]. ", row.getCnDetail()), e);
// }
//
// EnsResponseVO ensResponseVO = nicedDiCiService.ci(siteCode, sitePw, row.getIhidnum());
// String ci = ((Map<String, String>)ensResponseVO.getResultInfo()).get("ci");
// Document document = new Document();
// document.setTitle(sndng.getNhtTmplatManage().getNhtSj());
// document.setCommon_categories(new String[] {"NOTICE"});
// document.setHash(hash);
// Receiver receiver = new Receiver();
// if(ci==null) {
// receiver.setPhone_number(null);
// receiver.setName(null);
// receiver.setBirthday(null);
// receiver.setIs_required_verify_name(true);
// }else {
// receiver.setCi(ci);
// }
// document.setReceiver(receiver);
// Property property = new Property();
// String externalDocumentUuid = String.format("%s%09d", prefixExternalDocumentUuid, ++seq);
// row.setLinkedUuid(externalDocumentUuid);
// property.setLink(sndng.getNhtTmplatManage().getRedirectUrl());
// property.setPayload(payload);
// property.setMessage(sndng.getNhtTmplatManage().getNhtCn());
// property.setCs_number(sndng.getNhtTmplatManage().getCstmrCnterTlphonNo());
// property.setCs_name(StringUtils.isEmpty(sndng.getNhtTmplatManage().getCstmrCnterNm())?"문의처":sndng.getNhtTmplatManage().getCstmrCnterNm());
// property.setExternal_document_uuid(externalDocumentUuid);
// document.setProperty(property);
// documents.add(document);
//
//
//
// if(!StringUtils.isEmpty(row.getElctrnNticSndng())) {
// if(!StringUtils.isEmpty(row.getMobilePageCn()))
// try {
//
//// NotiDocument notiDocument = (NotiDocument) CmmnUtil.jsonStringtoObj(NotiDocument.class, row.getMobilePageCn());
// ObjectMapper mapper = new ObjectMapper();
// NotiDocument notiDocument = mapper.readValue(row.getMobilePageCn(), NotiDocument.class);
// notiDocument.setPayload``(payload);
// notidocuments.add(notiDocument);
// } catch (Exception e) {
// // log.error(String.format("고지정보 변환에 실패 했습니다. [%s]", row.getMobilePageCn()), e);
// throw new EnsException(EnsErrCd.ERR405, String.format("고지정보 변환에 실패 했습니다. [%s]. %s", row.getMobilePageCn(), e.getMessage()));
// }
// }
//
//
//
// if(documents.size()==100) {
// BulkSendReqDTO bulkSendReqDTO = new BulkSendReqDTO();
// bulkSendReqDTO.setDocuments(documents);
// bulkSendReqDTO.setNotidocuments(notidocuments);
// jsonStrList.add(CmmnUtil.toJsonString(bulkSendReqDTO));
// documents = new ArrayList<>();
// notidocuments = new ArrayList<>();
// }
//
// }
//
//
//
// BulkSendReqDTO bulkSendReqDTO = new BulkSendReqDTO();
// bulkSendReqDTO.setDocuments(documents);
// bulkSendReqDTO.setNotidocuments(notidocuments);
// jsonStrList.add(CmmnUtil.toJsonString(bulkSendReqDTO));
//
//
//
// return jsonStrList;
// }
//
//
//
// /**
// * 발송결과 업데이트
// */
// @Transactional
// public void result() {
//
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmm");
// Calendar cal = Calendar.getInstance();
// Date date = new Date();
// cal.setTime(date);
// cal.add(Calendar.MINUTE, -3);
// String beginSndngDt = String.format("%s00", dateFormat.format(cal.getTime()));
// cal.setTime(date);
// cal.add(Calendar.MINUTE, -1);
// String endSndngDt = String.format("%s59", dateFormat.format(new Date()));
//
// this.result(beginSndngDt, endSndngDt);
// }
// /**
// * 발송결과 업데이트
// */
// @SuppressWarnings("deprecation")
// @Transactional
// public void result(String beginSndngDt, String endSndngDt) {
// List<ElctrnNticSndng> list = elctrnNticSndngRepository.findAllBySndngProcessSttusAndSndngDtBetween("01", beginSndngDt, endSndngDt);
//
//
// for(ElctrnNticSndng row : list) {
// List<ElctrnNticSndngResult> sndngResultList = elctrnNticSndngResultRepository.findAllByElctrnNticSndngId(row.getElctrnNticSndngId());
// elctrnNticSndngResultRepository.saveAll(sndngResultList);
// row.setSndngProcessSttus("99");
// for(ElctrnNticSndngResult sndngResult : sndngResultList) {
// if(StringUtils.isEmpty(sndngResult.getErrorCn())) {
// row.setSndngProcessSttus("02");
// break;
// }
// }
// elctrnNticSndngRepository.save(row);
//
// }
//
// }
//
// /**
// *
// * 메소드 설명: 상태변경
// * @author: mk1126sj
// * @date: 2021. 12. 29.
// */
// @Transactional
// public void status() {
//
// List<ElctrnNticSndng> list = elctrnNticSndngRepository.findAllBySndngProcessSttus("02");
//
// for(ElctrnNticSndng row : list) {
// List<String> externalDocumentUuidList = elctrnNticSndngDetailRepository.findExternalDocumentUuidByElctrnNticSndng(row);
//
// Map<String, Object> m = new HashMap<>();
// m.put("accessToken", ACCESS_TOKEN);
// m.put("contractUuid", CONTRACT_UUID);
// m.put("externalDocumentUuidList", externalDocumentUuidList);
// userElctrnNticProducer.pubBulkStatus(CmmnUtil.toJsonString(m));
// }
//
// }
//
//
// /**
// *
// * 메소드 설명: 발송마스터 및 발송상세 상태정보 fetch
// * void 요청처리 후 응답객체
// * @author: mk1126sj
// * @date: 2021. 12. 29.
// */
// public void fetchStatus() {
//
// List<ElctrnNticSndng> list = elctrnNticSndngRepository.findAllBySndngProcessSttus("02");
//
// for(ElctrnNticSndng row : list) {
// elctrnNticSndngResultRepository.saveFetchStatus(row);
// }
//
// }
//
//
//
//
//}

@ -1,12 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.v2.model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
@Getter
@Schema(name = "TrafficCcMydocReqDTO")
public class TrafficCcMydocReqDTO {
@Schema(required = true, title = "전자 고지 발송 Id", example = " ")
private String elctrnNticSndngId;
}

@ -1,53 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.v2.presentation;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.v2.model.TrafficCcMydocReqDTO;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.v2.service.TrafficCcMydocService;
import cokr.xit.ens.core.aop.EnsResponseVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
@Tag(name = "TrafficCcSigntalkController")
@Slf4j
@Controller
@RequiredArgsConstructor
public class TrafficCcMydocController {
private final TrafficCcMydocService trafficCcMydocService;
@Operation(summary = "접수")
@PostMapping(value = "/traffic/cc/mydoc/accept", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EnsResponseVO> accept(@RequestBody TrafficCcMydocReqDTO reqDTO){
EnsResponseVO responseVO = trafficCcMydocService.accept(reqDTO.getElctrnNticSndngId());
return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
}
@Operation(summary = "제작")
@PutMapping(value = "/traffic/cc/mydoc/re/make", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EnsResponseVO> reMake(@RequestBody TrafficCcMydocReqDTO reqDTO){
EnsResponseVO responseVO = trafficCcMydocService.reMake(reqDTO.getElctrnNticSndngId());
return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
}
@Operation(summary = "전송")
@PutMapping(value = "/traffic/cc/mydoc/re/send", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EnsResponseVO> reSend(@RequestBody TrafficCcMydocReqDTO reqDTO){
EnsResponseVO responseVO = trafficCcMydocService.reSend(reqDTO.getElctrnNticSndngId());
return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
}
@Operation(summary = "전송결과가져오기")
@PostMapping(value = "/traffic/cc/mydoc/fetch", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EnsResponseVO> fetch(@RequestBody TrafficCcMydocReqDTO reqDTO){
EnsResponseVO responseVO = trafficCcMydocService.fetch(reqDTO.getElctrnNticSndngId());
return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
}
}

@ -1,46 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.v2.sched;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.v2.service.TrafficCcMydocService;
import cokr.xit.ens.core.aop.EnsResponseVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Slf4j
@Component
@Profile("prod-traffic")
@RequiredArgsConstructor
public class TrafficCcMydocScheduler {
private final TrafficCcMydocService trafficCcMydocService;
/**
*
* -. TRAFFIC ENS .
*/
@Scheduled(cron = "0 */1 7-22 * * *")
public void accepted(){
EnsResponseVO responseVO = trafficCcMydocService.acceptAll();
log.info("=======================================================");
log.info("[TRAFFIC] 인증톡 접수처리 결과");
log.info(responseVO.toString());
log.info("=======================================================");
}
/**
*
* -. (/) ENS -> TRAFFIC DB .
*/
@Scheduled(cron = "0 */15 7-22 * * *")
public void fetched(){
EnsResponseVO responseVO = trafficCcMydocService.fetchAll();
log.info("=======================================================");
log.info("[TRAFFIC] 인증톡 요청문서정보 Fetch 결과");
log.info(responseVO.toString());
log.info("=======================================================");
}
}

@ -1,167 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.v2.service;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.ElctrnNticSndng;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.repository.ElctrnNticSndngRepository;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.v2.service.support.TrafficCcMydocAcceptor;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.v2.service.support.TrafficCcMydocFetcher;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.v2.service.support.TrafficCcMydocMaker;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.v2.service.support.TrafficCcMydocSender;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.core.exception.EnsException;
import cokr.xit.ens.core.exception.code.EnsErrCd;
import cokr.xit.ens.core.utils.CmmnUtil;
import cokr.xit.ens.modules.kkomydoc.service.event.KkoMydocSendReserveEvent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@Service
@RequiredArgsConstructor
@Transactional
public class TrafficCcMydocService {
private final ElctrnNticSndngRepository elctrnNticSndngRepository;
private final TrafficCcMydocAcceptor trafficCcMydocAcceptor;
private final TrafficCcMydocMaker trafficCcMydocMaker;
private final TrafficCcMydocSender trafficCcMydocSender;
private final TrafficCcMydocFetcher trafficCcMydocFetcher;
private final ApplicationEventPublisher applicationEventPublisher;
/**
* (TRAFFIC -> ENS)
*/
public EnsResponseVO accept(String elctrnNticSndngId){
try {
ElctrnNticSndng elctrnNticSndng = elctrnNticSndngRepository.findById(elctrnNticSndngId)
.orElseThrow(()->new EnsException(EnsErrCd.ACPT404, "일치하는 자료가 없거나 \"요청(01)\" 상태가 아닙니다."));
return this.accept(Arrays.asList(elctrnNticSndng)).getResultInfo().get(0);
} catch (EnsException e){
return EnsResponseVO.errBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
}
}
/**
* (TRAFFIC -> ENS)
*/
public EnsResponseVO<List<EnsResponseVO>> acceptAll(){
try {
List<ElctrnNticSndng> elctrnNticSndngs = elctrnNticSndngRepository.findAllBySndngProcessSttus("01");
if(CmmnUtil.isEmpty(elctrnNticSndngs))
throw new EnsException(EnsErrCd.ACPT404, "\"요청(01)\" 상태의 자료가 없습니다.");
return this.accept(elctrnNticSndngs);
} catch (EnsException e){
return EnsResponseVO.<List<EnsResponseVO>>errBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
}
}
private EnsResponseVO<List<EnsResponseVO>> accept(List<ElctrnNticSndng> elctrnNticSndngs){
EnsResponseVO responseVO = trafficCcMydocAcceptor.statReady(elctrnNticSndngs.stream()
.map(row -> row.getElctrnNticSndngId())
.collect(Collectors.toList()));
if(!EnsErrCd.OK.equals(responseVO.getErrCode()))
return responseVO;
List<EnsResponseVO> resultInfo = elctrnNticSndngs.stream()
.map(row -> trafficCcMydocAcceptor.execute(row.getElctrnNticSndngId()))
.collect(Collectors.toList());
List<Long> sendMastIds = resultInfo.stream()
.filter(ensResponseVO -> EnsErrCd.OK.equals(ensResponseVO.getErrCode()))
.map(ensResponseVO -> (Long)((Map<String, Object>)ensResponseVO.getResultInfo()).get("sendMastId"))
.collect(Collectors.toList());
KkoMydocSendReserveEvent event = KkoMydocSendReserveEvent.builder()
.sendMastIds(sendMastIds)
.callback(() -> this.fetch(elctrnNticSndngs))
.build();
applicationEventPublisher.publishEvent(event);
return EnsResponseVO.<List<EnsResponseVO>>okBuilder().resultInfo(resultInfo).build();
}
/**
*
* @param elctrnNticSndngId
* @return
*/
public EnsResponseVO reMake(String elctrnNticSndngId){
return trafficCcMydocMaker.execute(elctrnNticSndngId);
}
/**
*
* @param elctrnNticSndngId
* @return
*/
public EnsResponseVO reSend(String elctrnNticSndngId){
return trafficCcMydocSender.execute(elctrnNticSndngId);
}
/**
* (/)
*/
public EnsResponseVO fetch(String elctrnNticSndngId){
ElctrnNticSndng elctrnNticSndng = null;
try {
elctrnNticSndng = elctrnNticSndngRepository.findById(elctrnNticSndngId)
.orElseThrow(() -> new EnsException(EnsErrCd.ERR404, String.format("[ elctrnNticSndngId %s ]와 일치하는 자료가 없습니다.", elctrnNticSndngId)));
} catch (EnsException e) {
return EnsResponseVO.errBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
}
return this.fetch(Arrays.asList(elctrnNticSndng));
}
/**
* (/)
*/
public EnsResponseVO fetchAll(){
List<ElctrnNticSndng> elctrnNticSndngs = elctrnNticSndngRepository.findAllBySndngProcessSttusIn(Arrays.asList("02", "08"));
return this.fetch(elctrnNticSndngs);
}
private EnsResponseVO fetch(List<ElctrnNticSndng> elctrnNticSndngs){
return EnsResponseVO.okBuilder()
.resultInfo(
elctrnNticSndngs.stream()
.map(row -> trafficCcMydocFetcher.execute(row.getElctrnNticSndngId()))
.collect(Collectors.toList()
)
)
.build();
}
}

@ -1,245 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.v2.service.support;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.ElctrnNticSndng;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.ElctrnNticSndngDetail;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.embeded.FieldUpdate;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.repository.ElctrnNticSndngDetailRepository;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.repository.ElctrnNticSndngRepository;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.core.exception.EnsException;
import cokr.xit.ens.core.exception.code.EnsErrCd;
import cokr.xit.ens.core.utils.Checks;
import cokr.xit.ens.core.utils.DateUtil;
import cokr.xit.ens.core.utils.MapDeserailizer;
import cokr.xit.ens.modules.common.biztmplt.EnsPhaseProcSupport;
import cokr.xit.ens.modules.common.code.VenderCd;
import cokr.xit.ens.modules.kkomydoc.model.KkoMydocAcceptReqDTO;
import cokr.xit.ens.modules.kkomydoc.model.config.Document;
import cokr.xit.ens.modules.kkomydoc.model.config.Property;
import cokr.xit.ens.modules.kkomydoc.model.config.Receiver;
import cokr.xit.ens.modules.kkomydoc.model.config.XitProperty;
import cokr.xit.ens.modules.kkomydoc.service.KkoMydocService;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.bytebuddy.utility.RandomString;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@Slf4j
@Component
@RequiredArgsConstructor
public class TrafficCcMydocAcceptor implements EnsPhaseProcSupport<EnsResponseVO, String> {
private final ElctrnNticSndngRepository elctrnNticSndngRepository;
private final ElctrnNticSndngDetailRepository elctrnNticSndngDetailRepository;
private final KkoMydocService kkoMydocService;
private Gson gson = new GsonBuilder().registerTypeAdapter(Map.class, new MapDeserailizer()).serializeNulls().create();
/**
* Accept
*
* @param elctrnNticSndngIds
* @return
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statReady(List<String> elctrnNticSndngIds) {
try {
AtomicInteger index = new AtomicInteger();
String prefixExternalDocumentUuid = String.format("B-%s%s", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")), RandomString.make(5));
elctrnNticSndngIds.stream()
.map(elctrnNticSndngId -> elctrnNticSndngRepository.findById(elctrnNticSndngId).get())
.map(elctrnNticSndng -> elctrnNticSndngDetailRepository.findAllDecByElctrnNticSndng(elctrnNticSndng))
.forEach(list -> {
list.stream()
.forEach(row -> {
row.setExternalDocumentUuid(String.format("%s%09d", prefixExternalDocumentUuid, index.getAndIncrement() + 1));
});
elctrnNticSndngDetailRepository.saveAll(list);
}
);
return EnsResponseVO.okBuilder().build();
} catch (Exception e) {
return EnsResponseVO.errBuilder()
.errCode(EnsErrCd.ACPT500)
.errMsg(String.format("문서식별번호(외부) 생성에 실패 했습니다. %s", e.getMessage()))
.build();
}
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statBegin(String elctrnNticSndngId) {
log.info("no process");
return null;
}
/**
*
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO execute(String elctrnNticSndngId) {
Map<String, Object> resultInfo = new HashMap<>();
resultInfo.put("elctrnNticSndngId", elctrnNticSndngId);
EnsResponseVO responseVO = null;
ElctrnNticSndng elctrnNticSndng = null;
try {
elctrnNticSndng = elctrnNticSndngRepository.findById(elctrnNticSndngId)
.orElseThrow(() -> new EnsException(EnsErrCd.ACPT404, String.format("일치하는 TB_ELCTRN_NTIC_SNDNG 데이터가 없습니다. [ elctrnNticSndngId %s ]", elctrnNticSndngId)));
KkoMydocAcceptReqDTO reqDTO = this.convertTbInputDataToAcceptReqDTO(elctrnNticSndngDetailRepository.findAllFetchByElctrnNticSndngId(elctrnNticSndng.getElctrnNticSndngId()));
EnsResponseVO reqResp = kkoMydocService.accept(reqDTO);
if (EnsErrCd.OK.equals(reqResp.getErrCode())) {
resultInfo.put("sendMastId", (Long) ((Map<String, Object>) reqResp.getResultInfo()).get("sendMastId"));
responseVO = EnsResponseVO.okBuilder().resultInfo(resultInfo).build();
} else {
responseVO = EnsResponseVO.errRsltBuilder()
.errCode(reqResp.getErrCode())
.errMsg(reqResp.getErrMsg())
.resultInfo(reqResp.getResultInfo())
.build();
}
} catch (EnsException e) {
responseVO = EnsResponseVO.errRsltBuilder()
.errCode(e.getErrCd())
.errMsg(String.format("인증톡 \"접수\" 처리 실패. [%s] %s", e.getErrCd().getCode(), e.getMessage()))
.resultInfo(resultInfo)
.build();
} catch (Exception e) {
responseVO = EnsResponseVO.errRsltBuilder()
.errCode(EnsErrCd.ACPT500)
.errMsg(String.format("인증톡 \"접수\" 처리 실패. %s", e.getMessage()))
.resultInfo(resultInfo)
.build();
} finally {
if (EnsErrCd.OK.equals(responseVO.getErrCode())) {
elctrnNticSndng.setUpdate(FieldUpdate.builder()
.updusr("ENS_SYS")
.updtDt(LocalDateTime.now())
.build());
elctrnNticSndng.setSndngProcessSttus("02");
elctrnNticSndng.setErrorCn(null);
} else {
elctrnNticSndng.setUpdate(FieldUpdate.builder()
.updusr("ENS_SYS")
.updtDt(LocalDateTime.now())
.build());
elctrnNticSndng.setSndngProcessSttus("99");
elctrnNticSndng.setErrorCn(responseVO.getErrMsg());
if (responseVO.getResultInfo() != null && (responseVO.getResultInfo() instanceof List || responseVO.getResultInfo() instanceof Map))
elctrnNticSndng.setErrorDtls(gson.toJson(responseVO.getResultInfo()));
}
}
return responseVO;
}
private KkoMydocAcceptReqDTO convertTbInputDataToAcceptReqDTO(List<ElctrnNticSndngDetail> list) {
return KkoMydocAcceptReqDTO.builder()
.vender(VenderCd.intech.getCode())
.org_cd(list.get(0).getElctrnNticSndng().getSignguCode())
.tmplt_cd(list.get(0).getElctrnNticSndng().getNhtTmplatManage().getNhtTmplatId())
.post_bundle_title(
String.format("%s(%s건)-%s"
, list.get(0).getElctrnNticSndng().getNhtTmplatManage().getNhtNm()
, list.get(0).getElctrnNticSndng().getSndngCo()
, LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))
)
)
.send_dt(list.get(0).getElctrnNticSndng().getSndngDt())
.close_dt(list.get(0).getElctrnNticSndng().getClosDt())
.documents(
list.stream()
.map(row -> createDocument(row))
.collect(Collectors.toList())
)
.build();
}
private Document createDocument(ElctrnNticSndngDetail data) throws EnsException {
return Document.builder()
.external_document_uuid(data.getExternalDocumentUuid())
.hash(null)
.common_categories(Arrays.asList("NOTICE"))
.read_expired_at(DateUtil.dateToAbsTimeSec(data.getElctrnNticSndng().getClosDt()))
// .read_expired_sec()
.receiver(this.createReceiver(data))
.property(this.createProperty(data))
.bridge(null)
.xit_property(this.createXitProperty(data))
.build();
}
private Receiver createReceiver(ElctrnNticSndngDetail data) {
return Receiver.builder()
.ci(null)
.phone_number(null)
.name(null)
.birthday(null)
.is_required_verify_name(null)
.build();
}
private Property createProperty(ElctrnNticSndngDetail data) {
return Property.builder()
.link(data.getElctrnNticSndng().getNhtTmplatManage().getRedirectUrl())
.payload(null)
// .external_document_uuid(data.getExternalDocumentUuid())
.build();
}
private XitProperty createXitProperty(ElctrnNticSndngDetail data) {
Map<String, List<Map<String, Object>>> mobilePage = new HashMap<>();
mobilePage.put("details", this.createDetails(data));
String jid = elctrnNticSndngDetailRepository.findIhidnumDecByElctrnNticSndngDetailId(data.getElctrnNticSndngDetailId());
return XitProperty.builder()
.mbl_page_data(mobilePage)
// .ci_trans_use_yn("Y")
// .jid(data.getIhidnum())
.jid(Checks.isCheckJid(jid) ? jid : "1111111111111")
.tmplt_msg_data(null)
.build();
}
private List<Map<String, Object>> createDetails(ElctrnNticSndngDetail data) {
try {
Map<String, List<Map<String, Object>>> m = gson.fromJson(data.getMobilePageCn(), Map.class);
return m.get("details");
} catch (Exception e) {
log.error("\"mobilePageCn\" Json Parse 실패. {}", data.getMobilePageCn());
return null;
}
}
}

@ -1,213 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.v2.service.support;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.ElctrnNticSndng;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.ElctrnNticSndngDetail;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.ElctrnNticSndngResult;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.embeded.FieldCreate;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.embeded.FieldUpdate;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.repository.ElctrnNticSndngDetailRepository;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.repository.ElctrnNticSndngRepository;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.repository.ElctrnNticSndngResultRepository;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.core.exception.EnsException;
import cokr.xit.ens.core.exception.code.EnsErrCd;
import cokr.xit.ens.core.utils.CmmnUtil;
import cokr.xit.ens.modules.common.biztmplt.EnsPhaseProcSupport;
import cokr.xit.ens.modules.kkomydoc.model.KkoMydocRsltRespDTO;
import cokr.xit.ens.modules.kkomydoc.model.config.KkoMydocStat;
import cokr.xit.ens.modules.kkomydoc.service.KkoMydocService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@Component
@RequiredArgsConstructor
public class TrafficCcMydocFetcher implements EnsPhaseProcSupport<EnsResponseVO, String> {
private final ElctrnNticSndngRepository elctrnNticSndngRepository;
private final ElctrnNticSndngDetailRepository elctrnNticSndngDetailRepository;
private final ElctrnNticSndngResultRepository elctrnNticSndngResultRepository;
private final KkoMydocService kkoMydocService;
/**
* Fetch
*
* @param elctrnNticSndngIds
* @return
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statReady(List<String> elctrnNticSndngIds) {
log.info("no process");
return null;
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statBegin(String elctrnNticSndngId) {
log.info("no process");
return null;
}
/**
* (/)
*
* @param elctrnNticSndngId
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO execute(String elctrnNticSndngId) {
EnsResponseVO responseVO = null;
Map<String, Object> resultInfo = new HashMap<>();
resultInfo.put("elctrnNticSndngId", elctrnNticSndngId);
KkoMydocRsltRespDTO respDTO = null;
try {
Long sendMastId = elctrnNticSndngDetailRepository.findLastSendMastIdByElctrnNticSndngId(elctrnNticSndngId)
.orElseThrow(() -> new EnsException(EnsErrCd.RSLT404, "일치하는 ENS 접수자료가 없습니다."));
resultInfo.put("sendMastId", sendMastId);
EnsResponseVO apiRespVO = kkoMydocService.sendResultProvide(sendMastId);
respDTO = (KkoMydocRsltRespDTO) apiRespVO.getResultInfo();
// elctrnNticSndngResultRepository.saveAll(respDTO.getDocuments().stream()
// .map(row -> {
// return ElctrnNticSndngResult.builder()
// .elctrnNticSndngDetailId(elctrnNticSndngDetailRepository.findByExternalDocumentUuid(row.getExternalDocumentUuid())
// .orElse(new ElctrnNticSndngDetail())
// .getElctrnNticSndngDetailId())
// .sndngResultCode(this.sndngResultCode(row))
// .requstDt(row.getKkoDocSentDt())
// .inqireDt(row.getKkoDocReceivedDt())
// .readngDt(row.getKkoDocReadFrstDt())
// .errorCn(CmmnUtil.isEmpty(row.getErrorMessage()) ? null : row.getErrorMessage())
// .create(FieldCreate.builder()
// .REGISTER("ENS_SYS")
// .REGIST_DT(LocalDateTime.now())
// .build())
// .build();
// })
// .collect(Collectors.toList())
// );
List<ElctrnNticSndngResult> elctrnNticSndngResults = respDTO.getDocuments().stream()
.map(row -> {
return ElctrnNticSndngResult.builder()
.elctrnNticSndngDetailId(elctrnNticSndngDetailRepository.findByExternalDocumentUuid(row.getExternalDocumentUuid())
.orElse(new ElctrnNticSndngDetail())
.getElctrnNticSndngDetailId())
.sndngResultCode(this.sndngResultCode(row))
.requstDt(row.getKkoDocSentDt())
.inqireDt(row.getKkoDocReceivedDt())
.readngDt(row.getKkoDocReadFrstDt())
.errorCn(CmmnUtil.isEmpty(row.getErrorMessage()) ? null : row.getErrorMessage())
.create(FieldCreate.builder()
.register("ENS_SYS")
.registDt(LocalDateTime.now())
.build())
.build();
})
.collect(Collectors.toList());
if (elctrnNticSndngResultRepository.findById(elctrnNticSndngResults.get(0).getElctrnNticSndngDetailId()).isPresent())
elctrnNticSndngResultRepository.modifyByElctrnNticSndngResults(elctrnNticSndngResults);
else
elctrnNticSndngResultRepository.saveAll(elctrnNticSndngResults);
responseVO = EnsResponseVO.okBuilder().resultInfo(resultInfo).build();
} catch (EnsException e) {
responseVO = EnsResponseVO.errBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
} catch (Exception e) {
responseVO = EnsResponseVO.errBuilder()
.errCode(EnsErrCd.RSLT999)
.errMsg(String.format("[elctrnNticSndngId %s]에 대한 전송결과 FETCH 처리 실패. %s", elctrnNticSndngId, e.getMessage()))
.build();
} finally {
ElctrnNticSndng elctrnNticSndng = elctrnNticSndngRepository.findById(elctrnNticSndngId).orElseThrow(() -> new EnsException(EnsErrCd.RSLT404, "일치하는 tbInputXit 자료가 없습니다."));
if (EnsErrCd.OK.equals(responseVO.getErrCode())) {
elctrnNticSndng.setUpdate(FieldUpdate.builder()
.updusr("ENS_SYS")
.updtDt(LocalDateTime.now())
.build());
elctrnNticSndng.setSndngProcessSttus(this.sndngProcessSttus(respDTO, elctrnNticSndng.getSndngProcessSttus()));
elctrnNticSndng.setErrorCn(null);
} else {
elctrnNticSndng.setUpdate(FieldUpdate.builder()
.updusr("ENS_SYS")
.updtDt(LocalDateTime.now())
.build());
elctrnNticSndng.setSndngProcessSttus("99");
elctrnNticSndng.setErrorCn(responseVO.getErrMsg());
}
}
return responseVO;
}
private String sndngProcessSttus(KkoMydocRsltRespDTO respDTO, String sndngProcessSttus) {
switch (respDTO.getStatCd()) {
case makefail:
case sendfail:
return "99";
case sendok:
case sendcmplt:
return "02";
case open:
return "08";
case close:
return "09";
default:
return sndngProcessSttus;
}
}
private String sndngResultCode(KkoMydocStat row) {
String sndngResultCode = null;
try {
switch (row.getKkoDocStat()) {
case SENT:
case RECEIVED:
case EXPIRED:
sndngResultCode = "1";
break;
case READ:
sndngResultCode = "2";
break;
case UNIDENTIFIED_USER:
case FORBIDDEN:
case INVALID_VALUE:
case INTERNAL_ERROR:
case INVALID_REQUEST:
case INTERNAL_SENT_ERR:
sndngResultCode = "3";
break;
default:
break;
}
} catch (Exception e) {
log.info("IupSendSttusCd와 일치하는 값 없음. [ dataId {} KkoDocStat {} ]", row.getExternalDocumentUuid(), row.getKkoDocStat());
}
return sndngResultCode;
}
}

@ -1,65 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.v2.service.support;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.repository.ElctrnNticSndngDetailRepository;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.core.exception.EnsException;
import cokr.xit.ens.core.exception.code.EnsErrCd;
import cokr.xit.ens.modules.common.biztmplt.EnsPhaseProcSupport;
import cokr.xit.ens.modules.kkomydoc.service.KkoMydocService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Slf4j
@Component
@RequiredArgsConstructor
public class TrafficCcMydocMaker implements EnsPhaseProcSupport<EnsResponseVO, String> {
private final ElctrnNticSndngDetailRepository elctrnNticSndngDetailRepository;
private final KkoMydocService kkoMydocService;
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statReady(List<String> elctrnNticSndngIds) {
log.info("no process");
return null;
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statBegin(String elctrnNticSndngId) {
log.info("no process");
return null;
}
/**
*
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO execute(String elctrnNticSndngId){
EnsResponseVO responseVO = null;
try {
Long sendMastId = elctrnNticSndngDetailRepository.findLastSendMastIdByElctrnNticSndngId(elctrnNticSndngId)
.orElseThrow(() -> new EnsException(EnsErrCd.MAKE404, "일치하는 ENS 접수자료가 없습니다."));
responseVO = kkoMydocService.remake(sendMastId);
} catch (EnsException e){
responseVO = EnsResponseVO.errBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
}
return responseVO;
}
}

@ -1,65 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.v2.service.support;
import cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.repository.ElctrnNticSndngDetailRepository;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.core.exception.EnsException;
import cokr.xit.ens.core.exception.code.EnsErrCd;
import cokr.xit.ens.modules.common.biztmplt.EnsPhaseProcSupport;
import cokr.xit.ens.modules.kkomydoc.service.KkoMydocService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Slf4j
@Component
@RequiredArgsConstructor
public class TrafficCcMydocSender implements EnsPhaseProcSupport<EnsResponseVO, String> {
private final ElctrnNticSndngDetailRepository elctrnNticSndngDetailRepository;
private final KkoMydocService kkoMydocService;
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statReady(List<String> elctrnNticSndngIds) {
log.info("no process");
return null;
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statBegin(String elctrnNticSndngId) {
log.info("no process");
return null;
}
/**
*
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO execute(String elctrnNticSndngId){
EnsResponseVO responseVO = null;
try {
Long sendMastId = elctrnNticSndngDetailRepository.findLastSendMastIdByElctrnNticSndngId(elctrnNticSndngId)
.orElseThrow(() -> new EnsException(EnsErrCd.SEND404, "일치하는 ENS 접수자료가 없습니다."));
responseVO = kkoMydocService.sendBulk(sendMastId);
} catch (EnsException e){
responseVO = EnsResponseVO.errBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
}
return responseVO;
}
}

@ -1,18 +1,19 @@
package cokr.xit.ens.core.config; package cokr.xit.ens.core.config;
import io.swagger.v3.oas.models.OpenAPI; import java.util.Arrays;
import io.swagger.v3.oas.models.info.Contact; import java.util.List;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import io.swagger.v3.oas.models.servers.Server;
import org.springdoc.core.GroupedOpenApi; import org.springdoc.core.GroupedOpenApi;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile; import org.springframework.context.annotation.Profile;
import java.util.Arrays; import io.swagger.v3.oas.models.OpenAPI;
import java.util.List; import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import io.swagger.v3.oas.models.servers.Server;
@Configuration @Configuration
public class SpringDocConfig { public class SpringDocConfig {
@ -69,7 +70,7 @@ public class SpringDocConfig {
.build(); .build();
} }
@Profile({"local", "local-test", "local-maria", "local-oracle", "prod-iup", "dev-oracle"}) @Profile({"local", "prod", "dev"})
@Bean @Bean
public GroupedOpenApi cmmnFtBillPaysApiDoc() { public GroupedOpenApi cmmnFtBillPaysApiDoc() {
return GroupedOpenApi.builder() return GroupedOpenApi.builder()
@ -77,7 +78,7 @@ public class SpringDocConfig {
.pathsToMatch("/bill/pay/**") .pathsToMatch("/bill/pay/**")
.build(); .build();
} }
@Profile({"local", "local-test", "local-maria", "local-oracle", "prod-iup", "dev-oracle"}) @Profile({"local", "prod", "dev"})
@Bean @Bean
public GroupedOpenApi cmmnFtBillKkopayApiDoc() { public GroupedOpenApi cmmnFtBillKkopayApiDoc() {
return GroupedOpenApi.builder() return GroupedOpenApi.builder()
@ -85,7 +86,7 @@ public class SpringDocConfig {
.pathsToMatch("/bill/kko/**") .pathsToMatch("/bill/kko/**")
.build(); .build();
} }
@Profile({"local", "local-test", "local-maria", "local-oracle", "prod-iup", "dev-oracle"}) @Profile({"local", "prod", "dev"})
@Bean @Bean
public GroupedOpenApi cmmnFtBillNvpayApiDoc() { public GroupedOpenApi cmmnFtBillNvpayApiDoc() {
return GroupedOpenApi.builder() return GroupedOpenApi.builder()
@ -94,7 +95,7 @@ public class SpringDocConfig {
.build(); .build();
} }
@Profile({"local", "local-test", "local-maria", "local-oracle", "prod-traffic", "prod-traffic-cheonan", "prod-iup"}) @Profile({"local", "prod", "dev"})
@Bean @Bean
public GroupedOpenApi cmmnFtNiceCiDiApiDoc() { public GroupedOpenApi cmmnFtNiceCiDiApiDoc() {
return GroupedOpenApi.builder() return GroupedOpenApi.builder()
@ -114,7 +115,7 @@ public class SpringDocConfig {
} }
@Profile({"local", "local-test", "local-maria", "local-oracle", "prod-iup"}) @Profile({"local", "prod"})
@Bean @Bean
public GroupedOpenApi kkoAlimtalkApiDoc() { public GroupedOpenApi kkoAlimtalkApiDoc() {
return GroupedOpenApi.builder() return GroupedOpenApi.builder()
@ -123,7 +124,7 @@ public class SpringDocConfig {
.build(); .build();
} }
@Profile({"local", "local-test", "local-maria", "local-oracle", "prod-traffic", "prod-traffic-cheonan", "prod-iup", "dev-oracle"}) @Profile({"local", "prod", "dev"})
@Bean @Bean
public GroupedOpenApi kkoMydocApiDoc() { public GroupedOpenApi kkoMydocApiDoc() {
return GroupedOpenApi.builder() return GroupedOpenApi.builder()
@ -132,7 +133,7 @@ public class SpringDocConfig {
.build(); .build();
} }
@Profile({"local", "local-test", "local-maria", "local-oracle", "prod-iup", "dev-oracle"}) @Profile({"local", "prod", "dev"})
@Bean @Bean
public GroupedOpenApi nvSigntalkApiDoc() { public GroupedOpenApi nvSigntalkApiDoc() {
return GroupedOpenApi.builder() return GroupedOpenApi.builder()
@ -141,7 +142,7 @@ public class SpringDocConfig {
.build(); .build();
} }
@Profile({"local", "local-test", "local-maria", "local-oracle"}) @Profile({"local"})
@Bean @Bean
public GroupedOpenApi ktSigntalkApiDoc() { public GroupedOpenApi ktSigntalkApiDoc() {
return GroupedOpenApi.builder() return GroupedOpenApi.builder()
@ -150,7 +151,7 @@ public class SpringDocConfig {
.build(); .build();
} }
@Profile({"local", "local-test", "local-maria", "local-oracle", "prod-traffic-cheonan"}) @Profile({"local", "prod"})
@Bean @Bean
public GroupedOpenApi ktGibisApiDoc() { public GroupedOpenApi ktGibisApiDoc() {
return GroupedOpenApi.builder() return GroupedOpenApi.builder()
@ -159,7 +160,7 @@ public class SpringDocConfig {
.build(); .build();
} }
@Profile({"local", "local-test", "local-maria", "local-oracle", "prod-iup", "prod-traffic-cheonan", "dev-oracle"}) @Profile({"local", "prod", "dev"})
@Bean @Bean
public GroupedOpenApi intgrnNotiApiDoc() { public GroupedOpenApi intgrnNotiApiDoc() {
return GroupedOpenApi.builder() return GroupedOpenApi.builder()
@ -169,7 +170,7 @@ public class SpringDocConfig {
} }
@Profile({"local", "local-test", "local-maria", "local-oracle", "prod-iup", "dev-oracle"}) @Profile({"local", "prod", "dev"})
@Bean @Bean
public GroupedOpenApi iupServiceApiDoc() { public GroupedOpenApi iupServiceApiDoc() {
return GroupedOpenApi.builder() return GroupedOpenApi.builder()
@ -178,24 +179,6 @@ public class SpringDocConfig {
.build(); .build();
} }
@Profile({"local", "local-test", "local-maria", "local-oracle", "prod-traffic"})
@Bean
public GroupedOpenApi trafficCcServiceApiDoc() {
return GroupedOpenApi.builder()
.group("BIZ. 이용시스템-주정차웹(TRAFFIC-춘천)")
.pathsToMatch("/traffic/cc/**")
.build();
}
@Profile({"local", "local-test", "local-maria", "local-oracle", "prod-traffic-cheonan"})
@Bean
public GroupedOpenApi trafficCaServiceApiDoc() {
return GroupedOpenApi.builder()
.group("BIZ. 이용시스템-주정차웹(TRAFFIC-천안)")
.pathsToMatch("/traffic/ca/**")
.build();
}
// @Bean // @Bean
// public GroupedOpenApi adminApiDoc() { // public GroupedOpenApi adminApiDoc() {

@ -6,7 +6,7 @@ server:
spring: spring:
config: config:
activate: activate:
on-profile: dev-oracle on-profile: dev
@ -16,17 +16,17 @@ spring:
mode: always mode: always
# Database 벤더(h2,oracle,mysql,postgresql,...) # Database 벤더(h2,oracle,mysql,postgresql,...)
platform: oracle platform: oracle
# schema-locations: classpath:/db/test/schema.sql # schema-locations: classpath:/db/test/schema.sql
# data-locations: classpath:/db/test/data.sql # data-locations: classpath:/db/test/data.sql
datasource: datasource:
# jndi-name: java:jdbc/ensOracleDB # jndi-name: java:jdbc/ensOracleDB
driver-class-name: oracle.jdbc.OracleDriver driver-class-name: oracle.jdbc.OracleDriver
# url: jdbc:oracle:thin:@211.119.124.118:1521:bustms?rewriteBatchedStatements=true&profileSQL=true&logger=Slf4JLogger&maxQuerySizeToLog=999999 # url: jdbc:oracle:thin:@211.119.124.118:1521:bustms?rewriteBatchedStatements=true&profileSQL=true&logger=Slf4JLogger&maxQuerySizeToLog=999999
url: jdbc:oracle:thin:@211.119.124.118:1521:bustms url: jdbc:oracle:thin:@211.119.124.118:1521:bustms
username: iup username: iup
password: iup!0202 password: iup!0202
hikari: hikari:
# auto-commit: false # auto-commit: false
connection-test-query: SELECT 1 FROM DUAL connection-test-query: SELECT 1 FROM DUAL
transaction-isolation: TRANSACTION_READ_COMMITTED transaction-isolation: TRANSACTION_READ_COMMITTED
hikari: hikari:

@ -6,36 +6,38 @@ server:
spring: spring:
config: config:
activate: activate:
on-profile: local-oracle on-profile: local-h2
sql: sql:
init: init:
mode: always mode: always
platform: oracle platform: h2
# schema-locations: classpath:/db/test/schema.sql
# data-locations: classpath:/db/test/data.sql
datasource: datasource:
driver-class-name: oracle.jdbc.OracleDriver # url: "jdbc:h2:tcp://localhost:19092/~/ens"
url: jdbc:oracle:thin:@211.119.124.118:1521:bustms url: jdbc:h2:mem:xitdb?rewriteBatchedStatements=true&profileSQL=true&logger=Slf4JLogger&maxQuerySizeToLog=999999
username: iup driver-class-name: org.h2.Driver
password: iup!0202 username: sa
hikari: password:
# auto-commit: false # url: "jdbc:log4jdbc:h2:tcp://localhost/~/dev_post"
connection-test-query: SELECT 1 FROM DUAL # driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
transaction-isolation: TRANSACTION_READ_COMMITTED # username: sa
# password:
hikari: hikari:
driver-class-name: ${spring.datasource.driver-class-name} driver-class-name: ${spring.datasource.driver-class-name}
jdbc-url: ${spring.datasource.url} jdbc-url: ${spring.datasource.url}
username: ${spring.datasource.username} username: ${spring.datasource.username}
password: ${spring.datasource.password} password: ${spring.datasource.password}
jpa: jpa:
database-platform: org.hibernate.dialect.Oracle10gDialect database-platform: org.hibernate.dialect.H2Dialect
show-sql: false #하이버네이트SQL 콘솔 출력 여부
hibernate: hibernate:
ddl-auto: none # create / create-drop / update / validate / none
ddl-auto: update
open-in-view: true
h2: h2:
console: console:
@ -43,6 +45,7 @@ spring:
path: /h2-console path: /h2-console
kafka: kafka:
producer: producer:
bootstrap-servers: minkyu1128.synology.me:49092 bootstrap-servers: minkyu1128.synology.me:49092
@ -50,11 +53,8 @@ spring:
value-serializer: org.apache.kafka.common.serialization.StringSerializer value-serializer: org.apache.kafka.common.serialization.StringSerializer
consumer: consumer:
bootstrap-servers: minkyu1128.synology.me:49092 bootstrap-servers: minkyu1128.synology.me:49092
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
group-id: group-id-ens group-id: group-id-ens
auto-offset-reset: latest auto-offset-reset: latest
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
max-poll-records: 1 max-poll-records: 1
# enable-auto-commit: true
# auto-commit-interval: 1000

@ -1,46 +0,0 @@
server:
port: 18090 #port
spring:
config:
activate:
on-profile: local-maria
sql:
init:
mode: always
platform: mysql
# schema-locations: classpath:/db/test/schema.sql
# data-locations: classpath:/db/test/data.sql
datasource:
driver-class-name: org.mariadb.jdbc.Driver
url: jdbc:mariadb://211.119.124.117:53306/ens?rewriteBatchedStatements=true&profileSQL=true&logger=Slf4JLogger&maxQuerySizeToLog=999999
username: ens
password: xit5811807
hikari:
driver-class-name: ${spring.datasource.driver-class-name}
jdbc-url: ${spring.datasource.url}
username: ${spring.datasource.username}
password: ${spring.datasource.password}
jpa:
# database-platform: org.hibernate.dialect.MariaDB103Dialect
database-platform: cokr.xit.ens.core.jpa.dialect.MariaDB103DialectCustom
hibernate:
# create / create-drop / update / validate / none
ddl-auto: update
h2:
console:
enabled: true
path: /h2-console
xit:
mblpage:
payinf:
host: http://localhost:8080/ens-middleware

@ -10,34 +10,32 @@ spring:
sql: sql:
init: init:
mode: always mode: always
platform: h2 platform: oracle
# schema-locations: classpath:/db/test/schema.sql
# data-locations: classpath:/db/test/data.sql
datasource: datasource:
# url: "jdbc:h2:tcp://localhost:19092/~/ens" driver-class-name: oracle.jdbc.OracleDriver
url: jdbc:h2:mem:xitdb?rewriteBatchedStatements=true&profileSQL=true&logger=Slf4JLogger&maxQuerySizeToLog=999999 url: jdbc:oracle:thin:@211.119.124.118:1521:bustms
driver-class-name: org.h2.Driver username: iup
username: sa password: iup!0202
password: hikari:
# url: "jdbc:log4jdbc:h2:tcp://localhost/~/dev_post" # auto-commit: false
# driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy connection-test-query: SELECT 1 FROM DUAL
# username: sa transaction-isolation: TRANSACTION_READ_COMMITTED
# password:
hikari: hikari:
driver-class-name: ${spring.datasource.driver-class-name} driver-class-name: ${spring.datasource.driver-class-name}
jdbc-url: ${spring.datasource.url} jdbc-url: ${spring.datasource.url}
username: ${spring.datasource.username} username: ${spring.datasource.username}
password: ${spring.datasource.password} password: ${spring.datasource.password}
jpa: jpa:
database-platform: org.hibernate.dialect.H2Dialect database-platform: org.hibernate.dialect.Oracle10gDialect
show-sql: false #하이버네이트SQL 콘솔 출력 여부
hibernate: hibernate:
# create / create-drop / update / validate / none ddl-auto: none
ddl-auto: update
open-in-view: true
h2: h2:
console: console:
@ -45,7 +43,6 @@ spring:
path: /h2-console path: /h2-console
kafka: kafka:
producer: producer:
bootstrap-servers: minkyu1128.synology.me:49092 bootstrap-servers: minkyu1128.synology.me:49092
@ -53,8 +50,11 @@ spring:
value-serializer: org.apache.kafka.common.serialization.StringSerializer value-serializer: org.apache.kafka.common.serialization.StringSerializer
consumer: consumer:
bootstrap-servers: minkyu1128.synology.me:49092 bootstrap-servers: minkyu1128.synology.me:49092
group-id: group-id-ens
auto-offset-reset: latest
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
group-id: group-id-ens
auto-offset-reset: latest
max-poll-records: 1 max-poll-records: 1
# enable-auto-commit: true
# auto-commit-interval: 1000

@ -1,98 +0,0 @@
server:
port: 18090 #port
servlet:
context-path: /goji
spring:
config:
activate:
on-profile: prod-traffic-cheonan
sql:
init:
mode: always
platform: oracle
datasource:
driver-class-name: oracle.jdbc.OracleDriver
url: jdbc:oracle:thin:@108.1.143.28:11521:ora11g
username: xit_traffic
password: traffic5
hikari:
connection-test-query: SELECT 1 FROM DUAL
transaction-isolation: TRANSACTION_READ_COMMITTED
hikari:
driver-class-name: ${spring.datasource.driver-class-name}
jdbc-url: ${spring.datasource.url}
username: ${spring.datasource.username}
password: ${spring.datasource.password}
jpa:
database-platform: cokr.xit.ens.core.dialect.Oracle10gDialectCustom
show-sql: false
hibernate:
ddl-auto: none
open-in-view: true
xit:
app:
url: https://parking.cheonan.go.kr
ctx: /goji
mblpage:
intgrn:
url: ${xit.app.url}${xit.app.ctx}
path: /intgrn/noti/page/prnt
swagger:
conf:
api:
url: ${xit.app.url}${xit.app.ctx}
version: '@project.version@'
contract:
kakao:
pay:
mydoc:
host: http://parking.cheonan.go.kr
api:
send: /pxy/kkost/v1/documents
token: /pxy/kkost/v1/tokens
readcompleted: /pxy/kkost/v1/documents/change
status: /pxy/kkost/v1/documents/status
bulksend: /pxy/kkost/v1/documents/bulk
bulksend-batch-unit: 100
bulkstatus: /pxy/kkost/v1/documents/bulk/status
nice:
dici:
type: rest
rest:
host: http://parking.cheonan.go.kr
api:
generate-token: /pxy/niceci/digital/niceid/oauth/oauth/token
revoke-token: /pxy/niceci/digital/niceid/oauth/oauth/token/revokeById
publickey: /pxy/niceci/digital/niceid/api/v1.0/common/crypto/publickey
symmetrickey: /pxy/niceci/digital/niceid/api/v1.0/common/crypto/symmetrickey
ci: /pxy/niceci/digital/niceid/cert/v1.0/ipin/addinfo/ci
kt:
signtalk:
gibis:
host: http://108.1.143.27:8071
decorator:
datasource:
p6spy:
enable-logging: false #p6spy logging 활성화 여부

@ -1,69 +0,0 @@
server:
port: 18090 #port
spring:
config:
activate:
on-profile: prod-traffic
sql:
init:
mode: always
platform: mysql
datasource:
driver-class-name: org.mariadb.jdbc.Driver
url: "jdbc:mariadb://152.99.141.30:60001/xplatform?rewriteBatchedStatements=true&profileSQL=true&logger=Slf4JLogger&maxQuerySizeToLog=999999"
username: root
password: xit5811807
hikari:
connection-test-query: SELECT 1 FROM DUAL
transaction-isolation: TRANSACTION_READ_COMMITTED
hikari:
driver-class-name: ${spring.datasource.driver-class-name}
jdbc-url: ${spring.datasource.url}
username: ${spring.datasource.username}
password: ${spring.datasource.password}
jpa:
database-platform: cokr.xit.ens.core.jpa.dialect.MariaDB103DialectCustom
hibernate:
ddl-auto: none
open-in-view: true
contract:
kakao:
pay:
mydoc:
host: https://docs-gw.kakaopay.com
access-token: b40d3c623d1011ecbceae6cf4630da62
contract-uuid: CON-b4126c833d1011ecbceae6cf4630da62
nice:
dici:
type: socket
socket:
site-code: EQ00
site-pw: 76646885
deposit:
token: sha5120e6d1bdf446185e836fd61aa4c645ab0ff4161a4a5919f5d31ea4c2c5ca800bbb5d31f7fbbff2350ebb350f29b5e3ae8cd4a451789823532b8455e7929e578ee
decorator:
datasource:
p6spy:
enable-logging: false

@ -6,7 +6,7 @@ server:
spring: spring:
config: config:
activate: activate:
on-profile: prod-iup on-profile: prod
sql: sql:
@ -15,18 +15,18 @@ spring:
platform: oracle platform: oracle
datasource: datasource:
jndi-name: java:jdbc/cephis_toll jndi-name: java:jdbc/cephis_toll
# driver-class-name: oracle.jdbc.driver.OracleDriver # driver-class-name: oracle.jdbc.driver.OracleDriver
# url: jdbc:oracle:thin:@10.1.1.103:1521:PUBLICDB # url: jdbc:oracle:thin:@10.1.1.103:1521:PUBLICDB
# username: cephis_toll # username: cephis_toll
# password: cephis_toll@044@!! # password: cephis_toll@044@!!
hikari: hikari:
connection-test-query: SELECT 1 FROM DUAL connection-test-query: SELECT 1 FROM DUAL
transaction-isolation: TRANSACTION_READ_COMMITTED transaction-isolation: TRANSACTION_READ_COMMITTED
# hikari: # hikari:
# driver-class-name: ${spring.datasource.driver-class-name} # driver-class-name: ${spring.datasource.driver-class-name}
# jdbc-url: ${spring.datasource.url} # jdbc-url: ${spring.datasource.url}
# username: ${spring.datasource.username} # username: ${spring.datasource.username}
# password: ${spring.datasource.password} # password: ${spring.datasource.password}
jpa: jpa:
database-platform: org.hibernate.dialect.Oracle10gDialect database-platform: org.hibernate.dialect.Oracle10gDialect
show-sql: false show-sql: false
@ -71,11 +71,11 @@ contract:
bulkstatus: /v1/documents/bulk/status bulkstatus: /v1/documents/bulk/status
#TODO feat.ens-proxy 배포 시 아래 path 변경 할 것. #TODO feat.ens-proxy 배포 시 아래 path 변경 할 것.
# send: /pxy/kkost/v1/documents # send: /pxy/kkost/v1/documents
# token: /pxy/kkost/v1/tokens # token: /pxy/kkost/v1/tokens
# readcompleted: /pxy/kkost/v1/documents/change # readcompleted: /pxy/kkost/v1/documents/change
# status: /pxy/kkost/v1/documents/status # status: /pxy/kkost/v1/documents/status
# bulksend: /pxy/kkost/v1/documents/bulk # bulksend: /pxy/kkost/v1/documents/bulk
bill: bill:
dozn: dozn:
host: ${xit.app.url} host: ${xit.app.url}
@ -88,9 +88,9 @@ contract:
notice: /iup/kakao/notice notice: /iup/kakao/notice
prepay: /iup/kakao/prepay prepay: /iup/kakao/prepay
payresult: /iup/kakao/pay-result payresult: /iup/kakao/pay-result
# notice: /bill/kko/pay/notice # notice: /bill/kko/pay/notice
# prepay: /bill/kko/pay/able # prepay: /bill/kko/pay/able
# payresult: /bill/kko/pay/result # payresult: /bill/kko/pay/result
alimtalk: alimtalk:
biztalk: biztalk:
@ -116,9 +116,9 @@ contract:
pay: pay:
easy: easy:
#TODO feat.NaverPay 운영전환 시 네이버 직접호출 불가할 경우 web서버 통해서 호출하도록 설정 #TODO feat.NaverPay 운영전환 시 네이버 직접호출 불가할 경우 web서버 통해서 호출하도록 설정
# host: https://dev.apis.naver.com # host: https://dev.apis.naver.com
host: https://apis.naver.com host: https://apis.naver.com
# host: ${xit.app.url} # host: ${xit.app.url}
partner-id: np_mtbfw423545 partner-id: np_mtbfw423545
client-id: eN8fbl2qw0tox78Z3D5C client-id: eN8fbl2qw0tox78Z3D5C
client-secret: nvE6dSSnGf client-secret: nvE6dSSnGf
@ -126,12 +126,12 @@ contract:
ep-sdk-mode: production ep-sdk-mode: production
api: api:
# TODO feat.NaverPay - 변경된 ens-proxy URL 적용 # TODO feat.NaverPay - 변경된 ens-proxy URL 적용
# pay-apply: /pxy/nvbill/ep/pay-apply # pay-apply: /pxy/nvbill/ep/pay-apply
# pay-cancel: /pxy/nvbill/ep/pay-cancel # pay-cancel: /pxy/nvbill/ep/pay-cancel
# pay-hist: /pxy/nvbill/ep/pay-hist # pay-hist: /pxy/nvbill/ep/pay-hist
# purchase-confirm: /pxy/nvbill/ep/purchase-confirm # purchase-confirm: /pxy/nvbill/ep/purchase-confirm
# point-save: /pxy/nvbill/ep/point-save # point-save: /pxy/nvbill/ep/point-save
# cash-amount: /pxy/nvbill/ep/cash-amount # cash-amount: /pxy/nvbill/ep/cash-amount
validate: validate:
#TODO feat.NaverPay 네이버페이측에서 결제검증 요청 시 ens-middleware 주소인 https://paytoll.koti.re.kr 로 변경 요함 #TODO feat.NaverPay 네이버페이측에서 결제검증 요청 시 ens-middleware 주소인 https://paytoll.koti.re.kr 로 변경 요함
host: ${xit.middle.url} host: ${xit.middle.url}

@ -1,146 +0,0 @@
package cokr.xit;
import cokr.xit.ens.core.utils.DateUtil;
import cokr.xit.ens.core.utils.crypto.Crypto;
import cokr.xit.ens.core.utils.crypto.SHA256;
import cokr.xit.ens.modules.common.ctgy.nicedici.support.rest.model.NiceCiRespDTO;
import cokr.xit.ens.modules.common.ctgy.nicedici.support.rest.model.conf.DataBodyGenerateTokenResp;
import cokr.xit.ens.modules.common.ctgy.nicedici.support.rest.model.conf.DataBodySymkeyResp;
import cokr.xit.ens.core.utils.crypto.AES256;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import org.junit.jupiter.api.Test;
import java.security.NoSuchAlgorithmException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
public class TempTest {
@Test
public void t() throws NoSuchAlgorithmException {
List<String> jids = Arrays.asList("861128-1018410", "8611281234567", "9311281234567", "1211281234567", "1111281234567", "3211281234567");
jids.forEach(s -> {
AES256 aes = new AES256(Crypto.AES256.getKey());
String encStr = aes.encrypt(s);
String decStr = aes.decrypt(encStr);
System.out.println("AES256 enc:::" + encStr);
System.out.println("AES256 dec:::" + decStr);
});
String enc = SHA256.encrypt("8611281018410");
System.out.println("SHA256 enc:::" + enc);
System.out.println("688787d8ff144c502c7f5cffaafe2cc588d86079f9de88304c26b0cb99ce91c6".length());
// Collections.singletonList(Collections.singletonMap())
// new Gson().
}
@Test
public void test() {
Gson gson = new Gson();
ObjectMapper mapper = new ObjectMapper();
String json = "{ \"access_token\": \"a12341234\"}";
try {
DataBodyGenerateTokenResp dto = gson.fromJson(json, DataBodyGenerateTokenResp.class);
DataBodyGenerateTokenResp dto2 = mapper.readValue(json, DataBodyGenerateTokenResp.class);
System.out.println("=========================================");
System.out.println("dto " + dto.toString());
System.out.println("dto2 " + dto2.toString());
Map<String, String> m = gson.fromJson(json, Map.class);
DataBodyGenerateTokenResp dto3 = mapper.convertValue(m, DataBodyGenerateTokenResp.class);
System.out.println("dto3 " + dto3.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void test2() throws ParseException {
System.out.println(DateUtil.daysByFromBetweenTo(new SimpleDateFormat("yyyyMMdd").parse("20220403"), new Date()));
System.out.println(DateUtil.absTimeSecToDate(1576983012, "yyyyMMdd"));
int curSec = (int) (new SimpleDateFormat("yyyyMMdd").parse("20220503").getTime() / 1000);
System.out.println(DateUtil.daysByFromBetweenTo(1576983012, curSec));
System.out.println(1576983012 + curSec);
System.out.println((1576983012 / 24 / 60 / 60));
// System.out.println(new Date().getTime());
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis((1576983012 * 1000L) + (curSec * 1000L));
Date date = calendar.getTime();
System.out.println(new SimpleDateFormat("yyyyMMdd").format(date));
System.out.println(DateUtil.relTimeSecToDate(1576983012, "yyyyMMdd"));
}
@Test
public void test3() {
System.out.println(randomAlphaWord(30));
System.out.println(randomAlphaWord(16));
System.out.println(randomAlphaWord(2));
}
public static String randomAlphaWord(int wordLength) {
Random r = new Random();
StringBuilder sb = new StringBuilder(wordLength);
for (int i = 0; i < wordLength; i++) {
char tmp = (char) ('a' + r.nextInt('z' - 'a'));
sb.append(tmp);
}
return sb.toString();
}
@Test
public void test4() {
final ObjectMapper mapper = new ObjectMapper()
// .disable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
// Map<String, String> dataHeader = new HashMap<>();
// dataHeader.put("GW_RSLT_CD", "abcd");
// dataHeader.put("GW_RSLT_MSG", "aaaaa");
// Map<String, String> dataBody = new HashMap<>();
// dataBody.put("rsp_cd", "1234");
// dataBody.put("res_msg", "hahahah");
// Map<String, Object> mParam = new HashMap<>();
// mParam.put("dataHeader", dataHeader);
//// mParam.put("dataBody", dataBody);
// mParam.put("dataBody", "");
//// mParam.put("dataBody", null);
//
//
//
try {
// String jsonStr = mapper.writeValueAsString(mParam);
//// System.out.println(jsonStr);
//// jsonStr = jsonStr.replaceAll("\"\"", "null");
//// System.out.println(jsonStr);
//
// NiceCiRespDTO<DataBodyCiResp> respDTO = mapper.readValue(jsonStr, NiceCiRespDTO.class);
//// NiceCiRespDTO<DataBodyCiResp> respDTO = mapper.readValue(jsonStr, new TypeReference<NiceCiRespDTO<DataBodyCiResp>>(){});
//// NiceCiRespDTO<DataBodyCiResp> respDTO = mapper.readValue(jsonStr, mapper.getTypeFactory().constructType(DataBodyCiResp.class));
// System.out.println(respDTO.toString());
String strRespBody = "{ \"dataHeader\": { \"CNTY_CD\": \"ko\", \"GW_RSLT_CD\": \"1200\", \"GW_RSLT_MSG\": \"오류 없음\" }, \"dataBody\": { \"rsp_cd\": \"P000\", \"result_cd\": \"0000\", \"symkey_stat_info\": \"{\\\"cur_symkey_version\\\":\\\"20220506A6834B1B-1288-IPCD-965C-8C9B30558CCF\\\",\\\"cur_valid_dtim\\\":\\\"20221106180509\\\"}\" }}";
strRespBody = strRespBody.replace("\\", "").replace("\"{", "{").replace("}\"", "}");
NiceCiRespDTO<DataBodySymkeyResp> result = mapper.readValue(strRespBody, new TypeReference<NiceCiRespDTO<DataBodySymkeyResp>>() {
});
System.out.println(result);
} catch (Exception e) {
e.printStackTrace();
}
}
}

@ -1,183 +0,0 @@
//package cokr.xit.ens.biz.iup.service;
//
//import cokr.xit.ens.core.exception.EnsException;
//import cokr.xit.ens.core.exception.code.EnsErrCd;
//import cokr.xit.ens.modules.common.code.PostSeCd;
//import cokr.xit.ens.modules.common.code.StatCd;
//import cokr.xit.ens.modules.common.code.VenderCd;
//import cokr.xit.ens.modules.common.domain.SendMast;
//import cokr.xit.ens.modules.common.domain.repository.SendMastRepository;
//import cokr.xit.ens.modules.kkoalimtalk.domain.SendDetailKkoAlimtalk;
//import cokr.xit.ens.modules.kkoalimtalk.domain.repository.SendDetailKkoAlimtalkRepository;
//import cokr.xit.ens.modules.common.ctgy.bill.kko.domain.KkoBillMast;
//import cokr.xit.ens.modules.common.ctgy.bill.kko.domain.repository.KkoBillMastRepository;
//import com.fasterxml.jackson.core.JsonProcessingException;
//import com.fasterxml.jackson.databind.ObjectMapper;
//import org.junit.jupiter.api.Test;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.test.context.SpringBootTest;
//
//import java.time.LocalDateTime;
//import java.util.*;
//
//@SpringBootTest
//class IupAlimtalkEnsAcceptorTest {
//
// @Autowired
// private SendMastRepository sendMastRepository;
// @Autowired
// private KkoBillMastRepository kkoBillMastRepository;
// @Autowired
// private SendDetailKkoAlimtalkRepository sendDetailKkoAlimtalkRepository;
//
//
// final String ORG_CD = "123";
// final String TMPLT_CD = "IUP_001";
//
// @Test
// void alimtalk() {
//
// SendMast sendMast = this.makeSendMast(10);
// List<SendDetailKkoAlimtalk> sendDetails = Arrays.asList(
// convertTbInputDataToSendDetailKkoAlimtalk("data-1",sendMast),
// convertTbInputDataToSendDetailKkoAlimtalk("data-2", sendMast),
// convertTbInputDataToSendDetailKkoAlimtalk("data-3", sendMast),
// convertTbInputDataToSendDetailKkoAlimtalk("data-4", sendMast),
// convertTbInputDataToSendDetailKkoAlimtalk("data-5", sendMast),
// convertTbInputDataToSendDetailKkoAlimtalk("data-6", sendMast),
// convertTbInputDataToSendDetailKkoAlimtalk("data-7", sendMast),
// convertTbInputDataToSendDetailKkoAlimtalk("data-8", sendMast),
// convertTbInputDataToSendDetailKkoAlimtalk("data-9", sendMast),
// convertTbInputDataToSendDetailKkoAlimtalk("data-10", sendMast),
// convertTbInputDataToSendDetailKkoAlimtalk("data-11", sendMast),
// convertTbInputDataToSendDetailKkoAlimtalk("data-12", sendMast)
// );
//
//
// sendMastRepository.save(sendMast);
// sendDetails.stream().forEach(row -> kkoBillMastRepository.save(row.getKkoBillMast()));
// List<SendDetailKkoAlimtalk> result = sendDetailKkoAlimtalkRepository.saveAll(sendDetails);
//// System.out.println(result.toString());
// }
//
//
// /**
// * 발송마스터
// * @param sendCnt
// * @return
// */
// private SendMast makeSendMast(int sendCnt){
//
// return SendMast.builder()
// .vender(VenderCd.biztalk)
// .postSe(PostSeCd.kkoAlimtalk)
// .orgCd(ORG_CD)
// .tmpltCd(TMPLT_CD)
// .postBundleTitle("")
//// .acceptDt()
// .statCd(StatCd.accept)
// .sendDt(LocalDateTime.now())
// .sendCnt(sendCnt)
// .readCnt(0)
// .closeDt(LocalDateTime.now())
// .build();
// }
//
// /**
// * 카카오청구서 마스터
// * @param dataId
// * @return
// */
// private KkoBillMast makeKkoBillMast(String dataId){
//
// ObjectMapper mapper = new ObjectMapper();
//
//
// Map<String, Object> mParameters = new HashMap<String, Object>();
// mParameters.put("orgCd", ORG_CD);
// mParameters.put("tmpltCd", TMPLT_CD);
// String parameters = null;
// try {
// parameters = mapper.writeValueAsString(parameters);
// } catch (JsonProcessingException e) {
// throw new EnsException(EnsErrCd.ACPT511, "청구서 parameters 데이터 변환 실패");
// }
// Map<String, Object> mCutomUrl = new HashMap<String, Object>();
// mCutomUrl.put("notice_url", "http://localhost/kakao/notice");
// mCutomUrl.put("prepay_url", "http://localhost/kakao/prepay");
// mCutomUrl.put("pay_result_url", "http://localhost/kakao/pay-result");
// String customUrl = null;
// try {
// customUrl = mapper.writeValueAsString(mCutomUrl);
// } catch (JsonProcessingException e) {
// throw new EnsException(EnsErrCd.ACPT511, "청구서 customUrl 데이터 변환 실패");
// }
// return KkoBillMast.builder()
// .billerUserKey(dataId)
// .billedYearMonth(null)
// .ordinal(null)
// .billerNoticeKey(null)
// .expireAt(String.format("%s235959", "20220221"))
// .parameters(parameters)
// .customUrl(customUrl)
// .build();
//
// }
//
// /**
// * 데이터변환( InputData => SendDetailKkoAlimtalk )
// * @param dataId
// * @param sendMast
// * @return
// */
// private SendDetailKkoAlimtalk convertTbInputDataToSendDetailKkoAlimtalk(String dataId, SendMast sendMast) {
// ObjectMapper mapper = new ObjectMapper();
//
// KkoBillMast kkobillMast = this.makeKkoBillMast(dataId);
//
// Map<String, Object> button = new HashMap<>();
// button.put("name", "납부하기");
// button.put("type", "WL");
// button.put("url_mobile", "#{billlink_url}");
// button.put("url_pc", "#{billlink_url}");
// ArrayList<Map<String, Object>> buttons = new ArrayList<>();
// buttons.add(button);
// Map<String, Object> mAttach = new HashMap<>();
// mAttach.put("button", buttons);
// String attach = null;
// try {
// attach = mapper.writeValueAsString(mAttach);
// } catch (JsonProcessingException e) {
// throw new EnsException(EnsErrCd.ACPT511, "청구서 attach 데이터 변환 실패");
// }
//
//
//
// return SendDetailKkoAlimtalk.builder()
// .sendMast(sendMast)
// .msgIdx(dataId)
// .countryCode("82")
// .recipient(null)
// .senderKey("SENDER_KEY")
// .appUserId(null)
// .orgCode(null)
// .message("NONasfasdf")
// .tmpltCode(TMPLT_CD)
// .title(null)
// .resMethod("PUSH")
// .attach(attach)
// .supplement(null)
// .messageType("AT")
// .useFailback(null)
// .mmsAttach("N")
// .kkoBillMast(kkobillMast)
// .mkName("data.getName()")
// .mkBirthday("data.getBirthday()")
// .mkSid("data.getSid()")
// .mkGender("data.getGender()")
// .mkTmpltMsgJsonData("data.getMsgData()")
// .mkMblJsonData("data.getMsgDtlData()")
// .mkPayBillJsonData(null)
// .build();
// }
//}

@ -1,39 +0,0 @@
package cokr.xit.ens.biz.traffic.chuncheon.mydoc.v2.service;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@SpringBootTest
@ExtendWith(SpringExtension.class)
class TrafficCcMydocServiceTest {
@Autowired
private TrafficCcMydocService trafficCcMydocService;
@Test
void accept() {
}
@Test
void acceptAll() {
}
@Test
void reMake() {
}
@Test
void reSend() {
}
@Test
void fetch() {
}
@Test
void fetchAll() {
}
}

@ -1,53 +0,0 @@
//package cokr.xit.modules.post.domains.sign.domain;
//
//import static org.junit.jupiter.api.Assertions.assertEquals;
//
//import org.junit.jupiter.api.Test;
//import org.junit.jupiter.api.extension.ExtendWith;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
//import org.springframework.test.context.junit.jupiter.SpringExtension;
//
//import cokr.xit.modules.domain.SendMast;
//
//@ExtendWith(SpringExtension.class)
//@DataJpaTest
//class KakaoSignTalkSendInfoRepositoryTest {
//
// @Autowired
// private KakaoSignTalkSendInfoRepository kakaoSignTalkSendInfoRepository;
//
// @Test
// void testFindByTxId() {
// String txId = "abcdefg123456";
//
// final KakaoSignTalkSendInfo param = KakaoSignTalkSendInfo.builder()
// .sendMast(SendMast.builder().vender("kt").build())
// .phone_no("01012341234")
// .name("test")
// .birthday("021025")
// .expires_in(86400)
// .call_center_no("070-1234-1234")
// .title("test")
// .publish_certified_electronic_doc("N")
// .redirect_url("http://xxx.xxx.com")
// .result("N")
// .txId(txId)
// .build();
//
// final KakaoSignTalkSendInfo vo = kakaoSignTalkSendInfoRepository.save(param);
//
// assertEquals(txId, vo.getTxId());
// }
//
//// @Test
//// void testFindBySendMast() {
//// fail("Not yet implemented");
//// }
////
//// @Test
//// void testBatchUpdateByResult() {
//// fail("Not yet implemented");
//// }
//
//}

@ -1,43 +0,0 @@
package cokr.xit.problems;
import org.junit.jupiter.api.Test;
public class FindDuplicateNumber {
@Test
public void main(){
int[] nums = {1,3,4,2,2};
System.out.println(String.format("{1,3,4,2,2} in duplicate number => %s", findDuplicate(nums)));
nums = new int[]{3,1,3,4,2};
System.out.println(String.format("{3,1,3,4,2} in duplicate number => %s", findDuplicate(nums)));
nums = new int[]{1,1};
System.out.println(String.format("{1,1} in duplicate number => %s", findDuplicate(nums)));
nums = new int[]{1,1,2};
System.out.println(String.format("{1,1,2} in duplicate number => %s", findDuplicate(nums)));
nums = new int[]{4,1,2,3,4};
System.out.println(String.format("{4,1,2,3,4} in duplicate number => %s", findDuplicate(nums)));
}
private int findDuplicate(int[] nums) {
int slow = nums[0], fast = nums[nums[0]];
while (slow != fast) {
slow = nums[slow];
fast = nums[nums[fast]];
}
int index = 0;
while (slow != index) {
index = nums[index];
slow = nums[slow];
}
return index;
}
}

@ -1,68 +0,0 @@
package cokr.xit.problems;
import org.junit.jupiter.api.Test;
public class Permutation {
@Test
public void main() {
int n = 3;
int[] arr = {1, 2, 3};
int[] output = new int[n];
boolean[] visited = new boolean[n];
perm(arr, output, visited, 0, n, 3);
System.out.println();
permutation(arr, 0, n, 3);
}
private void perm(int[] arr, int[] output, boolean[] visited, int depth, int n, int r) {
if (depth == r) {
print(output, r);
return;
}
for (int i = 0; i < n; i++) {
if (visited[i] != true) {
visited[i] = true;
output[depth] = arr[i];
perm(arr, output, visited, depth + 1, n, r);
visited[i] = false;
}
}
}
private void permutation(int[] arr, int depth, int n, int r) {
if (depth == r) {
print(arr, r);
return;
}
for (int i = depth; i < n; i++) {
swap(arr, depth, i);
permutation(arr, depth + 1, n, r);
swap(arr, depth, i);
}
}
private void swap(int[] arr, int depth, int i) {
int temp = arr[depth];
arr[depth] = arr[i];
arr[i] = temp;
}
private void print(int[] arr, int r) {
for (int i = 0; i < r; i++)
System.out.print(arr[i] + " ");
System.out.println();
}
}

@ -1,64 +0,0 @@
package cokr.xit.problems;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
class Solution {
@Test
public void main(){
int[] progresses = new int[0];
int[] speeds = new int[0];
progresses = new int[]{93,30,55};
speeds = new int[]{1,30,5};
solution(progresses, speeds);
progresses = new int[]{95,91,95,95, 1};
speeds = new int[]{4,2,3,4,20};
solution(progresses, speeds);
}
public int[] solution(int[] progresses, int[] speeds) {
int[] answer = {};
int[] endDays = new int[progresses.length];
List<Integer> releases = new ArrayList<>();
for(int i=0; i<progresses.length; i++){
int day = (100-progresses[i])/speeds[i];
day += (100-progresses[i])%speeds[i]>0?1:0;
endDays[i] = day;
}
check(releases, endDays, endDays[0], 1, 1, false);
answer = releases.stream().mapToInt(value -> value).toArray();
return answer;
}
private void check(List<Integer> release, int[] endDays, int endDay, int idx, int cnt, boolean isRangeEnd){
if(isRangeEnd){
release.add(cnt);
cnt = 1;
}
if(endDays.length == idx){
release.add(cnt);
return;
}
if(endDays[idx] <= endDay){
check(release, endDays, endDay, ++idx, ++cnt, false);
}else{
check(release, endDays, endDays[idx], ++idx, cnt, true);
}
}
}

@ -1,104 +0,0 @@
package cokr.xit.problems;
import org.junit.jupiter.api.Test;
import java.util.*;
class Solution1 {
@Test
public void main(){
String path = null;
path = "EEESEEEEEENNNN";
solution(path);
// System.out.println(solution(path));
path = "SSSSSSWWWNNNNNN";
solution(path);
// System.out.println(solution(path));
}
public String[] solution(String path){
String[] answer = {};
Map<String,Map<String, String>> mDirection = createLeftRigthByDirection();
List<Map<String, Object>> infos = new ArrayList<>();
Map<String, Object> info = new HashMap<>();
String curD = null;
int m = 0;
for(int i=0; i<path.length(); i++) {
String chngD = path.substring(i, i + 1);
if(i==0) curD = chngD;
else{
if(curD.equals(chngD)){
m++;
}else{
info.put("meter", m+1);
info.put("direction", mDirection.get(curD).get(chngD));
info.put("time", i+1);
infos.add(info);
curD = chngD;
m = 0;
info = new HashMap<>();
}
}
}
String msgTmplt = "Time %d: Go straight %dm and turn %s";
List<String> messages = new ArrayList<>();
for(int i=0; i<infos.size(); i++){
Map<String, Object> inf = infos.get(i);
int x = (int) inf.get("time");
int y = (int) inf.get("meter");
String direction = (String) inf.get("direction");
if(i==0 && y <= 5)
messages.add(String.format(msgTmplt, 0, (y*100), direction));
else
if(y > 5)
messages.add(String.format(msgTmplt, x-5, 500, direction));
else
messages.add(String.format(msgTmplt, x-1, (y*100), direction));
}
System.out.println(messages.toString());
answer = new String[messages.size()];
for(int i=0; i<answer.length; i++)
answer[i] = messages.get(i);
// answer = massages.toArray();
return answer;
}
private Map<String, Map<String, String>> createLeftRigthByDirection(){
Map<String,String> lrE = new HashMap<>();
lrE.put("N", "left");
lrE.put("S", "right");
Map<String,String> lrW = new HashMap<>();
lrW.put("S", "left");
lrW.put("N", "right");
Map<String,String> lrS = new HashMap<>();
lrS.put("E", "left");
lrS.put("W", "right");
Map<String,String> lrN = new HashMap<>();
lrN.put("W", "left");
lrN.put("E", "right");
Map<String,Map<String, String>> mDirection = new HashMap<>();
mDirection.put("E", lrE);
mDirection.put("W", lrW);
mDirection.put("S", lrS);
mDirection.put("N", lrN);
return mDirection;
}
}

@ -1,58 +0,0 @@
package cokr.xit.problems;
import org.junit.jupiter.api.Test;
import java.util.*;
class Solution2 {
@Test
public void main(){
String call = null;
call = "abcabcdefabc";
System.out.println(solution(call));
call = "abxdeydeabz";
System.out.println(solution(call));
call = "abcabca";
System.out.println(solution(call));
call = "ABCabcA";
System.out.println(solution(call));
}
private String solution(String call){
String answer = "";
Map<String, Integer> map = new HashMap();
for(int i=0; i<call.length(); i++){
String ch = call.substring(i, i+1);
map.put(ch.toLowerCase(), map.getOrDefault(ch.toLowerCase(), 0)+1);
}
String maxCntKey = Collections.max(map.entrySet(), Comparator.comparingInt(Map.Entry::getValue)).getKey();
int maxCnt = map.get(maxCntKey);
Iterator<String> it = map.keySet().iterator();
while(it.hasNext()){
String key = it.next();
int value = map.get(key);
if(maxCnt == value){
call = call.replace(key, "").replaceAll(key.toUpperCase(), "");
}
}
return call;
}
}

@ -1,66 +0,0 @@
package cokr.xit.problems;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.Collections;
public class Sort {
@Test
public void fncSortInteger(){
int[] nums = {21,31,19,4,16};
System.out.println("==================================");
System.out.println("index 2 부터 정렬");
System.out.println("==================================");
Arrays.sort(nums, 2, nums.length);
Arrays.stream(nums).asLongStream()
.forEach(System.out::println);
System.out.println("==================================");
System.out.println("index 0 부터 정렬");
System.out.println("==================================");
Arrays.sort(nums);
Arrays.stream(nums).asLongStream()
.forEach(System.out::println);
System.out.println("==================================");
System.out.println("내림차순(desc) 정렬");
System.out.println("==================================");
Integer[] nums2 = {4,2,1,5,3};
Arrays.sort(nums2, Collections.reverseOrder());
Arrays.stream(nums2)
.forEach(System.out::println);
}
@Test
public void fncSortString(){
String[] strs = {"efg","dab","bff","abc",};
System.out.println("==================================");
System.out.println("index 2 부터 정렬");
System.out.println("==================================");
Arrays.sort(strs, 2, strs.length);
Arrays.asList(strs).stream()
.forEach(System.out::println);
System.out.println("==================================");
System.out.println("index 0 부터 정렬");
System.out.println("==================================");
// Arrays.sort(strs);
Arrays.asList(strs).stream()
.sorted()
.forEach(System.out::println);
System.out.println("==================================");
System.out.println("내림차순(desc) 정렬");
System.out.println("==================================");
Arrays.sort(strs, Collections.reverseOrder());
Arrays.asList(strs).stream()
.forEach(System.out::println);
}
}
Loading…
Cancel
Save