init: 춘천, 천안 전자고지 시스템

main
kjh 4 months ago
commit c3e2efbecc

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,450 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>cokr.modules</groupId>
<artifactId>module-post</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>module-post</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<webapp.lib>${basedir}/libs</webapp.lib>
<webapp.lib.jdbc.oracle>ojdbc8</webapp.lib.jdbc.oracle>
<springdoc.swagger>1.6.3</springdoc.swagger>
<mapstruct.version>1.4.2.Final</mapstruct.version>
<lombok.version>1.18.20</lombok.version>
<package.include.base>
3rd-party/**,
resource/**,
WEB-INF/jsp/**,
WEB-INF/META-INF/**,
WEB-INF/classes/application.yml,
WEB-INF/classes/config/*.yml,
WEB-INF/classes/**/ens/*.class,
WEB-INF/classes/**/ens/core/**,
WEB-INF/classes/**/ens/batch/**/EnsScheduler.class,
WEB-INF/classes/**/ens/modules/*.class,
</package.include.base>
<package.exclude.base>
WEB-INF/classes/**/ens/modules/example/**,
</package.exclude.base>
</properties>
<profiles>
<profile>
<id>local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<spring.profiles.active>local</spring.profiles.active>
<packageIncludesByProfile>
${package.include.base}
WEB-INF/classes/**/ens/batch/**,
WEB-INF/classes/**/ens/modules/**,
WEB-INF/classes/application-local*.yml,
</packageIncludesByProfile>
<packageExcludesByProfile>
</packageExcludesByProfile>
</properties>
</profile>
<profile>
<id>prod-iup</id>
<properties>
<spring.profiles.active>prod-iup</spring.profiles.active>
<packageIncludesByProfile>
${package.include.base}
WEB-INF/classes/**/ens/modules/**,
<!-- WEB-INF/classes/**/ens/modules/common/**,-->
<!-- WEB-INF/classes/**/ens/modules/kkomydoc/**,-->
<!-- WEB-INF/classes/**/ens/modules/nvsigntalk/**,-->
WEB-INF/classes/**/ens/biz/iup/**,
WEB-INF/classes/application-prod-iup.yml,
WEB-INF/classes/mybatis-mapper/**,
</packageIncludesByProfile>
<packageExcludesByProfile>
${package.exclude.base}
WEB-INF/classes/**/ens/batch/**/EnsScheduler.class,
WEB-INF/classes/**/ens/biz/iup/_legacy/**,
WEB-INF/classes/**/ens/biz/iup/alimtalk/**,
</packageExcludesByProfile>
</properties>
</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>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.springframework.boot</groupId> -->
<!-- <artifactId>spring-boot-starter-security</artifactId> -->
<!-- </dependency> -->
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.199</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${mapstruct.version}</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<!-- <groupId>com.mysema.querydsl</groupId> -->
<artifactId>querydsl-jpa</artifactId>
<!-- <version>3.6.3</version> -->
<version>4.4.0</version>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<!-- <groupId>com.mysema.querydsl</groupId> -->
<artifactId>querydsl-apt</artifactId>
<!-- <version>3.6.3</version> -->
<version>4.2.1</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.6</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.11</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.10.3</version>
</dependency>
<dependency>
<groupId>com.github.gavlyukovskiy</groupId>
<artifactId>p6spy-spring-boot-starter</artifactId>
<version>1.8.0</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.github.gavlyukovskiy</groupId>-->
<!-- <artifactId>datasource-proxy-spring-boot-starter</artifactId>-->
<!-- <version>1.8.0</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>it.ozimov</groupId>
<artifactId>embedded-redis</artifactId>
<version>0.7.2</version>
</dependency>
<dependency>
<groupId>external</groupId>
<artifactId>nicedici</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${webapp.lib}/VNOInterop.jar</systemPath>
</dependency>
<dependency>
<groupId>external</groupId>
<artifactId>${webapp.lib.jdbc.oracle}</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${webapp.lib}/${webapp.lib.jdbc.oracle}.jar</systemPath>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>${springdoc.swagger}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springdoc</groupId>-->
<!-- <artifactId>springdoc-openapi-security</artifactId>-->
<!-- <version>${springdoc.swagger}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.springdoc</groupId>-->
<!-- <artifactId>springdoc-openapi-data-rest</artifactId>-->
<!-- <version>${springdoc.swagger}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.springdoc</groupId>-->
<!-- <artifactId>springdoc-openapi-webmvc-core</artifactId>-->
<!-- <version>${springdoc.swagger}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.springdoc</groupId>-->
<!-- <artifactId>springdoc-openapi-javadoc</artifactId>-->
<!-- <version>${springdoc.swagger}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>com.slack.api</groupId>
<artifactId>bolt</artifactId>
<version>1.21.2</version>
</dependency>
<dependency>
<groupId>com.slack.api</groupId>
<artifactId>bolt-servlet</artifactId>
<version>1.21.2</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.2.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/java</outputDirectory>
<!-- <processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor> -->
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-mapstruct-binding</artifactId>
<version>0.2.0</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<packagingIncludes>${packageIncludesByProfile}</packagingIncludes>
<packagingExcludes>${packageExcludesByProfile}</packagingExcludes>
</configuration>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,84 @@
package cokr.xit.ens;
import cokr.xit.ens.core.utils.Checks;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.ApplicationPidFileWriter;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
@Slf4j
@SpringBootApplication
//@Import({QuerydslConfig.class, CodeMapperConfig.class})
@ComponentScan(
// nameGenerator = CustomBeanNameGenerator.class,
basePackages = "cokr.xit")
//@EnableAutoConfiguration
@EnableScheduling
//@EnableWebMvc
//public class ModulePostApplication{
public class ModulePostApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
log.info("ENS Application load start...");
if (Checks.isEmpty(System.getProperty("spring.profiles.active"))) {
log.error("====================================================================");
log.error(">>>>>>>>>>>>>> Undefined start option <<<<<<<<<<<<<<");
log.error(">>>>>>>>>>>>>> -Dspring.profiles.active=local|dev|prod-traffic/prod-traffic-cheonan/prod-iup <<<<<<<<<<<<<<");
log.error("============== ENS Application start fail ===============");
log.error("====================================================================");
System.exit(-1);
}
System.setProperty("ens.active.profile", System.getProperty("spring.profiles.active"));
/*
SpringApplication.run(ModulePostApplication.class, args);
*/
Long begin = System.currentTimeMillis();
SpringApplication application = new SpringApplication(ModulePostApplication.class);
application.addListeners(new ApplicationPidFileWriter());
application.run(args);
log.info("=========================================================================================");
log.info("========== ENS Application load Complete :: active profiles - {} ==========", System.getProperty("spring.profiles.active"));
log.info("=========================================================================================");
Long end = System.currentTimeMillis();
System.out.println("====================================================");
System.out.println("기동 소요시간: " + (end - begin) + "ms");
System.out.println("====================================================");
/* multi-thread test */
// try {
// MultiThreadSample.example();
// MultiThreadSample.runnableExample();
// MultiThreadSample.callableExample();
// MultiThreadSample.completionServiceExample();
// } catch (InterruptedException e) {
// e.printStackTrace();
// } catch (ExecutionException e) {
// e.printStackTrace();
// }
/* multi-thread return result test */
// ResultByRunnableExample.main(args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(ModulePostApplication.class);
}
}

@ -0,0 +1,13 @@
package cokr.xit.ens;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(ModulePostApplication.class);
}
}

@ -0,0 +1,70 @@
package cokr.xit.ens.batch.sched;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.service.IntgrnNotiService;
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;
import java.util.List;
@Slf4j
@Component
@Profile("!local & !local-maria & !local-oracle & !local-test")
@RequiredArgsConstructor
public class EnsIntgrnScheduler {
private final IntgrnNotiService intgrnNotiService;
/**
*
* -. .
*/
@Scheduled(cron = "0 */10 9-18 * * *")
public void resended() {
EnsResponseVO responseVO = intgrnNotiService.sendBulkAll();
StringBuffer sb = new StringBuffer();
sb.append("\n=======================================================")
.append("\n[ENS INTGRN] 통합고지 재전송처리")
.append("\n결과: {}")
.append("\n=======================================================");
log.info(sb.toString(), responseVO.toString());
}
/**
*
* -. "실패(~fail) 또는 만료(close) 외" .
* -. "전송완료(sendcmplt) 또는 열람중(open)" .
*/
@Scheduled(cron = "0 0 23 * * *")
public void fetched() {
EnsResponseVO responseVO = intgrnNotiService.statBulkAll();
StringBuffer sb = new StringBuffer();
sb.append("\n=======================================================")
.append("\n[ENS INTGRN] 통합고지 문서상태갱신 처리")
.append("\n결과: {}")
.append("\n=======================================================");
log.info(sb.toString(), responseVO.toString());
}
/**
*
* -. "열람(open)" "마감(close)" .
*/
@Scheduled(cron = "30 0 9-18 * * *")
public void closed() {
EnsResponseVO<List<Long>> responseVO = intgrnNotiService.closed();
StringBuffer sb = new StringBuffer();
sb.append("\n=======================================================")
.append("\n[ENS INTGRN] 통합고지 마감처리 - 총 {}건")
.append("\nIntSendMastId {}")
.append("\n=======================================================");
log.info(sb.toString(), responseVO.getResultInfo().size(), responseVO.getResultInfo().toString());
}
}

@ -0,0 +1,35 @@
package cokr.xit.ens.batch.sched;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.modules.kkoalimtalk.service.KkoAlimtalkService;
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("!local & !local-maria & !local-oracle & !local-test")
@RequiredArgsConstructor
public class EnsKkoAlimtalkScheduler {
private final KkoAlimtalkService kkoAlimtalkService;
/**
*
* -. "제작성공(makeok)" (sendDt) .
*/
@Scheduled(cron = "0 */1 9-18 * * *")
public void sended() {
EnsResponseVO responseVO = kkoAlimtalkService.sendBulkAll();
StringBuffer sb = new StringBuffer();
sb.append("\n=======================================================")
.append("\n[ENS] 카카오 알림톡 전송처리")
.append("\n결과: {}")
.append("\n=======================================================");
log.info(sb.toString(), responseVO.toString());
}
}

@ -0,0 +1,68 @@
package cokr.xit.ens.batch.sched;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.modules.kkomydoc.service.KkoMydocHisService;
import cokr.xit.ens.modules.kkomydoc.service.KkoMydocService;
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("!local & !local-maria & !local-oracle & !local-test")
@RequiredArgsConstructor
public class EnsKkoMydocScheduler {
private final KkoMydocService kkoMydocService;
private final KkoMydocHisService kkoMydocHisService;
/**
* ()
* -. "제작성공(makeok)" .
*/
@Scheduled(cron = "0 */1 9-18 * * *")
public void sended() {
EnsResponseVO responseVO = kkoMydocService.sendBulkAll();
StringBuffer sb = new StringBuffer();
sb.append("\n=======================================================")
.append("\n[ENS] 카카오 내문서함(인증톡) 전송처리")
.append("\n결과: {}")
.append("\n=======================================================");
log.info(sb.toString(), responseVO.toString());
}
/**
* ()
* -. "발송성공/발송완료/열람중(sendok/sendcmplt/open)" .
* -. "전송완료(sendcmplt) 또는 열람중(open)" .
*/
// @Scheduled(cron = "0 */5 9-18 * * *")
@Scheduled(cron = "0 */30 9-18 * * *")
public void fetched() {
EnsResponseVO responseVO = kkoMydocService.statBulkAll();
StringBuffer sb = new StringBuffer();
sb.append("\n=======================================================")
.append("\n[ENS] 카카오 내문서함(인증톡) 문서상태갱신 처리")
.append("\n결과: {}")
.append("\n=======================================================");
log.info(sb.toString(), responseVO.toString());
}
/**
* ()
*/
@Scheduled(cron = "4 4 4 * * *")
public void deleteStateHis() {
Long totCnt = kkoMydocHisService.truncateStatHist();
StringBuffer sb = new StringBuffer();
sb.append("\n=======================================================")
.append("\n[ENS] 카카오 내문서함(인증톡) 상태변경요청이력 영구 삭제")
.append("\n결과: {} 건 삭제")
.append("\n=======================================================");
log.info(sb.toString(), totCnt);
}
}

@ -0,0 +1,82 @@
package cokr.xit.ens.batch.sched;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.core.exception.code.EnsErrCd;
import cokr.xit.ens.modules.ktsigntalk.gibis.service.KtGibisHisService;
import cokr.xit.ens.modules.ktsigntalk.gibis.service.KtGibisService;
import com.querydsl.core.Tuple;
import com.querydsl.jpa.impl.JPAQueryFactory;
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;
import java.util.List;
import static cokr.xit.ens.modules.common.ctgy.sys.mng.domain.QOrgMng.orgMng;
@Slf4j
@Component
@Profile("!local & !local-maria & !local-oracle & !local-test")
@RequiredArgsConstructor
public class EnsKtGibisScheduler {
private final KtGibisService ktGibisService;
private final KtGibisHisService ktGibisHisService;
private final JPAQueryFactory query;
/**
* KT ()
* -. "제작성공(makeok)" .
*/
@Scheduled(cron = "0 */1 9-18 * * *")
public void sended() {
EnsResponseVO responseVO = ktGibisService.sendBulkAll();
log.info("=======================================================");
log.info("[ENS] KT 인증톡(지비스) 전송처리");
log.info("결과: {}", responseVO.toString());
log.info("=======================================================");
}
/**
* KT ()
*/
@Scheduled(cron = "0 0 0 1 */4 *")
public void refreshAuthToken() {
List<Tuple> list = query.select(orgMng.orgCd, orgMng.ktStClientId, orgMng.ktStClientSecret)
.from(orgMng)
.where(orgMng.ktStAccessToken.isNotNull())
.fetch();
int cntRefresh = list.stream()
.map(tuple -> {
EnsResponseVO<Long> ensResponseVO = ktGibisService.refreshAuthToken(tuple.get(orgMng.orgCd), tuple.get(orgMng.ktStClientId), tuple.get(orgMng.ktStClientSecret));
return EnsErrCd.OK.equals(ensResponseVO.getErrCode()) ? 1 : 0;
})
.reduce(Integer::sum)
.orElse(0);
log.info("=======================================================");
log.info("[ENS] KT 인증톡(지비스) accessToken 갱신");
log.info("결과: {} 건 갱신({}/{})", cntRefresh, cntRefresh, list.size());
log.info("=======================================================");
}
// /**
// * KT 인증톡(지비스) 상태갱신요청이력 영구 삭제
// */
// @Scheduled(cron = "4 4 4 * * *")
// public void deleteStateHis() {
// EnsResponseVO<Long> ensResponseVO = ktGibisHisService.truncateStatHist();
// log.info("=======================================================");
// log.info("[ENS] KT 인증톡(지비스) 상태변경요청이력 영구 삭제");
// log.info("결과: {} 건 삭제", ensResponseVO.getResultInfo());
// log.info("=======================================================");
// }
}

@ -0,0 +1,63 @@
package cokr.xit.ens.batch.sched;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.modules.ktsigntalk.direct.service.KtSigntalkHisService;
import cokr.xit.ens.modules.ktsigntalk.direct.service.KtSigntalkService;
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("!local & !local-maria & !local-oracle & !local-test")
@RequiredArgsConstructor
public class EnsKtSigntalkScheduler {
private final KtSigntalkService ktSigntalkService;
private final KtSigntalkHisService ktSigntalkHisService;
/**
* KT
* -. "제작성공(makeok)" .
*/
@Scheduled(cron = "0 */1 9-18 * * *")
public void sended() {
EnsResponseVO responseVO = ktSigntalkService.sendBulkAll();
log.info("=======================================================");
log.info("[ENS] KT 인증톡 전송처리");
log.info("결과: {}", responseVO.toString());
log.info("=======================================================");
}
/**
* KT
* -. "발송성공/발송완료/열람중(sendok/sendcmplt/open)" .
* -. "전송완료(sendcmplt) 또는 열람중(open)" .
*/
// @Scheduled(cron = "0 */5 9-18 * * *")
@Scheduled(cron = "0 */30 9-18 * * *")
public void fetched() {
EnsResponseVO responseVO = ktSigntalkService.statBulkAll();
log.info("=======================================================");
log.info("[ENS] KT 인증톡 문서상태갱신 처리");
log.info("결과: {}", responseVO.toString());
log.info("=======================================================");
}
/**
* KT
*/
@Scheduled(cron = "4 4 4 * * *")
public void deleteStateHis() {
EnsResponseVO<Long> ensResponseVO = ktSigntalkHisService.truncateStatHist();
log.info("=======================================================");
log.info("[ENS] KT 인증톡 상태변경요청이력 영구 삭제");
log.info("결과: {} 건 삭제", ensResponseVO.getResultInfo());
log.info("=======================================================");
}
}

@ -0,0 +1,70 @@
package cokr.xit.ens.batch.sched;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.modules.nvsigntalk.service.NvSigntalkHisService;
import cokr.xit.ens.modules.nvsigntalk.service.NvSigntalkService;
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("!local & !local-maria & !local-oracle & !local-test")
@RequiredArgsConstructor
public class EnsNvSigntalkScheduler {
private final NvSigntalkService nvSigntalkService;
private final NvSigntalkHisService nvSigntalkHisService;
/**
* ()
* -. "제작성공(makeok)" .
*/
@Scheduled(cron = "0 */1 9-18 * * *")
public void sended() {
EnsResponseVO responseVO = nvSigntalkService.sendBulkAll();
StringBuffer sb = new StringBuffer();
sb.append("\n=======================================================")
.append("\n[ENS] 네이버 고지서(인증톡) 전송처리")
.append("\n결과: {}")
.append("\n=======================================================");
log.info(sb.toString(), responseVO.toString());
}
/**
* ()
* -. "발송성공/발송완료/열람중(sendok/sendcmplt/open)" .
* -. "전송완료(sendcmplt) 또는 열람중(open)" .
*/
// @Scheduled(cron = "0 */5 9-18 * * *")
@Scheduled(cron = "0 */30 9-18 * * *")
public void fetched() {
EnsResponseVO responseVO = nvSigntalkService.statBulkAll();
StringBuffer sb = new StringBuffer();
sb.append("\n=======================================================")
.append("\n[ENS] 네이버 고지서(인증톡) 문서상태갱신 처리")
.append("\n결과: {}")
.append("\n=======================================================");
log.info(sb.toString(), responseVO.toString());
}
/**
* ()
*/
@Scheduled(cron = "4 4 4 * * *")
public void deleteStateHis() {
Long totCnt = nvSigntalkHisService.truncateStatHist();
StringBuffer sb = new StringBuffer();
sb.append("\n=======================================================")
.append("\n[ENS] 네이버 고지서(인증톡) 상태변경요청이력 영구 삭제")
.append("\n결과: {} 건 삭제")
.append("\n=======================================================");
log.info(sb.toString(), totCnt);
}
}

@ -0,0 +1,48 @@
package cokr.xit.ens.batch.sched;
import cokr.xit.ens.modules.common.code.StatCd;
import cokr.xit.ens.modules.common.domain.SendMast;
import cokr.xit.ens.modules.common.domain.repository.SendMastRepository;
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;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
@Component
@Profile("!local & !local-maria & !local-oracle & !local-test")
//@Profile({"prod-traffic", "prod-iup"})
@RequiredArgsConstructor
public class EnsScheduler {
private final SendMastRepository sendMastRepository;
/**
*
* -. "열람(open)" "마감(close)" .
*/
@Scheduled(cron = "0 1 10 * * *")
@Transactional
public void closed() {
log.info("=======================================================");
List<SendMast> sendMastList = sendMastRepository.findAllByStatCdInAndCloseDtBefore(Arrays.asList(StatCd.sendcmplt, StatCd.open), LocalDateTime.now().minusDays(1));
log.info("[ENS] 마감처리 - 총 {}건", sendMastList.size());
log.info("SendMastId {}", sendMastList.stream()
.map(row -> {
row.setStatCd(StatCd.close);
return row.getSendMastId();
})
.collect(Collectors.toList())
.toString());
log.info("=======================================================");
}
}

@ -0,0 +1,42 @@
//package cokr.xit.biz.iup._legacy;
//
//
//import four.api.service.DoznService;
//import four.api.service.DoznVO;
//import java.util.Date;
//import javax.annotation.Resource;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//@RestController
//public class ApiController {
// private final Logger logger = LoggerFactory.getLogger(getClass());
//
// @Resource(name = "DoznService")
// private DoznService doznService;
//
// @RequestMapping(value = {"/kakao/notice"}, produces = {"application/json; charset=utf-8;"})
// public String createBill(@RequestBody String data) {
// this.logger.info("/kakao/notice(" + new Date() + ") : " + data);
// DoznVO doznVO = this.doznService.selectNoticeInfo(data);
// return this.doznService.updateApiResponse(doznVO);
// }
//
// @RequestMapping(value = {"/kakao/prepay"}, produces = {"application/json; charset=utf-8;"})
// public String kakaoPrepay(@RequestBody String data) {
// this.logger.info("/kakao/prepay(" + new Date() + ") : " + data);
// DoznVO doznVO = this.doznService.selectPrepayInfo(data);
// return this.doznService.updateApiResponse(doznVO);
// }
//
// @RequestMapping(value = {"/kakao/pay-result"}, produces = {"application/json; charset=utf-8;"})
// public String kakaoPayResult(@RequestBody String data) {
// this.logger.info("/kakao/pay-result(" + new Date() + ") : " + data);
// DoznVO doznVO = this.doznService.insertPayResultInfo(data);
// return this.doznService.updateApiResponse(doznVO);
// }
//}
//

@ -0,0 +1,54 @@
package cokr.xit.ens.biz.iup._legacy;
public class DetailVO
{
public String title;
public String itemType;
public String description;
public String unitName;
public Object elements;
public DetailVO()
{
this.title = null;
this.itemType = null;
this.description = null;
this.unitName = null;
this.elements = null; }
public String getTitle() {
return this.title; }
public void setTitle(String title) {
this.title = title; }
public String getItemType() {
return this.itemType; }
public void setItemType(String item_type) {
this.itemType = item_type; }
public String getDescription() {
return this.description; }
public void setDescription(String description) {
this.description = description; }
public Object getElements() {
return this.elements; }
public void setElements(Object elements) {
this.elements = elements; }
public String getUnitName() {
return this.unitName; }
public void setUnitName(String unitName) {
this.unitName = unitName;
}
public String toString()
{
return "DetailVO [title=" + this.title + ", itemType=" + this.itemType ;
}
}

@ -0,0 +1,274 @@
<!--<?xml version="1.0" encoding="UTF-8" ?>-->
<!--<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">-->
<!--<mapper namespace="DoznDAO">-->
<!-- &lt;!&ndash; <resultMap type="DoznVO" id="doznDtlMap">-->
<!-- <id property="billerNoticeKey" column="BILLER_NOTICE_KEY" />-->
<!-- <result property="billerUserKey" column="BILLER_USER_KEY"/>-->
<!-- <result property="billedYearMonth" column="BILLED_YEAR_MONTH"/>-->
<!-- <result property="ordinal" column="ORDINAL"/>-->
<!-- <result property="payBy" column="PAY_BY"/>-->
<!-- <result property="payType" column="PAY_TYPE"/>-->
<!-- <result property="payDetail1" column="PAY_DETAIL1"/>-->
<!-- <result property="payDetail2" column="PAY_DETAIL2"/>-->
<!-- <result property="amount" column="AMOUNT"/>-->
<!-- <result property="payAmount" column="PAY_AMOUNT"/>-->
<!-- <result property="payFeeType" column="PAY_FEE_TYPE"/>-->
<!-- <result property="payFee" column="PAY_FEE"/>-->
<!-- <result property="payFeeTax" column="PAY_FEE_TAX"/>-->
<!-- <result property="adjustDate" column="ADJUST_DATE"/>-->
<!-- <result property="paidAt" column="PAID_AT"/>-->
<!-- <result property="payId" column="PAY_ID"/>-->
<!-- <result property="resCode" column="RES_CODE"/>-->
<!-- <result property="message" column="MESSAGE"/>-->
<!-- <result property="errMsg" column="ERR_MSG"/>-->
<!-- <result property="userBirth" column="USER_BIRTH"/>-->
<!-- <result property="requestData" column="REQUEST_DATA"/>-->
<!-- <result property="responseData" column="RESPONSE_DATA"/>-->
<!-- <result property="orgCd" column="ORG_CD"/>-->
<!-- <result property="parametersJson" column="PARAMETERS" />-->
<!-- <collection property="details" ofType="DetailVO">-->
<!-- <result property="elements" column="CI_SEND_YN"/>-->
<!-- </collection>-->
<!-- </resultMap> &ndash;&gt;-->
<!-- <select id="selectNoticeName" resultType="String" parameterType="DoznVO">-->
<!-- SELECT Q1.JOB_NAME AS TITLE-->
<!-- FROM-->
<!-- FS_JOB Q1,-->
<!-- (-->
<!-- SELECT-->
<!-- A.JOB_CD,-->
<!-- B.DATA_ID-->
<!-- FROM-->
<!-- TB_INPUT A,-->
<!-- TB_INPUT_DATA B-->
<!-- WHERE-->
<!-- A.LNK_INPUT_ID = B.LNK_INPUT_ID-->
<!-- ) Q2-->
<!-- WHERE Q1.JOB_CD = Q2.JOB_CD-->
<!-- AND Q2.DATA_ID = #{billerUserKey}-->
<!-- </select>-->
<!-- <select id="selectNoticeInfo" resultType="DoznVO" parameterType="DoznVO">-->
<!-- SELECT-->
<!-- ENFRC_LEV_MASTR_ID,-->
<!-- USER_BIRTH ,-->
<!-- AMOUNT ,-->
<!-- PAY_EXPIRE_DATE ,-->
<!-- DETAIL_PASNG_CHRGE_SM ,-->
<!-- DETAIL_ADI_PASNG_CHRGE_SM-->
<!-- FROM V_KAKAO_NOTICE_INFO-->
<!-- WHERE 1=1-->
<!-- AND ENFRC_LEV_MASTR_ID = SUBSTR(#{billerUserKey}, 1, 20)-->
<!-- </select>-->
<!-- <select id="selectNoticeInfoSn" resultType="DoznVO" parameterType="DoznVO">-->
<!-- SELECT-->
<!-- USER_BIRTH ,-->
<!-- AMOUNT ,-->
<!-- PAY_EXPIRE_DATE ,-->
<!-- DETAIL_PASNG_CHRGE_SM ,-->
<!-- DETAIL_ADI_PASNG_CHRGE_SM-->
<!-- FROM V_KAKAO_NOTICE_INFO_SN-->
<!-- WHERE 1=1-->
<!-- AND DATA_ID = #{billerUserKey}-->
<!-- </select>-->
<!-- <select id="selectPrepayInfo" resultType="DoznVO" parameterType="DoznVO">-->
<!-- SELECT-->
<!-- ENFRC_LEV_RCIV_ID-->
<!-- FROM TB_ENFRC_LEV_RCIV-->
<!-- WHERE ENFRC_LEV_MASTR_ID = SUBSTR(#{billerUserKey}, 1, 20)-->
<!-- AND DELETE_AT = 'N'-->
<!-- </select>-->
<!-- <insert id="insertPayResultInfo" parameterType="DoznVO">-->
<!-- INSERT INTO TB_KAKAO_PAY_RESULT-->
<!-- (-->
<!-- DATA_ID,-->
<!-- JOB_SE,-->
<!-- PAY_MN,-->
<!-- PAY_TY,-->
<!-- PAY_DETAIL_1,-->
<!-- PAY_DETAIL_2,-->
<!-- PAY_DETAIL_3,-->
<!-- PAY_AMOUNT,-->
<!-- PAY_FEE_TY,-->
<!-- PAY_FEE_AMOUNT,-->
<!-- PAY_FEE_VAT,-->
<!-- EXCCLC_PREARNGE_DE,-->
<!-- PAY_DT,-->
<!-- PAY_ID,-->
<!-- PAY_RESULT_PROCESS_STTUS,-->
<!-- CREAT_DT,-->
<!-- CRTR-->
<!-- )-->
<!-- VALUES-->
<!-- (-->
<!-- #{billerUserKey},-->
<!-- #{jobSe},-->
<!-- #{payBy},-->
<!-- #{payType},-->
<!-- #{payDetail1},-->
<!-- #{payDetail2},-->
<!-- #{payDetail3},-->
<!-- #{payAmount},-->
<!-- #{payFeeType},-->
<!-- #{payFee},-->
<!-- #{payFeeTax},-->
<!-- #{adjustDate},-->
<!-- #{paidAt},-->
<!-- #{payId},-->
<!-- 0,-->
<!-- SYSDATE,-->
<!-- #{crtr}-->
<!-- )-->
<!-- </insert>-->
<!-- <select id="selectApiUrl" resultType="String" parameterType="DoznVO">-->
<!-- SELECT-->
<!-- <choose>-->
<!-- &lt;!&ndash; <when test = '"NOTICE".equals(apiType)'>-->
<!-- CONSIGNMENT_YN-->
<!-- </when> &ndash;&gt;-->
<!-- <when test = '"PREPAY".equals(apiType)'>-->
<!-- PREPAY_API-->
<!-- </when>-->
<!-- <when test = '"PAY_RESULT".equals(apiType)'>-->
<!-- PAY_RESULT_API-->
<!-- </when>-->
<!-- </choose>-->
<!-- FROM MOBI_ORG_MNG-->
<!-- WHERE ORG_CD = #{orgCd}-->
<!-- </select>-->
<!-- <select id="selectConsignmentYn" resultType="String" parameterType="String">-->
<!-- SELECT CONSIGNMENT_YN FROM MOBI_ORG_MNG WHERE ORG_CD = #{orgCd}-->
<!-- </select>-->
<!-- <select id="selectTbSeq" resultType="Integer" parameterType="DoznVO">-->
<!-- SELECT-->
<!-- <choose>-->
<!-- <when test = '"NOTICE".equals(apiType)'>-->
<!-- TB_PAY_NOTICE_SEQ.NEXTVAL-->
<!-- </when>-->
<!-- <when test = '"PREPAY".equals(apiType)'>-->
<!-- TB_PAY_PREPAY_SEQ.NEXTVAL-->
<!-- </when>-->
<!-- <when test='"PAY_RESULT".equals(apiType)'>-->
<!-- TB_PAY_RESULT_SEQ.NEXTVAL-->
<!-- </when>-->
<!-- </choose>-->
<!-- AS TB_SEQ From DUAL-->
<!-- </select>-->
<!-- <insert id="insertApiRequest" parameterType="DoznVO">-->
<!-- INSERT INTO-->
<!-- <choose>-->
<!-- <when test = '"NOTICE".equals(apiType)'>-->
<!-- TB_PAY_NOTICE (-->
<!-- PAY_NOTICE_SEQ,-->
<!-- USER_BIRTH,-->
<!-- </when>-->
<!-- <when test = '"PREPAY".equals(apiType)'>-->
<!-- TB_PAY_PREPAY (-->
<!-- PAY_PREPAY_SEQ,-->
<!-- AMOUNT ,-->
<!-- </when>-->
<!-- <when test='"PAY_RESULT".equals(apiType)'>-->
<!-- TB_PAY_RESULT (-->
<!-- PAY_RESULT_SEQ,-->
<!-- PAY_BY ,-->
<!-- PAY_TYPE ,-->
<!-- PAY_DETAIL1 ,-->
<!-- PAY_DETAIL2 ,-->
<!-- AMOUNT ,-->
<!-- PAY_AMOUNT ,-->
<!-- PAY_FEE ,-->
<!-- PAY_FEE_TAX ,-->
<!-- ADJUST_DATE ,-->
<!-- PAID_AT ,-->
<!-- PAY_ID ,-->
<!-- </when>-->
<!-- </choose>-->
<!-- REQUEST_DATA ,-->
<!-- BILLER_USER_KEY ,-->
<!-- BILLED_YEAR_MONTH ,-->
<!-- ORDINAL ,-->
<!-- BILLER_NOTICE_KEY ,-->
<!-- PARAMETERS ,-->
<!-- ORG_CD ,-->
<!-- REQ_DT-->
<!-- )-->
<!-- VALUES (-->
<!-- #{tbSeq},-->
<!-- <choose>-->
<!-- <when test = '"NOTICE".equals(apiType)'>-->
<!-- #{userBirth},-->
<!-- </when>-->
<!-- <when test = '"PREPAY".equals(apiType)'>-->
<!-- #{amount},-->
<!-- </when>-->
<!-- <when test='"PAY_RESULT".equals(apiType)'>-->
<!-- #{payBy},-->
<!-- #{payType},-->
<!-- #{payDetail1},-->
<!-- #{payDetail2},-->
<!-- #{amount},-->
<!-- #{payAmount},-->
<!-- #{payFee},-->
<!-- #{payFeeTax},-->
<!-- #{adjustDate},-->
<!-- #{paidAt},-->
<!-- #{payId},-->
<!-- </when>-->
<!-- </choose>-->
<!-- #{requestData},-->
<!-- #{billerUserKey},-->
<!-- #{billedYearMonth},-->
<!-- #{ordinal},-->
<!-- #{billerNoticeKey},-->
<!-- #{parametersJson},-->
<!-- #{orgCd},-->
<!-- SYSDATE-->
<!-- )-->
<!-- </insert>-->
<!-- <update id="updateApiResponse" parameterType="DoznVO">-->
<!-- UPDATE-->
<!-- <choose>-->
<!-- <when test = '"NOTICE".equals(apiType)'>-->
<!-- TB_PAY_NOTICE-->
<!-- </when>-->
<!-- <when test = '"PREPAY".equals(apiType)'>-->
<!-- TB_PAY_PREPAY-->
<!-- </when>-->
<!-- <when test='"PAY_RESULT".equals(apiType)'>-->
<!-- TB_PAY_RESULT-->
<!-- </when>-->
<!-- </choose>-->
<!-- SET-->
<!-- RES_CODE = #{resCode} ,-->
<!-- MESSAGE = #{message},-->
<!-- RESPONSE_DATA = #{responseData},-->
<!-- RES_DT = SYSDATE,-->
<!-- ERR_MSG = #{errMsg}-->
<!-- WHERE-->
<!-- <choose>-->
<!-- <when test = '"NOTICE".equals(apiType)'>-->
<!-- PAY_NOTICE_SEQ = #{tbSeq}-->
<!-- </when>-->
<!-- <when test = '"PREPAY".equals(apiType)'>-->
<!-- PAY_PREPAY_SEQ = #{tbSeq}-->
<!-- </when>-->
<!-- <when test='"PAY_RESULT".equals(apiType)'>-->
<!-- PAY_RESULT_SEQ = #{tbSeq}-->
<!-- </when>-->
<!-- </choose>-->
<!-- </update>-->
<!--</mapper>-->

@ -0,0 +1,354 @@
//package cokr.xit.biz.iup.service;
//
//import cokr.xit.biz.iup._legacy.DoznVO;
//import com.fasterxml.jackson.databind.ObjectMapper;
//import com.google.gson.FieldNamingPolicy;
//import com.google.gson.Gson;
//import com.google.gson.GsonBuilder;
//import egovframework.com.cmm.util.StringUtil;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
//import java.io.*;
//import java.net.HttpURLConnection;
//import java.net.URL;
//import java.net.URLEncoder;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//public class DoznSender
//{
// private final Logger logger = LoggerFactory.getLogger(super.getClass());
//
// public static int CALL_FAIL_REPEAT_COUNT = 1;
//
// public static String PROXY_USE_YN = null;
// public static String PROXY_IP = null;
// public static int PROXY_PORT = 0;
//
// public static int CALL_CONNECTION_TIMEOUT = 8000;
//
// private ObjectMapper objectMapper = null;
//
// private String API_HOST = null;
// private String BILLER_CODE = null;
// private String AUTHORIZATION = null;
//
// public DoznSender() {
// getObjectMapper();
// this.logger.debug("DoznSender init");
// }
//
// public DoznSender(String api_host, String biller_code, String authorization)
// {
// getObjectMapper();
// this.API_HOST = api_host;
// this.BILLER_CODE = biller_code;
// this.AUTHORIZATION = authorization;
//
// this.logger.debug("DoznSender init");
// }
//
// public ObjectMapper getObjectMapper()
// {
// if (this.objectMapper == null) {
// this.objectMapper = new ObjectMapper();
// }
// return this.objectMapper;
// }
//
// public String makeQuerystring(Map<String, Object> params)
// throws IOException
// {
// if (params == null) return null;
// if (params.size() == 0) return null;
// StringBuffer sb = new StringBuffer();
// for (String key : params.keySet()) {
// if (sb.length() > 0) sb.append("&");
// sb.append(key + "=" + encodeString(params.get(key)));
// }
// return sb.toString();
// }
//
// public String encodeString(Object value) throws IOException {
// return URLEncoder.encode(String.valueOf(value), "UTF-8");
// }
//
// private Map<String, Object> parseRespData(String plaindata)
// throws IOException
// {
// return ((Map)getObjectMapper().readValue(plaindata, Map.class));
// }
//
// private void setResponse(Response resp) throws IOException {
// if (resp == null) return;
// if ((resp.status != -1) && (resp.plaindata != null)) {
// Map respMap = parseRespData(resp.plaindata);
// if (respMap.get("res_code") != null) {
// resp.res_code = ((String)respMap.get("res_code"));
// }
// if (respMap.get("message") != null) {
// resp.message = ((String)respMap.get("message"));
// }
// if (respMap.get("data") != null) {
// resp.data = respMap.get("data");
// }
// if (respMap.size() > 0)
// resp.plaindata = null;
// }
// }
//
// private HttpURLConnection getConnection(String address)
// throws IOException
// {
// URL url = new URL(address);
// return ((HttpURLConnection)url.openConnection());
// }
//
// public Response callGenerateUrl(Map<String, Object> params)
// {
// String uri = "/external/inquiry-payment/one-time/url/" + this.BILLER_CODE;
// try
// {
// HashMap someParam = new HashMap();
// someParam.put("some_param", params.get("org_cd"));
//
// HashMap parameters = new HashMap();
// parameters.put("biller_user_key", params.get("data_id"));
// parameters.put("expire_at", params.get("pay_expires_dt"));
// parameters.put("parameters", someParam);
//
// HashMap sendParams = new HashMap();
// sendParams.put("data", parameters);
//
// String querystring = this.objectMapper.writeValueAsString(sendParams);
//
// Response resp = sendData(uri, "POST", "application/json; charset=utf-8", querystring, "N");
// setResponse(resp);
//
// return resp;
// } catch (IOException e) {
// this.logger.error("callGenerateUrl {}", e);
// }
// return null;
// }
//
// public Response callReGenerateUrl(Map<String, Object> params)
// {
// String uri = "/external/inquiry-payment/one-time/url/re/" + this.BILLER_CODE;
// try
// {
// HashMap someParam = new HashMap();
// someParam.put("some_param", params.get("org_cd"));
//
// HashMap parameters = new HashMap();
// parameters.put("biller_user_key", params.get("data_id"));
// parameters.put("expire_at", params.get("pay_expires_dt"));
// parameters.put("parameters", someParam);
//
// HashMap sendParams = new HashMap();
// sendParams.put("data", parameters);
//
// String querystring = this.objectMapper.writeValueAsString(sendParams);
//
// Response resp = sendData(uri, "POST", "application/json; charset=utf-8", querystring, "N");
// setResponse(resp);
//
// return resp;
// } catch (IOException e) {
// this.logger.error("callReGenerateUrl {}", e);
// }
// return null;
// }
//
// public Response sendData(String uri, String method, String contentType, String querystring, String fullUrlYn)
// {
// int respCode;
// HttpURLConnection conn = null;
// OutputStreamWriter out = null;
//
// InputStream is = null;
// BufferedReader br = null;
//
// Response resp = new Response(this);
// try
// {
// String address = "";
//
// if ("N".equals(fullUrlYn)) {
// if ((this.API_HOST == null) || (this.API_HOST.length() < 5)) {
// throw new IOException("API_URL is null!");
// }
// if ((uri == null) || (uri.isEmpty())) {
// throw new IOException("URI is null!");
// }
//
// address = this.API_HOST + uri;
// }
// else {
// if ((uri == null) || (uri.isEmpty())) {
// throw new IOException("URI is null!");
// }
//
// address = uri;
// }
//
// this.logger.debug("DoznSender uri: " + address);
//
// if ((contentType == null) || (contentType.length() == 0)) {
// contentType = "application/json; charset=utf-8";
// }
//
// conn = getConnection(address);
//
// conn.setDefaultUseCaches(false);
// conn.setDoInput(true);
// conn.setDoOutput(true);
// conn.setRequestMethod(method);
// conn.setRequestProperty("Content-Type", contentType);
//
// if (this.AUTHORIZATION != null) {
// conn.setRequestProperty("Authorization", this.AUTHORIZATION);
// }
//
// conn.setConnectTimeout(CALL_CONNECTION_TIMEOUT);
// conn.setReadTimeout(CALL_CONNECTION_TIMEOUT);
// conn.connect();
//
// if ((querystring != null) && (querystring.length() > 0)) {
// this.logger.debug("DoznSender querystring[" + querystring + "]");
// out = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
// out.write(querystring);
// out.flush();
// }
//
// respCode = conn.getResponseCode();
// System.out.println("respCode:" + respCode);
//
// if (respCode >= 400)
// {
// is = conn.getErrorStream();
// }
// else is = conn.getInputStream();
//
// br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
//
// String line = null;
// StringBuffer bf = new StringBuffer();
// while ((line = br.readLine()) != null) {
// bf.append(line.trim());
// }
// if (respCode != 200) {
// this.logger.warn("DoznSender HTTP status: " + respCode);
// }
// this.logger.debug("DoznSender RESPONSE: " + bf.toString());
//
// resp.status = respCode;
// resp.plaindata = bf.toString();
// return resp;
// }
// catch (IOException e) {
// this.logger.error("DoznSender sendData {}", e.toString());
// if ((querystring != null) && (querystring.length() > 0) &&
// (!(uri.endsWith("S510")))) {
// this.logger.warn(">>> DoznSender querystring: " + querystring);
// }
//
// resp.status = -1;
// resp.message = e.getLocalizedMessage();
// return resp;
// }
// finally {
// if (conn != null) { conn.disconnect(); conn = null; }
// if (out != null) { try { out.close(); } catch (IOException e) { this.logger.error("sendData finally {}", e); } out = null; }
// if (br != null) { try { br.close(); } catch (IOException e) { this.logger.error("sendData finally {}", e); } br = null; }
// if (is != null) { try { is.close(); } catch (IOException e) { this.logger.error("sendData finally {}", e); } is = null;
// }
// }
// }
//
// public String simpleResponse(DoznVO doznVO)
// {
// Map respData = new HashMap();
// DoznVO resultVO = new DoznVO();
// Response resp = new Response(this);
//
// if ((StringUtil.evl(doznVO.getApiType(), "").equals("NOTICE")) && (doznVO.getResCode().equals("OK")))
// {
// HashMap hashMap = new HashMap();
// hashMap.put("biller_user_key", doznVO.getBillerUserKey());
// hashMap.put("title", doznVO.getTitle());
// hashMap.put("amount", doznVO.getAmount());
//
// hashMap.put("expire_type", doznVO.getExpireType());
// hashMap.put("pay_expire_date", doznVO.getPayExpireDate());
//
// HashMap detail = new HashMap();
// List elements = new ArrayList();
// List details = new ArrayList();
// detail.put("item_type", "TEXT");
//
// elements.add("상세 통행료 : " + doznVO.getDetailPasngChrgeSm());
// elements.add("상세 부가통행료 : " + doznVO.getDetailAdiPasngChrgeSm());
// detail.put("elements", elements);
//
// details.add(detail);
// hashMap.put("details", details);
// respData.put("result", hashMap);
// }
// else {
// respData = null;
// }
//
// this.logger.debug("getResCode:" + doznVO.getResCode());
// this.logger.debug("getMessage:" + doznVO.getMessage());
//
// resp.res_code = doznVO.getResCode();
// resp.message = doznVO.getMessage();
// resp.data = respData;
//
// String result = new Gson().toJson(resp).replace("\"status\":0,", "");
//
// this.logger.debug("return :" + result);
// return result;
// }
//
// public DoznVO getData(String data)
// {
// Gson gson = new GsonBuilder()
// .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
// .create();
//
// String result = data.replace(" ", "").replace("\n", "").replace("\r", "").replace("\"data\":", "");
//
// return ((DoznVO)gson.fromJson(result.substring(1, result.length() - 1), DoznVO.class));
// }
//
// public DoznVO callBillsInfoUrl(String request, String uri) throws Exception
// {
// try {
// Response resp = sendData(uri, "POST", "application/json; charset=utf-8", request, "Y");
// setResponse(resp);
//
// DoznVO result = new DoznVO();
//
// this.logger.debug("res_code:" + resp.res_code);
// this.logger.debug("message:" + resp.message);
//
// result.setResCode(resp.res_code);
// result.setMessage(resp.message);
//
// if ((!(result.getResCode().equals("OK"))) || (!(result.getMessage().equals("성공")))) {
// result.setErrMsg(result.getMessage());
// }
//
// return result;
// } catch (IOException e) {
// this.logger.error("callBillsInfoUrl {}", e);
// }
//
// return null;
// }
//}

@ -0,0 +1,300 @@
//package cokr.xit.biz.iup._legacy;
//
//public class DoznServiceImpl {
//
//
// public DoznVO selectNoticeInfo(String request)
// {
// DoznVO data = this.doznSender.getData(request);
//
// String orgCd = null;
//
// if (data.getParameters() != null) {
// orgCd = (String)data.getParameters().get("some_param");
// }
//
// DoznVO noticeVO = new DoznVO();
// String errMsg = null;
//
// String title = this.doznDAO.selectNoticeName(data);
//
// data.setApiType("NOTICE");
// data.setTbSeq(Integer.valueOf(this.doznDAO.c(data)));
// data.setRequestData(request);
// data.setOrgCd(orgCd);
// data.setParametersJson();
// try
// {
// this.doznDAO.insertApiRequest(data);
// } catch (Exception e) {
// log.error("insertPayResultInfo : " + e.getMessage());
// }
//
// if ((orgCd == null) || (orgCd.equals(""))) {
// noticeVO = new DoznVO();
// noticeVO.setBillerUserKey(data.getBillerUserKey());
// noticeVO.setApiType("NOTICE");
// noticeVO.setResCode("E402");
// noticeVO.setMessage("청구서 조회 결과가 없습니다.");
// noticeVO.setErrMsg("요청받은 값에 기관코드가 없습니다.");
// noticeVO.setTbSeq(data.getTbSeq());
//
// return noticeVO;
// }
//
// String consignmentYn = this.doznDAO.selectConsignmentYn(orgCd);
// try
// {
// if ((consignmentYn == null) || (consignmentYn.equals("")))
// throw new Exception("청구서 조회 DB 구분값 미등록");
// if (consignmentYn.equals("N"))
// noticeVO = this.doznDAO.selectNoticeInfo(data);
// else if (consignmentYn.equals("Y")) {
// noticeVO = this.doznDAO.selectNoticeInfoSn(data);
// }
//
// if (noticeVO == null)
// throw new Exception("청구서 조회 결과가 없습니다.");
// }
// catch (Exception e)
// {
// log.error("selectNoticeInfo : " + e.getMessage());
// noticeVO = new DoznVO();
// noticeVO.setBillerUserKey(data.getBillerUserKey());
// noticeVO.setApiType("NOTICE");
// noticeVO.setResCode("E402");
// noticeVO.setMessage("청구서 조회 결과가 없습니다.");
// noticeVO.setErrMsg("청구서 조회 결과가 없습니다.");
// noticeVO.setTbSeq(data.getTbSeq());
// return noticeVO;
// }
//
// if (noticeVO != null)
// {
// noticeVO.setBillerUserKey(data.getBillerUserKey());
// noticeVO.setApiType("NOTICE");
// noticeVO.setResCode("OK");
// noticeVO.setMessage("성공");
// noticeVO.setTbSeq(data.getTbSeq());
// noticeVO.setExpireType("D1");
// }
//
// if ((title == null) || (title.equals("")))
// {
// noticeVO = new DoznVO();
// noticeVO.setBillerUserKey(data.getBillerUserKey());
// noticeVO.setApiType("NOTICE");
// noticeVO.setResCode("E402");
// noticeVO.setMessage("청구서 조회 결과가 없습니다.");
// noticeVO.setErrMsg("청구서 조회 결과가 없습니다.");
// noticeVO.setTbSeq(data.getTbSeq());
// return noticeVO;
// }
// noticeVO.setTitle(title);
//
// if ((noticeVO.getUserBirth() == null) || (noticeVO.getUserBirth().equals("")) || (!(noticeVO.getUserBirth().equals(data.getUserBirth())))) {
// noticeVO = new DoznVO();
// noticeVO.setBillerUserKey(data.getBillerUserKey());
// noticeVO.setApiType("NOTICE");
// noticeVO.setResCode("E404");
// noticeVO.setMessage("생년월일이 일치하지 않습니다.");
// noticeVO.setErrMsg("생년월일이 일치하지 않습니다.");
// noticeVO.setTbSeq(data.getTbSeq());
// return noticeVO;
// }
//
// return noticeVO;
// }
//
// public DoznVO selectPrepayInfo(String request) {
// DoznVO data = this.doznSender.getData(request);
// String orgCd = null;
// DoznVO noticeInfo = null;
// DoznVO prepayVO = null;
// if (data.getParameters() != null)
// orgCd = (String)data.getParameters().get("some_param");
// data.setApiType("PREPAY");
// data.setTbSeq(Integer.valueOf(this.doznDAO.selectTbSeq(data)));
// data.setRequestData(request);
// data.setOrgCd(orgCd);
// data.setParametersJson();
// try {
// this.doznDAO.insertApiRequest(data);
// } catch (Exception e) {
// this.logger.error("selectPrepayInfo : " + e.getMessage());
// }
// if (orgCd == null || orgCd.equals("")) {
// prepayVO = new DoznVO();
// prepayVO.setBillerUserKey(data.getBillerUserKey());
// prepayVO.setApiType("PREPAY");
// prepayVO.setResCode("E601");
// prepayVO.setMessage("수납처리실패 - 납부요청 정보 조회 실패");
// prepayVO.setErrMsg("요청받은 값에 기관코드가 없습니다.");
// prepayVO.setTbSeq(data.getTbSeq());
// return prepayVO;
// }
// Date now = new Date();
// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
// try {
// String consignmentYn = this.doznDAO.selectConsignmentYn(orgCd);
// if (consignmentYn == null || consignmentYn.equals(""))
// throw new Exception("청구서 조회 DB 구분값 미등록");
// if (consignmentYn.equals("N")) {
// noticeInfo = this.doznDAO.selectNoticeInfo(data);
// } else if (consignmentYn.equals("Y")) {
// noticeInfo = this.doznDAO.selectNoticeInfoSn(data);
// }
// if (noticeInfo != null) {
// if (consignmentYn.equals("N")) {
// prepayVO = this.doznDAO.selectPrepayInfo(data);
// } else if (consignmentYn.equals("Y")) {
//
// prepayVO = this.doznSender.callBillsInfoUrl(request, this.doznDAO.selectApiUrl(data));
// prepayVO.setApiType("PREPAY");
// prepayVO.setTbSeq(data.getTbSeq());
// return prepayVO;
// }
// } else {
// prepayVO = new DoznVO();
// prepayVO.setBillerUserKey(data.getBillerUserKey());
// prepayVO.setApiType("PREPAY");
// prepayVO.setResCode("E502");
// prepayVO.setMessage("납부불가 - 납부 대상 없음");
// prepayVO.setErrMsg("납부대상이 존재하지 않습니다.");
// prepayVO.setTbSeq(data.getTbSeq());
// this.logger.error("selectPrepayInfo : " + prepayVO.getMessage());
// return prepayVO;
// }
//
//
// if (prepayVO != null)
// throw new Exception("수납처리실패 - 납부요청 정보 조회 실패");
// } catch (Exception e) {
// this.logger.error("selectPrepayInfo : " + e.getMessage());
// prepayVO = new DoznVO();
// prepayVO.setBillerUserKey(data.getBillerUserKey());
// prepayVO.setApiType("PREPAY");
// prepayVO.setResCode("E601");
// prepayVO.setMessage("수납처리실패 - 납부요청 정보 조회 실패");
// prepayVO.setErrMsg("수납처리실패 - 납부요청 정보 조회 실패");
// prepayVO.setTbSeq(data.getTbSeq());
// return prepayVO;
// }
//
//
// if (prepayVO == null) {
// prepayVO = new DoznVO();
// prepayVO.setBillerUserKey(data.getBillerUserKey());
// prepayVO.setApiType("PREPAY");
// prepayVO.setResCode("OK");
// prepayVO.setMessage("성공");
// prepayVO.setTbSeq(data.getTbSeq());
// }
// if (noticeInfo.getPayExpireDate() != null &&
// Integer.parseInt(noticeInfo.getPayExpireDate()) < Integer.parseInt(format.format(now).replace("-", ""))) {
// this.logger.error("selectPrepayInfo - noticeInfo.getPayExpireDate() : " + noticeInfo.getPayExpireDate());
// prepayVO = new DoznVO();
// prepayVO.setBillerUserKey(data.getBillerUserKey());
// prepayVO.setApiType("PREPAY");
// prepayVO.setResCode("E506");
// prepayVO.setMessage("납부기한이 경과했습니다.");
// prepayVO.setErrMsg("납부기한이 경과하여 납부가 불가능합니다. 이용기관에 문의하세요");
// prepayVO.setTbSeq(data.getTbSeq());
// return prepayVO;
// }
// if (noticeInfo.getAmount() == null || noticeInfo.getAmount().intValue() == 0 || !noticeInfo.getAmount().equals(data.getAmount())) {
// prepayVO.setResCode("E403");
// prepayVO.setMessage("납부 가능 금액이 없습니다.");
// prepayVO.setErrMsg("고객정보 및 금액이 일치하지 않아 납부가 불가합니다");
// prepayVO.setTbSeq(data.getTbSeq());
// return prepayVO;
// }
// return prepayVO;
// }
//
//
// public DoznVO insertPayResultInfo(String request)
// {
// DoznVO resultVO = new DoznVO();
//
// String orgCd = null;
// DoznVO data = null;
// try
// {
// data = this.doznSender.getData(request);
// if (data.getParameters() != null)
// orgCd = (String)data.getParameters().get("some_param");
// }
// catch (Exception consignmentYn)
// {
// log.error("FAILED TO PARSE DoznVO : " + request);
// log.error("insertPayResultInfo : " + consignmentYn.getMessage());
// }
// finally {
// data.setApiType("PAY_RESULT");
// data.setTbSeq(Integer.valueOf(this.doznDAO.selectTbSeq(data)));
// data.setRequestData(request);
// data.setOrgCd(orgCd);
// data.setParametersJson();
// try
// {
// this.doznDAO.insertApiRequest(data);
// } catch (Exception e) {
// log.error("insertPayResultInfo : " + e.getMessage());
// }
//
// resultVO.setBillerUserKey(data.getBillerUserKey());
// resultVO.setApiType("PAY_RESULT");
// resultVO.setResCode("OK");
// resultVO.setMessage("성공");
// resultVO.setTbSeq(data.getTbSeq());
//
// if (data.getBillerUserKey().substring(0, 2).equals("EL")) {
// data.setJobSe("2");
// }
// else {
// data.setJobSe("1");
// }
//
// this.doznDAO.insertPayResultInfo(data);
//
// String consignmentYn = this.doznDAO.selectConsignmentYn(orgCd);
// if (consignmentYn.equals("Y"))
// {
// try {
// resultVO = this.doznSender.callBillsInfoUrl(request, this.doznDAO.selectApiUrl(data));
// resultVO.setApiType("PAY_RESULT");
// resultVO.setTbSeq(data.getTbSeq());
// } catch (Exception e) {
// log.error("insertPayResultInfo : " + e.getMessage());
// resultVO.setResCode("SYSERR");
// resultVO.setMessage(orgCd + "(orgCd) 기관과의 통신 오류");
// resultVO.setApiType("PAY_RESULT");
// resultVO.setTbSeq(data.getTbSeq());
// }
//
// return resultVO; }
// if ((consignmentYn == null) || (consignmentYn.equals(""))) {
// resultVO.setResCode("SYSERR");
// resultVO.setMessage("위탁업체여부 구분값 미등록");
// resultVO.setApiType("PAY_RESULT");
// resultVO.setTbSeq(data.getTbSeq());
// }
// }
//
// return resultVO;
// }
//
// public String updateApiResponse(DoznVO doznVO)
// {
// doznVO.setResponseData(this.doznSender.simpleResponse(doznVO));
// try
// {
// this.doznDAO.updateApiResponse(doznVO);
// } catch (Exception e) {
// log.error("insertPayResultInfo : " + e.getMessage());
// }
//
// return doznVO.getResponseData();
// }
//}

@ -0,0 +1,450 @@
package cokr.xit.ens.biz.iup._legacy;
import java.util.List;
import java.util.Map;
public class DoznVO
{
private String billerUserKey;
private String billedYearMonth;
private String ordinal;
private String billerNoticeKey;
private Map<String, Object> parameters;
private String userBirth;
private Integer tbSeq;
private String settlementCode;
private String title;
private Integer amount;
private Integer taxFreeAmount;
private Integer vatAmount;
private String expireType;
private String payExpireDate;
private String secondPayExpireDate;
private String bankCode;
private String accountNo;
private String holderName;
private String senderName;
private String accountType;
private List<DetailVO> details;
private String enfrcLevMasterId;
private String enfrcLevRcivId;
private String jobSe;
private Integer detailPasngChrgeSm;
private Integer detailAdiPasngChrgeSm;
private String payBy;
private String payType;
private String payDetail1;
private String payDetail2;
private String payDetail3;
private Integer payAmount;
private String payFeeType;
private String payFee;
private String payFeeTax;
private String adjustDate;
private String paidAt;
private String payId;
private String requestData;
private String responseData;
private String resCode;
private String message;
private String errMsg;
private String orgCd;
private String parametersJson;
private String apiType;
private String crtr;
public DoznVO()
{
this.taxFreeAmount = null;
this.vatAmount = null;
this.crtr = "SYSTEM"; }
public String getParametersJson() {
return this.parametersJson;
}
public void setParametersJson() {
this.parametersJson = "{\"some_param\" : \"" + this.orgCd + "\"}";
}
public List<DetailVO> getDetails() {
return this.details;
}
public void setDetails(List<DetailVO> details) {
this.details = details;
}
public String getPayId() {
return this.payId;
}
public void setPayId(String payId) {
this.payId = payId;
}
public Integer getTbSeq() {
return this.tbSeq;
}
public void setTbSeq(Integer tbSeq) {
this.tbSeq = tbSeq;
}
public String getUserBirth() {
return this.userBirth;
}
public void setUserBirth(String userBirth) {
this.userBirth = userBirth;
}
public String getSettlementCode() {
return this.settlementCode;
}
public void setSettlementCode(String settlementCode) {
this.settlementCode = settlementCode;
}
public String getBillerUserKey() {
return this.billerUserKey;
}
public void setBillerUserKey(String billerUserKey) {
this.billerUserKey = billerUserKey;
}
public String getBilledYearMonth() {
return this.billedYearMonth;
}
public void setBilledYearMonth(String billedYearMonth) {
this.billedYearMonth = billedYearMonth;
}
public String getOrdinal() {
return this.ordinal;
}
public void setOrdinal(String ordinal) {
this.ordinal = ordinal;
}
public String getBillerNoticeKey() {
return this.billerNoticeKey;
}
public void setBillerNoticeKey(String billerNoticeKey) {
this.billerNoticeKey = billerNoticeKey;
}
public String getTitle() {
return this.title;
}
public void setTitle(String title) {
this.title = title;
}
public Integer getAmount() {
return this.amount;
}
public void setAmount(Integer amount) {
this.amount = amount;
}
public Integer getTaxFreeAmount() {
return this.taxFreeAmount;
}
public void setTaxFreeAmount(Integer taxFreeAmount) {
this.taxFreeAmount = taxFreeAmount;
}
public Integer getVatAmount() {
return this.vatAmount;
}
public void setVatAmount(Integer vatAmount) {
this.vatAmount = vatAmount;
}
public String getExpireType() {
return this.expireType;
}
public void setExpireType(String expireType) {
this.expireType = expireType;
}
public String getPayExpireDate() {
return this.payExpireDate;
}
public void setPayExpireDate(String payExpireDate) {
this.payExpireDate = payExpireDate;
}
public String getSecondPayExpireDate() {
return this.secondPayExpireDate;
}
public void setSecondPayExpireDate(String secondPayExpireDate) {
this.secondPayExpireDate = secondPayExpireDate;
}
public Map<String, Object> getParameters() {
return this.parameters;
}
public void setParameters(Map<String, Object> parameters) {
this.parameters = parameters;
}
public String getApiType() {
return this.apiType;
}
public void setApiType(String apiType) {
this.apiType = apiType;
}
public String getBankCode() {
return this.bankCode;
}
public void setBankCode(String bankCode) {
this.bankCode = bankCode;
}
public String getAccountNo() {
return this.accountNo;
}
public void setAccountNo(String accountNo) {
this.accountNo = accountNo;
}
public String getHolderName() {
return this.holderName;
}
public void setHolderName(String holderName) {
this.holderName = holderName;
}
public String getSenderName() {
return this.senderName;
}
public void setSenderName(String senderName) {
this.senderName = senderName;
}
public String getAccountType() {
return this.accountType;
}
public void setAccountType(String accountType) {
this.accountType = accountType;
}
public String getEnfrcLevMasterId() {
return this.enfrcLevMasterId;
}
public void setEnfrcLevMasterId(String enfrcLevMasterId) {
this.enfrcLevMasterId = enfrcLevMasterId;
}
public String getJobSe() {
return this.jobSe;
}
public void setJobSe(String jobSe) {
this.jobSe = jobSe;
}
public Integer getDetailPasngChrgeSm() {
return this.detailPasngChrgeSm;
}
public void setDetailPasngChrgeSm(Integer detailPasngChrgeSm) {
this.detailPasngChrgeSm = detailPasngChrgeSm;
}
public Integer getDetailAdiPasngChrgeSm() {
return this.detailAdiPasngChrgeSm;
}
public void setDetailAdiPasngChrgeSm(Integer detailAdiPasngChrgeSm) {
this.detailAdiPasngChrgeSm = detailAdiPasngChrgeSm;
}
public String getPayBy() {
return this.payBy;
}
public void setPayBy(String payBy) {
this.payBy = payBy;
}
public String getPayType() {
return this.payType;
}
public void setPayType(String payType) {
this.payType = payType;
}
public String getPayDetail1() {
return this.payDetail1;
}
public void setPayDetail1(String payDetail1) {
this.payDetail1 = payDetail1;
}
public String getPayDetail2() {
return this.payDetail2;
}
public void setPayDetail2(String payDetail2) {
this.payDetail2 = payDetail2;
}
public String getPayDetail3() {
return this.payDetail3;
}
public void setPayDetail3(String payDetail3) {
this.payDetail3 = payDetail3;
}
public Integer getPayAmount() {
return this.payAmount;
}
public void setPayAmount(Integer payAmount) {
this.payAmount = payAmount;
}
public String getPayFeeType() {
return this.payFeeType;
}
public void setPayFeeType(String payFeeType) {
this.payFeeType = payFeeType;
}
public String getPayFee() {
return this.payFee;
}
public void setPayFee(String payFee) {
this.payFee = payFee;
}
public String getPayFeeTax() {
return this.payFeeTax;
}
public void setPayFeeTax(String payFeeTax) {
this.payFeeTax = payFeeTax;
}
public String getAdjustDate() {
return this.adjustDate;
}
public void setAdjustDate(String adjustDate) {
this.adjustDate = adjustDate;
}
public String getPaidAt() {
return this.paidAt;
}
public void setPaidAt(String paidAt) {
this.paidAt = paidAt;
}
public String getPaidId() {
return this.payId;
}
public void setPaidId(String paidId) {
this.payId = paidId;
}
public String getRequestData() {
return this.requestData;
}
public void setRequestData(String requestData) {
this.requestData = requestData;
}
public String getResponseData() {
return this.responseData;
}
public void setResponseData(String responseData) {
this.responseData = responseData;
}
public String getResCode() {
return this.resCode;
}
public void setResCode(String resCode) {
this.resCode = resCode;
}
public String getMessage() {
return this.message;
}
public void setMessage(String message) {
this.message = message;
}
public String getErrMsg() {
return this.errMsg;
}
public void setErrMsg(String errMsg) {
this.errMsg = errMsg;
}
public String getOrgCd() {
return this.orgCd;
}
public void setOrgCd(String orgCd) {
this.orgCd = orgCd;
}
public String getEnfrcLevRcivId() {
return this.enfrcLevRcivId;
}
public void setEnfrcLevRcivId(String enfrcLevRcivId) {
this.enfrcLevRcivId = enfrcLevRcivId;
}
public String getCrtr() {
return this.crtr;
}
public void setCrtr(String crtr) {
this.crtr = crtr;
}
}

@ -0,0 +1,12 @@
package cokr.xit.ens.biz.iup.alimtalk.model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
@Getter
@Schema(name = "IupAlimtalkReqVO")
public class IupAlimtalkReqVO {
@Schema(required = true, title = "연계입수 아이디", example = " ")
private Long lnkInputId;
}

@ -0,0 +1,38 @@
package cokr.xit.ens.biz.iup.alimtalk.mq;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Profile;
import org.springframework.kafka.annotation.KafkaListener;
import javax.annotation.Resource;
import java.io.IOException;
@Slf4j
//@Component
@Profile("prod-iup")
public class IupAlimtalkConsumer {
@Resource(name = "iupAlimtalkMakerLegacy")
// @Autowired
// private IupAlimtalkMakerLegacy iupAlimtalkMaker;
/**
*
* @param message
* @throws IOException
*/
@SuppressWarnings("unchecked")
@KafkaListener(topics = "iup-kkoalimtalk-makereq", groupId = "group-id-ens")
public void subMakeReq(String message) throws IOException {
log.info("[iup-kkoalimtalk-makereq] sub message : " + message);
try {
Long sendMastId = Long.parseLong(message);
// iupAlimtalkMaker.make(sendMastId);
} catch (Exception e) {
e.printStackTrace();
}
}
}

@ -0,0 +1,28 @@
package cokr.xit.ens.biz.iup.alimtalk.mq;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class IupAlimtalkProducer {
@Autowired
private KafkaTemplate<String, String> kafkaTemplate;
/**
*
* @param message
*/
public void pubMakeReq(String message) {
final String topicName = "iup-kkoalimtalk-makereq";
log.info(String.format("[%s] pub message : %s", topicName, message));
this.kafkaTemplate.send(topicName, message);
}
}

@ -0,0 +1,54 @@
package cokr.xit.ens.biz.iup.alimtalk.presentation;
import cokr.xit.ens.biz.iup.alimtalk.model.IupAlimtalkReqVO;
import cokr.xit.ens.biz.iup.alimtalk.service.IupAlimtalkService;
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.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@Tag(name = "IupAlimtalkController")
@Slf4j
@RequiredArgsConstructor
@RestController
public class IupAlimtalkController {
private final IupAlimtalkService iupAlimtalkService;
@Operation(summary = "접수")
@PostMapping(value = "/iup/alimtalk/accept", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EnsResponseVO> accept(@RequestBody IupAlimtalkReqVO reqDTO){
EnsResponseVO responseVO = iupAlimtalkService.accept(reqDTO.getLnkInputId());
return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
}
@Operation(summary = "제작")
// @PutMapping(value = "/iup/alimtalk/re/make", produces = MediaType.APPLICATION_JSON_VALUE)
@PostMapping(value = "/iup/alimtalk/re/make", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EnsResponseVO> reMake(@RequestBody IupAlimtalkReqVO reqDTO){
EnsResponseVO responseVO = iupAlimtalkService.reMake(reqDTO.getLnkInputId());
return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
}
@Operation(summary = "전송")
// @PutMapping(value = "/iup/alimtalk/re/send", produces = MediaType.APPLICATION_JSON_VALUE)
@PostMapping(value = "/iup/alimtalk/re/send", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EnsResponseVO> reSend(@RequestBody IupAlimtalkReqVO reqDTO){
EnsResponseVO responseVO = iupAlimtalkService.reSend(reqDTO.getLnkInputId());
return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
}
@Operation(summary = "전송결과가져오기")
@PostMapping(value = "/iup/alimtalk/fetch", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EnsResponseVO> fetch(@RequestBody IupAlimtalkReqVO reqDTO){
EnsResponseVO responseVO = iupAlimtalkService.fetch(reqDTO.getLnkInputId());
return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
}
}

@ -0,0 +1,45 @@
package cokr.xit.ens.biz.iup.alimtalk.sched;
import cokr.xit.ens.biz.iup.alimtalk.service.IupAlimtalkService;
import cokr.xit.ens.core.aop.EnsResponseVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
@Slf4j
//@Component
//@Profile("prod-iup")
@RequiredArgsConstructor
public class IupAlimtalkScheduler {
private final IupAlimtalkService iupAlimtalkService;
/**
*
* -. IUP ENS .
*/
@Scheduled(cron = "0 */5 7-22 * * *")
public void accepted() {
EnsResponseVO responseVO = iupAlimtalkService.acceptAll();
log.info("=======================================================");
log.info("[IUP] 알림톡 접수처리 결과");
log.info(responseVO.toString());
log.info("=======================================================");
}
/**
*
* -. (/) ENS -> IUP .
*/
@Scheduled(cron = "0 */15 7-22 * * *")
public void fetched() {
EnsResponseVO responseVO = iupAlimtalkService.fetchAll();
log.info("=======================================================");
log.info("[IUP] 알림톡 전송결과 Fetch");
log.info(responseVO.toString());
log.info("=======================================================");
}
}

@ -0,0 +1,164 @@
package cokr.xit.ens.biz.iup.alimtalk.service;
import cokr.xit.ens.biz.iup.alimtalk.service.support.IupAlimtalkAcceptor;
import cokr.xit.ens.biz.iup.alimtalk.service.support.IupAlimtalkFetcher;
import cokr.xit.ens.biz.iup.alimtalk.service.support.IupAlimtalkMaker;
import cokr.xit.ens.biz.iup.alimtalk.service.support.IupAlimtalkSender;
import cokr.xit.ens.biz.iup.code.IupPrcsCd;
import cokr.xit.ens.biz.iup.code.IupSendTypeCd;
import cokr.xit.ens.biz.iup.domain.TbInputXit;
import cokr.xit.ens.biz.iup.domain.repository.TbInputXitRepository;
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.kkoalimtalk.service.event.KkoAlimtalkSendReserveEvent;
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 IupAlimtalkService {
private final TbInputXitRepository tbInputXitRepository;
private final IupAlimtalkAcceptor iupAlimtalkAcceptor;
private final IupAlimtalkMaker iupAlimtalkMaker;
private final IupAlimtalkSender iupAlimtalkSender;
private final IupAlimtalkFetcher iupAlimtalkFetcher;
private final ApplicationEventPublisher applicationEventPublisher;
/**
* (IUP -> ENS)
*/
public EnsResponseVO accept(Long lnkInputId){
try {
TbInputXit tbInputXit = tbInputXitRepository.findByPrcsCdAndSendTypeAndId(IupPrcsCd.TGRG, IupSendTypeCd.NI, lnkInputId)
.orElseThrow(()->new EnsException(EnsErrCd.ACPT404, "일치하는 자료가 없거나 \"등록(TGRG)\" 상태가 아닙니다."));
return this.accept(Arrays.asList(tbInputXit)).getResultInfo().get(0);
} catch (EnsException e){
return EnsResponseVO.errBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
}
}
/**
* (IUP -> ENS)
*/
public EnsResponseVO<List<EnsResponseVO>> acceptAll(){
try {
List<TbInputXit> tbInputXits = tbInputXitRepository.findAllByPrcsCdInAndSendType(Arrays.asList(IupPrcsCd.TGRG), IupSendTypeCd.NI);
if(CmmnUtil.isEmpty(tbInputXits))
throw new EnsException(EnsErrCd.ACPT404, "\"등록(TGRG)\" 상태의 자료가 없습니다.");
return this.accept(tbInputXits);
} catch (EnsException e){
return EnsResponseVO.<List<EnsResponseVO>>errBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
}
}
private EnsResponseVO<List<EnsResponseVO>> accept(List<TbInputXit> tbInputXits){
iupAlimtalkAcceptor.statReady(tbInputXits.stream().map(row -> row.getLnkInputId()).collect(Collectors.toList()));
List<EnsResponseVO> resultInfo = tbInputXits.stream()
.map(row -> iupAlimtalkAcceptor.execute(row.getLnkInputId()))
.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());
KkoAlimtalkSendReserveEvent event = KkoAlimtalkSendReserveEvent.builder()
.sendMastIds(sendMastIds)
.callback(() -> this.fetch(tbInputXits))
.build();
applicationEventPublisher.publishEvent(event);
return EnsResponseVO.<List<EnsResponseVO>>okBuilder().resultInfo(resultInfo).build();
}
/**
*
* @param lnkInputId
* @return
*/
public EnsResponseVO reMake(Long lnkInputId){
return iupAlimtalkMaker.execute(lnkInputId);
}
/**
*
* @param lnkInputId
* @return
*/
public EnsResponseVO reSend(Long lnkInputId){
return iupAlimtalkSender.execute(lnkInputId);
}
/**
* (/)
*/
public EnsResponseVO fetch(Long lnkInputId){
TbInputXit tbInputXit = null;
try {
tbInputXit = tbInputXitRepository.findById(lnkInputId)
.orElseThrow(() -> new EnsException(EnsErrCd.ERR404, String.format("[ lnkInputId %s ]와 일치하는 자료가 없습니다.", lnkInputId)));
if(!IupSendTypeCd.NI.equals(tbInputXit.getSendType()))
new EnsException(EnsErrCd.ERR404, String.format("[ lnkInputId %s ]는 인증톡 자료가 아닙니다.", lnkInputId));
} catch (EnsException e) {
return EnsResponseVO.errBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
}
return this.fetch(Arrays.asList(tbInputXit));
}
/**
* (/)
*/
public EnsResponseVO fetchAll(){
List<TbInputXit> tbInputXits = tbInputXitRepository.findAllByPrcsCdInAndSendType(Arrays.asList(IupPrcsCd.TGRC), IupSendTypeCd.NI);
return this.fetch(tbInputXits);
}
private EnsResponseVO fetch(List<TbInputXit> tbInputXits){
iupAlimtalkFetcher.statReady(tbInputXits.stream().map(row -> row.getLnkInputId()).collect(Collectors.toList()));
return EnsResponseVO.okBuilder()
.resultInfo(
tbInputXits.stream()
.map(row -> iupAlimtalkFetcher.execute(row.getLnkInputId()))
.collect(Collectors.toList()
)
)
.build();
}
}

@ -0,0 +1,430 @@
package cokr.xit.ens.biz.iup.alimtalk.service;
import cokr.xit.ens.biz.iup.billpay.service.IupBillPayApiServiceSupport;
import cokr.xit.ens.biz.iup.domain.TbEnfrcLevRciv;
import cokr.xit.ens.biz.iup.domain.TbInputDataXit;
import cokr.xit.ens.biz.iup.domain.VKakaoNoticeInfo;
import cokr.xit.ens.biz.iup.domain.VKakaoNoticeInfoSn;
import cokr.xit.ens.biz.iup.domain.repository.TbEnfrcLevRcivRepository;
import cokr.xit.ens.biz.iup.domain.repository.TbInputDataXitRepository;
import cokr.xit.ens.biz.iup.domain.repository.VKakaoNoticeInfoRepository;
import cokr.xit.ens.biz.iup.domain.repository.VKakaoNoticeInfoSnRepository;
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.intgrnbill.code.BillReqSeCd;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.entity.BillHist;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.api.BillKkoClientApiSpec;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.code.BillKkoErrCd;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model.BillKkoApiRespDTO;
import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.OrgMng;
import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.TmpltMng;
import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.repository.OrgMngRepository;
import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.repository.TmpltMngRepository;
import cokr.xit.ens.modules.kkoalimtalk.domain.SendDetailKkoAlimtalk;
import cokr.xit.ens.modules.kkoalimtalk.domain.repository.SendDetailKkoAlimtalkRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
@Slf4j
@Service("iupBillPayApiService_NI")
@RequiredArgsConstructor
public class IupBillPayApiAlimtalkService extends IupBillPayApiServiceSupport {
private final SendDetailKkoAlimtalkRepository sendDetailKkoAlimtalkRepository;
private final TmpltMngRepository sendTmpltMngRepository;
private final OrgMngRepository orgMngRepository;
private final TbInputDataXitRepository tbInputDataXitRepository;
private final VKakaoNoticeInfoRepository vKakaoNoticeInfoRepository;
private final VKakaoNoticeInfoSnRepository vKakaoNoticeInfoSnRepository;
private final TbEnfrcLevRcivRepository tbEnfrcLevRcivRepository;
private final BillKkoClientApiSpec billKkoClientApi;
/**
*
*
* @param mParam
* @return
*/
@Transactional
public BillKkoApiRespDTO findNoticeInfo(Map<String, Object> mParam) {
Map<String, Object> data = (Map<String, Object>) mParam.get("data");
// data.get("biller_user_key");
// data.get("billed_year_month");
// data.get("ordinal");
// data.get("biller_notice_key");
Map<String, Object> parameters = (Map<String, Object>) data.get("parameters");
// data.get("user_birth");
Map<String, Object> respData = null;
BillKkoApiRespDTO respVO = null;
BillKkoErrCd kkoBillErrCd = BillKkoErrCd.OK;
final String billerUserKey = Optional.ofNullable(data.get("biller_user_key")).isPresent() ?
String.valueOf(data.get("biller_user_key")) : null;
final String userBirth = Optional.ofNullable(data.get("user_birth")).isPresent() ?
String.valueOf(data.get("user_birth")) : null;
final String orgCd = Optional.ofNullable(parameters.get("orgCd")).isPresent() ?
String.valueOf(parameters.get("orgCd")) : null;
final String billUid = Optional.ofNullable(parameters.get("billUid")).isPresent() ?
String.valueOf(parameters.get("billUid")) : null;
BillHist billHist = null;
try {
billHist = this.addBillHistByReqInfo(BillReqSeCd.NOTICE, billerUserKey, orgCd, billUid, mParam);
if (CmmnUtil.isEmpty(billerUserKey)) {
kkoBillErrCd = BillKkoErrCd.E402;
throw new EnsException(EnsErrCd.ERR401, "사용자식별키가 없습니다.");
}
if (CmmnUtil.isEmpty(orgCd)) {
kkoBillErrCd = BillKkoErrCd.E402;
throw new EnsException(EnsErrCd.ERR401, "기관코드가 없습니다.");
}
if (CmmnUtil.isEmpty(userBirth)) {
kkoBillErrCd = BillKkoErrCd.E402;
throw new EnsException(EnsErrCd.ERR401, "생년월일이 없습니다.");
}
Optional<OrgMng> orgMng = orgMngRepository.findById(orgCd);
if (!orgMng.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E402;
throw new EnsException(EnsErrCd.ERR404, "일치하는 기관정보가 없습니다.");
}
Optional<SendDetailKkoAlimtalk> sendDetailKkoAlimtalk = sendDetailKkoAlimtalkRepository.findByMsgIdx(billerUserKey);
if (!sendDetailKkoAlimtalk.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E402;
throw new EnsException(EnsErrCd.ERR404, "일치하는 발송상세 자료가 없습니다.");
}
Optional<TmpltMng> sendTmpltMng = sendTmpltMngRepository.findFetchByOrgCdAndTmpltCdAndUseYn(orgCd, sendDetailKkoAlimtalk.get().getSendMast().getTmpltCd(), "Y");
if (!sendTmpltMng.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E402;
throw new EnsException(EnsErrCd.ERR404, "일치하는 템플릿정보가 없습니다.");
}
Optional<TbInputDataXit> tbInputDataXit = tbInputDataXitRepository.findByLinkedUuid(billerUserKey);
if (!tbInputDataXit.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E402;
throw new EnsException(EnsErrCd.ERR404, "일치하는 발송상세정보가 없습니다.");
}
final String dataId = tbInputDataXit.get().getDataId();
if ("Y".equals(orgMng.get().getKkoBpCsignYn())) {
Optional<VKakaoNoticeInfoSn> vKakaoNoticeInfoSn = vKakaoNoticeInfoSnRepository.findById(dataId);
if (!vKakaoNoticeInfoSn.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E402;
throw new EnsException(EnsErrCd.ERR404, "일치하는 단순미납부과 자료가 없습니다.");
}
if (!userBirth.equals(vKakaoNoticeInfoSn.get().getUserBirth())) {
kkoBillErrCd = BillKkoErrCd.E402;
throw new EnsException(EnsErrCd.ERR402, "생년월일이 일치하지 않습니다.");
}
respData = this.respNoticeSnData(sendTmpltMng.get().getTitle(), orgMng.get(), vKakaoNoticeInfoSn.get());
} else if ("N".equals(orgMng.get().getKkoBpCsignYn())) {
if (dataId.length() < 20) {
kkoBillErrCd = BillKkoErrCd.E402;
throw new EnsException(EnsErrCd.ERR403, "빌러코드가 20자리 미만 입니다.");
}
Optional<VKakaoNoticeInfo> vKakaoNoticeInfo = vKakaoNoticeInfoRepository.findById(dataId.substring(0, 20));
if (!vKakaoNoticeInfo.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E402;
throw new EnsException(EnsErrCd.ERR404, "일치하는 강제징수부과 자료가 없습니다.");
}
if (!userBirth.equals(vKakaoNoticeInfo.get().getUserBirth())) {
kkoBillErrCd = BillKkoErrCd.E404;
throw new EnsException(EnsErrCd.ERR402, "생년월일이 일치하지 않습니다.");
}
respData = this.respNoticeData(sendTmpltMng.get().getTitle(), orgMng.get(), vKakaoNoticeInfo.get());
} else {
kkoBillErrCd = BillKkoErrCd.E402;
throw new EnsException(EnsErrCd.ERR999, "위탁업체여부 구분값이 등록되지 않았습니다.");
}
respVO = BillKkoApiRespDTO.okBuilder()
.data(respData)
.build();
this.modifyBillHistByRespInfo(billHist, respVO, null, null);
} catch (EnsException e) {
respVO = BillKkoApiRespDTO.errBuilder()
.resCode(kkoBillErrCd.getCode())
.message(kkoBillErrCd.getCodeNm())
.build();
this.modifyBillHistByRespInfo(billHist, respVO, e.getErrCd(), e.getMessage());
} catch (Exception e) {
respVO = BillKkoApiRespDTO.errBuilder()
.resCode(BillKkoErrCd.E801.getCode())
.message(BillKkoErrCd.E801.getCodeNm())
.build();
this.modifyBillHistByRespInfo(billHist, respVO, EnsErrCd.ERR999, e.getMessage());
}
return respVO;
}
/**
*
*
* @param mParam
* @return
*/
@Transactional
public BillKkoApiRespDTO findPrepayInfo(Map<String, Object> mParam) {
Map<String, Object> data = (Map<String, Object>) mParam.get("data");
// data.get("biller_user_key");
// data.get("billed_year_month");
// data.get("ordinal");
// data.get("biller_notice_key");
Map<String, Object> parameters = (Map<String, Object>) data.get("parameters");
// data.get("amount");
BillKkoApiRespDTO respVO = null;
BillKkoErrCd kkoBillErrCd = BillKkoErrCd.OK;
final String billerUserKey = Optional.ofNullable(data.get("biller_user_key")).isPresent() ?
String.valueOf(data.get("biller_user_key")) : null;
final int amount = Optional.ofNullable(data.get("amount")).isPresent() ?
(int) data.get("amount") : 0;
final String orgCd = Optional.ofNullable(parameters.get("orgCd")).isPresent() ?
String.valueOf(parameters.get("orgCd")) : null;
final String billUid = Optional.ofNullable(parameters.get("billUid")).isPresent() ?
String.valueOf(parameters.get("billUid")) : null;
BillHist billHist = null;
try {
billHist = this.addBillHistByReqInfo(BillReqSeCd.PREPAY, billerUserKey, orgCd, billUid, mParam);
if (CmmnUtil.isEmpty(billerUserKey)) {
kkoBillErrCd = BillKkoErrCd.E601;
throw new EnsException(EnsErrCd.ERR401, "사용자식별키가 없습니다.");
}
if (CmmnUtil.isEmpty(orgCd)) {
kkoBillErrCd = BillKkoErrCd.E601;
throw new EnsException(EnsErrCd.ERR401, "기관코드가 없습니다.");
}
Optional<OrgMng> orgMng = orgMngRepository.findById(orgCd);
if (!orgMng.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E601;
throw new EnsException(EnsErrCd.ERR404, "일치하는 기관정보가 없습니다.");
}
Optional<TbInputDataXit> tbInputDataXit = tbInputDataXitRepository.findByLinkedUuid(billerUserKey);
if (!tbInputDataXit.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E402;
throw new EnsException(EnsErrCd.ERR404, "일치하는 발송상세정보가 없습니다.");
}
final String dataId = tbInputDataXit.get().getDataId();
Optional<VKakaoNoticeInfo> vKakaoNoticeInfo = Optional.ofNullable(null);
List<TbEnfrcLevRciv> tbEnfrcLevRcivs = new ArrayList<>();
if ("Y".equals(orgMng.get().getKkoBpCsignYn())) {
if (dataId.length() < 20) {
kkoBillErrCd = BillKkoErrCd.E601;
throw new EnsException(EnsErrCd.ERR403, "빌러코드가 20자리 미만 입니다.");
}
Optional<VKakaoNoticeInfoSn> vKakaoNoticeInfoSn = vKakaoNoticeInfoSnRepository.findById(dataId);
if (!vKakaoNoticeInfoSn.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E502;
throw new EnsException(EnsErrCd.ERR404, "일치하는 단순미납 자료가 없습니다.");
}
respVO = billKkoClientApi.callApiByOrg(orgMng.get().getKkoBpCsignPrepayApi(), mParam);
if ("OK".equals(respVO.getRes_code()))
this.modifyBillHistByRespInfo(billHist, respVO, null, null);
else
this.modifyBillHistByRespInfo(billHist, respVO, EnsErrCd.ERR999, String.format("[%s] %s", respVO.getRes_code(), respVO.getMessage()));
return respVO;
} else if ("N".equals(orgMng.get().getKkoBpCsignYn())) {
vKakaoNoticeInfo = vKakaoNoticeInfoRepository.findById(dataId.substring(0, 20));
if (!vKakaoNoticeInfo.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E502;
throw new EnsException(EnsErrCd.ERR404, "일치하는 강제징구 자료가 없습니다.");
}
tbEnfrcLevRcivs = tbEnfrcLevRcivRepository.findAllByEnfrcLevMastrIdAndDeleteAt(dataId.substring(0, 20), "N");
} else {
kkoBillErrCd = BillKkoErrCd.E601;
throw new EnsException(EnsErrCd.ERR999, "위탁업체여부 구분값이 등록되지 않았습니다.");
}
if (CmmnUtil.isEmpty(vKakaoNoticeInfo.get().getAmount())
|| amount != Integer.parseInt(vKakaoNoticeInfo.get().getAmount())) {
kkoBillErrCd = BillKkoErrCd.E403;
throw new EnsException(EnsErrCd.ERR902
, String.format("납부 가능 금액이 없거나 일치하지 않습니다. (요청금액:%s, 실제금액:%s)"
, amount
, vKakaoNoticeInfo.get().getAmount()));
}
if (amount > Integer.parseInt(vKakaoNoticeInfo.get().getAmount())) {
kkoBillErrCd = BillKkoErrCd.E501;
throw new EnsException(EnsErrCd.ERR902
, String.format("납부 가능 금액을 초과했습니다. (요청금액:%s, 실제금액:%s)"
, amount
, vKakaoNoticeInfo.get().getAmount()));
}
if (!vKakaoNoticeInfo.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E502;
throw new EnsException(EnsErrCd.ERR404, "일치하는 청구서자료가 없습니다.");
}
if (CmmnUtil.isEmpty(vKakaoNoticeInfo.get().getPayExpireDate())) {
kkoBillErrCd = BillKkoErrCd.E601;
throw new EnsException(EnsErrCd.ERR401, "납부기한이 값이 없습니다.");
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
if (Integer.parseInt(vKakaoNoticeInfo.get().getPayExpireDate()) < Integer.parseInt(simpleDateFormat.format(new Date()))) {
kkoBillErrCd = BillKkoErrCd.E506;
throw new EnsException(EnsErrCd.ERR902, "납부기한이 경과한 자료 입니다.");
}
if (tbEnfrcLevRcivs.size() > 0) {
kkoBillErrCd = BillKkoErrCd.E601;
throw new EnsException(EnsErrCd.ERR903, "납부가 완료된 자료 입니다.");
}
respVO = BillKkoApiRespDTO.okBuilder()
.data(null)
.build();
this.modifyBillHistByRespInfo(billHist, respVO, null, null);
} catch (EnsException e) {
respVO = BillKkoApiRespDTO.errBuilder()
.resCode(kkoBillErrCd.getCode())
.message(kkoBillErrCd.getCodeNm())
.build();
this.modifyBillHistByRespInfo(billHist, respVO, e.getErrCd(), e.getMessage());
} catch (Exception e) {
respVO = BillKkoApiRespDTO.errBuilder()
.resCode(BillKkoErrCd.E601.getCode())
.message(BillKkoErrCd.E601.getCodeNm())
.build();
this.modifyBillHistByRespInfo(billHist, respVO, EnsErrCd.ERR999, e.getMessage());
}
return respVO;
}
/**
*
*
* @param mParam
* @return
*/
@Transactional
public BillKkoApiRespDTO addPayReultIfno(Map<String, Object> mParam) {
Map<String, Object> data = (Map<String, Object>) mParam.get("data");
// data.get("biller_user_key");
// data.get("billed_year_month");
// data.get("ordinal");
// data.get("biller_notice_key");
Map<String, Object> parameters = (Map<String, Object>) data.get("parameters");
// data.get("pay_by");
// data.get("pay_type");
// data.get("pay_detail1");
// data.get("pay_detail2");
// data.get("pay_detail3");
// data.get("amount");
// data.get("pay_amount");
// data.get("pay_fee_type");
// data.get("pay_fee");
// data.get("pay_fee_tax");
// data.get("adjust_date");
// data.get("paid_at");
// data.get("pay_id");
BillKkoApiRespDTO respVO = null;
BillKkoErrCd kkoBillErrCd = BillKkoErrCd.OK;
final String billerUserKey = Optional.ofNullable(data.get("biller_user_key")).isPresent() ?
String.valueOf(data.get("biller_user_key")) : null;
final String orgCd = Optional.ofNullable(parameters.get("orgCd")).isPresent() ?
String.valueOf(parameters.get("orgCd")) : null;
final String billUid = Optional.ofNullable(parameters.get("billUid")).isPresent() ?
String.valueOf(parameters.get("billUid")) : null;
BillHist billHist = null;
try {
billHist = this.addBillHistByReqInfo(BillReqSeCd.PAYRSLT, billerUserKey, orgCd, billUid, mParam);
if (CmmnUtil.isEmpty(billerUserKey)) {
kkoBillErrCd = BillKkoErrCd.E601;
throw new EnsException(EnsErrCd.ERR401, "사용자식별키가 없습니다.");
}
if (CmmnUtil.isEmpty(orgCd)) {
kkoBillErrCd = BillKkoErrCd.E601;
throw new EnsException(EnsErrCd.ERR401, "기관코드가 없습니다.");
}
Optional<OrgMng> orgMng = orgMngRepository.findById(orgCd);
if (!orgMng.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E601;
throw new EnsException(EnsErrCd.ERR404, "일치하는 기관정보가 없습니다.");
}
if ("Y".equals(orgMng.get().getKkoBpCsignYn())) {
return billKkoClientApi.callApiByOrg(orgMng.get().getKkoBpCsignPayresultApi(), mParam);
} else if ("N".equals(orgMng.get().getKkoBpCsignYn())) {
} else {
kkoBillErrCd = BillKkoErrCd.E601;
throw new EnsException(EnsErrCd.ERR999, "위탁업체여부 구분값이 등록되지 않았습니다.");
}
respVO = BillKkoApiRespDTO.okBuilder()
.data(null)
.build();
this.modifyBillHistByRespInfo(billHist, respVO, null, null);
} catch (EnsException e) {
respVO = BillKkoApiRespDTO.errBuilder()
.resCode(kkoBillErrCd.getCode())
.message(kkoBillErrCd.getCodeNm())
.build();
this.modifyBillHistByRespInfo(billHist, respVO, e.getErrCd(), e.getMessage());
} catch (Exception e) {
respVO = BillKkoApiRespDTO.errBuilder()
.resCode(BillKkoErrCd.E601.getCode())
.message(BillKkoErrCd.E601.getCodeNm())
.build();
this.modifyBillHistByRespInfo(billHist, respVO, EnsErrCd.ERR999, e.getMessage());
}
return respVO;
}
}

@ -0,0 +1,294 @@
package cokr.xit.ens.biz.iup.alimtalk.service.support;
import cokr.xit.ens.biz.iup.code.IupPrcsCd;
import cokr.xit.ens.biz.iup.code.IupSendTypeCd;
import cokr.xit.ens.biz.iup.domain.TbInputDataXit;
import cokr.xit.ens.biz.iup.domain.TbInputXit;
import cokr.xit.ens.biz.iup.domain.repository.TbInputDataXitRepository;
import cokr.xit.ens.biz.iup.domain.repository.TbInputXitRepository;
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.MapDeserailizer;
import cokr.xit.ens.modules.common.biztmplt.EnsPhaseProcSupport;
import cokr.xit.ens.modules.common.code.VenderCd;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.BillAcptReqDTO;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.code.BillSeCd;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model.BillKkoAcptReqVO;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model.config.CustomUrl;
import cokr.xit.ens.modules.kkoalimtalk.model.KkoAlimtalkAcceptReqDTO;
import cokr.xit.ens.modules.kkoalimtalk.model.config.*;
import cokr.xit.ens.modules.kkoalimtalk.service.KkoAlimtalkService;
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 IupAlimtalkAcceptor implements EnsPhaseProcSupport<EnsResponseVO, Long> {
private final TbInputXitRepository tbInputXitRepository;
private final TbInputDataXitRepository tbInputDataXitRepository;
private final KkoAlimtalkService kkoAlimtalkService;
Gson gson = new GsonBuilder().registerTypeAdapter(Map.class, new MapDeserailizer()).disableHtmlEscaping().create();
@Value("${contract.kakao.pay.bill.dozn.api.validate.host}")
private String BILL_HOST;
@Value("${contract.kakao.pay.bill.dozn.api.validate.notice}")
private String BILL_NOTICE_URL;
@Value("${contract.kakao.pay.bill.dozn.api.validate.prepay}")
private String BILL_PREPAY_URL;
@Value("${contract.kakao.pay.bill.dozn.api.validate.payresult}")
private String BILL_PAYREUSLT_URL;
/**
* Accept
*
* @param lnkInputIds
* @return
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statReady(List<Long> lnkInputIds) {
try {
AtomicInteger index = new AtomicInteger();
String prefixLinkedUuid = String.format("B-KKOAT-%s%s", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")), RandomString.make(5));
lnkInputIds.stream()
.map(lnkInputId -> tbInputXitRepository.findById(lnkInputId).get())
.map(tbinput -> tbInputDataXitRepository.findAllByTbInputXit(tbinput))
.forEach(list -> {
list.stream()
.forEach(row -> {
log.info(row.toString());
// row.setLinkedUuid(String.format("%s%05d", prefixLinkedUuid, index.getAndIncrement() + 1));
row.setLinkedUuid(row.getDataId());
});
tbInputDataXitRepository.saveAll(list);
}
);
} catch (Exception e) {
return EnsResponseVO.errBuilder()
.errCode(EnsErrCd.ACPT500)
.errMsg(String.format("연계식별UUID 생성에 실패 했습니다. %s", e.getMessage()))
.build();
}
EnsResponseVO respVO = null;
try {
/**
*
*/
if (CmmnUtil.isEmpty(lnkInputIds))
throw new EnsException(EnsErrCd.ACPT410, "연계입수아이디(은)는 필수조건 입니다.");
/**
*
* -. "대상이관등록(TGRI)" .
*/
List<Long> resultInfo = tbInputXitRepository.findAllByLnkInputIdIn(lnkInputIds).stream()
.map(row -> {
row.setUpdId("ENS_SYS");
row.setPrcsCd(IupPrcsCd.TGRI);
return row.getLnkInputId();
})
.collect(Collectors.toList());
respVO = EnsResponseVO.okBuilder().resultInfo(resultInfo).build();
} catch (EnsException e) {
respVO = EnsResponseVO.errBuilder().errCode(e.getErrCd()).errMsg(e.getMessage()).build();
} catch (Exception e) {
respVO = EnsResponseVO.errBuilder().errCode(EnsErrCd.ACPT999).errMsg(e.getMessage()).build();
}
return respVO;
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statBegin(Long arg) {
log.info("no process");
return null;
}
/**
*
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO execute(Long lnkInputId) {
Map<String, Long> resultInfo = new HashMap<>();
resultInfo.put("lnkInputId", lnkInputId);
EnsResponseVO responseVO = null;
TbInputXit tbInputXit = null;
try {
tbInputXit = tbInputXitRepository.findById(lnkInputId)
.orElseThrow(() -> new EnsException(EnsErrCd.ACPT404, String.format("일치하는 TB_INPUT_XIT 데이터가 없습니다. [ lnkInputId %s ]", lnkInputId)));
KkoAlimtalkAcceptReqDTO reqDTO = this.convertTbInputDataToAcceptReqDTO(tbInputDataXitRepository.findAllFetchByLnkInputId(tbInputXit.getLnkInputId()));
EnsResponseVO reqResp = kkoAlimtalkService.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())) {
tbInputXit.setUpdId("ENS_SYS");
tbInputXit.setPrcsCd(IupPrcsCd.TGRC);
tbInputXit.setErrMsg(null);
} else {
tbInputXit.setUpdId("ENS_SYS");
tbInputXit.setPrcsCd(IupPrcsCd.TGRF);
tbInputXit.setErrMsg(responseVO.getErrMsg());
}
}
return responseVO;
}
private KkoAlimtalkAcceptReqDTO convertTbInputDataToAcceptReqDTO(List<TbInputDataXit> list) {
return KkoAlimtalkAcceptReqDTO.builder()
.vender(VenderCd.biztalk.getCode())
.org_cd(list.get(0).getTbInputXit().getOrgCd())
// .tmplt_cd(list.get(0).getTbInputXit().getFsJob().getTemplateCd())
.tmplt_cd(list.get(0).getTbInputXit().getFsJob().getJobCd())
.post_bundle_title(
String.format("%s(%s건)-%s"
, IupSendTypeCd.NI.getCodeNm()
, list.get(0).getTbInputXit().getTotCnt()
, LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))
)
)
.send_dt(list.get(0).getTbInputXit().getRunDt().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")))
.close_dt(list.get(0).getTbInputXit().getExpiresDt().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")))
.documents(
list.stream()
.map(row -> createDocument(row))
.collect(Collectors.toList())
)
.build();
}
private Document createDocument(TbInputDataXit data) throws EnsException {
return Document.builder()
// .msg_idx(data.getDataId())
.msg_idx(data.getLinkedUuid())
.country_code("82")
.recipient(data.getMoblphonNo())
.app_user_id(null)
.title(null)
.res_method("PUSH")
.attach(this.createAttach(data))
.supplement(this.createSupplement(data))
.message_type("AT")
.use_failback(null)
.mms_attach(this.createMmsAttach(data))
.xit_property(this.createXitProperty(data))
.build();
}
private Attachment createAttach(TbInputDataXit data) {
return null;
}
private Supplement createSupplement(TbInputDataXit data) {
return null;
}
private MmsAttach createMmsAttach(TbInputDataXit data) {
return null;
}
private XitProperty createXitProperty(TbInputDataXit data) {
return XitProperty.builder()
// .bill_link_info(this.createBillLinkInfo(data))
.bill_acpt_data(this.createBillAcptData(data))
.tmplt_msg_data(CmmnUtil.isEmpty(data.getMsgData()) ? null : gson.fromJson(data.getMsgData().replace("~~@@!!", "#{").replace("!!@@~~", "}"), Map.class))
.build();
}
// return BillLinkInfo.builder()
// .button_name("납부하기")
// .button_type("WL")
// .expire_at(data.getTbInputXit().getPayExpiresDt().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")))
// .notice_url(this.BILL_HOST + this.BILL_NOTICE_URL)
// .prepay_url(this.BILL_HOST + this.BILL_PREPAY_URL)
// .pay_result_url(this.BILL_HOST + this.BILL_PAYREUSLT_URL)
// .build();
// }
protected BillAcptReqDTO createBillAcptData(TbInputDataXit data) {
return BillAcptReqDTO.builder()
.use_bill_uid(false)
.bill_uid(null)
.bill_se(BillSeCd.bpKko)
.bill_kko(BillKkoAcptReqVO.builder()
.billUid(null)
.billerUserKey(data.getLinkedUuid())
.billedYearMonth(null)
.ordinal(null)
.billerNoticeKey(null)
.expireAt(data.getTbInputXit().getPayExpiresDt().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")))
.parameters(null)
.customUrl(CustomUrl.builder()
.noticeUrl(this.BILL_HOST + this.BILL_NOTICE_URL)
.prepayUrl(this.BILL_HOST + this.BILL_PREPAY_URL)
.payResultUrl(this.BILL_HOST + this.BILL_PAYREUSLT_URL)
.build())
.build())
.build();
}
}

@ -0,0 +1,192 @@
package cokr.xit.ens.biz.iup.alimtalk.service.support;
import cokr.xit.ens.biz.iup.code.IupPrcsCd;
import cokr.xit.ens.biz.iup.code.IupSendSttusCd;
import cokr.xit.ens.biz.iup.code.IupSendTypeCd;
import cokr.xit.ens.biz.iup.domain.TbInputDataXit;
import cokr.xit.ens.biz.iup.domain.TbInputXit;
import cokr.xit.ens.biz.iup.domain.TbSendResult;
import cokr.xit.ens.biz.iup.domain.repository.TbInputDataXitRepository;
import cokr.xit.ens.biz.iup.domain.repository.TbInputXitRepository;
import cokr.xit.ens.biz.iup.domain.repository.TbSendResultRepository;
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.DateUtil;
import cokr.xit.ens.modules.common.biztmplt.EnsPhaseProcSupport;
import cokr.xit.ens.modules.common.code.StatCd;
import cokr.xit.ens.modules.kkoalimtalk.model.KkoAlimtalkRsltRespDTO;
import cokr.xit.ens.modules.kkoalimtalk.service.KkoAlimtalkService;
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 IupAlimtalkFetcher implements EnsPhaseProcSupport<EnsResponseVO, Long> {
private final TbInputXitRepository tbInputXitRepository;
private final TbInputDataXitRepository tbInputDataXitRepository;
private final TbSendResultRepository tbSendResultRepository;
private final KkoAlimtalkService kkoAlimtalkService;
/**
* Fetch
* @param lnkInputIds
* @return
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statReady(List<Long> lnkInputIds) {
EnsResponseVO respVO = null;
try {
if (CmmnUtil.isEmpty(lnkInputIds))
throw new EnsException(EnsErrCd.RSLT410, "연계입수아이디(은)는 필수조건 입니다.");
List<Long> resultInfo = tbInputXitRepository.findAllByLnkInputIdIn(lnkInputIds).stream()
.map(row -> {
row.setUpdId("ENS_SYS");
row.setPrcsCd(IupPrcsCd.INCM);
return row.getLnkInputId();
})
.collect(Collectors.toList());
;
respVO = EnsResponseVO.okBuilder().resultInfo(resultInfo).build();
} catch (EnsException e) {
respVO = EnsResponseVO.errBuilder().errCode(e.getErrCd()).errMsg(e.getMessage()).build();
} catch (Exception e) {
respVO = EnsResponseVO.errBuilder().errCode(EnsErrCd.RSLT999).errMsg(e.getMessage()).build();
}
return respVO;
}
@Override
public EnsResponseVO statBegin(Long arg) {
log.info("no process");
return null;
}
/**
* (/)
* @param lnkInputId
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO execute(Long lnkInputId){
EnsResponseVO responseVO = null;
Map<String, Object> resultInfo = new HashMap<>();
resultInfo.put("lnkInputId", lnkInputId);
try {
Long sendMastId = tbInputDataXitRepository.findLastSendMastIdByLnkInputIdAndSendType(lnkInputId, IupSendTypeCd.NI)
.orElseThrow(() -> new EnsException(EnsErrCd.RSLT404, "일치하는 ENS 접수자료가 없습니다."));
resultInfo.put("sendMastId", sendMastId);
EnsResponseVO apiRespVO = kkoAlimtalkService.sendResultProvide(sendMastId);
KkoAlimtalkRsltRespDTO respDTO = (KkoAlimtalkRsltRespDTO) apiRespVO.getResultInfo();
tbSendResultRepository.saveAll(respDTO.getDocuments().stream()
.map(row -> {
IupSendSttusCd iupSendSttusCd = null;
try {
switch (row.getKkoResultCd()){
case RS_1000:
iupSendSttusCd = IupSendSttusCd.RECV;
break;
case RS_1014:
case RS_1015:
case RS_3018:
iupSendSttusCd = IupSendSttusCd.NOMB;
break;
case RQ_B400:
case RQ_B401:
case RQ_B402:
case RQ_B403:
case RS_1021:
case RS_1025:
iupSendSttusCd = IupSendSttusCd.DENY;
break;
default:
iupSendSttusCd = IupSendSttusCd.FAIL;
break;
// iupSendSttusCd = IupSendSttusCd.SEND;
// iupSendSttusCd = IupSendSttusCd.RECV;
}
} catch (Exception e){
log.info("IupSendSttusCd와 일치하는 값 없음. [ dataId {} kkoResultCd {} ]", row.getMsgIdx(), row.getKkoResultCd());
}
return TbSendResult.builder()
.lnkInputId(lnkInputId)
// .dataId(row.getMsgIdx())
.dataId(tbInputDataXitRepository.findByLinkedUuid(row.getMsgIdx())
.orElse(new TbInputDataXit())
.getDataId())
.prcsOdr(StatCd.close.equals(respDTO.getStatCd())?"2":"1")
.sendSttusCd(iupSendSttusCd)
.sendType(IupSendTypeCd.NI)
.runDt(DateUtil.toLocalDateTime(respDTO.getSendDt()))
.bizSendDt(null)
.bizRecvDt(null)
.bizReadDt(null)
.bizErrMsg(CmmnUtil.isEmpty(row.getErrorMessage()) ? null : row.getErrorMessage())
.regId("ENS_SYS")
.regDt(LocalDateTime.now())
.expiresDt(DateUtil.toLocalDateTime(respDTO.getCloseDt()))
.prcsYn("N")
.build();
})
.collect(Collectors.toList())
);
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("[lnkInputId %s]에 대한 전송결과 FETCH 처리 실패. %s", lnkInputId, e.getMessage()))
.build();
} finally {
TbInputXit tbInputXit = tbInputXitRepository.findById(lnkInputId).orElseThrow(()->new EnsException(EnsErrCd.RSLT404, "일치하는 tbInputXit 자료가 없습니다."));
if(EnsErrCd.OK.equals(responseVO.getErrCode())){
tbInputXit.setUpdId("ENS_SYS");
tbInputXit.setPrcsCd(IupPrcsCd.IPCP);
tbInputXit.setErrMsg(null);
}else{
tbInputXit.setUpdId("ENS_SYS");
tbInputXit.setPrcsCd(IupPrcsCd.FAIL);
tbInputXit.setErrMsg(responseVO.getErrMsg());
}
}
return responseVO;
}
}

@ -0,0 +1,66 @@
package cokr.xit.ens.biz.iup.alimtalk.service.support;
import cokr.xit.ens.biz.iup.code.IupSendTypeCd;
import cokr.xit.ens.biz.iup.domain.repository.TbInputDataXitRepository;
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.kkoalimtalk.service.KkoAlimtalkService;
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 IupAlimtalkMaker implements EnsPhaseProcSupport<EnsResponseVO, Long> {
private final TbInputDataXitRepository tbInputDataXitRepository;
private final KkoAlimtalkService kkoAlimtalkService;
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statReady(List<Long> lnkInputIds) {
log.info("no process");
return null;
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statBegin(Long arg) {
log.info("no process");
return null;
}
/**
*
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO execute(Long lnkInputId){
EnsResponseVO responseVO = null;
try {
Long sendMastId = tbInputDataXitRepository.findLastSendMastIdByLnkInputIdAndSendType(lnkInputId, IupSendTypeCd.NI)
.orElseThrow(() -> new EnsException(EnsErrCd.MAKE404, "일치하는 ENS 접수자료가 없습니다."));
responseVO = kkoAlimtalkService.make(sendMastId);
} catch (EnsException e){
responseVO = EnsResponseVO.errBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
}
return responseVO;
}
}

@ -0,0 +1,66 @@
package cokr.xit.ens.biz.iup.alimtalk.service.support;
import cokr.xit.ens.biz.iup.code.IupSendTypeCd;
import cokr.xit.ens.biz.iup.domain.repository.TbInputDataXitRepository;
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.kkoalimtalk.service.KkoAlimtalkService;
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 IupAlimtalkSender implements EnsPhaseProcSupport<EnsResponseVO, Long> {
private final TbInputDataXitRepository tbInputDataXitRepository;
private final KkoAlimtalkService kkoAlimtalkService;
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statReady(List<Long> lnkInputIds) {
log.info("no process");
return null;
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statBegin(Long arg) {
log.info("no process");
return null;
}
/**
*
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO execute(Long lnkInputId){
EnsResponseVO responseVO = null;
try {
Long sendMastId = tbInputDataXitRepository.findLastSendMastIdByLnkInputIdAndSendType(lnkInputId, IupSendTypeCd.NI)
.orElseThrow(() -> new EnsException(EnsErrCd.SEND404, "일치하는 ENS 접수자료가 없습니다."));
responseVO = kkoAlimtalkService.sendBulk(sendMastId);
} catch (EnsException e){
responseVO = EnsResponseVO.errBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
}
return responseVO;
}
}

@ -0,0 +1,276 @@
package cokr.xit.ens.biz.iup.billpay.presentation;
import cokr.xit.ens.biz.iup.billpay.service.IupBillPayApiServiceSupport;
import cokr.xit.ens.biz.iup.domain.TbInputDataXit;
import cokr.xit.ens.biz.iup.domain.repository.TbInputDataXitRepository;
import cokr.xit.ens.core.utils.CmmnUtil;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model.BillKkoApiRespDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
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.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@Tag(name = "IupBillPayApiController")
@Slf4j
@RequiredArgsConstructor
@RestController
public class IupBillPayApiController {
private final TbInputDataXitRepository tbInputDataXitRepository;
private final Map<String, IupBillPayApiServiceSupport> mIupBillPayApiService;
@io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, content = {
@Content(mediaType = "application/json", examples = {
@ExampleObject(name = "Sample Example..."
, summary = "sample"
, value = "{\n" +
"\"data\": {\n" +
"\"biller_user_key\": \"0000000001\",\n" +
"\"user_birth\":\"19900301\",\n" +
"\"parameters\": {\n" +
"\"some_param\": \"KT00000001\"\n" +
"}\n" +
"}\n" +
"}"
)
})
})
@ApiResponses({
@ApiResponse(responseCode = "200", content = {
@Content(mediaType = "application/json", examples = {
@ExampleObject(name = "Success Example..."
, summary = "Success"
, value = "{\n" +
" \"res_code\": \"OK\",\n" +
" \"message\": \"성공\",\n" +
" \"data\": {\n" +
" \"result\": {\n" +
" \"biller_user_key\": \"0000000001\",\n" +
" \"title\": \"통신요금\",\n" +
" \"amount\": 29000,\n" +
" \"tax_free_amount\": 0,\n" +
" \"vat_amount\": 0,\n" +
" \"pay_expire_date\": \"20190801\",\n" +
" \"details\": [\n" +
" {\n" +
" \"title\": \"고객정보\",\n" +
" \"itemType\": \"KEY_VALUE\",\n" +
" \"elements\": [\n" +
" {\n" +
" \"key\": \"이름\",\n" +
" \"value\": \"홍길동\",\n" +
" \"level\": \"1\"\n" +
" },\n" +
" {\n" +
" \"key\": \"고객번호\",\n" +
" \"value\": \"945034260\",\n" +
" \"level\": \"1\"\n" +
" }\n" +
" ]\n" +
" },\n" +
" {\n" +
" \"title\": \"상세내용\",\n" +
" \"itemType\": \"KEY_VALUE\",\n" +
" \"elements\": [\n" +
" {\n" +
" \"key\": \"상품명(서비스번호)\",\n" +
" \"value\": \"모바일(010-61**-*234)\",\n" +
" \"level\": \"1\"\n" +
" },\n" +
" {\n" +
" \"key\": \"당월요금계\",\n" +
" \"value\": \"42,610원\",\n" +
" \"level\": \"1\"\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" }\n" +
" }\n" +
"}"
),
@ExampleObject(name = "Fail Example..."
, summary = "Fail"
, value = "{\n" +
"\"res_code\": \"E402\",\n" +
"\"message\": \"청구서 조회 결과가 없습니다.\",\n" +
"\"data\": null\n" +
"}"
)
})
})
})
@Operation(summary = "청구서 조회")
@PostMapping(value = "/iup/kakao/notice", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<BillKkoApiRespDTO> kakaoNotice(@RequestBody Map<String, Object> mParam) {
try {
Map<String, Object> data = (Map<String, Object>) mParam.get("data");
String billerUserKey = (String) data.get("biller_user_key");
TbInputDataXit tbInputDataXit = tbInputDataXitRepository.findById(billerUserKey).orElseThrow(() -> new RuntimeException("biller_user_key와 일치하는 데이터를 찾을 수 없습니다."));
IupBillPayApiServiceSupport iupBillPayService = mIupBillPayApiService.get("iupBillPayApiService_" + tbInputDataXit.getTbInputXit().getSendType());
return new ResponseEntity<BillKkoApiRespDTO>(iupBillPayService.findNoticeInfo(mParam), HttpStatus.OK);
} finally {
StringBuffer sb = new StringBuffer();
sb.append("\n==============================================================================")
.append("\n[ kakao 청구서 - 청구서조회 ]")
.append("\n### Request Info...")
.append("\n" + CmmnUtil.toJsonString(mParam))
// .append("\n### Response Info...")
// .append("\n" + resp.getBody())
.append("\n==============================================================================");
log.info(sb.toString());
}
}
@io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, content = {
@Content(mediaType = "application/json", examples = {
@ExampleObject(name = "Sample Example..."
, summary = "sample"
, value = "{\n" +
"\"data\": {\n" +
"\"biller_user_key\": \"0000000001\",\n" +
"\"amount\": 29000,\n" +
"\"parameters\": {\n" +
"\"pay_rqt_seq\": \"KT00000001\"\n" +
"}\n" +
"}\n" +
"}")
})
})
@ApiResponses({
@ApiResponse(responseCode = "200", content = {
@Content(mediaType = "application/json", examples = {
@ExampleObject(name = "Success Example..."
, summary = "Success"
, value = "{\n" +
"\"res_code\": \"OK\",\n" +
"\"message\": \"성공\",\n" +
"\"data\": null\n" +
"}"
),
@ExampleObject(name = "Fail Example..."
, summary = "Fail"
, value = "{\n" +
"\"res_code\": \"E502\",\n" +
"\"message\": \"납부불가 - 납부 대상 없음\",\n" +
"\"data\": null\n" +
"}"
)
})
})
})
@Operation(summary = "납부 가능 조회")
@PostMapping(value = "/iup/kakao/prepay", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<BillKkoApiRespDTO> kakaoPrepay(@RequestBody Map<String, Object> mParam) {
try {
Map<String, Object> data = (Map<String, Object>) mParam.get("data");
String billerUserKey = (String) data.get("biller_user_key");
TbInputDataXit tbInputDataXit = tbInputDataXitRepository.findById(billerUserKey).orElseThrow(() -> new RuntimeException("biller_user_key와 일치하는 데이터를 찾을 수 없습니다."));
IupBillPayApiServiceSupport iupBillPayService = mIupBillPayApiService.get("iupBillPayApiService_" + tbInputDataXit.getTbInputXit().getSendType());
return new ResponseEntity<BillKkoApiRespDTO>(iupBillPayService.findPrepayInfo(mParam), HttpStatus.OK);
} finally {
StringBuffer sb = new StringBuffer();
sb.append("\n==============================================================================")
.append("\n[ kakao 청구서 - 납부가능조회 ]")
.append("\n### Request Info...")
.append("\n" + CmmnUtil.toJsonString(mParam))
// .append("\n### Response Info...")
// .append("\n" + resp.getBody())
.append("\n==============================================================================");
log.info(sb.toString());
}
}
@io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, content = {
@Content(mediaType = "application/json", examples = {
@ExampleObject(name = "Sample Example..."
, summary = "sample"
, value = "{\n" +
"\"data\": {\n" +
"\"biller_user_key\": \"0000000001\",\n" +
"\"parameters\": {\n" +
"\"pay_rqt_seq\": \"KT00000001\"\n" +
"},\n" +
"\"pay_by\": \"MONEY\",\n" +
"\"pay_type\": \"P\",\n" +
"\"pay_detail1\": \"\",\n" +
"\"pay_detail2\": \"\",\n" +
"\"amount\": 20000,\n" +
"\"pay_amount\": 20000,\n" +
"\"pay_fee_type\": \"BEFORE\",\n" +
"\"pay_fee\": 150,\n" +
"\"pay_fee_tax\": 15,\n" +
"\"paid_at\": \"20190220161656\",\n" +
"\"pay_id\": 2748877\n" +
"}\n" +
"}")
})
})
@ApiResponses({
@ApiResponse(responseCode = "200", content = {
@Content(mediaType = "application/json", examples = {
@ExampleObject(name = "Success Example..."
, summary = "Success"
, value = "{\n" +
"\"res_code\": \"OK\",\n" +
"\"message\": \"성공\",\n" +
"\"data\": null\n" +
"}"
)
})
})
})
@Operation(summary = "납부 결과 전달")
@PostMapping(value = "/iup/kakao/pay-result", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<BillKkoApiRespDTO> kakaoPayResult(@RequestBody Map<String, Object> mParam) {
try {
Map<String, Object> data = (Map<String, Object>) mParam.get("data");
String billerUserKey = (String) data.get("biller_user_key");
TbInputDataXit tbInputDataXit = tbInputDataXitRepository.findById(billerUserKey).orElseThrow(() -> new RuntimeException("biller_user_key와 일치하는 데이터를 찾을 수 없습니다."));
IupBillPayApiServiceSupport iupBillPayService = mIupBillPayApiService.get("iupBillPayApiService_" + tbInputDataXit.getTbInputXit().getSendType());
return new ResponseEntity<BillKkoApiRespDTO>(iupBillPayService.addPayReultIfno(mParam), HttpStatus.OK);
} finally {
StringBuffer sb = new StringBuffer();
sb.append("\n==============================================================================")
.append("\n[ kakao 청구서 - 납부결과전달 ]")
.append("\n### Request Info...")
.append("\n" + CmmnUtil.toJsonString(mParam))
// .append("\n### Response Info...")
// .append("\n" + resp.getBody())
.append("\n==============================================================================");
log.info(sb.toString());
}
}
}

@ -0,0 +1,109 @@
package cokr.xit.ens.biz.iup.billpay.presentation;
import cokr.xit.ens.biz.iup.domain.TbInputXit;
import cokr.xit.ens.biz.iup.domain.repository.TbInputDataXitRepository;
import cokr.xit.ens.biz.iup.domain.repository.TbInputXitRepository;
import cokr.xit.ens.biz.iup.signtalk.model.IupSigntalkReqVO;
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.MapDeserailizer;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model.BillKkoApiRespDTO;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.service.impl.BillKkoClientServiceImpl;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
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.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Tag(name = "IupBillPayRsltFwdController")
@Slf4j
@RequiredArgsConstructor
@RestController
public class IupBillPayRsltFwdController {
private final TbInputXitRepository tbInputXitRepository;
private final TbInputDataXitRepository tbInputDataXitRepository;
private final BillKkoClientServiceImpl billKkoClientServiceImpl;
private Gson gson = new GsonBuilder().registerTypeAdapter(Map.class, new MapDeserailizer()).disableHtmlEscaping().create();
@Operation(summary = "납부결과 전달(연계 입수 아이디)")
@PostMapping(value = "/iup/bill/payrslt/fwd/bulk", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EnsResponseVO> payrsltFwdBulk(@RequestBody IupSigntalkReqVO reqDTO) {
TbInputXit tbInputXit = tbInputXitRepository.findById(reqDTO.getLnkInputId())
.orElseThrow(() -> new EnsException(EnsErrCd.ERR404, String.format("연계입수아이디(%s)와 일치하는 자료가 없습니다.", reqDTO.getLnkInputId())));
List<String> billerUserKeys = tbInputDataXitRepository.findAllByTbInputXit(tbInputXit).stream()
.map(tbInputDataXit -> tbInputDataXit.getLinkedUuid())
.collect(Collectors.toList());
BillKkoApiRespDTO resultInfo = billKkoClientServiceImpl.fwdPayRslt(tbInputXit.getOrgCd(), billerUserKeys).getResultInfo();
return new ResponseEntity<EnsResponseVO>(EnsResponseVO.okBuilder().resultInfo(resultInfo).build(), HttpStatus.OK);
}
@io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, content = {
@Content(mediaType = "application/json", examples = {
@ExampleObject(name = "Sample Example..."
, summary = "sample"
, value = "{\"biller_user_key\":[\"abcd11234\",\"dddd1234\"]}")
})
})
@Operation(summary = "납부결과 전달(빌러 유저 키)")
@PostMapping(value = "/iup/bill/payrslt/fwd/ids", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EnsResponseVO> payrsltFwdIds(@RequestBody Map<String, List<String>> mParam) {
List<Map<String, Object>> data = mParam.get("biller_user_key").stream()
.map(s -> tbInputDataXitRepository.findById(s))
.filter(tbInputDataXit -> tbInputDataXit.isPresent())
.map(tbInputDataXit -> billKkoClientServiceImpl.fwdPayRslt(tbInputDataXit.get().getTbInputXit().getOrgCd(), Collections.singletonList(tbInputDataXit.get().getLinkedUuid())))
.map(ensResponseVO -> ensResponseVO.getResultInfo().getData())
.collect(Collectors.toList());
BillKkoApiRespDTO resultInfo = BillKkoApiRespDTO.okBuilder().data(data).build();
return new ResponseEntity<EnsResponseVO>(EnsResponseVO.okBuilder().resultInfo(resultInfo).build(), HttpStatus.OK);
}
// @Operation(summary = "[미전달분-일회성] - 납부결과 전달(2022.07.04 09:00:00 ~ 2022.07.05 15:00:00 데이터)")
// @PostMapping(value = "/iup/bill/payrslt/fwd/bulk/temp", produces = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<EnsResponseVO> payrsltFwdBulkTemp() {
//
// List<BillKkoApiRespDTO> resultInfo = tbInputDataXitRepository.findAllByNoFwdPayResult().stream()
// .map(tbInputDataXit -> {
// String billerUserKey = tbInputDataXit.getLinkedUuid();
//
// OrgMng orgMng = orgMngRepository.findById(tbInputDataXit.getTbInputXit().getOrgCd()).orElse(null);
// if (orgMng == null)
// return BillKkoApiRespDTO.errBuilder().resCode(EnsErrCd.ERR404.getCode()).message(String.format("기관코드(%s)와 일치하는 자료가 없습니다. [ biller_user_key %s ]", tbInputDataXit.getTbInputXit().getOrgCd(), billerUserKey)).build();
//
// KkoBillHist kkoBillHist = kkoBillHistRepository.findByBillerUserKeyAndReqSeAndLast(billerUserKey, KkoBillReqSeCd.PAYRSLT).orElse(null);
// if (kkoBillHist == null)
// return BillKkoApiRespDTO.errBuilder().resCode(EnsErrCd.ERR404.getCode()).message(String.format(" 일치하는 청구서 납부결과가 없습니다. [ biller_user_key %s ]", billerUserKey)).build();
// else {
// String uri = orgMng.getKkoBpCsignPayresultApi();
// Map<String, Object> param = gson.fromJson(kkoBillHist.getRequestData(), Map.class);
// return kkoBillClientApi.callApiByOrg(uri, param);
// }
// })
// .collect(Collectors.toList());
//
//
// return new ResponseEntity<EnsResponseVO>(EnsResponseVO.okBuilder().resultInfo(resultInfo).build(), HttpStatus.OK);
// }
}

@ -0,0 +1,114 @@
package cokr.xit.ens.biz.iup.billpay.service;
import cokr.xit.ens.biz.iup.domain.VKakaoNoticeInfo;
import cokr.xit.ens.biz.iup.domain.VKakaoNoticeInfoSn;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.service.BillKkoClientApiSupport;
import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.OrgMng;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@Component
public abstract class IupBillPayApiServiceSupport extends BillKkoClientApiSupport {
/**
* "강제징수"
*
* @param title
* @param orgMng
* @param vKakaoNoticeInfo
* @return
*/
protected Map<String, Object> respNoticeData(String title, OrgMng orgMng, VKakaoNoticeInfo vKakaoNoticeInfo) {
Map<String, Object> mParam = new HashMap<>();
mParam.put("biller_user_key", vKakaoNoticeInfo.getEnfrcLevMastrId());
mParam.put("user_birth ", vKakaoNoticeInfo.getUserBirth());
mParam.put("amount", vKakaoNoticeInfo.getAmount());
mParam.put("pay_expire_date", vKakaoNoticeInfo.getPayExpireDate());
mParam.put("detail_pasng_chrge_sm", vKakaoNoticeInfo.getDetailPasngChrgeSm());
mParam.put("detail_adi_pasng_chrge_sm", vKakaoNoticeInfo.getDetailAdiPasngChrgeSm());
return this.makeNoticeData(title, orgMng, mParam);
}
/**
* "단순미납"
*
* @param title
* @param orgMng
* @param vKakaoNoticeInfoSn
* @return
*/
protected Map<String, Object> respNoticeSnData(String title, OrgMng orgMng, VKakaoNoticeInfoSn vKakaoNoticeInfoSn) {
Map<String, Object> mParam = new HashMap<>();
mParam.put("biller_user_key", vKakaoNoticeInfoSn.getDataId());
mParam.put("user_birth", vKakaoNoticeInfoSn.getUserBirth());
mParam.put("amount", vKakaoNoticeInfoSn.getAmount());
mParam.put("pay_expire_date", vKakaoNoticeInfoSn.getPayExpireDate());
mParam.put("detail_pasng_chrge_sm", vKakaoNoticeInfoSn.getDetailPasngChrgeSm());
mParam.put("detail_adi_pasng_chrge_sm", vKakaoNoticeInfoSn.getDetailAdiPasngChrgeSm());
return this.makeNoticeData(title, orgMng, mParam);
}
/**
* Response
*
* @param title
* @param orgMng
* @param mParam
* @return
*/
protected Map<String, Object> makeNoticeData(String title, OrgMng orgMng, Map<String, Object> mParam) {
// Map<String, Object> bank_accounts = new HashMap<>();
// bank_accounts.put("bank_code", "");
// bank_accounts.put("account_no", "");
// bank_accounts.put("holder_name", "");
// bank_accounts.put("sender_name", "");
// bank_accounts.put("account_type", "");
Map<String, Object> result = new HashMap<>();
// result.put("settlement_code", "");
result.put("biller_user_key", mParam.get("biller_user_key"));
// result.put("billed_year_month", "");
// result.put("ordinal", "");
// result.put("biller_notice_key", "");
result.put("title", title);
result.put("amount", mParam.get("amount"));
// result.put("tax_free_amount", "");
// result.put("vat_amount", "");
result.put("expire_type", "D1");
result.put("pay_expire_date", mParam.get("pay_expire_date"));
// result.put("second_pay_expire_date", "");
// result.put("bank_accounts", bank_accounts);
result.put("details", this.makeNoticeDetailsData(mParam));
Map<String, Object> data = new HashMap<>();
data.put("result", result);
return data;
}
/**
* Response "details"
*
* @param mParam
* @return
*/
protected List<Map<String, Object>> makeNoticeDetailsData(Map<String, Object> mParam) {
Map<String, Object> detail = new HashMap<>();
detail.put("item_type", "TEXT");
detail.put("elements", Arrays.asList(String.format("상세 통행료: %s", mParam.get("detail_pasng_chrge_sm"))
, String.format("상세 부가통행료: %s", mParam.get("detail_adi_pasng_chrge_sm"))));
List<Map<String, Object>> details = Arrays.asList(detail);
return details;
}
}

@ -0,0 +1,47 @@
package cokr.xit.ens.biz.iup.code;
import cokr.xit.ens.core.code.CodeMapperType;
/**
* <ul>
* <li> : </li>
* <li> : </li>
* <li>: 2022. 2. 15. 3:51:43
* </ul>
* @author
*/
public enum IupPrcsCd implements CodeMapperType {
TGRG("대상등록중")
,TGRI("대상이관등록대기")
,TGRF("대상등록실패")
,TGRC("대상등록완료")
,GRUR("결제URL생성중")
,GRUC("결제URL생성완료")
,CICV("변환대상입수")
,CICC("변환대상입수완료")
,COMP("변환완료")
,INCM("입수중")
,IPCP("입수완료")
,FAIL("입수오류")
;
private final String code;
private final String codeNm;
IupPrcsCd(String codeNm) {
this.code = this.name();
this.codeNm = codeNm;
}
@Override
public String getCode() {
return this.code;
}
@Override
public String getCodeNm() {
return this.codeNm;
}
}

@ -0,0 +1,51 @@
package cokr.xit.ens.biz.iup.code;
import cokr.xit.ens.core.code.CodeMapperType;
/**
* <ul>
* <li> : </li>
* <li> : </li>
* <li>: 2022. 3. 2. 3:51:43
* </ul>
* @author
*/
public enum IupSendSttusCd implements CodeMapperType {
TALK_SEND("알림톡발송")
,SMS_SEND("SMS발송")
,READY("송신 준비")
,NOMB("카카오 비회원")
,DENY("카카오 거부")
,SEND("카카오 송신")
,RECV("카카오 수신")
,SIGN("카카오 서명")
,NV_NOMB("네이버 비회원")
,NV_DENY("네이버 거부")
,NV_SEND("네이버 송신")
,NV_RECV("네이버 수신")
,NV_SIGN("네이버 서명")
,FAIL("송신오류")
;
private final String code;
private final String codeNm;
IupSendSttusCd(String codeNm) {
this.code = this.name();
this.codeNm = codeNm;
}
@Override
public String getCode() {
return this.code;
}
@Override
public String getCodeNm() {
return this.codeNm;
}
}

@ -0,0 +1,37 @@
package cokr.xit.ens.biz.iup.code;
import cokr.xit.ens.core.code.CodeMapperType;
/**
* <ul>
* <li> : </li>
* <li> : </li>
* <li>: 2022. 6. 29. 3:51:43
* </ul>
* @author
*/
public enum IupSendTrySttusCd implements CodeMapperType {
TRYING("시도중")
, CMPLT("완료")
;
private final String code;
private final String codeNm;
IupSendTrySttusCd(String codeNm) {
this.code = this.name();
this.codeNm = codeNm;
}
@Override
public String getCode() {
return this.code;
}
@Override
public String getCodeNm() {
return this.codeNm;
}
}

@ -0,0 +1,37 @@
package cokr.xit.ens.biz.iup.code;
import cokr.xit.ens.core.code.CodeMapperType;
/**
* <ul>
* <li> : </li>
* <li> : </li>
* <li>: 2022. 3. 2. 3:51:43
* </ul>
* @author
*/
public enum IupSendTypeCd implements CodeMapperType {
NI("알림톡")
,KP("인증톡")
;
private final String code;
private final String codeNm;
IupSendTypeCd(String codeNm) {
this.code = this.name();
this.codeNm = codeNm;
}
@Override
public String getCode() {
return this.code;
}
@Override
public String getCodeNm() {
return this.codeNm;
}
}

@ -0,0 +1,88 @@
package cokr.xit.ens.biz.iup.domain;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import javax.persistence.*;
@Entity
//@Data
@Getter
@ToString
@Builder
@EqualsAndHashCode
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "fs_job", schema = "", catalog = "")
public class FsJob {
@Id
@Column(name = "job_cd", nullable = false, length = 10)
private String jobCd;
@Column(name = "job_name", nullable = true)
private String jobName;
@Column(name = "job_desc", nullable = true)
private String jobDesc;
@Column(name = "enc_phone_no_yn", nullable = true)
private String encPhoneNoYn;
@Column(name = "enc_name_yn", nullable = true)
private String encNameYn;
@Column(name = "enc_birthday_yn", nullable = true)
private String encBirthdayYn;
@Column(name = "unsube_use_yn", nullable = true)
private String unsubeUseYn;
@Column(name = "unsube_type", nullable = true)
private String unsubeType;
@Column(name = "use_yn", nullable = true)
private String useYn;
@Column(name = "reg_id", nullable = true)
private String regId;
@Column(name = "reg_dt", nullable = true)
private java.sql.Date regDt;
@Column(name = "upd_id", nullable = true)
private String updId;
@Column(name = "upd_dt", nullable = true)
private java.sql.Date updDt;
@Column(name = "org_cd", nullable = true)
private String orgCd;
@Column(name = "call_center_no", nullable = true)
private String callCenterNo;
@Column(name = "redirect_url", nullable = true)
private String redirectUrl;
@Column(name = "template_cd", nullable = true)
private String templateCd;
}

@ -0,0 +1,237 @@
package cokr.xit.ens.biz.iup.domain;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import javax.persistence.*;
import java.sql.Date;
import java.util.Objects;
@Entity
//@Data
@Getter
@ToString
@Builder
@EqualsAndHashCode
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "tb_enfrc_lev_mastr", schema = "", catalog = "")
public class TbEnfrcLevMastr {
@Id
@Column(name = "enfrc_lev_mastr_id")
private String enfrcLevMastrId;
@Column(name = "enfrc_lev_year")
private String enfrcLevYear;
@Column(name = "enfrc_lev_tme")
private String enfrcLevTme;
@Column(name = "enfrc_lev_sn")
private String enfrcLevSn;
@Column(name = "pvtcpt_road_sctn_id")
private String pvtcptRoadSctnId;
@Column(name = "vhcle_no")
private String vhcleNo;
@Column(name = "dfltr_id")
private String dfltrId;
@Column(name = "pasng_chrge_sm")
private Long pasngChrgeSm;
@Column(name = "adi_pasng_chrge_sm")
private Long adiPasngChrgeSm;
@Column(name = "npy_pasng_chrge_sm")
private Long npyPasngChrgeSm;
@Column(name = "npy_co_sm")
private Integer npyCoSm;
@Column(name = "npy_occrrnc_begin_de")
private String npyOccrrncBeginDe;
@Column(name = "npy_occrrnc_end_de")
private String npyOccrrncEndDe;
@Column(name = "elctrn_ntic_sndng_posbl_at")
private String elctrnNticSndngPosblAt;
@Column(name = "n_bank_virtl_acnut_no")
private String nBankVirtlAcnutNo;
@Column(name = "k_bank_virtl_acnut_no")
private String kBankVirtlAcnutNo;
@Column(name = "w_bank_virtl_acnut_no")
private String wBankVirtlAcnutNo;
@Column(name = "s_bank_virtl_acnut_no")
private String sBankVirtlAcnutNo;
@Column(name = "pay_tmlmt")
private String payTmlmt;
@Column(name = "enfrc_lev_reqst_dt")
private String enfrcLevReqstDt;
@Column(name = "enfrc_lev_applcnt")
private String enfrcLevApplcnt;
@Column(name = "enfrc_lev_outset_reqst_dt")
private String enfrcLevOutsetReqstDt;
@Column(name = "enfrc_lev_outset_applcnt")
private String enfrcLevOutsetApplcnt;
@Column(name = "enfrc_lev_reqst_process_dt")
private String enfrcLevReqstProcessDt;
@Column(name = "enfrc_lev_reqst_opetr")
private String enfrcLevReqstOpetr;
@Column(name = "enfrc_lev_outset_process_dt")
private String enfrcLevOutsetProcessDt;
@Column(name = "enfrc_lev_outset_opetr")
private String enfrcLevOutsetOpetr;
@Column(name = "enfrc_lev_last_process_resn")
private String enfrcLevLastProcessResn;
@Column(name = "enfrc_lev_last_process_dt")
private String enfrcLevLastProcessDt;
@Column(name = "enfrc_lev_last_opetr")
private String enfrcLevLastOpetr;
@Column(name = "enfrc_lev_mastr_process_sttus")
private String enfrcLevMastrProcessSttus;
@Column(name = "enfrc_lev_wthdraw_at")
private String enfrcLevWthdrawAt;
@Column(name = "enfrc_lev_wthdraw_mastr_id")
private String enfrcLevWthdrawMastrId;
@Column(name = "creat_dt")
private Date creatDt;
@Column(name = "crtr")
private String crtr;
@Column(name = "updt_dt")
private Date updtDt;
@Column(name = "updusr")
private String updusr;
@Column(name = "delete_at")
private String deleteAt;
@Column(name = "delete_dt")
private Date deleteDt;
@Column(name = "dltr")
private String dltr;
@Column(name = "job_sttus")
private String jobSttus;
@Column(name = "job_tmlmt")
private String jobTmlmt;
@Column(name = "rciv_pasng_chrge_sm")
private Long rcivPasngChrgeSm;
@Column(name = "rciv_adi_pasng_chrge_sm")
private Long rcivAdiPasngChrgeSm;
@Column(name = "rciv_npy_pasng_chrge_sm")
private Long rcivNpyPasngChrgeSm;
@Column(name = "rciv_co_sm")
private Integer rcivCoSm;
@Column(name = "blce_pasng_chrge_sm")
private Long blcePasngChrgeSm;
@Column(name = "blce_adi_pasng_chrge_sm")
private Long blceAdiPasngChrgeSm;
@Column(name = "blce_npy_pasng_chrge_sm")
private Long blceNpyPasngChrgeSm;
@Column(name = "blce_co_sm")
private Integer blceCoSm;
@Column(name = "dfct_dsps_pasng_chrge_sm")
private Long dfctDspsPasngChrgeSm;
@Column(name = "dfct_dsps_adi_pasmny_sm")
private Long dfctDspsAdiPasmnySm;
@Column(name = "dfct_dsps_npy_pasmny_sm")
private Long dfctDspsNpyPasmnySm;
@Column(name = "dfct_dsps_co_sm")
private Integer dfctDspsCoSm;
@Column(name = "part_rciv_at")
private String partRcivAt;
@Column(name = "ntcn_sndng_de")
private String ntcnSndngDe;
@Column(name = "ntcn_sndng_process_sttus")
private String ntcnSndngProcessSttus;
@Column(name = "crtfc_sndng_de")
private String crtfcSndngDe;
@Column(name = "crtfc_sndng_process_sttus")
private String crtfcSndngProcessSttus;
@Column(name = "urgsht_sndng_de")
private String urgshtSndngDe;
@Column(name = "urgsht_dlvr_sttus")
private String urgshtDlvrSttus;
@Column(name = "urgsht_scd_sndng_de")
private String urgshtScdSndngDe;
@Column(name = "urgsht_scd_dlvr_sttus")
private String urgshtScdDlvrSttus;
@Column(name = "seizr_prvntc_sndng_de")
private String seizrPrvntcSndngDe;
@Column(name = "seizr_prvntc_sndng_process_stt")
private String seizrPrvntcSndngProcessStt;
@Column(name = "seizr_de")
private String seizrDe;
@Column(name = "tkbak_de")
private String tkbakDe;
@Column(name = "seizr_relis_de")
private String seizrRelisDe;
@Column(name = "emrgncy_relis_de")
private String emrgncyRelisDe;
@Column(name = "tkbak_scd_de")
private String tkbakScdDe;
@Column(name = "rntcar_entrps_nm")
private String rntcarEntrpsNm;
@Column(name = "lessee_change_de")
private String lesseeChangeDe;
}

@ -0,0 +1,116 @@
package cokr.xit.ens.biz.iup.domain;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.sql.Date;
@Entity
//@Data
@Getter
@ToString
@Builder
@EqualsAndHashCode
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "tb_enfrc_lev_rciv", schema = "", catalog = "")
public class TbEnfrcLevRciv {
@Id
@Column(name = "enfrc_lev_rciv_id", nullable = false, length = 12)
private String enfrcLevRcivId;
@Column(name = "enfrc_lev_mastr_id", nullable = true, length = 20)
private String enfrcLevMastrId;
@Column(name = "enfrc_lev_year", nullable = true, length = 4)
private String enfrcLevYear;
@Column(name = "enfrc_lev_tme", nullable = true, length = 1)
private String enfrcLevTme;
@Column(name = "pvtcpt_road_sctn_id", nullable = true, length = 4)
private String pvtcptRoadSctnId;
@Column(name = "rciv_de", nullable = true, length = 8)
private String rcivDe;
@Column(name = "rciv_time", nullable = true, length = 6)
private String rcivTime;
@Column(name = "rciv_pasng_chrge", nullable = true, precision = 0)
private Long rcivPasngChrge;
@Column(name = "rciv_adi_pasng_chrge", nullable = true, precision = 0)
private Long rcivAdiPasngChrge;
@Column(name = "rciv_npy_pasng_chrge", nullable = true, precision = 0)
private Long rcivNpyPasngChrge;
@Column(name = "virtl_acnut_bank_code", nullable = true, length = 3)
private String virtlAcnutBankCode;
@Column(name = "virtl_acnut_no", nullable = true, length = 20)
private String virtlAcnutNo;
@Column(name = "virtl_acnut_delng_esntl_no", nullable = true, length = 14)
private String virtlAcnutDelngEsntlNo;
@Column(name = "rciv_se_code", nullable = true, length = 1)
private String rcivSeCode;
@Column(name = "rciv_cardfa_se_code", nullable = true, length = 20)
private String rcivCardfaSeCode;
@Column(name = "creat_dt", nullable = true)
private Date creatDt;
@Column(name = "crtr", nullable = true, length = 50)
private String crtr;
@Column(name = "delete_at", nullable = true, length = 1)
private String deleteAt;
@Column(name = "delete_dt", nullable = true)
private Date deleteDt;
@Column(name = "dltr", nullable = true, length = 50)
private String dltr;
@Column(name = "enfrc_lev_id", nullable = true, length = 20)
private String enfrcLevId;
@Column(name = "excclc_stdr_de", nullable = true, length = 8)
private String excclcStdrDe;
@Column(name = "excclc_stdr_dt", nullable = true, length = 6)
private String excclcStdrDt;
}

@ -0,0 +1,86 @@
package cokr.xit.ens.biz.iup.domain;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import javax.persistence.*;
@Entity
//@Data
@Getter
@ToString
@Builder
@EqualsAndHashCode
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "TB_INPUT_DATA_BULK_TEST", schema = "", catalog = "")
public class TbInputDataBulkTest {
@Id
// @GeneratedValue(strategy=GenerationType.AUTO)
@GeneratedValue(strategy = GenerationType.TABLE, generator = "TbInputDataBulkTest_Generator")
@TableGenerator(table = "ens_seq_generator", name = "TbInputDataBulkTest_Generator"
,pkColumnName = "seq_name", pkColumnValue = "TbInputDataBulkTest_id"
,initialValue = 0, allocationSize = 200)
private Long id;
// @Id
@Column(name = "DATA_ID", nullable = false)
private String dataId;
@Column(name = "SID", nullable = true)
private String sid;
@Column(name = "NAME", nullable = true)
private String name;
@Column(name = "BIRTHDAY", nullable = true)
private String birthday;
@Column(name = "GENDER", nullable = true)
private String gender;
@Column(name = "MSG_DATA", nullable = true, length = 4000)
private String msgData;
@Column(name = "MSG_DTL_DATA", nullable = true)
@Lob
private String msgDtlData;
@Column(name = "REG_ID", nullable = false)
private String regId;
@Column(name = "REG_DT", nullable = false)
private java.sql.Date regDt;
@Column(name = "UPD_ID", nullable = true)
private String updId;
@Column(name = "UPD_DT", nullable = true)
private java.sql.Date updDt;
@Column(name = "PAY_STATUS_CD", nullable = true)
private String payStatusCd;
@Column(name = "PAY_URL", nullable = true)
private String payUrl;
@Column(name = "CAR_NO", nullable = true)
private String carNo;
}

@ -0,0 +1,96 @@
package cokr.xit.ens.biz.iup.domain;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import javax.persistence.*;
@Entity
//@Data
@Getter
@ToString
@Builder
@EqualsAndHashCode
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "tb_input_data_xit", schema = "", catalog = "", indexes = {
@Index(name = "idx_TbInputDataXit_01", columnList = "linked_uuid")
})
public class TbInputDataXit {
@Id
@Column(name = "data_id", nullable = false)
private String dataId;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "lnk_input_id")
private TbInputXit tbInputXit;
@Column(name = "sid", nullable = true)
private String sid;
@Column(name = "name", nullable = true)
private String name;
@Column(name = "birthday", nullable = true)
private String birthday;
@Column(name = "gender", nullable = true)
private String gender;
@Column(name = "msg_data", nullable = true, length = 4000)
private String msgData;
@Column(name = "msg_dtl_data", nullable = true)
@Lob
private String msgDtlData;
@Column(name = "reg_id", nullable = false)
private String regId;
@Column(name = "reg_dt", nullable = false)
private java.sql.Date regDt;
@Column(name = "upd_id", nullable = true)
private String updId;
@Column(name = "upd_dt", nullable = true)
private java.sql.Date updDt;
@Column(name = "pay_status_cd", nullable = true)
private String payStatusCd;
@Column(name = "pay_url", nullable = true)
private String payUrl;
@Column(name = "car_no", nullable = true)
private String carNo;
@Column(name = "moblphon_no", nullable = true)
private String moblphonNo;
@Column(name = "call_center_no", nullable = true)
private String callCenterNo;
@Column(name = "linked_uuid", length = 40)
@Setter
private String linkedUuid;
}

@ -0,0 +1,92 @@
package cokr.xit.ens.biz.iup.domain;
import cokr.xit.ens.biz.iup.code.IupPrcsCd;
import cokr.xit.ens.biz.iup.code.IupSendTypeCd;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import org.hibernate.annotations.UpdateTimestamp;
import javax.persistence.*;
import java.time.LocalDateTime;
@Entity
//@Data
@Getter
@ToString
@Builder
@EqualsAndHashCode
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "tb_input_xit", schema = "", catalog = "")
public class TbInputXit {
@Id
@Column(name = "lnk_input_id", nullable = false)
private Long lnkInputId;
@Column(name = "org_cd", nullable = false, length = 100)
private String orgCd;
@JoinColumn(name = "job_cd")
@ManyToOne(fetch = FetchType.LAZY)
private FsJob fsJob;
@Column(name = "tot_cnt", nullable = false)
private Long totCnt;
@Column(name = "prcs_cd", nullable = false)
@Enumerated(EnumType.STRING)
@Setter
private IupPrcsCd prcsCd;
@Column(name = "err_msg", nullable = true, length = 1000)
@Setter
private String errMsg;
@Column(name = "run_dt", nullable = false)
// @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime runDt;
@Column(name = "expires_dt", nullable = false)
private LocalDateTime expiresDt;
@Column(name = "send_type", nullable = false, length = 10)
@Enumerated(EnumType.STRING)
private IupSendTypeCd sendType;
@Column(name = "reg_id", nullable = false, length = 20)
private String regId;
@Column(name = "reg_dt", nullable = false)
private LocalDateTime regDt;
@Column(name = "upd_id", nullable = true, length = 20)
@Setter
private String updId;
@Column(name = "upd_dt", nullable = true)
@UpdateTimestamp
private LocalDateTime updDt;
@Column(name = "rcpt_dt", nullable = true, length = 30)
private String rcptDt;
@Column(name = "pay_expires_dt", nullable = false)
private LocalDateTime payExpiresDt;
}

@ -0,0 +1,106 @@
package cokr.xit.ens.biz.iup.domain;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.time.LocalDateTime;
@Entity
//@Data
@Getter
@ToString
@Builder
@EqualsAndHashCode
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "tb_kakao_pay_result", schema = "", catalog = "")
public class TbKakaoPayResult {
@Id
@Column(name = "data_id", length = 30)
private String dataId;
@Column(name = "job_se", length = 1, nullable = true)
private String jobSe;
@Column(name = "pay_mn", length = 20, nullable = true)
private String payMn;
@Column(name = "pay_ty", length = 1, nullable = true)
private String payTy;
// @Column(name = "pay_detail1", length = 6, nullable = true)
@Column(name = "pay_detail1", length = 8, nullable = true)
private String payDetail1;
@Column(name = "pay_detail2", length = 20, nullable = true)
private String payDetail2;
@Column(name = "pay_detail3", length = 100, nullable = true)
private String payDetail3;
@Column(name = "pay_amount", length = 12, nullable = true)
private String payAmount;
@Column(name = "pay_fee_ty", length = 10, nullable = true)
private String payFeeTy;
@Column(name = "pay_fee_amount", length = 12, nullable = true)
private String payFeeAmount;
@Column(name = "pay_fee_vat", length = 12, nullable = true)
private String payFeeVat;
@Column(name = "excclc_prearnge_de", length = 8, nullable = true)
private String excclcPrearngeDe;
@Column(name = "pay_dt", length = 14, nullable = true)
private String payDt;
@Column(name = "pay_id", length = 20, nullable = true)
private String payId;
@Column(name = "pay_result_process_sttus", length = 1, nullable = true)
private String payResultProcessSttus;
@CreationTimestamp
@Column(name = "creat_dt", nullable = true)
private LocalDateTime creatDt;
@Column(name = "crtr", length = 50, nullable = true)
private String crtr;
@UpdateTimestamp
@Column(name = "updt_dt", nullable = true)
private LocalDateTime updtDt;
@Column(name = "updusr", length = 50, nullable = true)
private String updusr;
}

@ -0,0 +1,97 @@
package cokr.xit.ens.biz.iup.domain;
import cokr.xit.ens.biz.iup.code.IupSendSttusCd;
import cokr.xit.ens.biz.iup.code.IupSendTrySttusCd;
import cokr.xit.ens.biz.iup.code.IupSendTypeCd;
import cokr.xit.ens.biz.iup.domain.ids.TbSendResultIds;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;
import javax.persistence.*;
import java.time.LocalDateTime;
@Entity
//@Data
@Getter
@ToString
@Builder
@EqualsAndHashCode
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "tb_send_result_v2", schema = "", catalog = "")
@IdClass(TbSendResultIds.class)
public class TbSendResult {
@Id
@Column(name = "lnk_input_id", nullable = false)
private Long lnkInputId;
@Id
@Column(name = "data_id", nullable = false)
private String dataId;
@Id
@Column(name = "prcs_odr", nullable = false)
private String prcsOdr;
@Column(name = "send_sttus_cd", nullable = true)
@Enumerated(EnumType.STRING)
private IupSendSttusCd sendSttusCd;
@Column(name = "send_try_sttus_cd", nullable = true)
@Enumerated(EnumType.STRING)
private IupSendTrySttusCd sendTrySttusCd;
@Column(name = "send_type", nullable = true)
@Enumerated(EnumType.STRING)
private IupSendTypeCd sendType;
@Column(name = "run_dt", nullable = true)
private LocalDateTime runDt;
@Column(name = "biz_send_dt", nullable = true)
private LocalDateTime bizSendDt;
@Column(name = "biz_recv_dt", nullable = true)
private LocalDateTime bizRecvDt;
@Column(name = "biz_read_dt", nullable = true)
private LocalDateTime bizReadDt;
@Column(name = "biz_err_msg", nullable = true, length = 1000)
private String bizErrMsg;
@Column(name = "reg_id", nullable = true)
private String regId;
@Column(name = "reg_dt", nullable = true)
@CreationTimestamp
private LocalDateTime regDt;
@Column(name = "lastUpdt", nullable = true)
@UpdateTimestamp
private LocalDateTime lastUpdt;
@Column(name = "expires_dt", nullable = true)
private LocalDateTime expiresDt;
@Column(name = "prcs_yn", nullable = true)
private String prcsYn;
}

@ -0,0 +1,41 @@
package cokr.xit.ens.biz.iup.domain;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
//@Data
@Getter
@ToString
@Builder
@EqualsAndHashCode
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "V_KAKAO_NOTICE_INFO")
public class VKakaoNoticeInfo {
@Id
private String enfrcLevMastrId;
private String userBirth;
private String amount;
private String payExpireDate;
private String detailPasngChrgeSm;
private String detailAdiPasngChrgeSm;
}

@ -0,0 +1,43 @@
package cokr.xit.ens.biz.iup.domain;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import javax.persistence.*;
import java.util.Objects;
@Entity
//@Data
@Getter
@ToString
@Builder
@EqualsAndHashCode
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "V_KAKAO_NOTICE_INFO_SN", schema = "", catalog = "")
public class VKakaoNoticeInfoSn {
@Id
@Column(name = "DATA_ID", nullable = true, length = 24)
private String dataId;
@Column(name = "USER_BIRTH", nullable = true, length = 4000)
private String userBirth;
@Column(name = "AMOUNT", nullable = true, precision = 0)
private Long amount;
@Column(name = "PAY_EXPIRE_DATE", nullable = true, length = 8)
private String payExpireDate;
@Column(name = "DETAIL_PASNG_CHRGE_SM", nullable = true, precision = 0)
private Long detailPasngChrgeSm;
@Column(name = "DETAIL_ADI_PASNG_CHRGE_SM", nullable = true, precision = 0)
private Long detailAdiPasngChrgeSm;
}

@ -0,0 +1,28 @@
package cokr.xit.ens.biz.iup.domain.ids;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.Column;
import java.io.Serializable;
@Getter
@Setter
@EqualsAndHashCode
@NoArgsConstructor
public class TbSendResultIds implements Serializable {
@Column(name = "lnk_input_id", nullable = false)
private Long lnkInputId;
@Column(name = "data_id", nullable = false)
private String dataId;
@Column(name = "prcs_odr", nullable = false)
private String prcsOdr;
}

@ -0,0 +1,9 @@
package cokr.xit.ens.biz.iup.domain.repository;
import cokr.xit.ens.biz.iup.domain.FsJob;
import org.springframework.data.jpa.repository.JpaRepository;
public interface FsJobRepository extends JpaRepository<FsJob, String> {
}

@ -0,0 +1,12 @@
package cokr.xit.ens.biz.iup.domain.repository;
import cokr.xit.ens.biz.iup.domain.TbEnfrcLevMastr;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.Optional;
public interface TbEnfrcLevMastrRepository extends JpaRepository<TbEnfrcLevMastr, String> {
Optional<TbEnfrcLevMastr> findByEnfrcLevMastrIdAndEnfrcLevMastrProcessSttusAndDeleteAt(String enfrcLevMastrId, String enfrcLevMastrProcessSttus, String deleteAt);
}

@ -0,0 +1,13 @@
package cokr.xit.ens.biz.iup.domain.repository;
import cokr.xit.ens.biz.iup.domain.TbEnfrcLevRciv;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
import java.util.Optional;
public interface TbEnfrcLevRcivRepository extends JpaRepository<TbEnfrcLevRciv, String>, TbEnfrcLevRcivRepositoryCustom {
List<TbEnfrcLevRciv> findAllByEnfrcLevMastrIdAndDeleteAt(String enfrcLevMastrId, String deleteAt);
}

@ -0,0 +1,5 @@
package cokr.xit.ens.biz.iup.domain.repository;
public interface TbEnfrcLevRcivRepositoryCustom {
}

@ -0,0 +1,12 @@
package cokr.xit.ens.biz.iup.domain.repository;
import com.querydsl.jpa.impl.JPAQueryFactory;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
public class TbEnfrcLevRcivRepositoryImpl implements TbEnfrcLevRcivRepositoryCustom {
private final JPAQueryFactory query;
}

@ -0,0 +1,8 @@
package cokr.xit.ens.biz.iup.domain.repository;
import java.util.List;
public interface TbInputDataBulkTestCustomRepository<T> {
public void saveAll(List<T> list);
}

@ -0,0 +1,75 @@
package cokr.xit.ens.biz.iup.domain.repository;
import cokr.xit.ens.biz.iup.domain.TbInputDataBulkTest;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Repository
@RequiredArgsConstructor
public class TbInputDataBulkTestCustomRepositoryImpl implements TbInputDataBulkTestCustomRepository<TbInputDataBulkTest>{
private final JdbcTemplate jdbcTemplate;
@Value("${spring.jpa.properties.hibernate.jdbc.batch_size}")
private int batchSize;
@Override
public void saveAll(List<TbInputDataBulkTest> list) {
int batchCount = 0;
List<TbInputDataBulkTest> subItems = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
subItems.add(list.get(i));
if ((i + 1) % batchSize == 0) {
batchCount = batchInsert(batchSize, batchCount, subItems);
}
}
if (!subItems.isEmpty()) {
batchCount = batchInsert(batchSize, batchCount, subItems);
}
log.info("batchCount: " + batchCount);
}
private int batchInsert(int batchSize, int batchCount, List<TbInputDataBulkTest> list) {
// jdbcTemplate.batchUpdate("INSERT INTO tb_input_data_bulk_test (birthday, car_no, data_id, gender, msg_data, msg_dtl_data, name, pay_status_cd, pay_url, reg_dt, reg_id, sid, upd_dt, upd_id, id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
jdbcTemplate.batchUpdate("INSERT INTO tb_input_data_bulk_test (birthday, car_no, data_id, gender, msg_data, msg_dtl_data, name, pay_status_cd, pay_url, reg_dt, reg_id, sid, upd_dt, upd_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
new BatchPreparedStatementSetter() {
@Override
public void setValues(PreparedStatement ps, int i) throws SQLException {
ps.setString(1, list.get(i).getBirthday());
ps.setString(2, list.get(i).getCarNo());
ps.setString(3, list.get(i).getDataId());
ps.setString(4, list.get(i).getGender());
ps.setString(5, list.get(i).getMsgData());
ps.setString(6, list.get(i).getMsgDtlData());
ps.setString(7, list.get(i).getName());
ps.setString(8, list.get(i).getPayStatusCd());
ps.setString(9, list.get(i).getPayUrl());
ps.setDate(10, list.get(i).getRegDt());
ps.setString(11, list.get(i).getRegId());
ps.setString(12, list.get(i).getSid());
ps.setDate(13, list.get(i).getUpdDt());
ps.setString(14, list.get(i).getUpdId());
// ps.setLong(15, list.get(i).getId());
}
@Override
public int getBatchSize() {
return list.size();
}
});
list.clear();
batchCount++;
return batchCount;
}
}

@ -0,0 +1,7 @@
package cokr.xit.ens.biz.iup.domain.repository;
import cokr.xit.ens.biz.iup.domain.TbInputDataBulkTest;
import org.springframework.data.jpa.repository.JpaRepository;
public interface TbInputDataBulkTestRepository extends JpaRepository<TbInputDataBulkTest, String> {
}

@ -0,0 +1,22 @@
package cokr.xit.ens.biz.iup.domain.repository;
import cokr.xit.ens.biz.iup.code.IupSendTypeCd;
import cokr.xit.ens.biz.iup.domain.TbInputDataXit;
import java.util.List;
import java.util.Optional;
public interface TbInputDataXitCustomRepository<T> {
Optional<TbInputDataXit> findFetchByDataId(String dataId);
List<T> findAllFetchByLnkInputId(Long lnkInputId);
String findDataIdFirstByLnkInputId(Long lnkInputId);
Optional<Long> findLastSendMastIdByLnkInputIdAndSendType(Long lnkInputId, IupSendTypeCd sendTypeCd);
List<TbInputDataXit> findAllByNoFwdPayResult();
}

@ -0,0 +1,120 @@
package cokr.xit.ens.biz.iup.domain.repository;
import cokr.xit.ens.biz.iup.code.IupSendTypeCd;
import cokr.xit.ens.biz.iup.domain.TbInputDataXit;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.code.BillReqSeCd;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.code.BillSeCd;
import com.querydsl.core.types.dsl.DateTemplate;
import com.querydsl.core.types.dsl.Expressions;
import com.querydsl.jpa.impl.JPAQueryFactory;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Optional;
import static cokr.xit.ens.biz.iup.domain.QFsJob.fsJob;
import static cokr.xit.ens.biz.iup.domain.QTbInputDataXit.tbInputDataXit;
import static cokr.xit.ens.biz.iup.domain.QTbInputXit.tbInputXit;
import static cokr.xit.ens.modules.common.ctgy.intgrnbill.entity.QBillHist.billHist;
import static cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.QIntgrnSendDetail.intgrnSendDetail;
import static cokr.xit.ens.modules.kkoalimtalk.domain.QSendDetailKkoAlimtalk.sendDetailKkoAlimtalk;
@Slf4j
@Repository
@RequiredArgsConstructor
public class TbInputDataXitCustomRepositoryImpl implements TbInputDataXitCustomRepository<TbInputDataXit> {
private final JPAQueryFactory query;
@Override
public Optional<TbInputDataXit> findFetchByDataId(String dataId) {
return Optional.ofNullable(query.selectFrom(tbInputDataXit)
.innerJoin(tbInputDataXit.tbInputXit, tbInputXit)
.fetchJoin()
.innerJoin(tbInputXit.fsJob, fsJob)
.fetchJoin()
.where(tbInputDataXit.dataId.eq(dataId))
.fetchOne());
}
@Override
public List<TbInputDataXit> findAllFetchByLnkInputId(Long lnkInputId) {
return query.selectFrom(tbInputDataXit)
.innerJoin(tbInputDataXit.tbInputXit, tbInputXit)
.fetchJoin()
.innerJoin(tbInputXit.fsJob, fsJob)
.fetchJoin()
.where(tbInputDataXit.tbInputXit.lnkInputId.eq(lnkInputId))
.fetch();
}
@Override
public String findDataIdFirstByLnkInputId(Long lnkInputId) {
return query.select(tbInputDataXit.dataId)
.from(tbInputDataXit)
.where(tbInputDataXit.tbInputXit.lnkInputId.eq(lnkInputId))
.fetchFirst();
}
@Override
public Optional<Long> findLastSendMastIdByLnkInputIdAndSendType(Long lnkInputId, IupSendTypeCd sendTypeCd) {
if (IupSendTypeCd.KP.equals(sendTypeCd))
// return Optional.ofNullable(query.select(sendDetailKkoMydoc.sendMast.sendMastId)
// .from(sendDetailKkoMydoc)
//// .where(sendDetailKkoMydoc.propExternalDocumentUuid.in(findDataIdsByLnkInputId(lnkInputId)))
// .where(sendDetailKkoMydoc.propExternalDocumentUuid.eq(findExternalDocumentUuidByLnkInputId(lnkInputId)))
// .groupBy(sendDetailKkoMydoc.sendMast.sendMastId)
// .orderBy(sendDetailKkoMydoc.sendMast.sendMastId.desc())
// .fetchFirst());
return Optional.ofNullable(query.select(intgrnSendDetail.intgrnSendMast.intSendMastId)
.from(intgrnSendDetail)
.where(intgrnSendDetail.linkedUuid.eq(findExternalDocumentUuidByLnkInputId(lnkInputId)))
.groupBy(intgrnSendDetail.intgrnSendMast.intSendMastId)
.orderBy(intgrnSendDetail.intgrnSendMast.intSendMastId.desc())
.fetchFirst());
else if (IupSendTypeCd.NI.equals(sendTypeCd))
return Optional.ofNullable(query.select(sendDetailKkoAlimtalk.sendMast.sendMastId)
.from(sendDetailKkoAlimtalk)
// .where(sendDetailKkoAlimtalk.msgIdx.in(findDataIdsByLnkInputId(lnkInputId)))
.where(sendDetailKkoAlimtalk.msgIdx.eq(findExternalDocumentUuidByLnkInputId(lnkInputId)))
.groupBy(sendDetailKkoAlimtalk.sendMast.sendMastId)
.orderBy(sendDetailKkoAlimtalk.sendMast.sendMastId.desc())
.fetchFirst());
else
return Optional.ofNullable(null);
}
private String findExternalDocumentUuidByLnkInputId(Long lnkInputId) {
return query.select(tbInputDataXit.linkedUuid)
.from(tbInputDataXit)
.where(tbInputDataXit.tbInputXit.lnkInputId.eq(lnkInputId))
.fetchFirst();
}
@Override
public List<TbInputDataXit> findAllByNoFwdPayResult() {
LocalDateTime fromDate = LocalDateTime.of(2022, 07, 04, 00, 00, 00);
LocalDateTime toDate = LocalDateTime.of(2022, 07, 05, 15, 00, 00);
DateTemplate from = Expressions.dateTemplate(LocalDateTime.class, "TO_DATE({0}, {1})", fromDate.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")), "yyyyMMddHH24miss");
DateTemplate to = Expressions.dateTemplate(LocalDateTime.class, "TO_DATE({0}, {1})", toDate.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")), "yyyyMMddHH24miss");
return query.select(tbInputDataXit)
.from(tbInputDataXit)
.innerJoin(tbInputDataXit.tbInputXit, tbInputXit).fetchJoin()
// .innerJoin(kkoBillHist).on(kkoBillHist.billerUserKey.eq(tbInputDataXit.linkedUuid)).fetchJoin()
.innerJoin(billHist).on(billHist.billSe.eq(BillSeCd.bpKko).and(billHist.linkedUuid.eq(tbInputDataXit.linkedUuid))).fetchJoin()
.where(
billHist.reqSe.eq(BillReqSeCd.PAYRSLT)
.and(tbInputXit.runDt.between(from, to))
.and(billHist.registDt.between(from, to))
)
.fetch();
}
}

@ -0,0 +1,16 @@
package cokr.xit.ens.biz.iup.domain.repository;
import cokr.xit.ens.biz.iup.domain.TbInputDataXit;
import cokr.xit.ens.biz.iup.domain.TbInputXit;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
import java.util.Optional;
public interface TbInputDataXitRepository extends JpaRepository<TbInputDataXit, String>, TbInputDataXitCustomRepository<TbInputDataXit> {
List<TbInputDataXit> findAllByTbInputXit(TbInputXit tbInputXit);
Optional<TbInputDataXit> findByLinkedUuid(String linkedUuid);
}

@ -0,0 +1,13 @@
package cokr.xit.ens.biz.iup.domain.repository;
import cokr.xit.ens.biz.iup.code.IupPrcsCd;
import cokr.xit.ens.biz.iup.code.IupSendTypeCd;
import cokr.xit.ens.biz.iup.domain.TbInputXit;
import java.util.List;
import java.util.Optional;
public interface TbInputXitCustomRepository<T> {
Optional<TbInputXit> findByPrcsCdAndSendTypeAndId(IupPrcsCd prcsCd, IupSendTypeCd sendType, Long lnkInputId);
List<TbInputXit> findAllByPrcsCdInAndSendType(List<IupPrcsCd> prcsCds, IupSendTypeCd sendType);
}

@ -0,0 +1,51 @@
package cokr.xit.ens.biz.iup.domain.repository;
import cokr.xit.ens.biz.iup.code.IupPrcsCd;
import cokr.xit.ens.biz.iup.code.IupSendTypeCd;
import cokr.xit.ens.biz.iup.domain.TbInputXit;
import com.querydsl.jpa.impl.JPAQueryFactory;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
import static cokr.xit.ens.biz.iup.domain.QFsJob.fsJob;
import static cokr.xit.ens.biz.iup.domain.QTbInputXit.tbInputXit;
@Slf4j
@Repository
@RequiredArgsConstructor
public class TbInputXitCustomRepositoryImpl implements TbInputXitCustomRepository<TbInputXit>{
private final JPAQueryFactory query;
@Override
public Optional<TbInputXit> findByPrcsCdAndSendTypeAndId(IupPrcsCd prcsCd, IupSendTypeCd sendType, Long lnkInputId) {
return Optional.ofNullable(query.selectFrom(tbInputXit)
.innerJoin(tbInputXit.fsJob, fsJob)
.fetchJoin()
.where(
tbInputXit.prcsCd.eq(prcsCd)
.and(tbInputXit.sendType.eq(sendType))
.and(tbInputXit.lnkInputId.eq(lnkInputId))
)
.fetchOne());
}
@Override
public List<TbInputXit> findAllByPrcsCdInAndSendType(List<IupPrcsCd> prcsCds, IupSendTypeCd sendType) {
return query.selectFrom(tbInputXit)
.innerJoin(tbInputXit.fsJob, fsJob)
.fetchJoin()
.where(
tbInputXit.prcsCd.in(prcsCds)
.and(tbInputXit.sendType.eq(sendType))
)
.fetch();
}
}

@ -0,0 +1,11 @@
package cokr.xit.ens.biz.iup.domain.repository;
import cokr.xit.ens.biz.iup.domain.TbInputXit;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface TbInputXitRepository extends JpaRepository<TbInputXit, Long>, TbInputXitCustomRepository<TbInputXit> {
List<TbInputXit> findAllByLnkInputIdIn(List<Long> lnkInputIds);
}

@ -0,0 +1,8 @@
package cokr.xit.ens.biz.iup.domain.repository;
import cokr.xit.ens.biz.iup.domain.TbKakaoPayResult;
import org.springframework.data.jpa.repository.JpaRepository;
public interface TbKakaoPayResultRepository extends JpaRepository<TbKakaoPayResult, String> {
}

@ -0,0 +1,12 @@
package cokr.xit.ens.biz.iup.domain.repository;
import cokr.xit.ens.biz.iup.domain.TbSendResult;
import java.util.List;
public interface TbSendResultCustomRepository {
void modifyByTbSendResults(List<TbSendResult> list);
Boolean findExistsByLnkInputIdAndPrcsOdr(Long lnkInputId, String prcsOdr);
}

@ -0,0 +1,9 @@
package cokr.xit.ens.biz.iup.domain.repository;
import cokr.xit.ens.biz.iup.domain.TbSendResult;
import org.springframework.data.jpa.repository.JpaRepository;
public interface TbSendResultRepository extends JpaRepository<TbSendResult, Long>, TbSendResultCustomRepository {
}

@ -0,0 +1,53 @@
package cokr.xit.ens.biz.iup.domain.repository;
import cokr.xit.ens.biz.iup.domain.TbSendResult;
import cokr.xit.ens.core.utils.CmmnUtil;
import com.querydsl.jpa.impl.JPAQueryFactory;
import lombok.RequiredArgsConstructor;
import java.time.LocalDateTime;
import java.util.List;
import static cokr.xit.ens.biz.iup.domain.QTbSendResult.tbSendResult;
@RequiredArgsConstructor
public class TbSendResultRepositoryImpl implements TbSendResultCustomRepository {
private final JPAQueryFactory query;
@Override
public void modifyByTbSendResults(List<TbSendResult> list) {
list.forEach(data -> query.update(tbSendResult)
.set(tbSendResult.prcsOdr, data.getPrcsOdr())
.set(tbSendResult.sendSttusCd, data.getSendSttusCd())
.set(tbSendResult.sendTrySttusCd, data.getSendTrySttusCd())
.set(tbSendResult.sendType, data.getSendType())
.set(tbSendResult.runDt, data.getRunDt())
.set(tbSendResult.bizSendDt, data.getBizSendDt())
.set(tbSendResult.bizRecvDt, data.getBizRecvDt())
.set(tbSendResult.bizReadDt, data.getBizReadDt())
.set(tbSendResult.bizErrMsg, data.getBizErrMsg())
.set(tbSendResult.regId, data.getRegId())
// .set(tbSendResult.regDt, data.getRegDt())
.set(tbSendResult.lastUpdt, LocalDateTime.now())
.set(tbSendResult.expiresDt, data.getExpiresDt())
.set(tbSendResult.prcsYn, data.getPrcsYn())
.where(tbSendResult.lnkInputId.eq(data.getLnkInputId())
.and(tbSendResult.dataId.eq(data.getDataId()))
)
.execute()
);
}
@Override
public Boolean findExistsByLnkInputIdAndPrcsOdr(Long lnkInputId, String prcsOdr) {
Long result = query.select(tbSendResult.lnkInputId)
.from(tbSendResult)
.where(tbSendResult.lnkInputId.eq(lnkInputId)
.and(tbSendResult.prcsOdr.eq(prcsOdr))
)
.fetchFirst();
return CmmnUtil.isEmpty(result) ? false : true;
}
}

@ -0,0 +1,9 @@
package cokr.xit.ens.biz.iup.domain.repository;
import cokr.xit.ens.biz.iup.domain.VKakaoNoticeInfo;
import org.springframework.data.jpa.repository.JpaRepository;
public interface VKakaoNoticeInfoRepository extends JpaRepository<VKakaoNoticeInfo, String>, VKakaoNoticeInfoRepositoryCustom {
}

@ -0,0 +1,5 @@
package cokr.xit.ens.biz.iup.domain.repository;
public interface VKakaoNoticeInfoRepositoryCustom {
}

@ -0,0 +1,12 @@
package cokr.xit.ens.biz.iup.domain.repository;
import com.querydsl.jpa.impl.JPAQueryFactory;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
public class VKakaoNoticeInfoRepositoryImpl implements VKakaoNoticeInfoRepositoryCustom {
private final JPAQueryFactory query;
}

@ -0,0 +1,9 @@
package cokr.xit.ens.biz.iup.domain.repository;
import cokr.xit.ens.biz.iup.domain.VKakaoNoticeInfoSn;
import org.springframework.data.jpa.repository.JpaRepository;
public interface VKakaoNoticeInfoSnRepository extends JpaRepository<VKakaoNoticeInfoSn, String>, VKakaoNoticeInfoSnRepositoryCustom {
}

@ -0,0 +1,5 @@
package cokr.xit.ens.biz.iup.domain.repository;
public interface VKakaoNoticeInfoSnRepositoryCustom {
}

@ -0,0 +1,12 @@
package cokr.xit.ens.biz.iup.domain.repository;
import com.querydsl.jpa.impl.JPAQueryFactory;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
public class VKakaoNoticeInfoSnRepositoryImpl implements VKakaoNoticeInfoSnRepositoryCustom {
private final JPAQueryFactory query;
}

@ -0,0 +1,142 @@
package cokr.xit.ens.biz.iup.init;
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 com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Component
@Transactional
@Profile({"prod-iup", "local-maria", "local-oracle"})
public class IupJpaRunner extends InitJpaRunner {
ObjectMapper mapper = new ObjectMapper();
@Override
protected List<OrgMngDTO> createOrgMngDTO() {
List<OrgMngDTO> list = new ArrayList<>();
list.add(createOrgMngDTO("0001", "", "관리지원센터", "N", null, null));
list.add(createOrgMngDTO("0002", "ThbGXS13oaidCCOk", "경수고속도로", "Y", "http://190.100.100.12/api/kakao/prepay", "http://190.100.100.12/api/kakao/pay-result"));
list.add(createOrgMngDTO("0003", "jTsUoCwm3BSOANcJ", "인천대교", "Y", "http://200.200.22.13:8080/IDTCS/kakao/prepay", "http://200.200.22.13:8080/IDTCS/kakao/pay-result"));
list.add(createOrgMngDTO("0004", "MfhmiR2oif0j5f3C", "인천공항하이웨이", "Y", "http://211.195.163.91:8080/api/kakao/prepay", "http://211.195.163.91:8080/api/kakao/pay-result"));
list.add(createOrgMngDTO("0005", "dtX0rzX4IyPnR0Zw", "서울고속도로", "Y", "http://172.20.11.10:8080/kakao/prepay.jsp", "http://172.20.11.10:8080/kakao/pay-result.jsp"));
return list;
}
@Override
protected List<Map<String, Object>> createTmpltMngDTO() {
List<Map<String, Object>> list = new ArrayList<>();
list.add(mapper.convertValue(createTmpltMngKkoAlimtalk("0001", "A0001", "CEPHIS001", "한국교통연구원 민자도로 관리지원센터 미납통행료 납부고지서", "~~@@!!ORG_NM!!@@~~에서 ~~@@!!TARGET_NAME!!@@~~님께 발송한 미납통행료 고지서가 도착했습니다.\n" +
"\n" +
"민자도로 미납통행료 고지서\n" +
"\n" +
"□ 차량번호 : ~~@@!!CAR_NO!!@@~~\n" +
"□ 미납발생 노선 : ~~@@!!COMPANY!!@@~~\n" +
"□ 미납발생 기간 : ~~@@!!TERM!!@@~~\n" +
"□ 납부금액 : ~~@@!!FEE!!@@~~원(~~@@!!COUNT!!@@~~건)\n" +
"□ 납부기한 : ~~@@!!DEADLINE!!@@~~\n" +
"□ 납부방법 : \n" +
"① 하단의 (납부하기) 클릭\n" +
"② 가상계좌 납부\n" +
"~~@@!!BANK_ACCOUNT!!@@~~\n" +
"\n" +
"※ 알림톡 수신 시 종이고지서는 발송되지 않습니다.\n" +
"\n" +
"문의처 : ~~@@!!REP_CALL_NO!!@@~~", "Y")
, Map.class));
list.add(mapper.convertValue(createTmpltMngIntgrn(PostSeCd.kkoMydoc, PostSeCd.nvSigntalk, null, "0001", "A0002", "민자도로 미납통행료 독촉장", "소유차량(#{CAR_NO})의 미납통행료 독촉장", "Y"
, null
, createTmpltMngKkoMydoc(null, null, null, null, null, "044-211-3377", "문의처", "Y", "Y", "Y")
, createTmpltMngNvSigntalk(null, null, null, null, null, "044-211-3377", "Y", "Y", "N", "{\"data\":[{\"내용\":\"소유차량(#{CAR_NO})의 미납통행료 독촉장\"}]}"))
, Map.class));
list.add(mapper.convertValue(createTmpltMngKkoAlimtalk("0001", "A0003", "CEPHIS001", "통행료 미납에 따른 예금 압류 예고 안내", "~~@@!!ORG_NM!!@@~~ 에서 ~~@@!!TARGET_NAME!!@@~~ 님께 발송한 통행료 미납에 따른 예금 압류 예고 안내문이 도착했습니다.\n" +
"\n" +
"통행료 미납에 따른 예금 압류 예고 안내\n" +
"\n" +
"민자도로 관리지원센터에서는 ~~@@!!NAME!!@@~~님께서 통행료 납부를 하지 않을 시 유료도로법 제21조 제6항에 따라 예금압류를 진행할 예정입니다.\n" +
"예금이 압류되면 입출금, 계좌이체를 할 수 없어 채무연체 등 불이익을 입을 수 있고, 은행 영업일 기준으로 24시간 이내에 압류해제가 가능하지 않음을 알려드립니다. \n" +
"\n" +
"□ 차량번호 : ~~@@!!CAR_NO!!@@~~\n" +
"□ 미납발생 노선 : ~~@@!!COMPANY!!@@~~\n" +
"□ 미납발생 기간 : ~~@@!!TERM!!@@~~\n" +
"□ 납부금액 : ~~@@!!FEE!!@@~~원(~~@@!!COUNT!!@@~~건)\n" +
"□ 납부방법 : ~~@@!!METHOD!!@@~~\n" +
"~~@@!!BANK_ACCOUNT!!@@~~\n" +
"□ 납부기한 : ~~@@!!DEADLINE!!@@~~까지\n" +
"□ 민자도로 관리지원센터 : ~~@@!!CALL_NO!!@@~~\n" +
"\n" +
"문의처 : ~~@@!!REP_CALL_NO!!@@~~", "Y")
, Map.class));
list.add(mapper.convertValue(createTmpltMngIntgrn(PostSeCd.kkoMydoc, PostSeCd.nvSigntalk, null, "0002", "B0001", "용인-서울고속도로 미납통행료 1차 안내문", "소유차량(#{CAR_NO})의 미납통행료 1차 안내문", "Y"
, null
, createTmpltMngKkoMydoc(null, null, null, null, null, "1599-2509", "문의처", "Y", "Y", "Y")
, createTmpltMngNvSigntalk(null, null, null, null, null, "1599-2509", "Y", "Y", "N", "{\"data\":[{\"내용\":\"소유차량(#{CAR_NO})의 미납통행료 1차 안내문\"}]}"))
, Map.class));
list.add(mapper.convertValue(createTmpltMngIntgrn(PostSeCd.kkoMydoc, PostSeCd.nvSigntalk, null, "0002", "B0002", "용인-서울고속도로 미납통행료 독촉장", "소유차량(#{CAR_NO})의 미납통행료 독촉장", "Y"
, null
, createTmpltMngKkoMydoc(null, null, null, null, null, "1599-2509", "문의처", "Y", "Y", "Y")
, createTmpltMngNvSigntalk(null, null, null, null, null, "1599-2509", "Y", "Y", "N", "{\"data\":[{\"내용\":\"소유차량(#{CAR_NO})의 미납통행료 독촉장\"}]}"))
, Map.class));
list.add(mapper.convertValue(createTmpltMngIntgrn(PostSeCd.kkoMydoc, PostSeCd.nvSigntalk, null, "0002", "B1001", "용인-서울고속도로 미납통행료 2차 고지서", "소유차량(#{CAR_NO})의 미납통행료 2차 고지서", "Y"
, null
, createTmpltMngKkoMydoc(null, null, null, null, null, "1599-2509", "문의처", "Y", "Y", "Y")
, createTmpltMngNvSigntalk(null, null, null, null, null, "1599-2509", "Y", "Y", "N", "{\"data\":[{\"내용\":\"소유차량(#{CAR_NO})의 미납통행료 2차 고지서\"}]}"))
, Map.class));
list.add(mapper.convertValue(createTmpltMngIntgrn(PostSeCd.kkoMydoc, PostSeCd.nvSigntalk, null, "0003", "C0001", "인천대교 고속도로 미납통행료 1차 안내문", "소유차량(#{CAR_NO})의 미납통행료 1차 안내문", "Y"
, null
, createTmpltMngKkoMydoc(null, null, null, null, null, "032-745-8200", "문의처", "Y", "Y", "Y")
, createTmpltMngNvSigntalk(null, null, null, null, null, "032-745-8200", "Y", "Y", "N", "{\"data\":[{\"내용\":\"소유차량(#{CAR_NO})의 미납통행료 1차 안내문\"}]}"))
, Map.class));
list.add(mapper.convertValue(createTmpltMngIntgrn(PostSeCd.kkoMydoc, PostSeCd.nvSigntalk, null, "0003", "C0002", "인천대교 고속도로 미납통행료 독촉장", "소유차량(#{CAR_NO})의 미납통행료 독촉장", "Y"
, null
, createTmpltMngKkoMydoc(null, null, null, null, null, "032-745-8200", "문의처", "Y", "Y", "Y")
, createTmpltMngNvSigntalk(null, null, null, null, null, "032-745-8200", "Y", "Y", "N", "{\"data\":[{\"내용\":\"소유차량(#{CAR_NO})의 미납통행료 독촉장\"}]}"))
, Map.class));
list.add(mapper.convertValue(createTmpltMngIntgrn(PostSeCd.kkoMydoc, PostSeCd.nvSigntalk, null, "0003", "C1001", "인천대교 고속도로 미납통행료 2차 고지서", "소유차량(#{CAR_NO})의 미납통행료 2차 고지서", "Y"
, null
, createTmpltMngKkoMydoc(null, null, null, null, null, "032-745-8200", "문의처", "Y", "Y", "Y")
, createTmpltMngNvSigntalk(null, null, null, null, null, "032-745-8200", "Y", "Y", "N", "{\"data\":[{\"내용\":\"소유차량(#{CAR_NO})의 미납통행료 2차 고지서\"}]}"))
, Map.class));
list.add(mapper.convertValue(createTmpltMngIntgrn(PostSeCd.kkoMydoc, PostSeCd.nvSigntalk, null, "0004", "D0001", "인천국제공항 고속도로 미납통행료 1차 안내문", "소유차량(#{CAR_NO})의 미납통행료 1차 안내문", "Y"
, null
, createTmpltMngKkoMydoc(null, null, null, null, null, "032-560-6200", "문의처", "Y", "Y", "Y")
, createTmpltMngNvSigntalk(null, null, null, null, null, "032-560-6200", "Y", "Y", "N", "{\"data\":[{\"내용\":\"소유차량(#{CAR_NO})의 미납통행료 1차 안내문\"}]}"))
, Map.class));
list.add(mapper.convertValue(createTmpltMngIntgrn(PostSeCd.kkoMydoc, PostSeCd.nvSigntalk, null, "0004", "D0002", "인천국제공항 고속도로 미납통행료 독촉장", "소유차량(#{CAR_NO})의 미납통행료 독촉장", "Y"
, null
, createTmpltMngKkoMydoc(null, null, null, null, null, "032-560-6200", "문의처", "Y", "Y", "Y")
, createTmpltMngNvSigntalk(null, null, null, null, null, "032-560-6200", "Y", "Y", "N", "{\"data\":[{\"내용\":\"소유차량(#{CAR_NO})의 미납통행료 독촉장\"}]}"))
, Map.class));
list.add(mapper.convertValue(createTmpltMngIntgrn(PostSeCd.kkoMydoc, PostSeCd.nvSigntalk, null, "0004", "D1001", "인천국제공항 고속도로 미납통행료 2차 고지서", "소유차량(#{CAR_NO})의 미납통행료 2차 고지서", "Y"
, null
, createTmpltMngKkoMydoc(null, null, null, null, null, "032-560-6200", "문의처", "Y", "Y", "Y")
, createTmpltMngNvSigntalk(null, null, null, null, null, "032-560-6200", "Y", "Y", "N", "{\"data\":[{\"내용\":\"소유차량(#{CAR_NO})의 미납통행료 2차 고지서\"}]}"))
, Map.class));
list.add(mapper.convertValue(createTmpltMngIntgrn(PostSeCd.kkoMydoc, PostSeCd.nvSigntalk, null, "0005", "E0001", "수도권제1순환 고속도로 미납통행료 1차 안내문", "소유차량(#{CAR_NO})의 미납통행료 1차 안내문", "Y"
, null
, createTmpltMngKkoMydoc(null, null, null, null, null, "영업소마다 다름", "문의처", "Y", "Y", "N")
, createTmpltMngNvSigntalk(null, null, null, null, null, "영업소마다 다름", "Y", "Y", "N", "{\"data\":[{\"내용\":\"소유차량(#{CAR_NO})의 미납통행료 1차 안내문\"}]}"))
, Map.class));
list.add(mapper.convertValue(createTmpltMngIntgrn(PostSeCd.kkoMydoc, PostSeCd.nvSigntalk, null, "0005", "E0002", "수도권제1순환 고속도로 미납통행료 독촉장", "소유차량(#{CAR_NO})의 미납통행료 독촉장", "Y"
, null
, createTmpltMngKkoMydoc(null, null, null, null, null, "영업소마다 다름", "문의처", "Y", "Y", "N")
, createTmpltMngNvSigntalk(null, null, null, null, null, "영업소마다 다름", "Y", "Y", "N", "{\"data\":[{\"내용\":\"소유차량(#{CAR_NO})의 미납통행료 독촉장\"}]}"))
, Map.class));
list.add(mapper.convertValue(createTmpltMngIntgrn(PostSeCd.kkoMydoc, PostSeCd.nvSigntalk, null, "0005", "E1001", "수도권제1순환 고속도로 미납통행료 2차 고지서", "소유차량(#{CAR_NO})의 미납통행료 2차 고지서", "Y"
, null
, createTmpltMngKkoMydoc(null, null, null, null, null, "영업소마다 다름", "문의처", "Y", "Y", "N")
, createTmpltMngNvSigntalk(null, null, null, null, null, "영업소마다 다름", "Y", "Y", "N", "{\"data\":[{\"내용\":\"소유차량(#{CAR_NO})의 미납통행료 2차 고지서\"}]}")
)
, Map.class));
return list;
}
}

@ -0,0 +1,12 @@
package cokr.xit.ens.biz.iup.signtalk.model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
@Getter
@Schema(name = "IupSigntalkReqVO")
public class IupSigntalkReqVO {
@Schema(required = true, title = "연계입수 아이디", example = " ")
private Long lnkInputId;
}

@ -0,0 +1,66 @@
package cokr.xit.ens.biz.iup.signtalk.presentation;
import cokr.xit.ens.biz.iup.signtalk.model.IupSigntalkReqVO;
import cokr.xit.ens.biz.iup.signtalk.service.IupSigntalkService;
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.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@Tag(name = "iupSigntalkController")
@Slf4j
@RequiredArgsConstructor
@RestController
public class IupSigntalkController {
private final IupSigntalkService iupSigntalkService;
@Operation(summary = "접수")
@PostMapping(value = "/iup/signtalk/accept", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EnsResponseVO> accept(@RequestBody IupSigntalkReqVO reqDTO){
EnsResponseVO responseVO = iupSigntalkService.accept(reqDTO.getLnkInputId());
return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
}
@Operation(summary = "접수(일괄)")
@PostMapping(value = "/iup/signtalk/accept/all", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EnsResponseVO> acceptAll(){
EnsResponseVO responseVO = iupSigntalkService.acceptAll();
return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
}
// @Operation(summary = "제작")
//// @PutMapping(value = "/iup/signtalk/re/make", produces = MediaType.APPLICATION_JSON_VALUE)
// @PostMapping(value = "/iup/signtalk/re/make", produces = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<EnsResponseVO> reMake(@RequestBody iupSigntalkReqVO reqDTO){
// EnsResponseVO responseVO = iupMydocService.reMake(reqDTO.getLnkInputId());
// return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
// }
@Operation(summary = "전송")
// @PutMapping(value = "/iup/signtalk/re/send", produces = MediaType.APPLICATION_JSON_VALUE)
@PostMapping(value = "/iup/signtalk/re/send", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EnsResponseVO> reSend(@RequestBody IupSigntalkReqVO reqDTO){
EnsResponseVO responseVO = iupSigntalkService.reSend(reqDTO.getLnkInputId());
return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
}
@Operation(summary = "전송결과가져오기")
@PostMapping(value = "/iup/signtalk/fetch", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EnsResponseVO> fetch(@RequestBody IupSigntalkReqVO reqDTO){
EnsResponseVO responseVO = iupSigntalkService.fetch(reqDTO.getLnkInputId());
return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
}
@Operation(summary = "전송결과가져오기(일괄)")
@PostMapping(value = "/iup/signtalk/fetch/all", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EnsResponseVO> fetchAll(){
EnsResponseVO responseVO = iupSigntalkService.fetchAll();
return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
}
}

@ -0,0 +1,47 @@
package cokr.xit.ens.biz.iup.signtalk.sched;
import cokr.xit.ens.biz.iup.signtalk.service.IupSigntalkService;
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-iup")
@RequiredArgsConstructor
public class IupSigntalkScheduler {
private final IupSigntalkService iupMydocService;
/**
*
* -. IUP ENS .
*/
@Scheduled(cron = "0 */5 * * * *")
public void accepted(){
EnsResponseVO responseVO = iupMydocService.acceptAll();
log.info("=======================================================");
log.info("[IUP] 인증톡 접수처리 결과");
log.info(responseVO.toString());
log.info("=======================================================");
}
/**
*
* -. (/) ENS -> IUP .
*/
@Scheduled(cron = "0 */15 * * * *")
public void fetched(){
EnsResponseVO responseVO = iupMydocService.fetchAll();
log.info("=======================================================");
log.info("[IUP] 인증톡 요청문서정보 Fetch 결과");
log.info(responseVO.toString());
log.info("=======================================================");
}
}

@ -0,0 +1,476 @@
package cokr.xit.ens.biz.iup.signtalk.service;
import cokr.xit.ens.biz.iup.billpay.service.IupBillPayApiServiceSupport;
import cokr.xit.ens.biz.iup.domain.*;
import cokr.xit.ens.biz.iup.domain.repository.*;
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.intgrnbill.code.BillReqSeCd;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.entity.BillHist;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.api.BillKkoClientApiSpec;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.code.BillKkoErrCd;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model.BillKkoApiRespDTO;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model.BillKkoPayResultDTO;
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.IntgrnSendDetail;
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.repository.IntgrnSendDetailRepository;
import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.OrgMng;
import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.TmpltMng;
import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.repository.OrgMngRepository;
import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.repository.TmpltMngRepository;
import com.google.gson.Gson;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import java.util.Optional;
@Slf4j
@Service("iupBillPayApiService_KP")
@RequiredArgsConstructor
public class IupBillPayApiSigntalkService extends IupBillPayApiServiceSupport {
private final IntgrnSendDetailRepository intgrnSendDetailRepository;
private final TmpltMngRepository sendTmpltMngRepository;
private final OrgMngRepository orgMngRepository;
private final TbInputDataXitRepository tbInputDataXitRepository;
private final VKakaoNoticeInfoRepository vKakaoNoticeInfoRepository;
private final VKakaoNoticeInfoSnRepository vKakaoNoticeInfoSnRepository;
private final TbEnfrcLevMastrRepository tbEnfrcLevMastrRepository;
private final TbKakaoPayResultRepository tbKakaoPayResultRepository;
private final BillKkoClientApiSpec billKkoClientApi;
/**
*
*
* @param mParam
* @return
*/
@Transactional(propagation = Propagation.NEVER)
public BillKkoApiRespDTO findNoticeInfo(Map<String, Object> mParam) {
Map<String, Object> data = (Map<String, Object>) mParam.get("data");
// data.get("biller_user_key");
// data.get("billed_year_month");
// data.get("ordinal");
// data.get("biller_notice_key");
Map<String, Object> parameters = (Map<String, Object>) data.get("parameters");
// data.get("user_birth");
Map<String, Object> respData = null;
BillKkoApiRespDTO respVO = null;
BillKkoErrCd kkoBillErrCd = BillKkoErrCd.OK;
final String billerUserKey = Optional.ofNullable(data.get("biller_user_key")).isPresent() ?
String.valueOf(data.get("biller_user_key")) : null;
final String userBirth = Optional.ofNullable(data.get("user_birth")).isPresent() ?
String.valueOf(data.get("user_birth")) : null;
final String orgCd = Optional.ofNullable(parameters.get("orgCd")).isPresent() ?
String.valueOf(parameters.get("orgCd")) : null;
final String billUid = Optional.ofNullable(parameters.get("billUid")).isPresent() ?
String.valueOf(parameters.get("billUid")) : null;
BillHist billHist = null;
try {
billHist = this.addBillHistByReqInfo(BillReqSeCd.NOTICE, billerUserKey, orgCd, billUid, mParam);
if (CmmnUtil.isEmpty(billerUserKey)) {
kkoBillErrCd = BillKkoErrCd.E801;
throw new EnsException(EnsErrCd.ERR401, "사용자식별키가 없습니다.");
}
if (CmmnUtil.isEmpty(orgCd)) {
kkoBillErrCd = BillKkoErrCd.E801;
throw new EnsException(EnsErrCd.ERR401, "기관코드가 없습니다.");
}
if (CmmnUtil.isEmpty(userBirth)) {
kkoBillErrCd = BillKkoErrCd.E801;
throw new EnsException(EnsErrCd.ERR401, "생년월일이 없습니다.");
}
Optional<IntgrnSendDetail> intgrnSendDetail = intgrnSendDetailRepository.findByLinkedUuid(billerUserKey);
if (!intgrnSendDetail.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E402;
throw new EnsException(EnsErrCd.ERR404, "일치하는 발송상세 자료가 없습니다.");
}
if (!orgCd.equals(intgrnSendDetail.get().getIntgrnSendMast().getOrgCd())) {
kkoBillErrCd = BillKkoErrCd.E402;
throw new EnsException(EnsErrCd.ERR402, String.format("기관코드가 상이 합니다. ( 요청: %s 실제: %s )", orgCd, intgrnSendDetail.get().getIntgrnSendMast().getOrgCd()));
}
Optional<OrgMng> orgMng = orgMngRepository.findById(orgCd);
if (!orgMng.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E801;
throw new EnsException(EnsErrCd.ERR404, "일치하는 기관정보가 없습니다.");
}
Optional<TmpltMng> sendTmpltMng = sendTmpltMngRepository.findFetchByOrgCdAndTmpltCdAndUseYn(orgCd, intgrnSendDetail.get().getIntgrnSendMast().getTmpltCd(), "Y");
if (!sendTmpltMng.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E801;
throw new EnsException(EnsErrCd.ERR404, "일치하는 템플릿정보가 없습니다.");
}
Optional<TbInputDataXit> tbInputDataXit = tbInputDataXitRepository.findByLinkedUuid(billerUserKey);
if (!tbInputDataXit.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E402;
throw new EnsException(EnsErrCd.ERR404, "일치하는 발송상세정보가 없습니다.");
}
// final String dataId = tbInputDataXit.get().getDataId();
final String dataId = billerUserKey;
if ("Y".equals(orgMng.get().getKkoBpCsignYn())) {
Optional<VKakaoNoticeInfoSn> vKakaoNoticeInfoSn = vKakaoNoticeInfoSnRepository.findById(dataId);
if (!vKakaoNoticeInfoSn.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E402;
throw new EnsException(EnsErrCd.ERR404, "일치하는 단순미납부과 자료가 없습니다.");
}
if (!userBirth.equals(vKakaoNoticeInfoSn.get().getUserBirth())) {
kkoBillErrCd = BillKkoErrCd.E402;
throw new EnsException(EnsErrCd.ERR402, String.format("생년월일이 일치하지 않습니다. (요청: %s 실제: %s)", userBirth, vKakaoNoticeInfoSn.get().getUserBirth()));
}
respData = this.respNoticeSnData(sendTmpltMng.get().getTitle(), orgMng.get(), vKakaoNoticeInfoSn.get());
} else if ("N".equals(orgMng.get().getKkoBpCsignYn())) {
if (dataId.length() < 20) {
kkoBillErrCd = BillKkoErrCd.E402;
throw new EnsException(EnsErrCd.ERR403, "빌러코드가 20자리 미만 입니다.");
}
Optional<VKakaoNoticeInfo> vKakaoNoticeInfo = vKakaoNoticeInfoRepository.findById(dataId.substring(0, 20));
if (!vKakaoNoticeInfo.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E402;
throw new EnsException(EnsErrCd.ERR404, "일치하는 강제징수부과 자료가 없습니다.");
}
if (!userBirth.equals(vKakaoNoticeInfo.get().getUserBirth())) {
kkoBillErrCd = BillKkoErrCd.E404;
throw new EnsException(EnsErrCd.ERR402, String.format("생년월일이 일치하지 않습니다. (요청: %s 실제: %s)", userBirth, vKakaoNoticeInfo.get().getUserBirth()));
}
respData = this.respNoticeData(sendTmpltMng.get().getTitle(), orgMng.get(), vKakaoNoticeInfo.get());
} else {
kkoBillErrCd = BillKkoErrCd.E402;
throw new EnsException(EnsErrCd.ERR999, "위탁업체여부 구분값이 등록되지 않았습니다.");
}
respVO = BillKkoApiRespDTO.okBuilder()
.data(respData)
.build();
this.modifyBillHistByRespInfo(billHist, respVO, null, null);
} catch (EnsException e) {
respVO = BillKkoApiRespDTO.errBuilder()
.resCode(kkoBillErrCd.getCode())
.message(kkoBillErrCd.getCodeNm())
.build();
this.modifyBillHistByRespInfo(billHist, respVO, e.getErrCd(), e.getMessage());
} catch (Exception e) {
respVO = BillKkoApiRespDTO.errBuilder()
.resCode(BillKkoErrCd.E801.getCode())
.message(BillKkoErrCd.E801.getCodeNm())
.build();
this.modifyBillHistByRespInfo(billHist, respVO, EnsErrCd.ERR999, e.getMessage());
}
return respVO;
}
/**
*
*
* @param mParam
* @return
*/
@Transactional(propagation = Propagation.NEVER)
public BillKkoApiRespDTO findPrepayInfo(Map<String, Object> mParam) {
Map<String, Object> data = (Map<String, Object>) mParam.get("data");
// data.get("biller_user_key");
// data.get("billed_year_month");
// data.get("ordinal");
// data.get("biller_notice_key");
Map<String, Object> parameters = (Map<String, Object>) data.get("parameters");
// data.get("amount");
BillKkoApiRespDTO respVO = null;
BillKkoErrCd kkoBillErrCd = BillKkoErrCd.OK;
final String billerUserKey = Optional.ofNullable(data.get("biller_user_key")).isPresent() ?
String.valueOf(data.get("biller_user_key")) : null;
final int amount = Optional.ofNullable(data.get("amount")).isPresent() ?
(int) data.get("amount") : 0;
final String orgCd = Optional.ofNullable(parameters.get("orgCd")).isPresent() ?
String.valueOf(parameters.get("orgCd")) : null;
final String billUid = Optional.ofNullable(parameters.get("billUid")).isPresent() ?
String.valueOf(parameters.get("billUid")) : null;
BillHist billHist = null;
try {
billHist = this.addBillHistByReqInfo(BillReqSeCd.PREPAY, billerUserKey, orgCd, billUid, mParam);
if (CmmnUtil.isEmpty(billerUserKey)) {
kkoBillErrCd = BillKkoErrCd.E601;
throw new EnsException(EnsErrCd.ERR401, "사용자식별키가 없습니다.");
}
if (CmmnUtil.isEmpty(orgCd)) {
kkoBillErrCd = BillKkoErrCd.E601;
throw new EnsException(EnsErrCd.ERR401, "기관코드가 없습니다.");
}
Optional<OrgMng> orgMng = orgMngRepository.findById(orgCd);
if (!orgMng.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E601;
throw new EnsException(EnsErrCd.ERR404, "일치하는 기관정보가 없습니다.");
}
Optional<TbInputDataXit> tbInputDataXit = tbInputDataXitRepository.findByLinkedUuid(billerUserKey);
if (!tbInputDataXit.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E402;
throw new EnsException(EnsErrCd.ERR404, "일치하는 발송상세정보가 없습니다.");
}
final String dataId = tbInputDataXit.get().getDataId();
Optional<VKakaoNoticeInfo> vKakaoNoticeInfo = Optional.ofNullable(null);
// List<TbEnfrcLevRciv> tbEnfrcLevRcivs = new ArrayList<>();
if ("Y".equals(orgMng.get().getKkoBpCsignYn())) {
Optional<VKakaoNoticeInfoSn> vKakaoNoticeInfoSn = vKakaoNoticeInfoSnRepository.findById(dataId);
if (!vKakaoNoticeInfoSn.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E502;
throw new EnsException(EnsErrCd.ERR404, "일치하는 단순미납 자료가 없습니다.");
}
respVO = billKkoClientApi.callApiByOrg(orgMng.get().getKkoBpCsignPrepayApi(), mParam);
if ("OK".equals(respVO.getRes_code()))
this.modifyBillHistByRespInfo(billHist, respVO, null, null);
else
this.modifyBillHistByRespInfo(billHist, respVO, EnsErrCd.ERR999, String.format("[%s] %s", respVO.getRes_code(), respVO.getMessage()));
return respVO;
} else if ("N".equals(orgMng.get().getKkoBpCsignYn())) {
if (dataId.length() < 20) {
kkoBillErrCd = BillKkoErrCd.E502;
throw new EnsException(EnsErrCd.ERR403, "빌러코드가 20자리 미만 입니다.");
}
vKakaoNoticeInfo = vKakaoNoticeInfoRepository.findById(dataId.substring(0, 20));
if (!vKakaoNoticeInfo.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E502;
throw new EnsException(EnsErrCd.ERR404, "일치하는 강제징수 자료가 없습니다.");
}
// tbEnfrcLevRcivs = tbEnfrcLevRcivRepository.findAllByEnfrcLevMastrIdAndDeleteAt(dataId.substring(0, 20), "N");
Optional<TbEnfrcLevMastr> tbEnfrcLevMastr = tbEnfrcLevMastrRepository.findByEnfrcLevMastrIdAndEnfrcLevMastrProcessSttusAndDeleteAt(dataId.substring(0, 20), "04", "N");
if (!tbEnfrcLevMastr.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E601;
throw new EnsException(EnsErrCd.ERR507, "납부가능 상태가 아닙니다.");
}
} else {
kkoBillErrCd = BillKkoErrCd.E601;
throw new EnsException(EnsErrCd.ERR999, "위탁업체여부 구분값이 등록되지 않았습니다.");
}
if (CmmnUtil.isEmpty(vKakaoNoticeInfo.get().getAmount())
|| amount != Integer.parseInt(vKakaoNoticeInfo.get().getAmount())) {
kkoBillErrCd = BillKkoErrCd.E403;
throw new EnsException(EnsErrCd.ERR902
, String.format("납부 가능 금액이 없거나 일치하지 않습니다. (요청금액:%s, 실제금액:%s)"
, amount
, vKakaoNoticeInfo.get().getAmount()));
}
if (amount > Integer.parseInt(vKakaoNoticeInfo.get().getAmount())) {
kkoBillErrCd = BillKkoErrCd.E501;
throw new EnsException(EnsErrCd.ERR902
, String.format("납부 가능 금액을 초과했습니다. (요청금액:%s, 실제금액:%s)"
, amount
, vKakaoNoticeInfo.get().getAmount()));
}
if (!vKakaoNoticeInfo.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E502;
throw new EnsException(EnsErrCd.ERR404, "일치하는 청구서자료가 없습니다.");
}
if (CmmnUtil.isEmpty(vKakaoNoticeInfo.get().getPayExpireDate())) {
kkoBillErrCd = BillKkoErrCd.E601;
throw new EnsException(EnsErrCd.ERR401, "납부기한이 값이 없습니다.");
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
if (Integer.parseInt(vKakaoNoticeInfo.get().getPayExpireDate()) < Integer.parseInt(simpleDateFormat.format(new Date()))) {
kkoBillErrCd = BillKkoErrCd.E506;
throw new EnsException(EnsErrCd.ERR902, "납부기한이 경과한 자료 입니다.");
}
// if (tbEnfrcLevRcivs.size() > 0) {
// kkoBillErrCd = BillKkoErrCd.E601;
// throw new EnsException(EnsErrCd.ERR903, "납부가 완료된 자료 입니다.");
// }
respVO = BillKkoApiRespDTO.okBuilder()
.data(null)
.build();
this.modifyBillHistByRespInfo(billHist, respVO, null, null);
} catch (EnsException e) {
respVO = BillKkoApiRespDTO.errBuilder()
.resCode(kkoBillErrCd.getCode())
.message(kkoBillErrCd.getCodeNm())
.build();
this.modifyBillHistByRespInfo(billHist, respVO, e.getErrCd(), e.getMessage());
} catch (Exception e) {
respVO = BillKkoApiRespDTO.errBuilder()
.resCode(BillKkoErrCd.E601.getCode())
.message(BillKkoErrCd.E601.getCodeNm())
.build();
this.modifyBillHistByRespInfo(billHist, respVO, EnsErrCd.ERR999, e.getMessage());
}
return respVO;
}
/**
*
*
* @param mParam
* @return
*/
@Transactional(propagation = Propagation.NEVER)
public BillKkoApiRespDTO addPayReultIfno(Map<String, Object> mParam) {
Map<String, Object> data = (Map<String, Object>) mParam.get("data");
Gson gson = new Gson();
BillKkoPayResultDTO kkoBillPayResultVO = gson.fromJson(gson.toJson(data), BillKkoPayResultDTO.class);
Map<String, Object> parameters = kkoBillPayResultVO.getParameters();
BillKkoApiRespDTO respVO = null;
BillKkoErrCd kkoBillErrCd = BillKkoErrCd.OK;
final String orgCd = Optional.ofNullable(parameters.get("orgCd")).isPresent() ?
String.valueOf(parameters.get("orgCd")) : null;
final String billUid = Optional.ofNullable(parameters.get("billUid")).isPresent() ?
String.valueOf(parameters.get("billUid")) : null;
BillHist kkoBillHist = null;
try {
kkoBillHist = this.addBillHistByReqInfo(BillReqSeCd.PAYRSLT, kkoBillPayResultVO.getBiller_user_key(), orgCd, billUid, mParam);
if (CmmnUtil.isEmpty(kkoBillPayResultVO.getBiller_user_key())) {
kkoBillErrCd = BillKkoErrCd.E601;
throw new EnsException(EnsErrCd.ERR401, "사용자식별키가 없습니다.");
}
if (CmmnUtil.isEmpty(orgCd)) {
kkoBillErrCd = BillKkoErrCd.E601;
throw new EnsException(EnsErrCd.ERR401, "기관코드가 없습니다.");
}
Optional<OrgMng> orgMng = orgMngRepository.findById(orgCd);
if (!orgMng.isPresent()) {
kkoBillErrCd = BillKkoErrCd.E601;
throw new EnsException(EnsErrCd.ERR404, "일치하는 기관정보가 없습니다.");
}
if (!tbKakaoPayResultRepository.findById(kkoBillPayResultVO.getBiller_user_key()).isPresent())
tbKakaoPayResultRepository.save(this.createTbKakaoPayResult(kkoBillPayResultVO));
if ("Y".equals(orgMng.get().getKkoBpCsignYn())) {
respVO = billKkoClientApi.callApiByOrg(orgMng.get().getKkoBpCsignPayresultApi(), mParam);
if (!"OK".equals(respVO.getRes_code()))
this.modifyBillHistByRespInfo(kkoBillHist, respVO, EnsErrCd.ERR600, String.format("[%s] %s", respVO.getRes_code(), respVO.getMessage()));
return respVO;
} else if ("N".equals(orgMng.get().getKkoBpCsignYn())) {
} else {
kkoBillErrCd = BillKkoErrCd.E601;
throw new EnsException(EnsErrCd.ERR999, "위탁업체여부 구분값이 등록되지 않았습니다.");
}
respVO = BillKkoApiRespDTO.okBuilder()
.data(null)
.build();
this.modifyBillHistByRespInfo(kkoBillHist, respVO, null, null);
} catch (EnsException e) {
respVO = BillKkoApiRespDTO.errBuilder()
.resCode(kkoBillErrCd.getCode())
.message(kkoBillErrCd.getCodeNm())
.build();
this.modifyBillHistByRespInfo(kkoBillHist, respVO, e.getErrCd(), e.getMessage());
} catch (Exception e) {
respVO = BillKkoApiRespDTO.errBuilder()
.resCode(BillKkoErrCd.E601.getCode())
.message(BillKkoErrCd.E601.getCodeNm())
.build();
this.modifyBillHistByRespInfo(kkoBillHist, respVO, EnsErrCd.ERR999, e.getMessage());
}
return respVO;
}
private TbKakaoPayResult createTbKakaoPayResult(BillKkoPayResultDTO kkoBillPayResultVO) {
final String jobSe = "EL".equals(kkoBillPayResultVO.getBiller_user_key().substring(0, 2)) ? "2" : "1";
return TbKakaoPayResult.builder()
.dataId(kkoBillPayResultVO.getBiller_user_key())
.jobSe(jobSe)
.payMn(kkoBillPayResultVO.getPay_by())
.payTy(kkoBillPayResultVO.getPay_type())
.payDetail1(kkoBillPayResultVO.getPay_detail1())
.payDetail2(kkoBillPayResultVO.getPay_detail2())
.payDetail3(kkoBillPayResultVO.getPay_detail3())
.payAmount(kkoBillPayResultVO.getPay_amount())
.payFeeTy(kkoBillPayResultVO.getPay_fee_type())
.payFeeAmount(kkoBillPayResultVO.getPay_fee())
.payFeeVat(kkoBillPayResultVO.getPay_fee_tax())
.excclcPrearngeDe(kkoBillPayResultVO.getAdjust_date())
.payDt(kkoBillPayResultVO.getPaid_at())
.payId(kkoBillPayResultVO.getPay_id())
.payResultProcessSttus("0")
// .creatDt()
.crtr("ENS_SYS")
// .updtDt()
// .updusr()
.build();
}
}

@ -0,0 +1,167 @@
package cokr.xit.ens.biz.iup.signtalk.service;
import cokr.xit.ens.biz.iup.code.IupPrcsCd;
import cokr.xit.ens.biz.iup.code.IupSendTypeCd;
import cokr.xit.ens.biz.iup.domain.TbInputXit;
import cokr.xit.ens.biz.iup.domain.repository.TbInputXitRepository;
import cokr.xit.ens.biz.iup.signtalk.service.support.IupSigntalkAcceptor;
import cokr.xit.ens.biz.iup.signtalk.service.support.IupSigntalkFetcher;
import cokr.xit.ens.biz.iup.signtalk.service.support.IupSigntalkSender;
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
public class IupSigntalkService {
private final TbInputXitRepository tbInputXitRepository;
private final IupSigntalkAcceptor iupSigntalkAcceptor;
private final IupSigntalkSender iupSigntalkSender;
private final IupSigntalkFetcher iupSigntalkFetcher;
private final ApplicationEventPublisher applicationEventPublisher;
/**
* (IUP -> ENS)
*/
@Transactional
public EnsResponseVO accept(Long lnkInputId) {
try {
TbInputXit tbInputXit = tbInputXitRepository.findByPrcsCdAndSendTypeAndId(IupPrcsCd.TGRG, IupSendTypeCd.KP, lnkInputId)
.orElseThrow(() -> new EnsException(EnsErrCd.ACPT404, "일치하는 자료가 없거나 \"등록(TGRG)\" 상태가 아닙니다."));
return this.accept(Arrays.asList(tbInputXit)).getResultInfo().get(0);
} catch (EnsException e) {
return EnsResponseVO.errBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
}
}
/**
* (IUP -> ENS)
*/
@Transactional
public EnsResponseVO<List<EnsResponseVO>> acceptAll() {
try {
List<TbInputXit> tbInputXits = tbInputXitRepository.findAllByPrcsCdInAndSendType(Arrays.asList(IupPrcsCd.TGRG), IupSendTypeCd.KP);
if (CmmnUtil.isEmpty(tbInputXits))
throw new EnsException(EnsErrCd.ACPT404, "\"등록(TGRG)\" 상태의 자료가 없습니다.");
return this.accept(tbInputXits);
} catch (EnsException e) {
return EnsResponseVO.<List<EnsResponseVO>>errBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
}
}
private EnsResponseVO<List<EnsResponseVO>> accept(List<TbInputXit> tbInputXits) {
iupSigntalkAcceptor.statReady(tbInputXits.stream().map(row -> row.getLnkInputId()).collect(Collectors.toList()));
List<EnsResponseVO> resultInfo = tbInputXits.stream()
.map(row -> iupSigntalkAcceptor.execute(row.getLnkInputId()))
.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(tbInputXits))
.build();
applicationEventPublisher.publishEvent(event);
return EnsResponseVO.<List<EnsResponseVO>>okBuilder().resultInfo(resultInfo).build();
}
// /**
// * 인증톡 제작 재요청
// * @param lnkInputId
// * @return
// */
// public EnsResponseVO reMake(Long lnkInputId){
// return iupSigntalkMaker.execute(lnkInputId);
// }
/**
*
*
* @param lnkInputId
* @return
*/
public EnsResponseVO reSend(Long lnkInputId) {
return iupSigntalkSender.execute(lnkInputId);
}
/**
* (/)
*/
@Transactional
public EnsResponseVO fetch(Long lnkInputId) {
TbInputXit tbInputXit = null;
try {
tbInputXit = tbInputXitRepository.findById(lnkInputId)
.orElseThrow(() -> new EnsException(EnsErrCd.ERR404, String.format("[ lnkInputId %s ]와 일치하는 자료가 없습니다.", lnkInputId)));
if (!IupSendTypeCd.KP.equals(tbInputXit.getSendType()))
new EnsException(EnsErrCd.ERR404, String.format("[ lnkInputId %s ]는 인증톡 자료가 아닙니다.", lnkInputId));
} catch (EnsException e) {
return EnsResponseVO.errBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
}
return this.fetch(Arrays.asList(tbInputXit));
}
/**
* (/)
*/
public EnsResponseVO fetchAll() {
List<TbInputXit> tbInputXits = tbInputXitRepository.findAllByPrcsCdInAndSendType(Arrays.asList(IupPrcsCd.TGRC, IupPrcsCd.CICV, IupPrcsCd.CICC, IupPrcsCd.COMP, IupPrcsCd.INCM), IupSendTypeCd.KP);
return this.fetch(tbInputXits);
}
private EnsResponseVO fetch(List<TbInputXit> tbInputXits) {
iupSigntalkFetcher.statReady(tbInputXits.stream().map(row -> row.getLnkInputId()).collect(Collectors.toList()));
return EnsResponseVO.okBuilder()
.resultInfo(
tbInputXits.stream()
.map(row -> iupSigntalkFetcher.execute(row.getLnkInputId()))
.collect(Collectors.toList()
)
)
.build();
}
}

@ -0,0 +1,303 @@
package cokr.xit.ens.biz.iup.signtalk.service.support;
import cokr.xit.ens.biz.iup.code.IupPrcsCd;
import cokr.xit.ens.biz.iup.code.IupSendTypeCd;
import cokr.xit.ens.biz.iup.domain.TbInputDataXit;
import cokr.xit.ens.biz.iup.domain.TbInputXit;
import cokr.xit.ens.biz.iup.domain.repository.TbInputDataXitRepository;
import cokr.xit.ens.biz.iup.domain.repository.TbInputXitRepository;
import cokr.xit.ens.biz.iup.signtalk.service.support.accept.AcptDocKkoMd;
import cokr.xit.ens.biz.iup.signtalk.service.support.accept.AcptDocNvSt;
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.code.VenderCd;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.BillAcptReqDTO;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.code.BillSeCd;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model.BillKkoAcptReqVO;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model.config.CustomUrl;
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 IupSigntalkAcceptor implements EnsPhaseProcSupport<EnsResponseVO, Long> {
private final TbInputXitRepository tbInputXitRepository;
private final TbInputDataXitRepository tbInputDataXitRepository;
private final IntgrnNotiService intgrnNotiService;
@Value("${contract.kakao.pay.bill.dozn.api.validate.host}")
private String BILL_HOST;
@Value("${contract.kakao.pay.bill.dozn.api.validate.notice}")
private String BILL_NOTICE_URL;
@Value("${contract.kakao.pay.bill.dozn.api.validate.prepay}")
private String BILL_PREPAY_URL;
@Value("${contract.kakao.pay.bill.dozn.api.validate.payresult}")
private String BILL_PAYREUSLT_URL;
@Value("${xit.mblpage.intgrn.url}")
private String MBLPAGE_URL;
@Value("${xit.mblpage.intgrn.path}")
private String MBLPAGE_PATH;
/**
* Accept
*
* @param lnkInputIds
* @return
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statReady(List<Long> lnkInputIds) {
try {
AtomicInteger index = new AtomicInteger();
String prefixLinkedUuid = String.format("B-ST%s%s", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")), RandomString.make(5));
lnkInputIds.stream()
.map(lnkInputId -> tbInputXitRepository.findById(lnkInputId).get())
.map(tbinput -> tbInputDataXitRepository.findAllByTbInputXit(tbinput))
.forEach(list -> {
list.stream()
.forEach(row -> {
log.info(row.toString());
// row.setLinkedUuid(String.format("%s%05d", prefixLinkedUuid, index.getAndIncrement() + 1));
row.setLinkedUuid(row.getDataId());
});
tbInputDataXitRepository.saveAll(list);
}
);
} catch (Exception e) {
return EnsResponseVO.errBuilder()
.errCode(EnsErrCd.ACPT500)
.errMsg(String.format("연계식별UUID 생성에 실패 했습니다. %s", e.getMessage()))
.build();
}
EnsResponseVO respVO = null;
try {
/**
*
*/
if (CmmnUtil.isEmpty(lnkInputIds))
throw new EnsException(EnsErrCd.ACPT410, "연계입수아이디(은)는 필수조건 입니다.");
/**
*
* -. "대상이관등록(TGRI)" .
*/
List<Long> resultInfo = tbInputXitRepository.findAllByLnkInputIdIn(lnkInputIds).stream()
.map(row -> {
row.setUpdId("ENS_SYS");
row.setPrcsCd(IupPrcsCd.TGRI);
return row.getLnkInputId();
})
.collect(Collectors.toList());
respVO = EnsResponseVO.okBuilder().resultInfo(resultInfo).build();
} catch (EnsException e) {
respVO = EnsResponseVO.errBuilder().errCode(e.getErrCd()).errMsg(e.getMessage()).build();
} catch (Exception e) {
respVO = EnsResponseVO.errBuilder().errCode(EnsErrCd.ACPT999).errMsg(e.getMessage()).build();
}
return respVO;
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statBegin(Long arg) {
log.info("no process");
return null;
}
/**
*
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO execute(Long lnkInputId) {
Map<String, Long> resultInfo = new HashMap<>();
resultInfo.put("lnkInputId", lnkInputId);
EnsResponseVO responseVO = null;
TbInputXit tbInputXit = null;
try {
tbInputXit = tbInputXitRepository.findById(lnkInputId)
.orElseThrow(() -> new EnsException(EnsErrCd.ACPT404, String.format("일치하는 TB_INPUT_XIT 데이터가 없습니다. [ lnkInputId %s ]", lnkInputId)));
IntgrnNotiAcceptReqDTO reqDTO = this.convertTbInputDataToAcceptReqDTO(tbInputDataXitRepository.findAllFetchByLnkInputId(tbInputXit.getLnkInputId()));
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())) {
tbInputXit.setUpdId("ENS_SYS");
tbInputXit.setPrcsCd(IupPrcsCd.TGRC);
tbInputXit.setErrMsg(null);
} else {
tbInputXit.setUpdId("ENS_SYS");
tbInputXit.setPrcsCd(IupPrcsCd.TGRF);
tbInputXit.setErrMsg(responseVO.getErrMsg());
}
}
return responseVO;
}
private IntgrnNotiAcceptReqDTO convertTbInputDataToAcceptReqDTO(List<TbInputDataXit> list) {
return IntgrnNotiAcceptReqDTO.builder()
.vender(VenderCd.none.getCode())
.org_cd(list.get(0).getTbInputXit().getOrgCd())
.tmplt_cd(list.get(0).getTbInputXit().getFsJob().getJobCd())
.post_bundle_title(
String.format("%s(%s건)-%s"
, IupSendTypeCd.KP.getCodeNm()
, list.get(0).getTbInputXit().getTotCnt()
, LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))
)
)
.send_dt(list.get(0).getTbInputXit().getRunDt().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")))
.close_dt(list.get(0).getTbInputXit().getExpiresDt().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")))
.documents(
list.stream()
.map(row -> createDocument(row))
.collect(Collectors.toList())
)
.build();
}
private Document createDocument(TbInputDataXit data) throws EnsException {
Gson gson = new GsonBuilder().disableHtmlEscaping().create();
return Document.builder()
.linked_uuid(data.getLinkedUuid())
.receiver(Receiver.builder()
.ci(null)
.jid(data.getSid())
.mblphon_no(data.getMoblphonNo())
.build())
.acpt_data(AcptData.builder()
.kko_md(new AcptDocKkoMd(data, MBLPAGE_URL + MBLPAGE_PATH).createDocument())
.kko_at(null)
// .nv_st(new AcptDocNvSt(data, NV_ST_ORG_ID, MBLPAGE_URL + MBLPAGE_PATH).createDocument())
.nv_st(new AcptDocNvSt(data, null, MBLPAGE_URL + MBLPAGE_PATH).createDocument())
.build())
.xit_property(XitProperty.builder()
// .bill_link_info(this.createBillLinkInfo(data))
.bill_acpt_data(this.createBillAcptData(data))
.tmplt_msg_data(CmmnUtil.isEmpty(data.getMsgData()) ? null : gson.fromJson(data.getMsgData().replace("~~@@!!", "#{").replace("!!@@~~", "}"), Map.class))
.mbl_page_data(CmmnUtil.isEmpty(data.getMsgDtlData()) ? null : gson.fromJson(data.getMsgDtlData(), Map.class))
.build())
.build();
}
// private List<Map<String, Object>> createDetails(TbInputDataXit data) {
// return null;
// }
// private BillLinkInfo createBillLinkInfo(TbInputDataXit data) {
// return BillLinkInfo.builder()
// .use_bill_mast_id(false)
// .bill_mast_id(null)
// .button_name("납부하기")
// .button_type("WL")
// .expire_at(data.getTbInputXit().getPayExpiresDt().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")))
// .notice_url(this.BILL_HOST + this.BILL_NOTICE_URL)
// .prepay_url(this.BILL_HOST + this.BILL_PREPAY_URL)
// .pay_result_url(this.BILL_HOST + this.BILL_PAYREUSLT_URL)
// .build();
// }
private BillAcptReqDTO createBillAcptData(TbInputDataXit data) {
return BillAcptReqDTO.builder()
.use_bill_uid(false)
.bill_uid(null)
.bill_se(BillSeCd.bpKko)
.bill_kko(BillKkoAcptReqVO.builder()
.billUid(null)
.billerUserKey(data.getLinkedUuid())
.billedYearMonth(null)
.ordinal(null)
.billerNoticeKey(null)
.expireAt(data.getTbInputXit().getPayExpiresDt().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")))
.parameters(null)
.customUrl(CustomUrl.builder()
.noticeUrl(this.BILL_HOST + this.BILL_NOTICE_URL)
.prepayUrl(this.BILL_HOST + this.BILL_PREPAY_URL)
.payResultUrl(this.BILL_HOST + this.BILL_PAYREUSLT_URL)
.build())
.build())
.build();
}
}

@ -0,0 +1,276 @@
package cokr.xit.ens.biz.iup.signtalk.service.support;
import cokr.xit.ens.biz.iup.code.IupPrcsCd;
import cokr.xit.ens.biz.iup.code.IupSendSttusCd;
import cokr.xit.ens.biz.iup.code.IupSendTrySttusCd;
import cokr.xit.ens.biz.iup.code.IupSendTypeCd;
import cokr.xit.ens.biz.iup.domain.TbInputXit;
import cokr.xit.ens.biz.iup.domain.TbSendResult;
import cokr.xit.ens.biz.iup.domain.repository.TbInputDataXitRepository;
import cokr.xit.ens.biz.iup.domain.repository.TbInputXitRepository;
import cokr.xit.ens.biz.iup.domain.repository.TbSendResultRepository;
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.DateUtil;
import cokr.xit.ens.modules.common.biztmplt.EnsPhaseProcSupport;
import cokr.xit.ens.modules.common.code.PostSeCd;
import cokr.xit.ens.modules.common.code.StatCd;
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.code.TryStatCd;
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 IupSigntalkFetcher implements EnsPhaseProcSupport<EnsResponseVO, Long> {
private final TbInputXitRepository tbInputXitRepository;
private final TbInputDataXitRepository tbInputDataXitRepository;
private final TbSendResultRepository tbSendResultRepository;
private final IntgrnNotiService intgrnNotiService;
/**
* Fetch
*
* @param lnkInputIds
* @return
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statReady(List<Long> lnkInputIds) {
EnsResponseVO respVO = null;
try {
/**
*
*/
if (CmmnUtil.isEmpty(lnkInputIds))
throw new EnsException(EnsErrCd.RSLT410, "연계입수아이디(은)는 필수조건 입니다.");
/**
*
* -. "입수중(INCM)" .
*/
List<Long> resultInfo = tbInputXitRepository.findAllByLnkInputIdIn(lnkInputIds).stream()
.map(row -> {
row.setUpdId("ENS_SYS");
row.setPrcsCd(IupPrcsCd.INCM);
return row.getLnkInputId();
})
.collect(Collectors.toList());
;
respVO = EnsResponseVO.okBuilder().resultInfo(resultInfo).build();
} catch (EnsException e) {
respVO = EnsResponseVO.errBuilder().errCode(e.getErrCd()).errMsg(e.getMessage()).build();
} catch (Exception e) {
respVO = EnsResponseVO.errBuilder().errCode(EnsErrCd.RSLT999).errMsg(e.getMessage()).build();
}
return respVO;
}
@Override
public EnsResponseVO statBegin(Long arg) {
log.info("no process");
return null;
}
/**
* (/)
*
* @param lnkInputId
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO execute(Long lnkInputId) {
EnsResponseVO responseVO = null;
Map<String, Object> resultInfo = new HashMap<>();
resultInfo.put("lnkInputId", lnkInputId);
IntgrnNotiRsltRespDTO respDTO = null;
try {
Long intSendMastId = tbInputDataXitRepository.findLastSendMastIdByLnkInputIdAndSendType(lnkInputId, IupSendTypeCd.KP)
.orElseThrow(() -> new EnsException(EnsErrCd.RSLT404, "일치하는 ENS 접수자료가 없습니다."));
resultInfo.put("intSendMastId", intSendMastId);
EnsResponseVO apiRespVO = intgrnNotiService.sendResultProvide(intSendMastId);
respDTO = (IntgrnNotiRsltRespDTO) apiRespVO.getResultInfo();
IntgrnNotiRsltRespDTO finalRespDTO = respDTO;
List<TbSendResult> tbSendResults = respDTO.getDocuments().stream()
.map(row -> {
return TbSendResult.builder()
.lnkInputId(lnkInputId)
.dataId(row.getLinkedUuid())
// .dataId(tbInputDataXitRepository.findByLinkedUuid(row.getLinkedUuid())
// .orElse(new TbInputDataXit())
// .getDataId())
// .prcsOdr(StatCd.close.equals(finalRespDTO.getStatCd()) ? "2" : "1")
.prcsOdr(finalRespDTO.getCloseAt() ? "2" : "1")
// .sendSttusCd(iupSendSttusCd)
.sendSttusCd(this.sendSttusCd(row, finalRespDTO))
.sendTrySttusCd(TryStatCd.cmplt.equals(finalRespDTO.getTryStatCd()) ? IupSendTrySttusCd.CMPLT : IupSendTrySttusCd.TRYING)
.sendType(IupSendTypeCd.KP)
.runDt(DateUtil.toLocalDateTime(finalRespDTO.getSendDt()))
.bizSendDt(DateUtil.toLocalDateTime(row.getDocSentDt()))
.bizRecvDt(DateUtil.toLocalDateTime(row.getDocReceivedDt()))
.bizReadDt(DateUtil.toLocalDateTime(row.getDocReadFrstDt()))
.bizErrMsg(CmmnUtil.isEmpty(row.getErrorMessage()) ? null : String.format("%s %s", row.getErrorCode(), row.getErrorMessage()))
.regId("ENS_SYS")
.regDt(LocalDateTime.now())
.expiresDt(DateUtil.toLocalDateTime(finalRespDTO.getCloseDt()))
.prcsYn("N")
.build();
})
.collect(Collectors.toList());
// if (tbSendResultRepository.findExistsByLnkInputIdAndPrcsOdr(lnkInputId, StatCd.close.equals(finalRespDTO.getStatCd()) ? "2" : "1"))
if (tbSendResultRepository.findExistsByLnkInputIdAndPrcsOdr(lnkInputId, finalRespDTO.getCloseAt() ? "2" : "1"))
tbSendResultRepository.modifyByTbSendResults(tbSendResults);
else
tbSendResultRepository.saveAll(tbSendResults);
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("[lnkInputId %s]에 대한 전송결과 FETCH 처리 실패. %s", lnkInputId, e.getMessage()))
.build();
} finally {
TbInputXit tbInputXit = tbInputXitRepository.findById(lnkInputId).orElseThrow(() -> new EnsException(EnsErrCd.RSLT404, "일치하는 tbInputXit 자료가 없습니다."));
if (EnsErrCd.OK.equals(responseVO.getErrCode())) {
tbInputXit.setUpdId("ENS_SYS");
// tbInputXit.setPrcsCd(IupPrcsCd.IPCP);
tbInputXit.setPrcsCd(this.prcsCd(respDTO, tbInputXit.getPrcsCd()));
tbInputXit.setErrMsg(null);
} else {
tbInputXit.setUpdId("ENS_SYS");
tbInputXit.setPrcsCd(IupPrcsCd.FAIL);
tbInputXit.setErrMsg(responseVO.getErrMsg());
}
}
return responseVO;
}
private IupPrcsCd prcsCd(IntgrnNotiRsltRespDTO respDTO, IupPrcsCd prcsCd) {
switch (respDTO.getStatCd()) {
case makefail:
return IupPrcsCd.FAIL;
case sendfail:
if (TryStatCd.cmplt.equals(respDTO.getTryStatCd()))
return IupPrcsCd.FAIL;
case makerdy:
return IupPrcsCd.CICV;
case making:
return IupPrcsCd.CICC;
case makeok:
return IupPrcsCd.COMP;
case sendok:
case sendcmplt:
case open:
return IupPrcsCd.INCM;
case close:
return IupPrcsCd.IPCP;
default:
return prcsCd;
}
}
private IupSendSttusCd sendSttusCd(IntgrnDetailStatVO row, IntgrnNotiRsltRespDTO respDTO) {
IupSendSttusCd iupSendSttusCd = null;
try {
switch (row.getCurStatCd().getIntgrnDtlStatCd()) {
case UNIDENTIFIED_USER:
if (PostSeCd.nvSigntalk.equals(row.getCurPostSe()))
iupSendSttusCd = IupSendSttusCd.NV_NOMB;
else
iupSendSttusCd = IupSendSttusCd.NOMB;
break;
case FORBIDDEN:
if (PostSeCd.nvSigntalk.equals(row.getCurPostSe()))
iupSendSttusCd = IupSendSttusCd.NV_DENY;
else
iupSendSttusCd = IupSendSttusCd.DENY;
break;
case SENT:
if (PostSeCd.nvSigntalk.equals(row.getCurPostSe()))
iupSendSttusCd = IupSendSttusCd.NV_SEND;
else
iupSendSttusCd = IupSendSttusCd.SEND;
break;
case RECEIVED:
case EXPIRED:
if (PostSeCd.nvSigntalk.equals(row.getCurPostSe()))
iupSendSttusCd = IupSendSttusCd.NV_RECV;
else
iupSendSttusCd = IupSendSttusCd.RECV;
break;
case READ:
if (PostSeCd.nvSigntalk.equals(row.getCurPostSe()))
iupSendSttusCd = IupSendSttusCd.NV_SIGN;
else
iupSendSttusCd = IupSendSttusCd.SIGN;
break;
case REG:
case MAKING:
case ACPT_OK:
case ACPT_CMPLT:
if (StatCd.makefail.equals(respDTO.getStatCd())
|| StatCd.sendfail.equals(respDTO.getStatCd()))
iupSendSttusCd = IupSendSttusCd.FAIL;
else
iupSendSttusCd = IupSendSttusCd.READY;
break;
case ACPT_FAIL:
case INVALID_VALUE:
case INTERNAL_ERROR:
case INVALID_REQUEST:
case FORBIDDEN_USER:
case FAIL:
iupSendSttusCd = IupSendSttusCd.FAIL;
break;
default:
break;
}
} catch (Exception e) {
log.info("IupSendSttusCd와 일치하는 값 없음. [ dataId {} IntgrnDtlStatCd {} ]", row.getLinkedUuid(), row.getCurStatCd().getIntgrnDtlStatCd());
}
return iupSendSttusCd;
}
}

@ -0,0 +1,66 @@
package cokr.xit.ens.biz.iup.signtalk.service.support;
import cokr.xit.ens.biz.iup.code.IupSendTypeCd;
import cokr.xit.ens.biz.iup.domain.repository.TbInputDataXitRepository;
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 IupSigntalkSender implements EnsPhaseProcSupport<EnsResponseVO, Long> {
private final TbInputDataXitRepository tbInputDataXitRepository;
private final IntgrnNotiService intgrnNotiService;
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statReady(List<Long> lnkInputIds) {
log.info("no process");
return null;
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statBegin(Long arg) {
log.info("no process");
return null;
}
/**
*
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO execute(Long lnkInputId){
EnsResponseVO responseVO = null;
try {
Long sendMastId = tbInputDataXitRepository.findLastSendMastIdByLnkInputIdAndSendType(lnkInputId, IupSendTypeCd.KP)
.orElseThrow(() -> new EnsException(EnsErrCd.SEND404, "일치하는 ENS 접수자료가 없습니다."));
responseVO = intgrnNotiService.sendBulk(sendMastId);
} catch (EnsException e){
responseVO = EnsResponseVO.errBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.build();
}
return responseVO;
}
}

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

@ -0,0 +1,17 @@
package cokr.xit.ens.biz.iup.signtalk.service.support.accept;
import cokr.xit.ens.biz.iup.domain.TbInputDataXit;
import cokr.xit.ens.modules.kkoalimtalk.model.config.DocumentConfKkoAt;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
public class AcptDocKkoAt implements Accept<DocumentConfKkoAt> {
private final TbInputDataXit tbInputDataXit;
@Override
public DocumentConfKkoAt createDocument() {
return DocumentConfKkoAt.builder()
.build();
}
}

@ -0,0 +1,44 @@
package cokr.xit.ens.biz.iup.signtalk.service.support.accept;
import cokr.xit.ens.biz.iup.domain.TbInputDataXit;
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.time.format.DateTimeFormatter;
import java.util.Arrays;
@RequiredArgsConstructor
public class AcptDocKkoMd implements Accept<DocumentConfKkoMd> {
private final TbInputDataXit tbInputDataXit;
private final String redirectUrl;
@Override
public DocumentConfKkoMd createDocument() {
return DocumentConfKkoMd.builder()
.hash(null)
.common_categories(Arrays.asList("NOTICE"))
.read_expired_at(DateUtil.dateToAbsTimeSec(tbInputDataXit.getTbInputXit().getPayExpiresDt().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))))
// .read_expired_sec()
.property(this.createProperty(tbInputDataXit))
.bridge(null)
.build();
}
private Property createProperty(TbInputDataXit data) {
return Property.builder()
// .link(data.getPayUrl())
.link(redirectUrl)
.payload(null)
.message(null)
.cs_name("문의처")
.cs_number(data.getCallCenterNo())
// .external_document_uuid(data.getDataId())
// .external_document_uuid(data.getLinkedUuid())
.build();
}
}

@ -0,0 +1,38 @@
package cokr.xit.ens.biz.iup.signtalk.service.support.accept;
import cokr.xit.ens.biz.iup.domain.TbInputDataXit;
import cokr.xit.ens.core.utils.DateUtil;
import cokr.xit.ens.modules.nvsigntalk.model.config.DocumentConfNvSt;
import lombok.RequiredArgsConstructor;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
@RequiredArgsConstructor
public class AcptDocNvSt implements Accept<DocumentConfNvSt> {
private final TbInputDataXit tbInputDataXit;
private final String orgId;
private final String redirectUrl;
@Override
public DocumentConfNvSt createDocument() {
// int days = DateUtil.daysByFromBetweenTo(LocalDateTime.now(), tbInputDataXit.getTbInputXit().getPayExpiresDt());
return DocumentConfNvSt.builder()
// .valid_duration(DateUtil.daysToRelTime(days) / 1000)
.valid_duration_at(DateUtil.dateToAbsTimeSec(tbInputDataXit.getTbInputXit().getPayExpiresDt().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))))
// .redirect_url(tbInputDataXit.getPayUrl())
.redirect_url(redirectUrl)
.publish_document_yn("y")
.document_hash(null)
.call_center_no(tbInputDataXit.getCallCenterNo())
.org_id(orgId)
.auth_require_yn("y")
.notification(null)
.calculation_key(null)
.category_key(null)
.document_key(null)
.build();
}
}

@ -0,0 +1,40 @@
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;
}
}

@ -0,0 +1,66 @@
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;
}
}

@ -0,0 +1,49 @@
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;
}
}

@ -0,0 +1,130 @@
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());
}
}

@ -0,0 +1,70 @@
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;
}

@ -0,0 +1,82 @@
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;
}

@ -0,0 +1,65 @@
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;
}

@ -0,0 +1,69 @@
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;
}

@ -0,0 +1,70 @@
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;
}

@ -0,0 +1,37 @@
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;
}
}

@ -0,0 +1,34 @@
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;
}
}

@ -0,0 +1,13 @@
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);
}

@ -0,0 +1,20 @@
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);
}

@ -0,0 +1,86 @@
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();
}
}

@ -0,0 +1,16 @@
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);
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save