Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0206d6d1f6 | |||
| 7f98f9715e | |||
| 7409a497b9 | |||
| adeec703ea | |||
| 2cf94a3de8 |
@@ -9,3 +9,8 @@ build
|
||||
*.tmp
|
||||
bin
|
||||
tmp
|
||||
libs/
|
||||
.metadata/
|
||||
.idea/
|
||||
weblogic_mock/
|
||||
.gitignore
|
||||
@@ -8,9 +8,6 @@ ANT_HOME=/c/eactive/apps/apache-ant-1.10.15
|
||||
|
||||
export PATH=${PATH}:${JAVA_HOME}/bin:${ANT_HOME}/bin
|
||||
|
||||
cd /c/eactive/workspaces/kjb-bap/BAPRMSClient
|
||||
ant -s build-server.xml archive
|
||||
|
||||
cd /c/eactive/workspaces/kjb-bap/BAPWeb
|
||||
ant -s build.xml war
|
||||
```
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
|
||||
">
|
||||
|
||||
<bean id="TimerEventListener" class="com.eactive.eai.common.routing.jms.TimerEventListenerQueueConsumerService">
|
||||
<property name="uri" value="jms/cft01BapConnectionFactory"/>
|
||||
<property name="queue" value="jms/qu01Bap11Svr01TimerQueue"/>
|
||||
<bean id="TimerEventListener" class="com.eactive.eai.common.routing.TimerEventListenerConsumerService">
|
||||
<property name="uri" value="vm://localhost?broker.persistent=false&broker.useJmx=false"/>
|
||||
<property name="queue" value="com.eactive.eai.common.timerQueue"/>
|
||||
<property name="maxThread" value="100"/>
|
||||
</bean>
|
||||
<bean id="JobPolingHandler" class="com.eactive.eai.common.routing.jms.JobPolingHandlerQueueConsumerService">
|
||||
<property name="uri" value="jms/cft01BapConnectionFactory"/>
|
||||
<property name="queue" value="jms/qu01Bap11Svr01JobQueue"/>
|
||||
<bean id="JobPolingHandler" class="com.eactive.eai.common.routing.JobHandlerConsumerService">
|
||||
<property name="uri" value="vm://localhost?broker.persistent=false&broker.useJmx=false"/>
|
||||
<property name="queue" value="com.eactive.eai.common.jobQueue"/>
|
||||
<property name="maxThread" value="100"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@ applicationContext-jms.xml<?xml version="1.0" encoding="UTF-8"?>
|
||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
|
||||
">
|
||||
|
||||
<bean id="TimerEventListener" class="com.eactive.eai.common.routing.jms.TimerEventListenerQueueConsumerService">
|
||||
<property name="uri" value="jms/cft01BapConnectionFactory"/>
|
||||
<property name="queue" value="jms/qu01Bap11Svr01TimerQueue"/>
|
||||
<bean id="TimerEventListener" class="com.eactive.eai.common.routing.TimerEventListenerConsumerService">
|
||||
<property name="uri" value="vm://localhost?broker.persistent=false&broker.useJmx=false"/>
|
||||
<property name="queue" value="com.eactive.eai.common.timerQueue"/>
|
||||
<property name="maxThread" value="100"/>
|
||||
</bean>
|
||||
<bean id="JobPolingHandler" class="com.eactive.eai.common.routing.jms.JobPolingHandlerQueueConsumerService">
|
||||
<property name="uri" value="jms/cft01BapConnectionFactory"/>
|
||||
<property name="queue" value="jms/qu01Bap11Svr01JobQueue"/>
|
||||
<bean id="JobPolingHandler" class="com.eactive.eai.common.routing.JobHandlerConsumerService">
|
||||
<property name="uri" value="vm://localhost?broker.persistent=false&broker.useJmx=false"/>
|
||||
<property name="queue" value="com.eactive.eai.common.jobQueue"/>
|
||||
<property name="maxThread" value="100"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@ applicationContext-jms.xml<?xml version="1.0" encoding="UTF-8"?>
|
||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
|
||||
">
|
||||
|
||||
<bean id="TimerEventListener" class="com.eactive.eai.common.routing.jms.TimerEventListenerQueueConsumerService">
|
||||
<property name="uri" value="jms/cft01BapConnectionFactory"/>
|
||||
<property name="queue" value="jms/qu01Bap21Svr01TimerQueue"/>
|
||||
<bean id="TimerEventListener" class="com.eactive.eai.common.routing.TimerEventListenerConsumerService">
|
||||
<property name="uri" value="vm://localhost?broker.persistent=false&broker.useJmx=false"/>
|
||||
<property name="queue" value="com.eactive.eai.common.timerQueue"/>
|
||||
<property name="maxThread" value="100"/>
|
||||
</bean>
|
||||
<bean id="JobPolingHandler" class="com.eactive.eai.common.routing.jms.JobPolingHandlerQueueConsumerService">
|
||||
<property name="uri" value="jms/cft01BapConnectionFactory"/>
|
||||
<property name="queue" value="jms/qu01Bap21Svr01JobQueue"/>
|
||||
<bean id="JobPolingHandler" class="com.eactive.eai.common.routing.JobHandlerConsumerService">
|
||||
<property name="uri" value="vm://localhost?broker.persistent=false&broker.useJmx=false"/>
|
||||
<property name="queue" value="com.eactive.eai.common.jobQueue"/>
|
||||
<property name="maxThread" value="100"/>
|
||||
</bean>
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -37,24 +37,14 @@
|
||||
</servlet>
|
||||
<servlet>
|
||||
<description></description>
|
||||
<servlet-name>FepSendFile</servlet-name>
|
||||
<servlet-class>com.eactive.eai.agent.web.FepSendFile</servlet-class>
|
||||
</servlet>
|
||||
<servlet>
|
||||
<description></description>
|
||||
<servlet-name>FepReqRecvFile</servlet-name>
|
||||
<servlet-class>com.eactive.eai.agent.web.FepReqRecvFile</servlet-class>
|
||||
<servlet-name>FileFetchRequest</servlet-name>
|
||||
<servlet-class>com.eactive.eai.agent.web.FileFetchRequestHandler</servlet-class>
|
||||
</servlet>
|
||||
<servlet>
|
||||
<description></description>
|
||||
<servlet-name>CheckFileSysHealth</servlet-name>
|
||||
<servlet-class>com.eactive.eai.agent.web.CheckFileSysHealth</servlet-class>
|
||||
</servlet>
|
||||
<servlet>
|
||||
<description></description>
|
||||
<servlet-name>FepFileSend</servlet-name>
|
||||
<servlet-class>com.eactive.eai.agent.web.FepFileSend</servlet-class>
|
||||
</servlet>
|
||||
<servlet>
|
||||
<description></description>
|
||||
<servlet-name>FepFileReceive</servlet-name>
|
||||
@@ -71,21 +61,13 @@
|
||||
<url-pattern>/DBRefreshAgent</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>FepSendFile</servlet-name>
|
||||
<url-pattern>/FepSendFile</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>FepReqRecvFile</servlet-name>
|
||||
<url-pattern>/FepReqRecvFile</url-pattern>
|
||||
<servlet-name>FileFetchRequest</servlet-name>
|
||||
<url-pattern>/FileFetchRequest</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>CheckFileSysHealth</servlet-name>
|
||||
<url-pattern>/CheckFileSysHealth</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>FepFileSend</servlet-name>
|
||||
<url-pattern>/FepFileSend</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>FepFileReceive</servlet-name>
|
||||
<url-pattern>/FepFileReceive</url-pattern>
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.7/weblogic-web-app.xsd">
|
||||
<wls:context-root>BAPWeb</wls:context-root>
|
||||
|
||||
<wls:container-descriptor>
|
||||
<wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes>
|
||||
</wls:container-descriptor>
|
||||
</wls:weblogic-web-app>
|
||||
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app">
|
||||
<context-root>/BAPWeb</context-root>
|
||||
<container-descriptor>
|
||||
<prefer-application-packages>
|
||||
<package-name>org.slf4j.*</package-name>
|
||||
<package-name>ch.qos.logback.*</package-name>
|
||||
</prefer-application-packages>
|
||||
<prefer-application-resources>
|
||||
<resource-name>org/slf4j/impl/StaticLoggerBinder.class</resource-name>
|
||||
</prefer-application-resources>
|
||||
</container-descriptor>
|
||||
</weblogic-web-app>
|
||||
@@ -1,58 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<project basedir="." default="build" name="BAPWeb">
|
||||
<property environment="env"/>
|
||||
<property name="WEBLOGIC_HOME.location" value="/weblogic/Oracle14120/MiddleWare/Oracle_Home" />
|
||||
<!-- <property name="WEBLOGIC_HOME.location" value="C:\Oracle\Middleware\Oracle_Home"/> -->
|
||||
<property name="debuglevel" value="source,lines,vars"/>
|
||||
<property name="target" value="1.8"/>
|
||||
<property name="source" value="1.8"/>
|
||||
<property name="BAPRMSClient.location" value="../BAPRMSClient"/>
|
||||
<property name="target" value="17"/>
|
||||
<property name="source" value="17"/>
|
||||
|
||||
<property name="libs" value="WebContent/WEB-INF/lib"/>
|
||||
|
||||
<path id="WebApp.Libraries">
|
||||
<fileset dir="WebContent/WEB-INF/lib/" includes="*.jar"/>
|
||||
<fileset dir="${BAPRMSClient.location}/.deploy" includes="BAPRMSClient.jar"/>
|
||||
<!--fileset dir="WebContent/WEB-INF/lib/" includes="*.jar"/ -->
|
||||
<fileset dir="WebContent/WEB-INF/lib/" includes="*.jar" excludes="ezgatormodule2.jar"/>
|
||||
<fileset dir="libs/" includes="*.jar"/>
|
||||
</path>
|
||||
|
||||
<!--path id="Servlet.Libraries">
|
||||
<fileset dir="../COMWeb/module-build/" includes="*.jar"/>
|
||||
</path-->
|
||||
<path id="WebLogic System Libraries.libraryclasspath">
|
||||
<fileset dir="${WEBLOGIC_HOME.location}/wlserver/server/lib/" includes="*.jar"/>
|
||||
<fileset dir="${WEBLOGIC_HOME.location}/oracle_common/modules/" includes="*.jar"/>
|
||||
<fileset dir="${WEBLOGIC_HOME.location}/wlserver/modules/" includes="*.jar"/>
|
||||
|
||||
<!-- <pathelement location="${WEBLOGIC_HOME.location}/wlserver/server/lib/api.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/org.glassfish.web.javax.servlet.jsp.jstl.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/oracle_common/modules/javax.annotation_1.2.0.0_1-1.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/oracle_common/modules/javax.ejb_3.3.0.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.enterprise.deploy_1.4.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.enterprise.inject_1.2.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.interceptor_1.3.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.jdo_2.0.4.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/oracle_common/modules/javax.jms_1.1.4.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/glassfish.jsf_2.0.0.0_2-1-20.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/oracle_common/modules/javax.jsp_4.0.0.0_2-2.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/oracle_common/modules/javax.mail_2.0.0.0_1-4-4.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/oracle_common/modules/javax.management.j2ee_1.2.0.0.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/oracle_common/modules/javax.persistence_2.0.0.0_2-0.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.resource_1.7.0.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.security.auth.message_2.2.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.security.jacc_1.2.0.0_1-1.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/oracle_common/modules/javax.servlet_2.2.0.0_3-0.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.transaction_2.2.0.0_1-1.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.validation_1.2.0.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/oracle_common/modules/javax.xml.bind_1.0.0.0_2-2-3.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.xml.registry_1.2.0.0_1-0-4.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/oracle_common/modules/jaxrpc-api-1.1.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/oracle_common/modules/javax.xml.ws_1.0.0.0_2-2.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.websocket_1.0.0.0.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.json_1.0.0.0_1-0.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/server/lib/wls-api.jar"/> -->
|
||||
</path>
|
||||
<path id="BAPWeb.classpath">
|
||||
<pathelement location="build/classes"/>
|
||||
<path refid="WebApp.Libraries"/>
|
||||
<path refid="WebLogic System Libraries.libraryclasspath"/>
|
||||
</path>
|
||||
<target name="init">
|
||||
<mkdir dir="build/classes"/>
|
||||
@@ -68,21 +31,15 @@
|
||||
<target depends="clean" name="cleanall">
|
||||
</target>
|
||||
<target depends="build-project" name="build"/>
|
||||
<target name="build-subprojects">
|
||||
<ant antfile="build-server.xml" dir="${BAPRMSClient.location}" inheritAll="false" target="archive">
|
||||
<propertyset>
|
||||
<propertyref name="build.compiler"/>
|
||||
</propertyset>
|
||||
</ant>
|
||||
</target>
|
||||
<target depends="init" name="build-project">
|
||||
<echo message="${ant.project.name}: ${ant.file}"/>
|
||||
<javac debug="true" debuglevel="${debuglevel}" destdir="build/classes" includeantruntime="false" source="${source}" target="${target}" encoding="utf-8">
|
||||
<javac debug="true" debuglevel="${debuglevel}" destdir="build/classes" includeantruntime="false" source="${source}" target="${target}" encoding="utf-8" fork="true">
|
||||
<src path="src"/>
|
||||
<classpath refid="BAPWeb.classpath"/>
|
||||
<compilerarg value="-Xlint:-options"/>
|
||||
</javac>
|
||||
</target>
|
||||
<target depends="clean,build-subprojects,build-project" name="war" >
|
||||
<target depends="clean,build-project" name="war" >
|
||||
<delete dir="dist"></delete>
|
||||
<mkdir dir="dist"></mkdir>
|
||||
<war jarfile="dist/BAPWeb.war" webxml="WebContent/WEB-INF/web.xml">
|
||||
@@ -90,9 +47,7 @@
|
||||
<include name="**/*.*"/>
|
||||
<exclude name="WEB-INF/web.xml" />
|
||||
<exclude name="META-INF/context*.xml" />
|
||||
</zipfileset>
|
||||
<zipfileset dir="${BAPRMSClient.location}/.deploy" prefix="WEB-INF/lib" >
|
||||
<include name="BAPRMSClient.jar"/>
|
||||
<exclude name="WEB-INF/oldlib/**" />
|
||||
</zipfileset>
|
||||
<classes dir="build/classes" />
|
||||
</war>
|
||||
|
||||
Binary file not shown.
+306
@@ -0,0 +1,306 @@
|
||||
# FTPDJ — 대외기관 파일 수신 어댑터 (인수인계 문서)
|
||||
|
||||
> **대상 소스**: [`src/com/eactive/eai/adapter/ftp/FTPDJ.java`](../src/com/eactive/eai/adapter/ftp/FTPDJ.java)
|
||||
|
||||
> **관련 가이드**: [`DJERP_1000_AP_BAP(FTP)개발가이드_v0.9_20260603.pptx`](./DJERP_1000_AP_BAP%28FTP%29개발가이드_v0.9_20260603.pptx) — EMS 등록 절차·화면 조작 중심
|
||||
|
||||
> **최종 갱신**: 2026-09-09
|
||||
|
||||
## 0. 이 문서에 대하여
|
||||
|
||||
FTPDJ를 **넘겨받아 유지보수할 개발자**를 위한 문서입니다. PPT 가이드가 "화면에서 어떻게 등록하는가"를 다룬다면, 이 문서는 **"등록한 값이 코드에서 어떻게 해석되어 동작하는가"** 를 다룹니다.
|
||||
|
||||
특히 FTPDJ의 동작은 4장~10장이 그 내용이며 이 문서의 핵심입니다.
|
||||
|
||||
값 검증이 없어 **오타가 조용히 다른 동작으로 이어지는 지점**이 몇 군데 있습니다. 6장(`protocol`)과 7장(`io.bandwidth`)은 반드시 읽고 넘어가십시오.
|
||||
|
||||
---
|
||||
|
||||
## 1. 저장소 · 빌드 · 배포
|
||||
|
||||
### 1.1 Git 저장소
|
||||
|
||||
```
|
||||
origin https://git.eactive.synology.me:8090/eapim/djbank/bapweb.git
|
||||
```
|
||||
|
||||
| 브랜치 | 용도 |
|
||||
|---|---|
|
||||
| `master` | 주 브랜치 |
|
||||
| `soxor` | 작업 브랜치 (FTPDJ 개발이 진행된 곳) |
|
||||
|
||||
FTPDJ 관련 주요 커밋:
|
||||
|
||||
| 커밋 | 일자 | 내용 |
|
||||
|---|---|---|
|
||||
| `adeec70` | 2026-06-05 | `FileFetchRequestHandler` 구현 (HTTP 요청 진입점 신규) |
|
||||
| `7f98f97` | 2026-09-07 | 취약점 patch version (의존 jar 교체) |
|
||||
|
||||
### 1.2 빌드
|
||||
|
||||
Ant 기반입니다. Maven/Gradle 설정은 없으며 **jar는 `WebContent/WEB-INF/lib`에 직접 커밋**되어 있습니다.
|
||||
|
||||
```bash
|
||||
ant war # clean → compile → dist/BAPWeb.war 생성
|
||||
ant build # 컴파일만 (build/classes)
|
||||
```
|
||||
|
||||
| 항목 | 값 |
|
||||
|---|---|
|
||||
| Java source/target | **17** (`build.xml`) |
|
||||
| 컴파일 classpath | `WebContent/WEB-INF/lib/*.jar` (단 `ezgatormodule2.jar` 제외) + `libs/*.jar` |
|
||||
| 산출물 | `dist/BAPWeb.war` |
|
||||
| WAS | WebLogic, context-root `/BAPWeb` (`WebContent/WEB-INF/weblogic.xml`) |
|
||||
|
||||
> `WebContent/WEB-INF/oldlib`은 취약점 조치로 교체된 **구버전 jar 보관용**입니다. 클래스패스에도 WAR에도 포함되지 않습니다(`build.xml`의 war 태스크에서 제외 처리). 되돌릴 일이 없다면 삭제해도 무방합니다.
|
||||
|
||||
---
|
||||
|
||||
## 2. FTPDJ는 무엇인가
|
||||
|
||||
EMS(관리자포탈)의 **대외기관 등록 → 송수신구분코드**에서 `FTPDJ`를 선택하면 이 클래스가 전송 어댑터로 동작합니다.
|
||||
DJBank 공용 SFTP 프록시를 경유해 **대외기관의 파일을 내려받는(Download) 전용 어댑터**입니다.
|
||||
|
||||
| 항목 | 내용 |
|
||||
|---|---|
|
||||
| 클래스 | `com.eactive.eai.adapter.ftp.FTPDJ` |
|
||||
| 상속 / 구현 | `Transfer` 상속, `SocketService` 구현 |
|
||||
| 지원 동작 | **수신(`recvFile`)만 지원** |
|
||||
| 미지원 | `sendFile()` 호출 시 `UnsupportedOperationException` |
|
||||
| 전송 라이브러리 | JSch 기반 (`FTPUtil.listFilesJSCH`, `FTPUtil.retrieve`) |
|
||||
|
||||
`SocketService`의 나머지 메서드(`connect`, `isActive`, `getCurrentSocket` 등)는 인터페이스 계약을 채우기 위한 빈 구현입니다. **실제 로직은 `recvFile()` 한 곳에서 시작합니다.** 소스를 처음 읽는다면 여기부터 보십시오.
|
||||
|
||||
---
|
||||
|
||||
## 3. 전체 동작 흐름
|
||||
|
||||
```
|
||||
[1] HTTP 요청 (action=DOWNLOAD, remoteCode, remoteFile)
|
||||
│ FileFetchRequestHandler
|
||||
▼
|
||||
[2] Job_Queue 테이블에 작업 등록 → 즉시 응답 (status=QUEUED, jobId=UUID)
|
||||
│ 스케줄러가 매분 0초 / 30초에 큐를 집어감
|
||||
▼
|
||||
[3] FTPDJ.recvFile(batchDoc) ← 이 문서의 범위
|
||||
│
|
||||
├─ FtpEnv.init() : 접속정보(DB) + 프로퍼티(DB)로 실행 환경 조립 ← 핵심
|
||||
├─ listFilesJSCH() : 원격 디렉터리 목록 조회 후 대상 파일 존재 확인
|
||||
├─ fileDownProcess() : 다운로드 → RECVREAL 수신 → RECVARCH 이동 → check 파일 생성
|
||||
└─ callbackProcess() : callback.url 이 있으면 BAT에 완료 통보 후 응답코드 검증
|
||||
```
|
||||
|
||||
**비동기 구조**입니다. HTTP 요청은 큐에 넣고 바로 `QUEUED`를 반환하며, 실제 전송은 최대 30초 뒤 스케줄러가 시작합니다. 요청자는 `action=STATUS`로 `jobId`를 조회해 진행 상태를 확인합니다. 요청/응답 JSON 규격은 PPT 가이드 4장을 참조하십시오.
|
||||
|
||||
---
|
||||
|
||||
## 4. 프로퍼티 목록 (`TelegramInfo{업무구분_대외기관}`)
|
||||
|
||||
FTPDJ가 **실제로 읽는** 프로퍼티는 아래 8개가 전부입니다.
|
||||
|
||||
| 키 | 기본값 | 용도 | 비고 |
|
||||
|---|---|---|---|
|
||||
| `remote.path` | `""` | 원격지 기준 경로 | `#YYYYMMDD#` 치환 지원. 요청이 절대경로면 **무시됨** (5장) |
|
||||
| `protocol` | `""` → `sftp_passwd` | 전송 프로토콜 | **값 매핑 주의** (6장) |
|
||||
| `proxy.server` | `""` | SFTP 프록시 서버 | `IP:PORT` 형식. 비우면 직접 접속 |
|
||||
| `connection.timeout` | `30` | 접속 타임아웃(초) | 숫자만. 문자 포함 시 `NumberFormatException` |
|
||||
| `read.timeout` | `30` | 읽기 타임아웃(초) | 동일 |
|
||||
| `io.bandwidth` | `0` | 전송 대역 제한 | `0`=무제한. `K`/`M` 표기 지원 (7장) |
|
||||
| `ftp.transfer.type` | `BINARY` | FTP 전송 모드 | `ASCII`가 필요한 경우에만 지정 |
|
||||
| `callback.url` | `""` | 수신 완료 통보 URL | 비우면 콜백 생략 (10장) |
|
||||
|
||||
접속 정보(IP·포트·사용자 ID·비밀번호/SSH Key)와 수신 대상 파일명은 **프로퍼티가 아니라 대외기관 연결 정보 및 HTTP 요청**에서 배치 헤더로 전달됩니다. 프로퍼티에서 찾지 마십시오.
|
||||
|
||||
---
|
||||
|
||||
## 5. `remote.path` 조립 규칙
|
||||
|
||||
원격 경로는 **프로퍼티 단독으로 결정되지 않고** 요청으로 들어온 `remoteFile`과 조합됩니다.
|
||||
|
||||
```java
|
||||
remotePath = 프로퍼티 remote.path
|
||||
requestPath = remoteFile 의 디렉터리 부분
|
||||
remoteFile = remoteFile 의 파일명 부분
|
||||
|
||||
remotePath = Paths.get(remotePath).resolve(requestPath).normalize() + "/"
|
||||
```
|
||||
|
||||
### 5.1 요청이 절대경로면 `remote.path`는 무시된다
|
||||
|
||||
Java `Path.resolve()`는 인자가 절대경로일 때 **기준 경로를 버리고 인자를 그대로 반환**합니다. PPT 가이드의 *"remote.path : 요청시 full path 이면 무시됨"* 이 이 동작입니다.
|
||||
|
||||
| `remote.path` | 요청 `remoteFile` | 최종 원격 경로 | 파일명 |
|
||||
|---|---|---|---|
|
||||
| `/data/recv` | `test.txt` | `/data/recv/` | `test.txt` |
|
||||
| `/data/recv` | `sub/test.txt` | `/data/recv/sub/` | `test.txt` |
|
||||
| `/data/recv` | `/home/soxor/sftp/svr/test.txt` | `/home/soxor/sftp/svr/` ← **remote.path 무시** | `test.txt` |
|
||||
| `""` (미등록) | `/home/soxor/sftp/svr/test.txt` | `/home/soxor/sftp/svr/` | `test.txt` |
|
||||
|
||||
> 요청자가 절대경로를 보내는 방식이면 `remote.path`는 등록하지 않아도 됩니다. 반대로 `remote.path`로 접근 경로를 **통제하려는 의도라면 이 구조로는 불가능합니다** — 요청자가 절대경로를 보내면 어디든 접근됩니다. 경로 제한이 요건이라면 별도 검증 로직을 추가해야 합니다.
|
||||
|
||||
### 5.2 날짜 토큰 치환
|
||||
|
||||
조합이 끝난 경로에서 `#YYYYMMDD#` 패턴을 찾아 실제 일자로 치환합니다.
|
||||
|
||||
```
|
||||
정규식: #YYYYMMDD([+-]\d+)?#
|
||||
```
|
||||
|
||||
| 표기 | 의미 | 예 (오늘이 2026-09-09) |
|
||||
|---|---|---|
|
||||
| `#YYYYMMDD#` | 당일 | `20260909` |
|
||||
| `#YYYYMMDD-1#` | 전일 | `20260908` |
|
||||
| `#YYYYMMDD-7#` | 7일 전 | `20260902` |
|
||||
| `#YYYYMMDD+1#` | 익일 | `20260910` |
|
||||
|
||||
등록 예:
|
||||
|
||||
```
|
||||
remote.path = /data/recv/#YYYYMMDD# → /data/recv/20260909/
|
||||
remote.path = /data/recv/#YYYYMMDD-1# → /data/recv/20260908/
|
||||
```
|
||||
|
||||
동작상 유의점:
|
||||
|
||||
1. 치환이 발생하면 계산된 일자가 **배치 헤더의 기준일자(BaseDate)로 함께 설정**됩니다. 로그·모니터링의 기준일자가 이 값을 따릅니다.
|
||||
2. 치환 중 예외가 나도 **작업은 중단되지 않고** 어댑터 로그에만 기록됩니다. 이 경우 경로에 `#YYYYMMDD#` 문자열이 그대로 남아 원격 경로 조회 단계에서 실패합니다.
|
||||
3. 경로 끝의 `/`는 없으면 자동으로 붙습니다.
|
||||
|
||||
---
|
||||
|
||||
## 6. `protocol` 값 매핑 (주의)
|
||||
|
||||
**가장 오해하기 쉬운 항목입니다.** 매칭은 열거형 이름 기준이고, **매칭에 실패해도 오류 없이 조용히 기본값으로 처리**됩니다.
|
||||
|
||||
| 등록값(대소문자 무관) | 해석 | 내부 코드 | 전송 방식 |
|
||||
|---|---|---|---|
|
||||
| `ftp` | FTP | `0` | 평문 FTP |
|
||||
| `sftp_passwd` | SFTP + 비밀번호 | `1` | SFTP |
|
||||
| `sftp_key` | SFTP + SSH Key | `2` | SFTP |
|
||||
| **미등록 / 공백 / 그 외 모든 값** | **SFTP + 비밀번호** | `1` | SFTP |
|
||||
|
||||
즉 아래가 모두 **동일하게 `sftp_passwd`로 동작**합니다.
|
||||
|
||||
```
|
||||
protocol = (미등록)
|
||||
protocol = sftp ← 가이드 표기지만 매핑 대상이 아님
|
||||
protocol = SFTP
|
||||
protocol = sftp_password ← 오타
|
||||
```
|
||||
|
||||
지켜야 할 규칙은 두 가지입니다.
|
||||
|
||||
- **FTP를 쓰려면 반드시 `ftp`로 정확히** 등록해야 합니다. 오타 시 SFTP로 접속을 시도해 원인 파악이 어려운 실패가 납니다.
|
||||
- **SSH Key 인증을 쓰려면 반드시 `sftp_key`로** 등록해야 합니다. 비워두거나 `sftp`로 두면 비밀번호 인증으로 동작합니다.
|
||||
|
||||
> 오타가 로그에 남지 않으므로 접속 실패 시 프로퍼티 오타를 우선 의심하십시오. **개선 후보**: 매칭 실패 시 경고 로그를 남기거나 예외를 던지도록 `Protocol.get()`을 수정하는 것이 안전합니다.
|
||||
|
||||
---
|
||||
|
||||
## 7. `io.bandwidth` 단위 표기
|
||||
|
||||
문자열을 그대로 파싱하지 않고 **치환 후 정수 변환**합니다.
|
||||
|
||||
```java
|
||||
값.replace("K", "000").replace("M", "000000").replace(",", "")
|
||||
```
|
||||
|
||||
| 등록값 | 실제 적용값 | 설명 |
|
||||
|---|---|---|
|
||||
| `0` 또는 미등록 | `0` | 제한 없음 |
|
||||
| `500K` | `500000` | |
|
||||
| `10M` | `10000000` | |
|
||||
| `1,024` | `1024` | 콤마 제거 |
|
||||
| `500k` | **예외 발생** | 소문자 `k`는 치환되지 않음 → `NumberFormatException` |
|
||||
| `500KB` | **예외 발생** | `B`가 남음 |
|
||||
|
||||
**대문자 `K` / `M`만 사용하십시오.** 표기가 잘못되면 `FtpEnv.init()` 단계에서 예외가 나 다운로드가 시작되지 않습니다.
|
||||
|
||||
---
|
||||
|
||||
## 8. 파일 저장 위치 프로퍼티 (`ResponseRcvDirInfo`)
|
||||
|
||||
수신 파일이 놓이는 위치는 대외기관 프로퍼티가 아니라 **공통 그룹 `ResponseRcvDirInfo`** 에서 결정됩니다.
|
||||
(EMS 메뉴: 환경정보 → 공통코드관리 → 프라퍼티 관리)
|
||||
|
||||
| 키 | 용도 | FTPDJ에서의 역할 |
|
||||
|---|---|---|
|
||||
| `rcv.real.directory` | 수신 중 임시 디렉터리 | 다운로드가 **먼저 떨어지는 곳** |
|
||||
| `rcv.arch.directory` | 수신 완료 보관 디렉터리 | 완료 후 **이동되는 최종 위치**. check 파일도 여기 |
|
||||
| `rcv.error.directory` | 오류 파일 디렉터리 | 실패 시 받다 만 파일을 이동 |
|
||||
| `rcv.root.directory` | 빈 완료표시 파일 위치 | 0바이트 파일 생성 |
|
||||
| `rcv.root.ext` | check 파일 확장자 | **미등록 시 `.chk`** |
|
||||
| `retension.day.*` | 폴더별 보존일수 | 값(일) 경과 시 자동 삭제. 공백/비정수면 삭제 안 함 |
|
||||
|
||||
### 8.1 경로 조립과 파일 생성 순서
|
||||
|
||||
작업 등록 시 수신 디렉터리는 `rcv.real.directory/업무구분코드/대외기관코드` 로 설정됩니다.
|
||||
|
||||
```
|
||||
① 다운로드 {rcv.real.directory}/{업무구분}/{대외기관}/{파일명}
|
||||
② 이동 {rcv.arch.directory}/{업무구분}/{대외기관}/{파일명}
|
||||
③ check 파일 {rcv.arch.directory}/{업무구분}/{대외기관}/{파일명}{rcv.root.ext}
|
||||
④ 빈 표시 파일 {rcv.root.directory}/{업무구분}/{대외기관}/{파일명}
|
||||
```
|
||||
|
||||
- ①→② 이동은 `REPLACE_EXISTING`이므로 **같은 이름의 기존 파일은 덮어씁니다.**
|
||||
- ③, ④는 생성 전에 기존 파일이 있으면 **먼저 삭제**하고 새로 만듭니다.
|
||||
- 다운로드 중 실패하면 ①의 파일을 `rcv.error.directory`로 옮기고, 이동조차 실패하면 조용히 무시합니다.
|
||||
|
||||
> **순서를 바꾸지 마십시오.** check 파일(③)은 반드시 본 파일 이동(②) **이후**에 생성됩니다. 수신측(BAT)이 check 파일을 폴링하는 구조이므로, check 파일이 보이는 시점에는 본 파일이 이미 최종 위치에 있어야 합니다. 순서를 뒤집으면 BAT가 미완성 파일을 집어갈 수 있습니다.
|
||||
|
||||
---
|
||||
|
||||
## 9. check 파일 포맷
|
||||
|
||||
`rcv.arch.directory` 아래 `{파일명}.chk`로 생성되며, 기존 EAI(BAT)가 폴링으로 읽어갑니다.
|
||||
|
||||
```
|
||||
%-30s %8s %010d %c %-100s @@
|
||||
```
|
||||
|
||||
| 위치(1-based) | 길이 | 내용 |
|
||||
|---|---|---|
|
||||
| 1 – 30 | 30 | InterfaceID (거래구분코드 `bizCode`), 좌측정렬 공백 패딩 |
|
||||
| 31 – 38 | 8 | 기준일자 `YYYYMMDD` (생성 시점의 현재일자) |
|
||||
| 39 – 48 | 10 | 파일 건수, 0 패딩 (**항상 `0000000001`**) |
|
||||
| **49** | 1 | **상태값** — 생성 시 `'0'` 고정 |
|
||||
| 50 – 149 | 100 | 파일명, 좌측정렬 공백 패딩 |
|
||||
| 150 – 151 | 2 | 종료 표시 `@@` |
|
||||
|
||||
총 **151바이트**입니다. 49번째 바이트의 상태값은 콜백 응답 검증에서 다시 쓰입니다(10장). 상수 `BAT_RET_CODE_IDX = 49`가 이 위치를 가리킵니다.
|
||||
|
||||
> **BAT와의 인터페이스 규격입니다.** 포맷을 바꾸면 수신측 파싱이 깨집니다. 변경 시 반드시 BAT 담당자와 합의하십시오.
|
||||
|
||||
---
|
||||
|
||||
## 10. `callback.url` 동작
|
||||
|
||||
`callback.url`이 **비어 있으면 콜백 단계 자체를 건너뜁니다.** 등록되어 있으면 다음을 호출합니다.
|
||||
|
||||
```
|
||||
GET {callback.url}?eaibatMsg={check 파일과 동일한 151바이트 문자열}
|
||||
```
|
||||
|
||||
응답 검증 조건은 세 가지이며, **하나라도 어긋나면 작업 전체가 실패 처리**됩니다.
|
||||
|
||||
| 검증 | 실패 시 메시지 |
|
||||
|---|---|
|
||||
| HTTP 상태코드 `200` | `Response code is not 200.(코드)` |
|
||||
| 응답 본문 길이 ≥ 49바이트 | `BAT return message is too short.` |
|
||||
| 응답 본문 **49번째 바이트 = `'1'`** | `BAT return code is not '1'.(값)` |
|
||||
|
||||
응답 인코딩은 `Content-Type` 헤더의 charset을 따르고, 없으면 UTF-8로 처리합니다.
|
||||
|
||||
> **알아둘 것:** 파일 수신과 저장이 모두 성공해도 콜백 검증에서 실패하면 작업은 오류로 기록됩니다.
|
||||
|
||||
---
|
||||
|
||||
## 11. 의존 라이브러리 취약점 조치 내역
|
||||
|
||||
| 취약점 번호 | 해당 jar 파일 | 조치 내용 |
|
||||
|:-------------------|:-----------------------------|:------------------------------------|
|
||||
| CVE-2023-46604<br>CVE-2026-34197 | activemq-broker-5.15.13.jar<br>activemq-client-5.15.13.jar<br>activemq-console-5.15.13.jar<br>activemq-spring-5.15.13.jar | **5.15.13 → 5.19.11** 교체.<br>이 CVE의 최소 수정 버전은 5.15.16이며,<br>현재 활성 라인 최신인 5.19.11을 적용했습니다. |
|
||||
| CVE-2023-48795 | jsch-0.1.55.jar | **com.jcraft:jsch 0.1.55<br>→ com.github.mwiede:jsch 2.28.7** 교체.<br>Terrapin은 0.2.15에서<br>strict KEX 지원으로 수정되었습니다. |
|
||||
| CVE-2023-20863 | spring-core-5.3.27.jar 등<br>spring 계열 14건 | **현재 버전 5.3.27이 바로 이 CVE의 수정 버전입니다.**<br>영향 범위는 5.3.0–5.3.26 및 6.0.0–6.0.7이고,<br>수정 릴리스가 5.3.27 / 6.0.8입니다.<br>\*\* 조치 불필요. 스캔 도구가 영향 범위 상한을<br>잘못 잡은 것으로 보이며, 판정 근거 재확인을 요청드립니다 |
|
||||
| CVE-2026-22740 | spring-core-5.3.27.jar 등<br>spring 계열 14건 | 이 결함은 **WebFlux 서버 애플리케이션 전용**입니다<br>(멀티파트 임시파일 미삭제).<br>본 애플리케이션은 `spring-webmvc` 기반이며<br>`spring-webflux` jar 자체가 배포물에 없습니다. |
|
||||
+1006
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,638 @@
|
||||
package com.eactive.eai.adapter.ftp;
|
||||
|
||||
import com.eactive.eai.adapter.socket.common.CommonLib;
|
||||
import com.eactive.eai.adapter.socket.config.ConfigurationContext;
|
||||
import com.eactive.eai.adapter.socket.service.SocketService;
|
||||
import com.eactive.eai.agent.web.FileFetchRequestHandler;
|
||||
import com.eactive.eai.batch.common.BatchDirUtil;
|
||||
import com.eactive.eai.batch.common.CalendarUtil;
|
||||
import com.eactive.eai.batch.common.CommonKeys;
|
||||
import com.eactive.eai.batch.common.LogUtil;
|
||||
import com.eactive.eai.batch.common.StringUtil;
|
||||
import com.eactive.eai.batch.doc.BatchDoc;
|
||||
import com.eactive.eai.batch.doc.Body;
|
||||
import com.eactive.eai.batch.doc.Header;
|
||||
import com.eactive.eai.batch.ftp.FTPFileObject;
|
||||
import com.eactive.eai.batch.ftp.FTPUtil;
|
||||
import com.eactive.eai.batch.logger.LogManager;
|
||||
import com.eactive.eai.batch.message.EAIBatchMsgManager;
|
||||
import com.eactive.eai.batch.osd.OutsideManager;
|
||||
import com.eactive.eai.batch.osd.OutsideVO;
|
||||
import com.eactive.eai.batch.running.BatchRunningJobManager;
|
||||
import com.eactive.eai.batch.scheduler.SchedulerMessageManager;
|
||||
import com.eactive.eai.batch.scheduler.SchedulerMessageVO;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.property.PropManager;
|
||||
import com.eactive.eai.common.util.DatetimeUtil;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
import org.apache.hc.client5.http.fluent.Request;
|
||||
import org.apache.hc.core5.http.ClassicHttpResponse;
|
||||
import org.apache.hc.core5.http.ContentType;
|
||||
import org.apache.hc.core5.http.HttpEntity;
|
||||
import org.apache.hc.core5.http.io.entity.EntityUtils;
|
||||
import org.apache.hc.core5.net.URIBuilder;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.net.URI;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* DJBank 공융 sftp 전송을 위함 SFTP proxy사용
|
||||
*
|
||||
* 파일명 : FTPDJ
|
||||
*
|
||||
*/
|
||||
|
||||
public class FTPDJ extends Transfer implements SocketService {
|
||||
|
||||
private static final String PROP_GROUP_NAME_PREFIX = "TelegramInfo";
|
||||
|
||||
private static final String REMOTE_PATH = "remote.path";// 원격지 경로 #YYYYMMDD#
|
||||
private static final String FILENAME_PATTERN = "filename.pattern";// 기준일자 [YYYYMMDD] 당일이전일 [YYYYMMDD-1][YYYYMMDD-2][YYYYMMDD+1]
|
||||
private static final String EXT_NAME = "ext.name";
|
||||
private static final String FTP_TRANSFER_TYPE = "ftp.transfer.type";// ftp ASCII 인 경우만 default BINARY
|
||||
private static final String BASE_DATE_OVER_YN = "basedate.over.yn"; // 기준일 이후 파일전송여부
|
||||
private static final String PROXY_SERVER = "proxy.server"; // 프록시 서버
|
||||
private static final String PROTOCOL = "protocol"; // 프록시 서버
|
||||
private static final String CALLBACK_URL = "callback.url";
|
||||
|
||||
/** ftp 0 , 인증 방법 1 = id, 2 = key 방식 */
|
||||
private static final String AUTH_TYPE = "sftp.auth.type";
|
||||
private static final String TRANS_LIB = "sftp.trans.lib";
|
||||
|
||||
private static final String CALLBACK_PARAM_NAME = "eaibatMsg";
|
||||
private static final int BAT_RET_CODE_IDX = 49; // 상태값 index :: 안터페이스ID(30) + 기준일자(8) + 파일건수(10) + 상태값(1)
|
||||
|
||||
enum Protocol {
|
||||
FTP("0", false), SFTP_PASSWD("1"), SFTP_KEY("2");
|
||||
|
||||
private final String val;
|
||||
private final boolean isSFtp;
|
||||
|
||||
Protocol(String val) { this(val, true); }
|
||||
Protocol(String val, boolean isSFtp) {
|
||||
this.val = val;
|
||||
this.isSFtp = isSFtp;
|
||||
}
|
||||
|
||||
private static final Map<String, Protocol> MAP = Arrays.stream(values())
|
||||
.collect(Collectors.toMap(p -> p.name().toLowerCase(), p -> p));
|
||||
|
||||
public static Protocol get(String protocol) {
|
||||
if (protocol == null || protocol.trim().isEmpty())
|
||||
return SFTP_PASSWD;
|
||||
return MAP.getOrDefault(protocol.trim().toLowerCase(), SFTP_PASSWD);
|
||||
}
|
||||
}
|
||||
|
||||
private static class FtpEnv {
|
||||
private static final Pattern pattern = Pattern.compile("#YYYYMMDD([+-]\\d+)?#");
|
||||
String propName;
|
||||
|
||||
String ipaddress;
|
||||
int port;
|
||||
String userid;
|
||||
String passwd;
|
||||
Protocol protocol;
|
||||
String remotePath;
|
||||
String remoteFile;
|
||||
String proxyServer;
|
||||
int connTimeout;
|
||||
int setTimeout;
|
||||
int bandWidth;
|
||||
|
||||
String ftpTransferType;
|
||||
String checkFileExt;
|
||||
String callbackUrl;
|
||||
String checkFileContent;
|
||||
|
||||
private FtpEnv init(BatchDoc batchDoc) {
|
||||
Header batchHeader = batchDoc.getBatchMsg().getHeader();
|
||||
|
||||
propName = PROP_GROUP_NAME_PREFIX + "{" +
|
||||
batchHeader.getProcessCode() +
|
||||
"_" +
|
||||
batchHeader.getInstitutionCode() + "}";
|
||||
PropManager pmanager = PropManager.getInstance();
|
||||
|
||||
ipaddress = batchHeader.getRemoteIP();
|
||||
port = Integer.parseInt(batchHeader.getPort());
|
||||
userid = batchHeader.getUserID();
|
||||
passwd = batchHeader.getUserPassword();
|
||||
|
||||
if ( pmanager.getProperties(propName) == null ){
|
||||
throw new RuntimeException("프라퍼티 그룹을 찾을 수 없습니다. - [" + propName + "]");
|
||||
}
|
||||
remotePath = pmanager.getProperties(propName).getProperty(REMOTE_PATH, "");
|
||||
Path requestFile = Paths.get(batchHeader.getFileName());
|
||||
String requestPath = Optional.ofNullable(requestFile.getParent())
|
||||
.map(Path::toString)
|
||||
.orElse("");
|
||||
Path fileNamePart = requestFile.getFileName();
|
||||
if ( fileNamePart == null ){
|
||||
throw new RuntimeException("파일명을 추출할 수 없습니다:" + batchHeader.getFileName());
|
||||
}
|
||||
remoteFile = fileNamePart.toString();
|
||||
remotePath = Paths.get(remotePath).resolve(requestPath).normalize().toString();
|
||||
//batchHeader.setFileName(remoteFile);
|
||||
|
||||
proxyServer = pmanager.getProperties(propName).getProperty(PROXY_SERVER, "");
|
||||
protocol = Protocol.get(pmanager.getProperties(propName).getProperty(PROTOCOL, ""));
|
||||
|
||||
String connTimeoutStr = pmanager.getProperties(propName).getProperty(CONNECTION_TIMEOUT, "30");
|
||||
connTimeout = Integer.parseInt(connTimeoutStr);
|
||||
String setTimeoutStr = pmanager.getProperties(propName).getProperty(READ_TIMEOUT, "30");
|
||||
setTimeout = Integer.parseInt(setTimeoutStr);
|
||||
String bandWidthLimit = pmanager.getProperties(propName).getProperty(BADNWIDTH, "0");
|
||||
bandWidthLimit = bandWidthLimit.replace("K", "000").replace("M", "000000").replace(",", "");
|
||||
bandWidth = Integer.parseInt(bandWidthLimit);
|
||||
|
||||
ftpTransferType = pmanager.getProperties(propName).getProperty(FTP_TRANSFER_TYPE, "BINARY");
|
||||
checkFileExt = BatchDirUtil.getResponseRootExt();
|
||||
callbackUrl = pmanager.getProperties(propName).getProperty(CALLBACK_URL, "");
|
||||
|
||||
try {
|
||||
Matcher matcher = pattern.matcher(remotePath);
|
||||
if (matcher.find()) {
|
||||
String offset = matcher.group(1);
|
||||
int days = (offset != null) ? Integer.parseInt(offset) : 0;
|
||||
String baseDate = DatetimeUtil.addDays(DatetimeUtil.getCurrentDate(), days);
|
||||
batchHeader.setBaseDate(baseDate);
|
||||
remotePath = matcher.replaceAll(baseDate);
|
||||
}
|
||||
if (!remotePath.endsWith("/"))
|
||||
remotePath += "/";
|
||||
} catch ( Exception e) {
|
||||
((Logger) batchDoc.getLogger(Logger.LOGGER_ADAPTER)).error("", e);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private String getCheckFileContent(Header header) {
|
||||
if ( this.checkFileContent == null || this.checkFileContent.trim().isEmpty() ) {
|
||||
this.checkFileContent = String.format( "%-30s%8s%010d%c%-100s@@",
|
||||
header.getBizCode(), // InterfaceID == remoteCode
|
||||
DatetimeUtil.getCurrentDate(), // 현재 일자
|
||||
1, // 파일 건수 1
|
||||
'0', // 보낼때는 '0' 으로 setting
|
||||
this.remoteFile // 파일명
|
||||
);
|
||||
}
|
||||
|
||||
return this.checkFileContent;
|
||||
}
|
||||
}
|
||||
|
||||
Header batchHeader;
|
||||
Body batchBody;
|
||||
FtpEnv env;
|
||||
|
||||
@Override
|
||||
public void sendFile(BatchDoc batchDoc) throws Exception {
|
||||
throw new UnsupportedOperationException("send is not implemented yet");
|
||||
}
|
||||
|
||||
public void recvFile(BatchDoc batchDoc) throws Exception {
|
||||
|
||||
if ( logger.isInfoEnabled() ) logger.info("[FTPDJ] ■ 대외기관 → FEP 파일 수신 시작...... ");
|
||||
batchHeader = batchDoc.getBatchMsg().getHeader();
|
||||
batchBody = batchDoc.getBatchMsg().getBody();
|
||||
|
||||
// logger.debug("batchHeader=" + batchHeader);
|
||||
// logger.debug("batchBody=" + batchBody);
|
||||
|
||||
firstActivity = System.currentTimeMillis();
|
||||
BatchRunningJobManager.getInstance().addRunningJobInfo(batchHeader.getUUID(), this, batchDoc);
|
||||
|
||||
env = new FtpEnv().init(batchDoc);
|
||||
|
||||
if(logger.isDebugEnabled()) logger.debug("[FTPDJ] userid:" + env.userid + ", localPath=" + batchHeader.getFilePath());
|
||||
|
||||
try {
|
||||
batchBody.setPhaseStartTime(CalendarUtil.getCurrentTimeNoDash());
|
||||
LogUtil.setLogFileStart(batchDoc);
|
||||
|
||||
//changeRecvPath(batchHeader);
|
||||
FTPFileObject[] list = FTPUtil.listFilesJSCH(
|
||||
env.ipaddress, env.port, env.userid, env.passwd,
|
||||
env.remotePath,
|
||||
env.protocol.isSFtp,
|
||||
batchDoc.getLogger(),
|
||||
env.protocol.val,
|
||||
env.proxyServer
|
||||
);
|
||||
|
||||
if ( list == null ) { // 파일 경로가 없는경우 20231025
|
||||
if(logger.isDebugEnabled()) logger.debug("[FTPDJ] Not found remote path :: "+env.remotePath);
|
||||
throw new RuntimeException("[FTPDJ] Not found remote path :: "+env.remotePath);
|
||||
}
|
||||
|
||||
FTPFileObject found = Arrays.stream(list)
|
||||
.filter(FTPFileObject::isFile)
|
||||
.filter(f -> env.remoteFile.equals(f.getName()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if ( found == null ) {
|
||||
if(logger.isDebugEnabled()) logger.debug("[FTPDJ] Not found remote file :: "+env.remotePath + "/" + env.remoteFile);
|
||||
throw new RuntimeException("[FTPDJ] Not found remote file :: "+env.remotePath + "/" + env.remoteFile);
|
||||
}
|
||||
|
||||
fileDownProcess(batchDoc, found);
|
||||
callbackProcess();
|
||||
//fileDownEndProcess(batchDoc, "");
|
||||
|
||||
} catch (Exception ex) {
|
||||
String[] msgArgs = new String[1];
|
||||
msgArgs[0] = batchHeader.getProcessCode();
|
||||
String errCode = "BECEAIFJI002";
|
||||
String errMsg = ExceptionUtil.getErrorCode(ex, errCode, msgArgs);
|
||||
batchBody.setErrorMsg(errMsg);
|
||||
//batchBody.setPhaseEndTime(DatetimeUtil.getCurrentTimeMillis());
|
||||
LogUtil.setErrorLog(batchDoc, ex.getMessage());
|
||||
logger.error(errMsg, ex);
|
||||
createRetryJobIfRemains(batchDoc);
|
||||
throw ex;
|
||||
} finally {
|
||||
batchBody.setPhaseEndTime(DatetimeUtil.getCurrentTimeMillis());
|
||||
LogUtil.setLogFileEnd(batchDoc);
|
||||
this.disconnect();
|
||||
}
|
||||
|
||||
if(logger.isInfoEnabled()) logger.info("[FTPDJ] ■ VAN사 → FEP 파일 수신 완료.");
|
||||
}
|
||||
|
||||
private void changeRecvPath(Header h) {
|
||||
String removed = h.getFilePath().replace("/" + h.getProcessCode() + "/" + h.getInstitutionCode(), "");
|
||||
String newPath = removed + "/" + h.getBizCode() + "/";
|
||||
h.setFilePath(newPath);
|
||||
if(logger.isInfoEnabled()) logger.debug("[FTPDJ] processCode=" + batchHeader.getProcessCode() + ", institutionCode=" + batchHeader.getInstitutionCode() + ", bizCode=" + batchHeader.getBizCode() + ", newPath=" + newPath);
|
||||
}
|
||||
|
||||
private void fileDownProcess(BatchDoc batchDoc, FTPFileObject remoteFileInfo) throws Exception {
|
||||
if(logger.isDebugEnabled()) logger.debug("@@@@@@@@@ batchHeader.getJobCode()[" + batchHeader.getJobCode() + "]");
|
||||
|
||||
// batchBody.setPhaseStartTime(DatetimeUtil.getCurrentTimeMillis());
|
||||
// LogUtil.setLogFileStart(batchDoc);
|
||||
|
||||
String receivedFile = batchHeader.getFilePath() + File.separator + env.remoteFile;
|
||||
Path received = Paths.get(receivedFile);
|
||||
Path savePath = Paths.get(StringUtil.realToArchDir(receivedFile));
|
||||
Path intfcCheckFile = Paths.get(savePath.toAbsolutePath() + env.checkFileExt);
|
||||
Path emptyCheckFile = Paths.get(StringUtil.realToRootDir(receivedFile));
|
||||
|
||||
Files.createDirectories(received.getParent());
|
||||
Files.createDirectories(savePath.getParent());
|
||||
Files.createDirectories(emptyCheckFile.getParent());
|
||||
|
||||
if ( Files.exists(intfcCheckFile) ) Files.delete( intfcCheckFile );
|
||||
if ( Files.exists(emptyCheckFile) ) Files.delete( emptyCheckFile );
|
||||
|
||||
if(logger.isDebugEnabled()) logger.debug("received=" + received + "savePath=" + savePath);
|
||||
|
||||
try {
|
||||
|
||||
if(logger.isDebugEnabled()) logger.debug("@@@@@@@@" + this.getClass().getName() + " :: filename=[" + env.remoteFile + "], path=[" + batchHeader.getFilePath() + "]");
|
||||
|
||||
FTPUtil.retrieve(batchDoc,
|
||||
env.ipaddress, env.port, env.userid, env.passwd,
|
||||
env.remotePath ,
|
||||
env.remoteFile,
|
||||
batchHeader.getFilePath(),
|
||||
env.connTimeout,
|
||||
env.setTimeout,
|
||||
env.bandWidth,
|
||||
batchDoc.getLogger(Logger.LOGGER_ADAPTER),
|
||||
env.protocol.val,
|
||||
env.ftpTransferType, env.proxyServer);
|
||||
|
||||
batchHeader.setTotRecCnt(1);
|
||||
batchHeader.setFileSize(remoteFileInfo.getSize());
|
||||
|
||||
Files.move(received, savePath, StandardCopyOption.REPLACE_EXISTING);
|
||||
//String checkFileContent = String.format("%-138s@@" , batchHeader.getBizCode()); // Bat에서 읽기 위한 Format
|
||||
Files.writeString(intfcCheckFile, env.getCheckFileContent(batchHeader));
|
||||
Files.createFile(emptyCheckFile);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
try {
|
||||
if ( Files.exists(received) ) {
|
||||
Path errorPath = Paths.get(StringUtil.realToErrorDir(receivedFile));
|
||||
Files.createDirectories(errorPath.getParent());
|
||||
Files.move(received, errorPath);
|
||||
}
|
||||
} catch ( Exception ignore) { }
|
||||
throw new Exception("파일수신에 실패하였습니다. -" + e.getMessage());
|
||||
} finally {
|
||||
setLastActivity();
|
||||
//fos.close();
|
||||
}
|
||||
}
|
||||
|
||||
private void callbackProcess() throws Exception {
|
||||
if ( env.callbackUrl.isEmpty())
|
||||
return;
|
||||
|
||||
String paramVal = env.getCheckFileContent(batchHeader);
|
||||
if(logger.isDebugEnabled()) logger.debug("[FTPDJ] callbackProcess :: paramVal=[" + paramVal + "]");
|
||||
|
||||
URI uri = new URIBuilder(env.callbackUrl)
|
||||
.addParameter(CALLBACK_PARAM_NAME, paramVal)
|
||||
.build();
|
||||
|
||||
try (ClassicHttpResponse response = (ClassicHttpResponse) Request.get(uri).execute().returnResponse()) {
|
||||
int statusCode = response.getCode();
|
||||
if (statusCode != 200) {
|
||||
logger.error("[FTPDJ] callbackProcess :: " + "Response code is not 200.("+statusCode+") :: url="+ uri);
|
||||
throw new RuntimeException("Response code is not 200.("+statusCode+")");
|
||||
}
|
||||
|
||||
HttpEntity entity = response.getEntity();
|
||||
byte[] bodyBytes = EntityUtils.toByteArray(entity);
|
||||
|
||||
// Content-Type 헤더에서 charset 추출
|
||||
Charset charset = StandardCharsets.UTF_8; // fallback
|
||||
ContentType contentType = ContentType.parse(entity.getContentType());
|
||||
if (contentType != null && contentType.getCharset() != null) {
|
||||
charset = contentType.getCharset();
|
||||
logger.debug("[FTPDJ] callbackProcess :: charset=" + charset);
|
||||
}
|
||||
|
||||
String body = new String(bodyBytes, charset);
|
||||
|
||||
if(logger.isDebugEnabled())
|
||||
logger.debug("[FTPDJ] callbackProcess :: body=\n" + CommonLib.getDumpMessage(bodyBytes));
|
||||
|
||||
if ( bodyBytes.length < BAT_RET_CODE_IDX)
|
||||
throw new RuntimeException("BAT return message is too short.("+body+")");
|
||||
|
||||
char batRetCode = (char)(bodyBytes[BAT_RET_CODE_IDX-1] & 0xFF);
|
||||
if ( batRetCode != '1' ) {
|
||||
logger.debug("[FTPDJ] callbackProcess :: batRetCode=" + batRetCode);
|
||||
throw new RuntimeException("BAT return code is not '1'.(" + batRetCode + ")");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 정상처리 20241025
|
||||
private void fileDownEndProcess(BatchDoc batchDoc, String fileName, String errMsg) throws Exception {
|
||||
FileOutputStream fos = null;
|
||||
|
||||
batchHeader.setFileName(fileName);
|
||||
//batchHeader.setFileSize(0);
|
||||
//batchHeader.setTotRecCnt(1);
|
||||
if(logger.isInfoEnabled()) logger.debug("@@@@@@@@@fileDownEndProcess batchHeader.getFileName()["+ fileName + "]");
|
||||
|
||||
batchBody.setPhaseStartTime(DatetimeUtil.getCurrentTimeMillis());
|
||||
|
||||
LogUtil.setLogFileStart(batchDoc);
|
||||
|
||||
batchHeader.setTotRecCnt(1);
|
||||
//batchHeader.getJobCode();
|
||||
batchBody.setErrorMsg(errMsg);
|
||||
|
||||
// File 종료시간 설정
|
||||
batchBody.setPhaseEndTime(DatetimeUtil.getCurrentTimeMillis());
|
||||
LogUtil.setLogFileEnd(batchDoc);
|
||||
}
|
||||
|
||||
private void createRetryJobIfRemains(BatchDoc batchDoc) {
|
||||
try {
|
||||
int remain = LogManager.getInstance().selectRemainRetry(batchDoc);
|
||||
if ( remain < 1)
|
||||
return;
|
||||
|
||||
ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
|
||||
scheduler.schedule(() -> {
|
||||
try {
|
||||
createRetryJob(batchDoc, remain);
|
||||
} catch (Exception e) {
|
||||
logger.error("[FTPDJ] createRetryJob (delayed)", e);
|
||||
} finally {
|
||||
scheduler.shutdown();
|
||||
}
|
||||
}, 30, TimeUnit.SECONDS);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("[FTPDJ] createRetryJobIfRemains", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void createRetryJob(BatchDoc batchDoc, int remain) throws Exception {
|
||||
String bizCode = batchDoc.getBatchMsg().getHeader().getBizCode();
|
||||
String fileName = batchDoc.getBatchMsg().getHeader().getFileName();
|
||||
|
||||
// 수신한 파일 정보
|
||||
logger.info("[FTPDJ] =========================================================================");
|
||||
logger.info("[FTPDJ] ▶▶▶▶▶▶▶▶▶▶ Retry 수신요청 FILE EVENT 발생 !! (Remain = "+remain+") ◀◀◀◀◀◀◀◀◀◀");
|
||||
logger.info("[FTPDJ] ※ remoteCode : [" + bizCode +"]");
|
||||
logger.info("[FTPDJ] ※ remoteFile : [" + fileName +"]");
|
||||
SchedulerMessageVO codeInfo = SchedulerMessageManager.getInstance().getInfoByteBjobTransDstName(bizCode);
|
||||
if ( codeInfo == null ){
|
||||
throw new RuntimeException("미등록 거래구분코드:" + bizCode);
|
||||
}
|
||||
String processCode = codeInfo.getProcessCode();
|
||||
String institutionCode = codeInfo.getInstitutionCode();
|
||||
logger.info("[FTPDJ] ※ processCode : [" + codeInfo.getProcessCode()+"]");
|
||||
logger.info("[FTPDJ] ※ institutionCode : [" + codeInfo.getInstitutionCode() +"]");
|
||||
logger.info("[FTPDJ] =========================================================================");
|
||||
|
||||
|
||||
//거래구분 코드 설정
|
||||
int bizCodeStartIndex = 0;
|
||||
int bizCodeEndIndex = 0;
|
||||
OutsideVO organInfo = OutsideManager.getInstance().getOutsideInfo(processCode, institutionCode);
|
||||
if ( organInfo == null ){
|
||||
throw new RuntimeException("미등록 업무구분/기관코드:" + processCode + "/" + institutionCode);
|
||||
}
|
||||
String institutionName = organInfo.getOsdName();
|
||||
String processName = organInfo.getBatchName();
|
||||
bizCodeStartIndex = organInfo.getBizCdStartIdx();
|
||||
bizCodeEndIndex = organInfo.getBizCdEndIdx();
|
||||
logger.info("processName = " + processName);
|
||||
|
||||
|
||||
if (bizCodeStartIndex <= 0 || bizCodeStartIndex >= fileName.length()) bizCodeStartIndex = 0;
|
||||
if (bizCodeEndIndex <= 0 || bizCodeEndIndex > fileName.length()) bizCodeEndIndex = fileName.length();
|
||||
|
||||
logger.info("[FTPDJ] -------------------------------------------------------------------------");
|
||||
logger.info("[FTPDJ] ■ File Event 파싱 정보");
|
||||
logger.info("[FTPDJ] - 업무구분명 : [" + processName +"] (업무구분코드: "+ processCode +")");
|
||||
logger.info("[FTPDJ] - 대외기관명 : [" + institutionName +"] (대외기관코드: "+ institutionCode +")");
|
||||
logger.info("[FTPDJ] - 수신파일명 : [" + fileName +"]");
|
||||
logger.info("[FTPDJ] - 거래구분코드: [" + bizCode +"]");
|
||||
logger.info("[FTPDJ] -------------------------------------------------------------------------");
|
||||
|
||||
|
||||
/*
|
||||
* FileEvent가 SchedulerProcess로 전달할 기본 EAIBatchMsg를 생성한다.
|
||||
* FileEventListener가 입력가능한 값들은 EAIBatchMsg의 항목 중 다음과 같다.
|
||||
* - UUID
|
||||
* - Layer 구분 코드 (한시적)
|
||||
* - ProcessCode: 수신한 서브디렉토리와 동일
|
||||
* - FileName : 송수신 원 파일명
|
||||
* - FilePath : 파일이 실재 존재하는 디렉토리
|
||||
* - RenamedFileName : 저장후 이름이 변경된 파일명
|
||||
*/
|
||||
// BatchMsgDoc 생성
|
||||
BatchDoc batchMsgDoc = EAIBatchMsgManager.createBatchMsgWithUUID(false); //UUID 생성, false:초기화안함
|
||||
EAIBatchMsgManager.updateBatchMsgWithStageTime(batchMsgDoc, CommonKeys.LAYER_FILE_EVENT, CommonKeys.SUB_LAYER_FILE_EVENT); // layer, flowPahse, 시작시간 설정
|
||||
batchMsgDoc.getBatchMsg().getHeader().setProcessCode(processCode); // 업무코드
|
||||
batchMsgDoc.getBatchMsg().getHeader().setProcessName(processName); // 업무명
|
||||
batchMsgDoc.getBatchMsg().getHeader().setProcessType(CommonKeys.PROCESS_REQUEST_RECEIVE); // 업무유형 (요구송신 설정)
|
||||
batchMsgDoc.getBatchMsg().getHeader().setInstitutionCode(institutionCode); // 대외기관코드
|
||||
batchMsgDoc.getBatchMsg().getHeader().setInstitutionName(institutionName); // 대외기관명
|
||||
batchMsgDoc.getBatchMsg().getHeader().setFileName(fileName); // 원 파일명
|
||||
batchMsgDoc.getBatchMsg().getHeader().setBizCode(bizCode); // 거래구분코드
|
||||
SchedulerMessageVO info = SchedulerMessageManager.getInstance().getRecvScheduleInfo(bizCode, processCode, institutionCode);
|
||||
if ( info == null ){
|
||||
String errMsg = ExceptionUtil.getErrorCode("BECEAISSC016", new String[] {processCode, institutionCode, bizCode});
|
||||
throw new Exception(errMsg); // 해당 정보에 대한 스케쥴 정보가 존재하지 않습니다. (업무코드: {1}, 대외기관코드: {2}, 거래구분코드: {3})
|
||||
}
|
||||
|
||||
info.setFileName(fileName);
|
||||
//1. 요구수신 스케쥴러 단계 DB로그를 위한 BatchMsg 객체 생성
|
||||
EAIBatchMsgManager.updateBatchMsgWithStageTime(batchMsgDoc, CommonKeys.LAYER_SCHEDULER, CommonKeys.SUB_LAYER_SCHEDULER_QUEUE); // layer, flowPahse, 시작시간 설정
|
||||
|
||||
//2. 요구수신 디렉토리 설정 (수신_Real/업무구분/대외기관/..)
|
||||
//요구수신 기준 디렉토리 --> 배치업무유형코드(ProcessCode) 와 대외기관코드 (InstitutionCode) 로 계산.
|
||||
String strPathName = BatchDirUtil.getResponseRealDir();
|
||||
if ( strPathName.charAt(strPathName.length()-1) != '/' ) {
|
||||
strPathName = strPathName + '/';
|
||||
}
|
||||
|
||||
strPathName = strPathName + processCode + "/" + institutionCode;
|
||||
info.setFilePath(strPathName);
|
||||
|
||||
//3. UUID 설정 및 스케쥴 송수신 시각 설정
|
||||
info.setUUID (batchMsgDoc.getBatchMsg().getHeader().getUUID());
|
||||
info.setSubUUID (batchMsgDoc.getBatchMsg().getBody().getSubUUID());
|
||||
info.setStartTime(DatetimeUtil.getCurrentDate() + "000000000");
|
||||
info.setEndTime (DatetimeUtil.getCurrentDate() + "235900000");
|
||||
|
||||
//4. Job_Queue 테이블에 등록
|
||||
logger.info("[FTPDJ :: 요구수신 스케쥴러] =========================================================================");
|
||||
logger.info("[FTPDJ :: 요구수신 스케쥴러] ■ 요구수신 스케쥴 정보를 Job_Queue 테이블에 추가......");
|
||||
int resultCnt = SchedulerMessageManager.getInstance().insertJobToQueue(info);
|
||||
logger.info("[FTPDJ :: 요구수신 스케쥴러] ==> 배치 Job_Queue 테이블 INSERT 건수: "+ resultCnt);
|
||||
logger.info("[FTPDJ :: 요구수신 스케쥴러] =========================================================================");
|
||||
|
||||
// 단계 종료시간을 추가한다.
|
||||
batchMsgDoc.getBatchMsg().getBody().setPhaseEndTime(CalendarUtil.getCurrentTimeNoDash());
|
||||
|
||||
// 요구송신에 대한 최초 DB로그. StartLog 호출.
|
||||
LogUtil.setStartLog (batchMsgDoc);
|
||||
logger.info("[FTPDJ] ※ Event 파일명 : [" + fileName +"]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Socket getCurrentSocket() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean connect() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationContext getContext() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setControl(Object control) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyMessage() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean idle(long timeout) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCurrentState() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConnected() throws IOException {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkActivity() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRemoteIPAddress() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLastActivity() {
|
||||
// TODO Auto-generated method stub
|
||||
lastActivity = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getFirstActivity() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLastActivity() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,8 @@ import com.eactive.eai.common.util.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.InetAddress;
|
||||
import java.net.SocketAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.nio.channels.SelectionKey;
|
||||
@@ -107,7 +109,15 @@ public class SocketServer extends Thread implements SocketService {
|
||||
if(channel == null) continue;
|
||||
|
||||
// L4에서 보내온 세션인 경우
|
||||
String remoteIp = channel.socket().getRemoteSocketAddress().toString().substring(1,channel.socket().getRemoteSocketAddress().toString().indexOf(":") );
|
||||
SocketAddress remoteAddr = channel.socket().getRemoteSocketAddress();
|
||||
if ( remoteAddr == null ) { // accept 직후 끊긴 연결
|
||||
if ( logger.isDebug() ) logger.debug("[" + context.getAdapterName() + "] accept 직후 연결이 끊어져 해당 세션을 종료합니다.");
|
||||
try { channel.close(); } catch(IOException ie) {}
|
||||
continue;
|
||||
}
|
||||
String addrStr = remoteAddr.toString();
|
||||
int colonIdx = addrStr.indexOf(":");
|
||||
String remoteIp = ( colonIdx > 0 ) ? addrStr.substring(1, colonIdx) : addrStr;
|
||||
String blockIpList = PropManager.getInstance().getProperty(PROP_GROUP_SOCKET, PROP_BLOCK_IP_LIST);
|
||||
|
||||
if (( blockIpList != null) && ( blockIpList.indexOf(remoteIp) > -1 ) ) {
|
||||
@@ -124,6 +134,7 @@ public class SocketServer extends Thread implements SocketService {
|
||||
} catch(IOException ie) {}
|
||||
continue;
|
||||
}
|
||||
if ( threadPool == null ) throw new RuntimeException("소스 취약점 오탐 방지용");
|
||||
|
||||
if ( context.getMaxConnection() > 0 && context.getMaxConnection() <= threadPool.size() ) {
|
||||
try {
|
||||
@@ -140,13 +151,14 @@ public class SocketServer extends Thread implements SocketService {
|
||||
}
|
||||
// Client Socket별 (REMOTE IP) Connection 수 제한 있는 경우
|
||||
if ( context.getConnLimitPerIp() > 0 ) {
|
||||
String ip = channel.socket().getInetAddress().getHostAddress();
|
||||
InetAddress inetAddr = channel.socket().getInetAddress();
|
||||
String ip = ( inetAddr != null ) ? inetAddr.getHostAddress() : remoteIp;
|
||||
Integer connCount = ipTable.get( ip );
|
||||
if ( connCount == null ) {
|
||||
ipTable.put( ip, new Integer( 1 ) );
|
||||
ipTable.put( ip, 1);
|
||||
} else if ( connCount.intValue() < context.getConnLimitPerIp() ) {
|
||||
int newCount = connCount.intValue() + 1;
|
||||
ipTable.put( ip, new Integer( newCount ));
|
||||
ipTable.put( ip, newCount);
|
||||
} else {
|
||||
logger.error( CommonLib.getMessage("BECEAIMSA023", new String[]{ context.getAdapterName(), Integer.toString( context.getConnLimitPerIp() ),this.getSocketInfo( channel ) } ) );
|
||||
try {
|
||||
@@ -319,14 +331,10 @@ public class SocketServer extends Thread implements SocketService {
|
||||
}
|
||||
|
||||
private String getSocketInfo(SocketChannel channel) {
|
||||
StringBuffer connInfo = new StringBuffer();
|
||||
|
||||
connInfo.append("Local Address=");
|
||||
connInfo.append( channel.socket().getLocalAddress().getHostAddress()).append(":").append(channel.socket().getLocalPort()).append(", ");
|
||||
connInfo.append("Remote Address=");
|
||||
connInfo.append( channel.socket().getInetAddress().getHostAddress()).append(":").append(channel.socket().getPort());
|
||||
|
||||
return connInfo.toString();
|
||||
if ( channel == null ) {
|
||||
return "CHANNEL IS NULL";
|
||||
}
|
||||
return getSocketInfo( channel.socket() );
|
||||
}
|
||||
|
||||
private String getSocketInfo(Socket socket) {
|
||||
@@ -335,8 +343,9 @@ public class SocketServer extends Thread implements SocketService {
|
||||
if ( socket != null ) {
|
||||
connInfo.append("Local Address=");
|
||||
connInfo.append( socket.getLocalAddress().getHostAddress()).append(":").append(socket.getLocalPort()).append(", ");
|
||||
InetAddress remote = socket.getInetAddress();
|
||||
connInfo.append("Remote Address=");
|
||||
connInfo.append( socket.getInetAddress().getHostAddress()).append(":").append(socket.getPort());
|
||||
connInfo.append( remote == null ? "N/A" : remote.getHostAddress() + ":" + socket.getPort() );
|
||||
}else {
|
||||
connInfo.append("SOCKET IS NULL");
|
||||
}
|
||||
@@ -371,7 +380,7 @@ public class SocketServer extends Thread implements SocketService {
|
||||
int newCount = connCount.intValue() - 1;
|
||||
if ( newCount < 0 ) newCount = 0;
|
||||
|
||||
ipTable.put( ip, new Integer( newCount ) );
|
||||
ipTable.put( ip, newCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,313 @@
|
||||
package com.eactive.eai.agent.web;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.eactive.eai.batch.common.BatchDirUtil;
|
||||
import com.eactive.eai.batch.common.CalendarUtil;
|
||||
import com.eactive.eai.batch.common.CommonKeys;
|
||||
import com.eactive.eai.batch.common.LogUtil;
|
||||
import com.eactive.eai.batch.doc.BatchDoc;
|
||||
import com.eactive.eai.batch.message.EAIBatchMsgManager;
|
||||
import com.eactive.eai.batch.osd.OutsideManager;
|
||||
import com.eactive.eai.batch.osd.OutsideVO;
|
||||
import com.eactive.eai.batch.scheduler.JobStatusVO;
|
||||
import com.eactive.eai.batch.scheduler.SchedulerMessageManager;
|
||||
import com.eactive.eai.batch.scheduler.SchedulerMessageVO;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.util.DatetimeUtil;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class FileFetchRequestHandler extends HttpServlet {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
enum STATUS {
|
||||
QUEUED("Q"), ERROR("E"), RUNNING("S"), FINISHED("T"), UNKNOWN("U");;
|
||||
final String code;
|
||||
|
||||
STATUS(String code) { this.code = code; }
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : Eai Bat Call
|
||||
* 2. 처리 개요 : 요청 메세지를 받아서 처리 후 메세지 리턴.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param request HttpServletRequest
|
||||
* @param response HttpServletResponse
|
||||
**/
|
||||
public void service(HttpServletRequest request, HttpServletResponse response) {
|
||||
JsonRequest reqJson = null;
|
||||
try {
|
||||
logger.info("Servlet starting .......");
|
||||
|
||||
reqJson = getRequestBody(request, response);
|
||||
reqJson.validate();
|
||||
JsonRequest.Action action = reqJson.action;
|
||||
|
||||
JsonResponse jsonResponse;
|
||||
switch ( action ) {
|
||||
case DOWNLOAD -> jsonResponse = getFileEventInfo(reqJson);
|
||||
case STATUS -> jsonResponse = getTransferStatus(reqJson);
|
||||
case UPLOAD -> throw new UnsupportedOperationException("Not supported yet: " + action);
|
||||
default -> throw new IllegalArgumentException("Unsupported command: " + action);
|
||||
}
|
||||
|
||||
sendResponse(response, jsonResponse);
|
||||
|
||||
} catch (Exception ex) {
|
||||
logger.error(ex.getMessage(), ex);
|
||||
sendResponse(response, JsonResponse.getFailureMessage((reqJson == null ? "" : reqJson.job_id), ex));
|
||||
}
|
||||
}
|
||||
|
||||
private JsonRequest getRequestBody(HttpServletRequest request, HttpServletResponse response) {
|
||||
String encoding = request.getCharacterEncoding();
|
||||
if (encoding == null)
|
||||
encoding = StandardCharsets.UTF_8.name();
|
||||
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream(), encoding))) {
|
||||
return objectMapper.readValue(reader, JsonRequest.class);
|
||||
} catch (MismatchedInputException e) { // Body 내용이 완전히 비어있는 경우
|
||||
logger.error(e.getMessage());
|
||||
throw new IllegalArgumentException("Empty Body", e);
|
||||
} catch (JsonParseException | JsonMappingException e) { // JSON 문법이 틀렸거나, 클래스 구조와 맞지 않는 경우
|
||||
throw new IllegalArgumentException("Wrong Json format", e);
|
||||
} catch (UnsupportedEncodingException e) { // 지원하지 않는 인코딩(charset)을 요청한 경우
|
||||
throw new IllegalArgumentException("Unsupported Encoding: " + encoding, e);
|
||||
} catch (IOException e) { // 기타 순수 IO 에러 (스트림 끊김 등)
|
||||
throw new RuntimeException("IO Error occurred while reading request body", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void sendResponse(HttpServletResponse response, JsonResponse jsonResponse) {
|
||||
try {
|
||||
response.setContentType("application/json; charset=UTF-8");
|
||||
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
|
||||
response.getWriter().print(jsonResponse.toJsonString());
|
||||
} catch (Exception ignore) {}
|
||||
}
|
||||
|
||||
private JsonResponse getFileEventInfo(JsonRequest reqJson) throws Exception
|
||||
{
|
||||
String bizCode = reqJson.remote_code;
|
||||
String fileName = reqJson.remote_file;
|
||||
|
||||
// 수신한 파일 정보
|
||||
logger.info("[FetchRequestHandler] =========================================================================");
|
||||
logger.info("[FetchRequestHandler] ▶▶▶▶▶▶▶▶▶▶ Local 수신요청 FILE EVENT 발생 !! ◀◀◀◀◀◀◀◀◀◀");
|
||||
logger.info("[FetchRequestHandler] ※ remoteCode : [" + bizCode +"]");
|
||||
logger.info("[FetchRequestHandler] ※ remoteFile : [" + fileName +"]");
|
||||
SchedulerMessageVO codeInfo = SchedulerMessageManager.getInstance().getInfoByteBjobTransDstName(bizCode);
|
||||
if ( codeInfo == null) throw new RuntimeException("잘못된 bizCode : " + bizCode);
|
||||
String processCode = codeInfo.getProcessCode();
|
||||
String institutionCode = codeInfo.getInstitutionCode();
|
||||
logger.info("[FetchRequestHandler] ※ processCode : [" + codeInfo.getProcessCode()+"]");
|
||||
logger.info("[FetchRequestHandler] ※ institutionCode : [" + codeInfo.getInstitutionCode() +"]");
|
||||
logger.info("[FetchRequestHandler] =========================================================================");
|
||||
|
||||
|
||||
//거래구분 코드 설정
|
||||
int bizCodeStartIndex = 0;
|
||||
int bizCodeEndIndex = 0;
|
||||
OutsideVO organInfo = OutsideManager.getInstance().getOutsideInfo(processCode, institutionCode);
|
||||
if ( organInfo == null ){
|
||||
throw new RuntimeException("미등록 업무구분/기관코드:" + processCode + "/" + institutionCode);
|
||||
}
|
||||
String institutionName = organInfo.getOsdName();
|
||||
String processName = organInfo.getBatchName();
|
||||
bizCodeStartIndex = organInfo.getBizCdStartIdx();
|
||||
bizCodeEndIndex = organInfo.getBizCdEndIdx();
|
||||
logger.info("processName = " + processName);
|
||||
|
||||
|
||||
if (bizCodeStartIndex <= 0 || bizCodeStartIndex >= fileName.length()) bizCodeStartIndex = 0;
|
||||
if (bizCodeEndIndex <= 0 || bizCodeEndIndex > fileName.length()) bizCodeEndIndex = fileName.length();
|
||||
|
||||
logger.info("[FetchRequestHandler] -------------------------------------------------------------------------");
|
||||
logger.info("[FetchRequestHandler] ■ File Event 파싱 정보");
|
||||
logger.info("[FetchRequestHandler] - 업무구분명 : [" + processName +"] (업무구분코드: "+ processCode +")");
|
||||
logger.info("[FetchRequestHandler] - 대외기관명 : [" + institutionName +"] (대외기관코드: "+ institutionCode +")");
|
||||
logger.info("[FetchRequestHandler] - 수신파일명 : [" + fileName +"]");
|
||||
logger.info("[FetchRequestHandler] - 거래구분코드: [" + bizCode +"]");
|
||||
logger.info("[FetchRequestHandler] -------------------------------------------------------------------------");
|
||||
|
||||
|
||||
/*
|
||||
* FileEvent가 SchedulerProcess로 전달할 기본 EAIBatchMsg를 생성한다.
|
||||
* FileEventListener가 입력가능한 값들은 EAIBatchMsg의 항목 중 다음과 같다.
|
||||
* - UUID
|
||||
* - Layer 구분 코드 (한시적)
|
||||
* - ProcessCode: 수신한 서브디렉토리와 동일
|
||||
* - FileName : 송수신 원 파일명
|
||||
* - FilePath : 파일이 실재 존재하는 디렉토리
|
||||
* - RenamedFileName : 저장후 이름이 변경된 파일명
|
||||
*/
|
||||
// BatchMsgDoc 생성
|
||||
BatchDoc batchMsgDoc = EAIBatchMsgManager.createBatchMsgWithUUID(false); //UUID 생성, false:초기화안함
|
||||
EAIBatchMsgManager.updateBatchMsgWithStageTime(batchMsgDoc, CommonKeys.LAYER_FILE_EVENT, CommonKeys.SUB_LAYER_FILE_EVENT); // layer, flowPahse, 시작시간 설정
|
||||
batchMsgDoc.getBatchMsg().getHeader().setProcessCode(processCode); // 업무코드
|
||||
batchMsgDoc.getBatchMsg().getHeader().setProcessName(processName); // 업무명
|
||||
batchMsgDoc.getBatchMsg().getHeader().setProcessType(CommonKeys.PROCESS_REQUEST_RECEIVE); // 업무유형 (요구송신 설정)
|
||||
batchMsgDoc.getBatchMsg().getHeader().setInstitutionCode(institutionCode); // 대외기관코드
|
||||
batchMsgDoc.getBatchMsg().getHeader().setInstitutionName(institutionName); // 대외기관명
|
||||
batchMsgDoc.getBatchMsg().getHeader().setFileName(fileName); // 원 파일명
|
||||
batchMsgDoc.getBatchMsg().getHeader().setBizCode(bizCode); // 거래구분코드
|
||||
SchedulerMessageVO info = SchedulerMessageManager.getInstance().getRecvScheduleInfo(bizCode, processCode, institutionCode);
|
||||
if ( info == null ){
|
||||
String errMsg = ExceptionUtil.getErrorCode("BECEAISSC016", new String[] {processCode, institutionCode, bizCode});
|
||||
throw new Exception(errMsg); // 해당 정보에 대한 스케쥴 정보가 존재하지 않습니다. (업무코드: {1}, 대외기관코드: {2}, 거래구분코드: {3})
|
||||
}
|
||||
|
||||
info.setFileName(fileName);
|
||||
//1. 요구수신 스케쥴러 단계 DB로그를 위한 BatchMsg 객체 생성
|
||||
EAIBatchMsgManager.updateBatchMsgWithStageTime(batchMsgDoc, CommonKeys.LAYER_SCHEDULER, CommonKeys.SUB_LAYER_SCHEDULER_QUEUE); // layer, flowPahse, 시작시간 설정
|
||||
|
||||
//2. 요구수신 디렉토리 설정 (수신_Real/업무구분/대외기관/..)
|
||||
//요구수신 기준 디렉토리 --> 배치업무유형코드(ProcessCode) 와 대외기관코드 (InstitutionCode) 로 계산.
|
||||
String strPathName = BatchDirUtil.getResponseRealDir();
|
||||
if ( strPathName.charAt(strPathName.length()-1) != '/' ) {
|
||||
strPathName = strPathName + '/';
|
||||
}
|
||||
|
||||
strPathName = strPathName + processCode + "/" + institutionCode;
|
||||
info.setFilePath(strPathName);
|
||||
|
||||
//3. UUID 설정 및 스케쥴 송수신 시각 설정
|
||||
info.setUUID (batchMsgDoc.getBatchMsg().getHeader().getUUID());
|
||||
info.setSubUUID (batchMsgDoc.getBatchMsg().getBody().getSubUUID());
|
||||
info.setStartTime(DatetimeUtil.getCurrentDate() + "000000000");
|
||||
info.setEndTime (DatetimeUtil.getCurrentDate() + "235900000");
|
||||
|
||||
//4. Job_Queue 테이블에 등록
|
||||
logger.info("[요구수신 스케쥴러] =========================================================================");
|
||||
logger.info("[요구수신 스케쥴러] ■ 요구수신 스케쥴 정보를 Job_Queue 테이블에 추가......");
|
||||
int resultCnt = SchedulerMessageManager.getInstance().insertJobToQueue(info);
|
||||
logger.info("[요구수신 스케쥴러] ==> 배치 Job_Queue 테이블 INSERT 건수: "+ resultCnt);
|
||||
logger.info("[요구수신 스케쥴러] =========================================================================");
|
||||
|
||||
// 단계 종료시간을 추가한다.
|
||||
batchMsgDoc.getBatchMsg().getBody().setPhaseEndTime(CalendarUtil.getCurrentTimeNoDash());
|
||||
|
||||
// 요구송신에 대한 최초 DB로그. StartLog 호출.
|
||||
LogUtil.setStartLog (batchMsgDoc);
|
||||
logger.info("[FetchRequestHandler] ※ Event 파일명 : [" + fileName +"]");
|
||||
|
||||
return new JsonResponse(
|
||||
JsonResponse.RESULT_SUCCESS,
|
||||
STATUS.QUEUED,
|
||||
batchMsgDoc.getBatchMsg().getHeader().getUUID()
|
||||
).setQueuedTime();
|
||||
}
|
||||
|
||||
private JsonResponse getTransferStatus(JsonRequest reqJson) throws Exception {
|
||||
String jobId = reqJson.job_id;
|
||||
SchedulerMessageManager manager = SchedulerMessageManager.getInstance();
|
||||
JobStatusVO vo = manager.getOenJobByKey(jobId, jobId);
|
||||
|
||||
if ( vo == null )
|
||||
throw new RuntimeException("jobId('" + jobId + "')를 찾을수 없습니다.");
|
||||
|
||||
JsonResponse ret = new JsonResponse(
|
||||
JsonResponse.RESULT_SUCCESS,
|
||||
STATUS.QUEUED,
|
||||
jobId
|
||||
);
|
||||
|
||||
ret.status = Arrays.stream(STATUS.values())
|
||||
.filter(status -> status.code.equals(vo.getTranPrcssDstcd()))
|
||||
.findFirst()
|
||||
.orElse(STATUS.UNKNOWN);
|
||||
ret.message = vo.getEAIObstclOccurCausCtnt();
|
||||
ret.queued_at = vo.getBjobDmndMsgCretnHMS();
|
||||
ret.started_at = vo.getTranStartHMS();
|
||||
ret.finished_at = vo.getTranEndHMS();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
private static class JsonRequest {
|
||||
enum Action {
|
||||
DOWNLOAD, UPLOAD, STATUS;
|
||||
|
||||
@JsonCreator
|
||||
public static Action from(String value) {
|
||||
return Action.valueOf(value.toUpperCase());
|
||||
}
|
||||
}
|
||||
private Action action;
|
||||
private String job_id;
|
||||
private String remote_code;
|
||||
private String remote_file;
|
||||
|
||||
private void validate() {
|
||||
switch (this.action) {
|
||||
case DOWNLOAD, UPLOAD -> {
|
||||
if (remote_code == null || remote_code.trim().isEmpty()) throw new RuntimeException("remoteCode is Empty.");
|
||||
if (remote_file == null || remote_file.trim().isEmpty()) throw new RuntimeException("remoteFilePath is Empty.");
|
||||
}
|
||||
case STATUS -> {
|
||||
if (job_id == null || job_id.trim().isEmpty()) throw new RuntimeException("jobId is Empty.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
|
||||
private static class JsonResponse {
|
||||
private static final String RESULT_SUCCESS = "success";
|
||||
private static final String RESULT_FAILURE = "failure";
|
||||
|
||||
final String result;
|
||||
STATUS status;
|
||||
final String job_id;
|
||||
String message;
|
||||
String queued_at;
|
||||
String started_at;
|
||||
String finished_at;
|
||||
|
||||
// 생성자를 통해서만 객체를 생성하도록 제한
|
||||
private JsonResponse(String result, STATUS status, String jobId) {
|
||||
this.result = result;
|
||||
this.status = status;
|
||||
this.job_id = jobId;
|
||||
}
|
||||
|
||||
private JsonResponse setQueuedTime() { this.queued_at = DatetimeUtil.getCurrentDateTime(); return this; }
|
||||
private JsonResponse setMessage(String message) { this.message = message; return this; }
|
||||
|
||||
private String toJsonString() {
|
||||
try {
|
||||
return objectMapper.writeValueAsString(this);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException("JsonResponse JSON 생성 중 오류 발생", e);
|
||||
}
|
||||
}
|
||||
|
||||
// --- 유틸리티 메서드 ---
|
||||
public static JsonResponse getFailureMessage(String jobId, Exception e) {
|
||||
return new JsonResponse(RESULT_FAILURE, STATUS.ERROR, jobId).setMessage(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,6 +170,11 @@ public class BatchDirUtil
|
||||
// public static final String RESPONSE_RCV_CHK_DIR = "rcv.chk.directory";
|
||||
public static final String RESPONSE_RCV_ROOT_EXT = "rcv.root.ext";
|
||||
|
||||
public static final String RETENTION_DAY_ROOT = "retension.day.root";
|
||||
public static final String RETENTION_DAY_REAL = "retension.day.real";
|
||||
public static final String RETENTION_DAY_ARCH = "retension.day.arch";
|
||||
public static final String RETENTION_DAY_ERROR = "retension.day.error";
|
||||
|
||||
// 응답송신용 디렉토리 프라퍼티 키 정보 20060425 add by khs
|
||||
// public static final String RESPONSE_SND_DIR_INFO = "ResponseSndDirInfo";
|
||||
// public static final String RESPONSE_SND_REAL_DIR = "snd.real.directory";
|
||||
@@ -217,6 +222,9 @@ public class BatchDirUtil
|
||||
if (propKey.equals(REQUEST_RCV_ROOT_DIR )) throw new Exception(ExceptionUtil.getErrorCode("BECEAICUT009", new String[] {"요구수신", "ROOT" })); //배치 {1} {2} 디렉토리 정보를 프라퍼티에서 찾을 수 없습니다.
|
||||
else if (propKey.equals(REQUEST_RCV_ERROR_DIR )) throw new Exception(ExceptionUtil.getErrorCode("BECEAICUT009", new String[] {"요구수신", "ERROR" }));
|
||||
}
|
||||
|
||||
//위 분기에서 처리되지 않은 조합도 반드시 예외로 종료 (null 역참조 방지)
|
||||
throw new Exception(ExceptionUtil.getErrorCode("BECEAICUT009", new String[] { propGroupKey, propKey }));
|
||||
}
|
||||
//디렉토리 맨끝에 "/" 가 있으면 빼고 리턴
|
||||
return batchDir.endsWith("/")? batchDir.substring(0, batchDir.length()-1) : batchDir;
|
||||
|
||||
@@ -113,7 +113,7 @@ public class StringUtil
|
||||
|
||||
public static String itos(int i)
|
||||
{
|
||||
return (new Integer(i)).toString();
|
||||
return Integer.toString(i);
|
||||
}
|
||||
|
||||
public static String replaceStr(String s, String s1, String s2) throws NullPointerException
|
||||
@@ -201,17 +201,17 @@ public class StringUtil
|
||||
"/"; //default(unix)
|
||||
}
|
||||
|
||||
public static String getRandomDigit(long digitLen) {
|
||||
if (digitLen <= 0) return "";
|
||||
|
||||
String format = "";
|
||||
for (int i=0; i<digitLen; i++) format += "0";
|
||||
|
||||
DecimalFormat df = new DecimalFormat(format);
|
||||
long randomDigit = (long) (Math.random() * Long.parseLong("1"+format));
|
||||
|
||||
return df.format(randomDigit);
|
||||
}
|
||||
// public static String getRandomDigit(long digitLen) {
|
||||
// if (digitLen <= 0) return "";
|
||||
//
|
||||
// String format = "";
|
||||
// for (int i=0; i<digitLen; i++) format += "0";
|
||||
//
|
||||
// DecimalFormat df = new DecimalFormat(format);
|
||||
// long randomDigit = (long) (Math.random() * Long.parseLong("1"+format));
|
||||
//
|
||||
// return df.format(randomDigit);
|
||||
// }
|
||||
|
||||
public static String concateString(String[] valueArray) {
|
||||
return concateString(valueArray, ",");
|
||||
@@ -478,8 +478,9 @@ public class StringUtil
|
||||
|
||||
public static String getDump(Throwable t) {
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
try (PrintWriter pw = new PrintWriter(sw)) {
|
||||
t.printStackTrace(pw);
|
||||
}
|
||||
return sw.toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -63,8 +63,8 @@ public class EncryptManager implements Lifecycle
|
||||
{
|
||||
for(int i=65; i<91; i++)
|
||||
{
|
||||
String key = new Character((char)i).toString();
|
||||
String value = new Integer(100 - i).toString();
|
||||
String key = Character.toString((char) i);
|
||||
String value = Integer.toString(100 - i);
|
||||
|
||||
codeTable.put(key, value);
|
||||
codeTable.put(value, key);
|
||||
@@ -72,8 +72,8 @@ public class EncryptManager implements Lifecycle
|
||||
|
||||
for(int i=0; i<10; i++)
|
||||
{
|
||||
String key = new Integer(i).toString();
|
||||
String value = new Integer(9-i).toString();
|
||||
String key = Integer.toString(i);
|
||||
String value = Integer.toString(9 - i);
|
||||
codeTable.put(key, value);
|
||||
}
|
||||
//logger.debug("** if Hashtable : A = : " + codeTable.get("A"));
|
||||
@@ -169,9 +169,9 @@ public class EncryptManager implements Lifecycle
|
||||
/* 암호화 문장 생성 */
|
||||
for(int i=0; i<16; i++)
|
||||
{
|
||||
int m_Msg = new Integer((String)codeTable.get(transferPwd.substring(i, i+1))).intValue();
|
||||
int m_Key = new Integer((String)codeTable.get(encryptSeed.substring(i, i+1))).intValue();
|
||||
encryptMsg += (String)codeTable.get(new Integer((m_Msg + m_Key) % 36).toString());
|
||||
int m_Msg = Integer.parseInt((String) codeTable.get(transferPwd.substring(i, i + 1)));
|
||||
int m_Key = Integer.parseInt((String) codeTable.get(encryptSeed.substring(i, i + 1)));
|
||||
encryptMsg += (String)codeTable.get(Integer.toString((m_Msg + m_Key) % 36));
|
||||
}
|
||||
|
||||
return encryptMsg;
|
||||
@@ -231,9 +231,9 @@ public class EncryptManager implements Lifecycle
|
||||
/* 암호화 문장 생성 */
|
||||
for(int i=0; i<16; i++)
|
||||
{
|
||||
int m_Msg = new Integer((String)codeTable.get(transferPwd.substring(i, i+1))).intValue();
|
||||
int m_Key = new Integer((String)codeTable.get(encryptSeed.substring(i, i+1))).intValue();
|
||||
encryptMsg += (String)codeTable.get(new Integer((m_Msg + m_Key) % 36).toString());
|
||||
int m_Msg = Integer.parseInt((String) codeTable.get(transferPwd.substring(i, i + 1)));
|
||||
int m_Key = Integer.parseInt((String) codeTable.get(encryptSeed.substring(i, i + 1)));
|
||||
encryptMsg += (String)codeTable.get(Integer.toString((m_Msg + m_Key) % 36));
|
||||
}
|
||||
|
||||
return encryptMsg;
|
||||
@@ -258,9 +258,9 @@ public class EncryptManager implements Lifecycle
|
||||
|
||||
for(int i=0; i<16; i++)
|
||||
{
|
||||
int m_Msg = new Integer((String)codeTable.get(encryptMsg.substring(i, i+1))).intValue() + 36;
|
||||
int m_Key = new Integer((String)codeTable.get(seed.substring(i, i+1))).intValue();
|
||||
normalMsg += (String)codeTable.get(new Integer((m_Msg - m_Key) % 36).toString());
|
||||
int m_Msg = Integer.parseInt((String) codeTable.get(encryptMsg.substring(i, i + 1))) + 36;
|
||||
int m_Key = Integer.parseInt((String) codeTable.get(seed.substring(i, i + 1)));
|
||||
normalMsg += (String)codeTable.get(Integer.toString((m_Msg - m_Key) % 36));
|
||||
}
|
||||
|
||||
return normalMsg;
|
||||
@@ -347,9 +347,9 @@ public class EncryptManager implements Lifecycle
|
||||
/* 암호화 문장 생성 */
|
||||
for(int i=0; i<transferPwd.length(); i++)
|
||||
{
|
||||
int m_Msg = new Integer((String)codeTable.get(transferPwd.substring(i, i+1))).intValue();
|
||||
int m_Key = new Integer((String)codeTable.get(encryptSeed.substring(i, i+1))).intValue();
|
||||
encryptMsg += (String)codeTable.get(new Integer((m_Msg + m_Key) % 36).toString());
|
||||
int m_Msg = Integer.parseInt((String) codeTable.get(transferPwd.substring(i, i + 1)));
|
||||
int m_Key = Integer.parseInt((String) codeTable.get(encryptSeed.substring(i, i + 1)));
|
||||
encryptMsg += (String)codeTable.get(Integer.toString((m_Msg + m_Key) % 36));
|
||||
}
|
||||
|
||||
return encryptMsg;
|
||||
|
||||
@@ -24,6 +24,12 @@ public class FTPFileObject {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FTPFileObject{" +
|
||||
"file=" + file +
|
||||
", name='" + name + '\'' +
|
||||
", size=" + size +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public class RECV_BI0400 extends DefaultTelegram implements TelegramService
|
||||
}
|
||||
|
||||
for (int i=0; i<seq_no; i++){
|
||||
miss_data.put(new Integer(i), "1");
|
||||
miss_data.put(i, "1");
|
||||
}
|
||||
hm.put(JobProcessData.PROCDATA_MISSDATA, miss_data);
|
||||
} else {//수신된 데이터가 seq크기만큼 안되면 처음부터 다시..
|
||||
|
||||
@@ -73,7 +73,7 @@ public class RECV_BI0410 extends DefaultTelegram implements TelegramService
|
||||
if (block_data == null) {
|
||||
block_data = new HashMap<Integer, byte[]>();
|
||||
}
|
||||
block_data.put( new Integer(i) , fileData);
|
||||
block_data.put(i, fileData);
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,15 +78,15 @@ public class RECV_BI0420 extends DefaultTelegram implements TelegramService
|
||||
|
||||
if (first_miss_field == null){
|
||||
first_miss_field = new HashMap<String, Integer>();
|
||||
first_miss_field.put(JobProcessData.PROCDATA_FIRST_MISS, new Integer(seq_no+1));
|
||||
first_miss_field.put(JobProcessData.PROCDATA_FIRST_MISS, seq_no + 1);
|
||||
hm.put(JobProcessData.PROCDATA_FIRST_MISS, first_miss_field);
|
||||
|
||||
for (int i=seq_no; i<recv_seq_no; i++){//중간에 결번이 생긴 부분은 결번으로 셋팅
|
||||
miss_data.put(new Integer(i), "0");
|
||||
miss_data.put(i, "0");
|
||||
hm.put(JobProcessData.PROCDATA_MISSDATA, miss_data);
|
||||
|
||||
last_miss_field = new HashMap<String, Integer>();
|
||||
last_miss_field.put(JobProcessData.PROCDATA_LAST_MISS, new Integer(i));
|
||||
last_miss_field.put(JobProcessData.PROCDATA_LAST_MISS, i);
|
||||
hm.put(JobProcessData.PROCDATA_LAST_MISS, last_miss_field);
|
||||
|
||||
missCount = missCount+1;
|
||||
@@ -96,11 +96,11 @@ public class RECV_BI0420 extends DefaultTelegram implements TelegramService
|
||||
|
||||
} else { //이전에 miss_field가 있으면
|
||||
for (int i=seq_no; i<recv_seq_no; i++){//중간에 결번이 생긴 부분은 결번으로 셋팅
|
||||
miss_data.put(new Integer(i), "0");
|
||||
miss_data.put(i, "0");
|
||||
hm.put(JobProcessData.PROCDATA_MISSDATA, miss_data);
|
||||
|
||||
last_miss_field = new HashMap<String, Integer>();
|
||||
last_miss_field.put(JobProcessData.PROCDATA_LAST_MISS, new Integer(i));
|
||||
last_miss_field.put(JobProcessData.PROCDATA_LAST_MISS, i);
|
||||
hm.put(JobProcessData.PROCDATA_LAST_MISS, last_miss_field);
|
||||
|
||||
missCount = missCount+1;
|
||||
|
||||
@@ -119,20 +119,20 @@ public class RECV_BI0700 extends DefaultTelegram implements TelegramService
|
||||
}
|
||||
fout.write(bout.toByteArray());
|
||||
|
||||
miss_data.put(new Integer(recv_seq_no-1), "1");
|
||||
miss_data.put(recv_seq_no - 1, "1");
|
||||
hm.put(JobProcessData.PROCDATA_MISSDATA, miss_data);
|
||||
|
||||
}else { //결번이 발생한 경우이면 메모리에 저장.
|
||||
first_miss_field = new HashMap<String, Integer>();
|
||||
first_miss_field.put(JobProcessData.PROCDATA_FIRST_MISS, new Integer(seq_no+1));
|
||||
first_miss_field.put(JobProcessData.PROCDATA_FIRST_MISS, seq_no + 1);
|
||||
hm.put(JobProcessData.PROCDATA_FIRST_MISS, first_miss_field);
|
||||
|
||||
last_miss_field = new HashMap<String, Integer>();
|
||||
last_miss_field.put(JobProcessData.PROCDATA_LAST_MISS, new Integer(seq_no+1));
|
||||
last_miss_field.put(JobProcessData.PROCDATA_LAST_MISS, seq_no + 1);
|
||||
hm.put(JobProcessData.PROCDATA_LAST_MISS, last_miss_field);
|
||||
|
||||
for (int i=seq_no+1; i<recv_seq_no; i++){//중간에 결번이 생긴 부분은 결번으로 셋팅
|
||||
miss_data.put(new Integer(i-1), "0");
|
||||
miss_data.put(i - 1, "0");
|
||||
hm.put(JobProcessData.PROCDATA_MISSDATA, miss_data);
|
||||
|
||||
missCount = missCount+1;
|
||||
@@ -140,15 +140,15 @@ public class RECV_BI0700 extends DefaultTelegram implements TelegramService
|
||||
|
||||
this.batchDoc.getBatchMsg().getBody().setMissingNmCount(missCount);
|
||||
|
||||
block_data.put( new Integer(recv_seq_no-1) , bout.toByteArray());
|
||||
block_data.put(recv_seq_no - 1, bout.toByteArray());
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
miss_data.put(new Integer(recv_seq_no-1), "1");
|
||||
miss_data.put(recv_seq_no - 1, "1");
|
||||
hm.put(JobProcessData.PROCDATA_MISSDATA, miss_data);
|
||||
}
|
||||
} else { //이전에 miss_field가 있으면 현재 수신한 seq에 data set
|
||||
|
||||
for (int i=seq_no+1; i<recv_seq_no; i++){//중간에 결번이 생긴 부분은 결번으로 셋팅
|
||||
miss_data.put(new Integer(i-1), "0");
|
||||
miss_data.put(i - 1, "0");
|
||||
hm.put(JobProcessData.PROCDATA_MISSDATA, miss_data);
|
||||
|
||||
missCount = missCount+1;
|
||||
@@ -156,10 +156,10 @@ public class RECV_BI0700 extends DefaultTelegram implements TelegramService
|
||||
|
||||
this.batchDoc.getBatchMsg().getBody().setMissingNmCount(missCount);
|
||||
|
||||
block_data.put( new Integer(recv_seq_no-1) , bout.toByteArray());
|
||||
block_data.put(recv_seq_no - 1, bout.toByteArray());
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
|
||||
miss_data.put(new Integer(recv_seq_no-1), "1");
|
||||
miss_data.put(recv_seq_no - 1, "1");
|
||||
hm.put(JobProcessData.PROCDATA_MISSDATA, miss_data);
|
||||
}
|
||||
|
||||
|
||||
@@ -90,14 +90,14 @@ public class RECV_BI0710 extends DefaultTelegram implements TelegramService
|
||||
logger.info("{"+logHeader+"} doPostExecute> RECV recv_seq_no [" + recv_seq_no + "] ");
|
||||
byte[] _missing_field = new byte[miss_data.size()];
|
||||
for (int j = 0; j<miss_data.size(); j++) { //받은 seq_no만큼만 데이터 확인
|
||||
String field = (String) miss_data.get( new Integer(j) );
|
||||
String field = (String) miss_data.get(j);
|
||||
_missing_field[j] = field.getBytes()[0]; //결번이 발생한 seq만 '0' 설정
|
||||
|
||||
if ((recv_seq_no-1) == j && _missing_field[j] == '0' ){
|
||||
_missing_field[recv_seq_no-1] = '1';
|
||||
missingCount -= 1;
|
||||
|
||||
miss_data.put(new Integer(j), "1");
|
||||
miss_data.put(j, "1");
|
||||
hm.put(JobProcessData.PROCDATA_MISSDATA, miss_data);
|
||||
|
||||
}
|
||||
@@ -119,17 +119,17 @@ public class RECV_BI0710 extends DefaultTelegram implements TelegramService
|
||||
for (int i =0; i < _missing_field.length; i++){
|
||||
if (_missing_field[i]=='0'){
|
||||
|
||||
first_miss_field.put(JobProcessData.PROCDATA_FIRST_MISS, new Integer(i+1)); // 첫번째 결번
|
||||
first_miss_field.put(JobProcessData.PROCDATA_FIRST_MISS, i + 1); // 첫번째 결번
|
||||
hm.put(JobProcessData.PROCDATA_FIRST_MISS, first_miss_field );
|
||||
|
||||
last_miss_field = new HashMap<String, Integer>();
|
||||
last_miss_field.put(JobProcessData.PROCDATA_LAST_MISS, new Integer(i+1));
|
||||
last_miss_field.put(JobProcessData.PROCDATA_LAST_MISS, i + 1);
|
||||
hm.put(JobProcessData.PROCDATA_LAST_MISS, last_miss_field);
|
||||
|
||||
for (int n = recv_seq_no; n<i; n++){//현재 받은 결번 데이터와 다음 결번 사이에 seq data를 write한다.
|
||||
byte[] data = (byte[]) block_data.get(new Integer(n));
|
||||
byte[] data = (byte[]) block_data.get(n);
|
||||
fout.write(data);
|
||||
block_data.remove(new Integer(n));
|
||||
block_data.remove(n);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -137,8 +137,8 @@ public class RECV_BI0710 extends DefaultTelegram implements TelegramService
|
||||
|
||||
}else {//같지 않으면 메모리에 저장..
|
||||
logger.info("{} doInformalField >> missing telegram receive : [" + (recv_seq_no-1) + "]", logHeader);
|
||||
if (block_data.get(new Integer(recv_seq_no-1)) == null) {
|
||||
block_data.put(new Integer(recv_seq_no-1), bout.toByteArray());
|
||||
if (block_data.get(recv_seq_no - 1) == null) {
|
||||
block_data.put(recv_seq_no - 1, bout.toByteArray());
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ public class SEND_BI0430 extends DefaultTelegram implements TelegramService
|
||||
}
|
||||
} else {
|
||||
for (int j = 0; j<seq_no; j++) { //받은 seq_no만큼만 데이터 확인
|
||||
String field = miss_data.get( new Integer(j) );
|
||||
String field = miss_data.get(j);
|
||||
_missingNm[j] = field.getBytes()[0]; //결번이 발생한 seq만 '0' 설정
|
||||
}
|
||||
if (MISSING_COUNT == 0) {
|
||||
@@ -224,7 +224,7 @@ public class SEND_BI0430 extends DefaultTelegram implements TelegramService
|
||||
Integer lastMiss = last_miss_field.get(JobProcessData.PROCDATA_LAST_MISS);
|
||||
|
||||
for (int i = lastMiss.intValue(); i<seq_no; i++) { //결번이후 메모리에 저장한 데이터 기록
|
||||
byte[] data = (byte[]) block_data.get(new Integer(i));
|
||||
byte[] data = (byte[]) block_data.get(i);
|
||||
fout.write(data);
|
||||
}
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, null); //데이터 기록후 Vector 초기화
|
||||
|
||||
@@ -394,7 +394,7 @@ public class SEND_BI0700 extends DefaultTelegram implements TelegramService
|
||||
if (block_data == null) {
|
||||
block_data = new HashMap<Integer, byte[]>();
|
||||
}
|
||||
block_data.put( new Integer(SEQUENCE_NO-1) , fileData);
|
||||
block_data.put(SEQUENCE_NO - 1, fileData);
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
|
||||
this.batchDoc.getBatchMsg().getBody().setSeqNum(SEQUENCE_NO);
|
||||
|
||||
@@ -272,7 +272,7 @@ public class SEND_BI0710 extends DefaultTelegram implements TelegramService
|
||||
this.batchDoc.getBatchMsg().getBody().setErrorMsg(errMsg);
|
||||
return false;
|
||||
}
|
||||
byte[] data = block_data.get( new Integer(i) );
|
||||
byte[] data = block_data.get(i);
|
||||
fileData = new byte[data.length];
|
||||
System.arraycopy( data, 0, fileData, 0, data.length);
|
||||
this.REAL_BYTE = data.length;
|
||||
|
||||
@@ -64,7 +64,7 @@ public class RECV_BOKEX_03000030 extends DefaultTelegram implements TelegramServ
|
||||
int recv_seq_no = Integer.parseInt(_seq_no);
|
||||
batchDoc.getBatchMsg().getBody().setSeqNum(recv_seq_no);
|
||||
|
||||
block_data.put( new Integer(recv_seq_no-1) , bout.toByteArray());
|
||||
block_data.put(recv_seq_no - 1, bout.toByteArray());
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
|
||||
//DB로그에 남길 전문 헤더 설정
|
||||
|
||||
@@ -44,7 +44,7 @@ public class RECV_BOKEX_03100040 extends DefaultTelegram implements TelegramServ
|
||||
// 이전에 송신한 최초 시퀀스 찾아 내어 시퀀스 번호 다시 세팅
|
||||
int seq_no = batchDoc.getBatchMsg().getBody().getSeqNum();
|
||||
for ( int inx=0;inx<seq_no;inx++){
|
||||
Object obj = hm.get(new Integer(inx));
|
||||
Object obj = hm.get(inx);
|
||||
if ( obj!= null ){
|
||||
batchDoc.getBatchMsg().getBody().setSeqNum(inx+1);
|
||||
break;
|
||||
|
||||
@@ -323,7 +323,7 @@ public class SEND_BOKEX_03000030 extends DefaultTelegram implements TelegramServ
|
||||
block_data = new HashMap<Integer, byte[]>();
|
||||
}
|
||||
|
||||
fileData = block_data.get(new Integer(SEQUENCE_NO-1));
|
||||
fileData = block_data.get(SEQUENCE_NO - 1);
|
||||
|
||||
if ( fileData == null ){
|
||||
fileData = new byte[sequence_size];
|
||||
@@ -350,7 +350,7 @@ public class SEND_BOKEX_03000030 extends DefaultTelegram implements TelegramServ
|
||||
}
|
||||
}
|
||||
REAL_BYTE = offset;
|
||||
block_data.put( new Integer(SEQUENCE_NO-1) , fileData);
|
||||
block_data.put(SEQUENCE_NO - 1, fileData);
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
|
||||
// 전송 상태 처리
|
||||
|
||||
@@ -225,7 +225,7 @@ public class SEND_BOKEX_03100040 extends DefaultTelegram implements TelegramServ
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i<seq_no; i++) { //받은 seq_no만큼만 데이터 확인하여 기록
|
||||
byte[] data = (byte[]) block_data.get(new Integer(i));
|
||||
byte[] data = (byte[]) block_data.get(i);
|
||||
if (data != null ) fout.write(data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public class RECV_BOKGG_0310 extends DefaultTelegram implements TelegramService
|
||||
if (block_data == null) {
|
||||
block_data = new HashMap<Integer, byte[]>();
|
||||
}
|
||||
block_data.put( new Integer(recv_seq_no-1) , bout.toByteArray());
|
||||
block_data.put(recv_seq_no - 1, bout.toByteArray());
|
||||
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ public class RECV_BOKGG_0320 extends DefaultTelegram implements TelegramService
|
||||
if (block_data == null) {
|
||||
block_data = new HashMap<Integer, byte[]>();
|
||||
}
|
||||
block_data.put( new Integer(recv_seq_no-1) , bout.toByteArray());
|
||||
block_data.put(recv_seq_no - 1, bout.toByteArray());
|
||||
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
|
||||
|
||||
@@ -295,7 +295,7 @@ public class SEND_BOKGG_0300 extends DefaultTelegram implements TelegramService
|
||||
_missingNm[i] = '0';
|
||||
}else{
|
||||
for (int i = 0; i<seq_no; i++) { //받은 seq_no만큼만 데이터 확인
|
||||
byte[] data = (byte[]) block_data.get( new Integer(i) );
|
||||
byte[] data = (byte[]) block_data.get(i);
|
||||
if (data == null ) {
|
||||
_missingNm[i] = '0'; //결번이 발생한 seq만 '0' 설정
|
||||
MISSING_COUNT++;
|
||||
@@ -310,7 +310,7 @@ public class SEND_BOKGG_0300 extends DefaultTelegram implements TelegramService
|
||||
}
|
||||
|
||||
for (int i = 0; i<seq_no; i++) { //받은 seq_no만큼만 데이터 확인하여 기록
|
||||
byte[] data = (byte[]) block_data.get(new Integer(i));
|
||||
byte[] data = (byte[]) block_data.get(i);
|
||||
int recLen = batchDoc.getBatchMsg().getHeader().getRecLen();
|
||||
if ( recLen < 1 ){
|
||||
recLen = data.length;
|
||||
|
||||
@@ -268,7 +268,7 @@ public class SEND_BOKGG_0310 extends DefaultTelegram implements TelegramService
|
||||
this.batchDoc.getBatchMsg().getBody().setErrorMsg(errMsg);
|
||||
return false;
|
||||
}
|
||||
byte[] data = block_data.get( new Integer(SEQUENCE_NO -1) );
|
||||
byte[] data = block_data.get(SEQUENCE_NO - 1);
|
||||
this.REAL_BYTE = data.length;
|
||||
fileData = new byte[REAL_BYTE];
|
||||
System.arraycopy( data, 0, fileData, 0, data.length);
|
||||
|
||||
@@ -396,7 +396,7 @@ public class SEND_BOKGG_0320 extends DefaultTelegram implements TelegramService
|
||||
System.arraycopy( fileLine, 0, fileData, inx * batchDoc.getBatchMsg().getHeader().getRecLen(), batchDoc.getBatchMsg().getHeader().getRecLen());
|
||||
}
|
||||
|
||||
block_data.put( new Integer(SEQUENCE_NO-1), fileData);
|
||||
block_data.put(SEQUENCE_NO - 1, fileData);
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ public class RECV_BOKJJ_0310 extends DefaultTelegram implements TelegramService
|
||||
if (block_data == null) {
|
||||
block_data = new HashMap<Integer, byte[]>();
|
||||
}
|
||||
block_data.put( new Integer(recv_seq_no-1) , bout.toByteArray());
|
||||
block_data.put(recv_seq_no - 1, bout.toByteArray());
|
||||
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ public class RECV_BOKJJ_0320 extends DefaultTelegram implements TelegramService
|
||||
if (block_data == null) {
|
||||
block_data = new HashMap<Integer, byte[]>();
|
||||
}
|
||||
block_data.put( new Integer(recv_seq_no-1) , bout.toByteArray());
|
||||
block_data.put(recv_seq_no - 1, bout.toByteArray());
|
||||
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
|
||||
|
||||
@@ -298,7 +298,7 @@ public class SEND_BOKJJ_0300 extends DefaultTelegram implements TelegramService
|
||||
_missingNm[i] = '0';
|
||||
}else{
|
||||
for (int i = 0; i<seq_no; i++) { //받은 seq_no만큼만 데이터 확인
|
||||
byte[] data = (byte[]) block_data.get( new Integer(i) );
|
||||
byte[] data = (byte[]) block_data.get(i);
|
||||
if (data == null ) {
|
||||
_missingNm[i] = '0'; //결번이 발생한 seq만 '0' 설정
|
||||
MISSING_COUNT++;
|
||||
@@ -313,7 +313,7 @@ public class SEND_BOKJJ_0300 extends DefaultTelegram implements TelegramService
|
||||
}
|
||||
|
||||
for (int i = 0; i<seq_no; i++) { //받은 seq_no만큼만 데이터 확인하여 기록
|
||||
byte[] data = (byte[]) block_data.get(new Integer(i));
|
||||
byte[] data = (byte[]) block_data.get(i);
|
||||
int recLen = batchDoc.getBatchMsg().getHeader().getRecLen();
|
||||
if ( recLen < 1 ){
|
||||
recLen = data.length;
|
||||
|
||||
@@ -271,7 +271,7 @@ public class SEND_BOKJJ_0310 extends DefaultTelegram implements TelegramService
|
||||
this.batchDoc.getBatchMsg().getBody().setErrorMsg(errMsg);
|
||||
return false;
|
||||
}
|
||||
byte[] data = block_data.get( new Integer(SEQUENCE_NO -1) );
|
||||
byte[] data = block_data.get(SEQUENCE_NO - 1);
|
||||
this.REAL_BYTE = data.length;
|
||||
fileData = new byte[REAL_BYTE];
|
||||
System.arraycopy( data, 0, fileData, 0, data.length);
|
||||
|
||||
@@ -418,7 +418,7 @@ public class SEND_BOKJJ_0320 extends DefaultTelegram implements TelegramService
|
||||
System.arraycopy( fileLine, 0, fileData, inx * batchDoc.getBatchMsg().getHeader().getRecLen(), batchDoc.getBatchMsg().getHeader().getRecLen());
|
||||
}
|
||||
|
||||
block_data.put( new Integer(SEQUENCE_NO-1), fileData);
|
||||
block_data.put(SEQUENCE_NO - 1, fileData);
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
|
||||
// 이후 0600 전문 송신시에는 최종 block, seq를 보내 줘야 하기 때문에 헤더트레일러인 경우는 다음을 셋하지 않는다.
|
||||
|
||||
@@ -102,7 +102,7 @@ public class RECV_BOKNG_0310 extends DefaultTelegram implements TelegramService
|
||||
System.arraycopy(bout.toByteArray(), 3, enc, 0, enc.length);
|
||||
System.arraycopy(IniSafeManager.getInstance().dec(batchDoc,enc), 0, dec, 3, enc.length);
|
||||
|
||||
block_data.put( new Integer(recv_seq_no-1) , dec);
|
||||
block_data.put(recv_seq_no - 1, dec);
|
||||
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ public class RECV_BOKNG_0320 extends DefaultTelegram implements TelegramService
|
||||
if (block_data == null) {
|
||||
block_data = new HashMap<Integer, byte[]>();
|
||||
}
|
||||
block_data.put( new Integer(recv_seq_no-1) , dec);
|
||||
block_data.put(recv_seq_no - 1, dec);
|
||||
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
|
||||
|
||||
@@ -300,7 +300,7 @@ public class SEND_BOKNG_0300 extends DefaultTelegram implements TelegramService
|
||||
_missingNm[i] = '0';
|
||||
}else{
|
||||
for (int i = 0; i<seq_no; i++) { //받은 seq_no만큼만 데이터 확인
|
||||
byte[] data = (byte[]) block_data.get( new Integer(i) );
|
||||
byte[] data = (byte[]) block_data.get(i);
|
||||
if (data == null ) {
|
||||
_missingNm[i] = '0'; //결번이 발생한 seq만 '0' 설정
|
||||
MISSING_COUNT++;
|
||||
@@ -314,7 +314,7 @@ public class SEND_BOKNG_0300 extends DefaultTelegram implements TelegramService
|
||||
}
|
||||
|
||||
for (int i = 0; i<seq_no; i++) { //받은 seq_no만큼만 데이터 확인하여 기록
|
||||
byte[] data = (byte[]) block_data.get(new Integer(i));
|
||||
byte[] data = (byte[]) block_data.get(i);
|
||||
int recLen = batchDoc.getBatchMsg().getHeader().getRecLen();
|
||||
if ( recLen < 1 ){
|
||||
recLen = data.length;
|
||||
|
||||
@@ -283,7 +283,7 @@ public class SEND_BOKNG_0310 extends DefaultTelegram implements TelegramService
|
||||
this.batchDoc.getBatchMsg().getBody().setErrorMsg(errMsg);
|
||||
return false;
|
||||
}
|
||||
byte[] data = (byte[]) block_data.get( new Integer(SEQUENCE_NO -1) );
|
||||
byte[] data = (byte[]) block_data.get(SEQUENCE_NO - 1);
|
||||
this.REAL_BYTE = data.length;
|
||||
fileData = new byte[REAL_BYTE];
|
||||
System.arraycopy( data, 0, fileData, 0, data.length);
|
||||
|
||||
@@ -420,7 +420,7 @@ public class SEND_BOKNG_0320 extends DefaultTelegram implements TelegramService
|
||||
System.arraycopy( fileLine, 0, fileData, inx * batchDoc.getBatchMsg().getHeader().getRecLen(), batchDoc.getBatchMsg().getHeader().getRecLen());
|
||||
}
|
||||
|
||||
block_data.put( new Integer(SEQUENCE_NO-1), fileData);
|
||||
block_data.put(SEQUENCE_NO - 1, fileData);
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ public class RECV_CCRSF_0310 extends DefaultTelegram implements TelegramService
|
||||
if (block_data == null) {
|
||||
block_data = new HashMap<Integer, byte[]>();
|
||||
}
|
||||
block_data.put( new Integer(recv_seq_no-1) , bout.toByteArray());
|
||||
block_data.put(recv_seq_no - 1, bout.toByteArray());
|
||||
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ public class RECV_CCRSF_0320 extends DefaultTelegram implements TelegramService
|
||||
if (block_data == null) {
|
||||
block_data = new HashMap<Integer, byte[]>();
|
||||
}
|
||||
block_data.put( new Integer(recv_seq_no-1) , bout.toByteArray());
|
||||
block_data.put(recv_seq_no - 1, bout.toByteArray());
|
||||
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
|
||||
|
||||
@@ -302,7 +302,7 @@ public class SEND_CCRSF_0300 extends DefaultTelegram implements TelegramService
|
||||
_missingNm[i] = '0';
|
||||
}else{
|
||||
for (int i = 0; i<seq_no; i++) { //받은 seq_no만큼만 데이터 확인
|
||||
byte[] data = (byte[]) block_data.get( new Integer(i) );
|
||||
byte[] data = (byte[]) block_data.get(i);
|
||||
if (data == null ) {
|
||||
_missingNm[i] = '0'; //결번이 발생한 seq만 '0' 설정
|
||||
MISSING_COUNT++;
|
||||
@@ -317,7 +317,7 @@ public class SEND_CCRSF_0300 extends DefaultTelegram implements TelegramService
|
||||
}
|
||||
|
||||
for (int i = 0; i<seq_no; i++) { //받은 seq_no만큼만 데이터 확인하여 기록
|
||||
byte[] data = (byte[]) block_data.get(new Integer(i));
|
||||
byte[] data = (byte[]) block_data.get(i);
|
||||
int recLen = batchDoc.getBatchMsg().getHeader().getRecLen();
|
||||
if ( recLen < 1 ){
|
||||
recLen = data.length;
|
||||
|
||||
@@ -275,7 +275,7 @@ public class SEND_CCRSF_0310 extends DefaultTelegram implements TelegramService
|
||||
this.batchDoc.getBatchMsg().getBody().setErrorMsg(errMsg);
|
||||
return false;
|
||||
}
|
||||
byte[] data = block_data.get( new Integer(SEQUENCE_NO -1) );
|
||||
byte[] data = block_data.get(SEQUENCE_NO - 1);
|
||||
this.REAL_BYTE = data.length;
|
||||
fileData = new byte[REAL_BYTE];
|
||||
System.arraycopy( data, 0, fileData, 0, data.length);
|
||||
|
||||
@@ -401,7 +401,7 @@ public class SEND_CCRSF_0320 extends DefaultTelegram implements TelegramService
|
||||
System.arraycopy( fileLine, 0, fileData, inx * batchDoc.getBatchMsg().getHeader().getRecLen(), batchDoc.getBatchMsg().getHeader().getRecLen());
|
||||
}
|
||||
|
||||
block_data.put( new Integer(SEQUENCE_NO-1), fileData);
|
||||
block_data.put(SEQUENCE_NO - 1, fileData);
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
}
|
||||
|
||||
|
||||
@@ -95,8 +95,8 @@ public class RECV_CMS25_0310 extends DefaultTelegram implements TelegramService
|
||||
|
||||
logger.info("{} doInformalField >> missing telegram receive : [" + (recv_seq_no-1) + "]", logHeader);
|
||||
if ( recv_block_no == block_no ){
|
||||
if (block_data.get(new Integer(recv_seq_no-1)) == null) {
|
||||
block_data.put(new Integer(recv_seq_no-1), bout.toByteArray());
|
||||
if (block_data.get(recv_seq_no - 1) == null) {
|
||||
block_data.put(recv_seq_no - 1, bout.toByteArray());
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class RECV_CMS25_0320 extends DefaultTelegram implements TelegramService
|
||||
int recv_seq_no = Integer.parseInt(_seq_no);
|
||||
int block_no = batchDoc.getBatchMsg().getBody().getBlockNum();
|
||||
if ( recv_block_no == block_no ){
|
||||
block_data.put( new Integer(recv_seq_no-1) , bout.toByteArray());
|
||||
block_data.put(recv_seq_no-1, bout.toByteArray());
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
}
|
||||
//DB로그에 남길 전문 헤더 설정
|
||||
|
||||
@@ -139,7 +139,7 @@ public class RECV_CMS25_0640 extends DefaultTelegram implements TelegramService
|
||||
|
||||
}
|
||||
|
||||
block_data.put( new Integer(inx), fileData);
|
||||
block_data.put(inx, fileData);
|
||||
}
|
||||
batchDoc.getBatchMsg().getBody().setSeqNum(seqNo);
|
||||
|
||||
|
||||
@@ -386,7 +386,7 @@ public class SEND_CMS25_0300 extends DefaultTelegram implements TelegramService
|
||||
_missingNm[i] = '0';
|
||||
}else{
|
||||
for (int i = 0; i<seq_no; i++) { //받은 seq_no만큼만 데이터 확인
|
||||
byte[] data = (byte[]) block_data.get( new Integer(i) );
|
||||
byte[] data = (byte[]) block_data.get(i);
|
||||
if (data == null ) {
|
||||
_missingNm[i] = '0'; //결번이 발생한 seq만 '0' 설정
|
||||
MISSING_COUNT++;
|
||||
@@ -406,7 +406,7 @@ public class SEND_CMS25_0300 extends DefaultTelegram implements TelegramService
|
||||
|
||||
|
||||
for (int i = 0; i<seq_no; i++) { //받은 seq_no만큼만 데이터 확인하여 기록
|
||||
byte[] data = (byte[]) block_data.get(new Integer(i));
|
||||
byte[] data = (byte[]) block_data.get(i);
|
||||
if ( writeNoLf != null && writeNoLf.equals("Y")){
|
||||
fout.write(data);
|
||||
long lnCurSize = batchDoc.getBatchMsg().getBody().getCurFileSize()+data.length;
|
||||
|
||||
@@ -349,7 +349,7 @@ public class SEND_CMS25_0310 extends DefaultTelegram implements TelegramService
|
||||
this.batchDoc.getBatchMsg().getBody().setErrorMsg(errMsg);
|
||||
return false;
|
||||
}
|
||||
fileData = (byte[]) block_data.get( new Integer(SEQUENCE_NO -1) );
|
||||
fileData = (byte[]) block_data.get(SEQUENCE_NO -1);
|
||||
this.REAL_BYTE = fileData.length;
|
||||
return true;
|
||||
} catch (Exception e ) {
|
||||
|
||||
@@ -462,7 +462,7 @@ public class SEND_CMS25_0320 extends DefaultTelegram implements TelegramService
|
||||
if (block_data == null) {
|
||||
block_data = new HashMap<Integer, byte[]>();
|
||||
}
|
||||
block_data.put( new Integer(SEQUENCE_NO-1), fileData);
|
||||
block_data.put(SEQUENCE_NO-1, fileData);
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
// 2008.06.19 - 정동한
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ public class RECV_DEBIT_0310 extends DefaultTelegram implements TelegramService
|
||||
if (block_data == null) {
|
||||
block_data = new HashMap<Integer, byte[]>();
|
||||
}
|
||||
block_data.put( new Integer(recv_seq_no-1) , bout.toByteArray());
|
||||
block_data.put(recv_seq_no-1, bout.toByteArray());
|
||||
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ public class RECV_DEBIT_0320 extends DefaultTelegram implements TelegramService
|
||||
if (block_data == null) {
|
||||
block_data = new HashMap<Integer, byte[]>();
|
||||
}
|
||||
block_data.put( new Integer(recv_seq_no-1) , bout.toByteArray());
|
||||
block_data.put(recv_seq_no-1, bout.toByteArray());
|
||||
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
|
||||
|
||||
@@ -305,7 +305,7 @@ public class SEND_DEBIT_0300 extends DefaultTelegram implements TelegramService
|
||||
_missingNm[i] = '0';
|
||||
}else{
|
||||
for (int i = 0; i<seq_no; i++) { //받은 seq_no만큼만 데이터 확인
|
||||
byte[] data = (byte[]) block_data.get( new Integer(i) );
|
||||
byte[] data = (byte[]) block_data.get(i);
|
||||
if (data == null ) {
|
||||
_missingNm[i] = '0'; //결번이 발생한 seq만 '0' 설정
|
||||
MISSING_COUNT++;
|
||||
@@ -320,7 +320,7 @@ public class SEND_DEBIT_0300 extends DefaultTelegram implements TelegramService
|
||||
}
|
||||
|
||||
for (int i = 0; i<seq_no; i++) { //받은 seq_no만큼만 데이터 확인하여 기록
|
||||
byte[] data = (byte[]) block_data.get(new Integer(i));
|
||||
byte[] data = (byte[]) block_data.get(i);
|
||||
int recLen = batchDoc.getBatchMsg().getHeader().getRecLen();
|
||||
if ( recLen < 1 ){
|
||||
recLen = data.length;
|
||||
|
||||
@@ -273,7 +273,7 @@ public class SEND_DEBIT_0310 extends DefaultTelegram implements TelegramService
|
||||
this.batchDoc.getBatchMsg().getBody().setErrorMsg(errMsg);
|
||||
return false;
|
||||
}
|
||||
byte[] data = block_data.get( new Integer(SEQUENCE_NO -1) );
|
||||
byte[] data = block_data.get(SEQUENCE_NO -1);
|
||||
this.REAL_BYTE = data.length;
|
||||
fileData = new byte[REAL_BYTE];
|
||||
System.arraycopy( data, 0, fileData, 0, data.length);
|
||||
|
||||
@@ -409,7 +409,7 @@ public class SEND_DEBIT_0320 extends DefaultTelegram implements TelegramService
|
||||
System.arraycopy( fileLine, 0, fileData, inx * batchDoc.getBatchMsg().getHeader().getRecLen(), batchDoc.getBatchMsg().getHeader().getRecLen());
|
||||
}
|
||||
|
||||
block_data.put( new Integer(SEQUENCE_NO-1), fileData);
|
||||
block_data.put(SEQUENCE_NO-1, fileData);
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ public class RECV_FIUSC_0303 extends DefaultTelegram implements TelegramService
|
||||
int recv_seq_no = Integer.parseInt(_seq_no.trim());
|
||||
batchDoc.getBatchMsg().getBody().setSeqNum(recv_seq_no);
|
||||
|
||||
block_data.put( new Integer(recv_seq_no-1) , bout.toByteArray());
|
||||
block_data.put(recv_seq_no-1, bout.toByteArray());
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
|
||||
//DB로그에 남길 전문 헤더 설정
|
||||
|
||||
@@ -340,7 +340,7 @@ public class SEND_FIUSC_0303 extends DefaultTelegram implements TelegramService
|
||||
block_data = new HashMap<Integer, byte[]>();
|
||||
}
|
||||
|
||||
fileData = block_data.get(new Integer(SEQUENCE_NO-1));
|
||||
fileData = block_data.get(SEQUENCE_NO - 1);
|
||||
|
||||
if ( fileData == null ){
|
||||
fileData = new byte[sequence_size];
|
||||
@@ -351,10 +351,10 @@ public class SEND_FIUSC_0303 extends DefaultTelegram implements TelegramService
|
||||
byte[] retryFileData = new byte[REAL_BYTE];
|
||||
int bytesRead = bin.read(retryFileData);
|
||||
if (bytesRead == REAL_BYTE) {
|
||||
block_data.put(new Integer(SEQUENCE_NO-1), retryFileData);
|
||||
block_data.put(SEQUENCE_NO - 1, retryFileData);
|
||||
}
|
||||
} else {
|
||||
block_data.put(new Integer(SEQUENCE_NO-1), fileData);
|
||||
block_data.put(SEQUENCE_NO - 1, fileData);
|
||||
}
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.eactive.eai.batch.job.jobItem.fiusc;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Properties;
|
||||
|
||||
@@ -57,9 +58,7 @@ public class SEND_FIUSC_0314 extends DefaultTelegram implements TelegramService
|
||||
|
||||
//사용자ID
|
||||
byte[] userId = new byte[20];
|
||||
for ( int inx = 0; inx < userId.length; inx++ ){
|
||||
userId[inx] = ' ';
|
||||
}
|
||||
Arrays.fill(userId, (byte) ' ');
|
||||
|
||||
System.arraycopy(batchDoc.getBatchMsg().getHeader().getUserID().getBytes(), 0, userId, 0,
|
||||
Math.min(batchDoc.getBatchMsg().getHeader().getUserID().getBytes().length, 20));
|
||||
@@ -115,14 +114,14 @@ public class SEND_FIUSC_0314 extends DefaultTelegram implements TelegramService
|
||||
for (int i=0; i<10; i++) {
|
||||
baout.write((byte[])this.al_Field.get(i));
|
||||
}
|
||||
batchDoc.getBatchMsg().setTelegramHeader(new String(baout.toByteArray()));
|
||||
batchDoc.getBatchMsg().setTelegramHeader(baout.toString());
|
||||
|
||||
//DB로그에 남길 전문 바디 설정
|
||||
baout = new ByteArrayOutputStream();
|
||||
for (int i=10; i< al_Field.size(); i++) {
|
||||
baout.write((byte[])this.al_Field.get(i));
|
||||
}
|
||||
batchDoc.getBatchMsg().setTelegramBody(new String(baout.toByteArray()));
|
||||
batchDoc.getBatchMsg().setTelegramBody(baout.toString());
|
||||
|
||||
//확인결과 정상(RTN_CD='00')이 아닌 경우 재처리를 위해 기수신파일크기 리셋
|
||||
if (RTN_CD != "00") {
|
||||
@@ -262,7 +261,7 @@ public class SEND_FIUSC_0314 extends DefaultTelegram implements TelegramService
|
||||
|
||||
//받은 seq_no만큼만 데이터 확인하여 정상이면 파일에 기록하고, 비정상이면 받은 데이터 길이만 저장
|
||||
for (int i=0; i < seq_no; i++) {
|
||||
byte[] data = (byte[]) block_data.get(new Integer(i));
|
||||
byte[] data = (byte[]) block_data.get(i);
|
||||
if (data != null ) {
|
||||
if (RTN_CD.equals("00")) {
|
||||
fout.write(data);
|
||||
|
||||
@@ -82,7 +82,7 @@ public class RECV_HOUSE_0310 extends DefaultTelegram implements TelegramService
|
||||
if (block_data == null) {
|
||||
block_data = new HashMap<Integer, byte[]>();
|
||||
}
|
||||
block_data.put( new Integer(recv_seq_no-1) , bout.toByteArray());
|
||||
block_data.put(recv_seq_no-1, bout.toByteArray());
|
||||
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ public class RECV_HOUSE_0320 extends DefaultTelegram implements TelegramService
|
||||
if (block_data == null) {
|
||||
block_data = new HashMap<Integer, byte[]>();
|
||||
}
|
||||
block_data.put( new Integer(recv_seq_no-1) , bout.toByteArray());
|
||||
block_data.put(recv_seq_no-1, bout.toByteArray());
|
||||
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ public class SEND_HOUSE_0300 extends DefaultTelegram implements TelegramService
|
||||
//20060413 khs >> byte[] data = (byte[]) block_data.get( i );
|
||||
byte[] data = null;
|
||||
if ( block_data != null ){
|
||||
data = (byte[]) block_data.get( new Integer(i) );
|
||||
data = (byte[]) block_data.get(i);
|
||||
}
|
||||
if (data == null ) {
|
||||
_missingNm[i] = '0'; //결번이 발생한 seq만 '0' 설정
|
||||
@@ -336,7 +336,7 @@ public class SEND_HOUSE_0300 extends DefaultTelegram implements TelegramService
|
||||
for (int i = 0; i<seq_no; i++) { //받은 seq_no만큼만 데이터 확인하여 기록
|
||||
byte[] data = null;
|
||||
if ( block_data != null ){
|
||||
data = (byte[]) block_data.get( new Integer(i) );
|
||||
data = (byte[]) block_data.get(i);
|
||||
}
|
||||
int recLen = batchDoc.getBatchMsg().getHeader().getRecLen();
|
||||
if ( recLen < 1 ){
|
||||
|
||||
@@ -300,7 +300,7 @@ public class SEND_HOUSE_0310 extends DefaultTelegram implements TelegramService
|
||||
this.batchDoc.getBatchMsg().getBody().setErrorMsg(errMsg);
|
||||
return false;
|
||||
}
|
||||
byte[] data = (byte[]) block_data.get( new Integer(SEQUENCE_NO -1) );
|
||||
byte[] data = (byte[]) block_data.get(SEQUENCE_NO - 1);
|
||||
this.REAL_BYTE = data.length;
|
||||
fileData = new byte[REAL_BYTE];
|
||||
System.arraycopy( data, 0, fileData, 0, data.length);
|
||||
|
||||
@@ -465,7 +465,7 @@ public class SEND_HOUSE_0320 extends DefaultTelegram implements TelegramService
|
||||
System.arraycopy( fileLine, 0, fileData, inx * batchDoc.getBatchMsg().getHeader().getRecLen(), batchDoc.getBatchMsg().getHeader().getRecLen());
|
||||
}
|
||||
|
||||
block_data.put( new Integer(SEQUENCE_NO-1) , fileData);
|
||||
block_data.put(SEQUENCE_NO - 1, fileData);
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,11 +67,11 @@ public class RECV_KEDBT_0310 extends DefaultTelegram implements TelegramService
|
||||
}
|
||||
|
||||
logger.info("{} doInformalField >> missing telegram receive : [" + (recv_seq_no-1) + "]", logHeader);
|
||||
if (block_data.get(new Integer(recv_seq_no-1)) == null) {
|
||||
if (block_data.get(recv_seq_no-1) == null) {
|
||||
//결번 테스트용
|
||||
// if ( Math.random() > 0.6 ){
|
||||
// }
|
||||
block_data.put(new Integer(recv_seq_no-1), bout.toByteArray());
|
||||
block_data.put(recv_seq_no-1, bout.toByteArray());
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ public class RECV_KEDBT_0320 extends DefaultTelegram implements TelegramService
|
||||
//결번 테스트용
|
||||
// if ( Math.random() > 0.6 ){
|
||||
// }
|
||||
block_data.put( new Integer(recv_seq_no-1) , bout.toByteArray());
|
||||
block_data.put(recv_seq_no-1, bout.toByteArray());
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
return true;
|
||||
} catch ( Exception e) {
|
||||
|
||||
@@ -283,7 +283,7 @@ public class SEND_KEDBT_0300 extends DefaultTelegram implements TelegramService
|
||||
_missingNm[i] = '0'; //받은 DATA없을 시
|
||||
}else{
|
||||
for (int i = 0; i < SEQUENCE_NO; i++) { //받은 seq_no만큼만 데이터 확인
|
||||
byte[] data = (byte[]) block_data.get( new Integer(i) );
|
||||
byte[] data = (byte[]) block_data.get(i);
|
||||
if (data != null ) {
|
||||
_missingNm[i] = '1'; //정상이면 '1' 설정
|
||||
}else{
|
||||
@@ -307,7 +307,7 @@ public class SEND_KEDBT_0300 extends DefaultTelegram implements TelegramService
|
||||
}
|
||||
|
||||
for (int i = 0; i < SEQUENCE_NO; i++) { //받은 seq_no만큼만 데이터 확인하여 기록
|
||||
byte[] data = (byte[]) block_data.get(new Integer(i));
|
||||
byte[] data = (byte[]) block_data.get(i);
|
||||
int recLen = batchDoc.getBatchMsg().getHeader().getRecLen();
|
||||
if ( recLen < 1 ){
|
||||
recLen = data.length;
|
||||
|
||||
@@ -264,7 +264,7 @@ public class SEND_KEDBT_0310 extends DefaultTelegram implements TelegramService
|
||||
this.batchDoc.getBatchMsg().getBody().setErrorMsg(errMsg);
|
||||
return false;
|
||||
}
|
||||
fileData = (byte[]) block_data.get( new Integer(SEQUENCE_NO -1) );
|
||||
fileData = (byte[]) block_data.get(SEQUENCE_NO -1);
|
||||
this.REAL_BYTE = fileData.length;
|
||||
return true;
|
||||
|
||||
|
||||
@@ -345,7 +345,7 @@ public class SEND_KEDBT_0320 extends DefaultTelegram implements TelegramService
|
||||
if (block_data == null) {
|
||||
block_data = new HashMap<Integer, byte[]>();
|
||||
}
|
||||
block_data.put( new Integer(SEQUENCE_NO-1), fileData);
|
||||
block_data.put(SEQUENCE_NO-1, fileData);
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
// 2008.06.19 - 정동한
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ public class RECV_KFB0310 extends DefaultTelegram implements TelegramService {
|
||||
if (block_data == null) {
|
||||
block_data = new HashMap<Integer, byte[]>();
|
||||
}
|
||||
block_data.put( new Integer(recv_seq_no-1) , bout.toByteArray());
|
||||
block_data.put(recv_seq_no-1, bout.toByteArray());
|
||||
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ public class RECV_KFB0320 extends DefaultTelegram implements TelegramService {
|
||||
if (block_data == null) {
|
||||
block_data = new HashMap<Integer, byte[]>();
|
||||
}
|
||||
block_data.put( new Integer(recv_seq_no-1) , bout.toByteArray());
|
||||
block_data.put(recv_seq_no-1, bout.toByteArray());
|
||||
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ public class SEND_KFB0300 extends DefaultTelegram implements TelegramService {
|
||||
_missingNm[i] = '0';
|
||||
}else{
|
||||
for (int i = 0; i<seq_no; i++) { //받은 seq_no만큼만 데이터 확인
|
||||
byte[] data = (byte[]) block_data.get( new Integer(i) );
|
||||
byte[] data = (byte[]) block_data.get(i);
|
||||
if (data == null ) {
|
||||
_missingNm[i] = '0'; //결번이 발생한 seq만 '0' 설정
|
||||
MISSING_COUNT++;
|
||||
@@ -324,7 +324,7 @@ public class SEND_KFB0300 extends DefaultTelegram implements TelegramService {
|
||||
}
|
||||
|
||||
for (int i = 0; i<seq_no; i++) { //받은 seq_no만큼만 데이터 확인하여 기록
|
||||
byte[] data = (byte[]) block_data.get(new Integer(i));
|
||||
byte[] data = (byte[]) block_data.get(i);
|
||||
int recLen = batchDoc.getBatchMsg().getHeader().getRecLen();
|
||||
if ( recLen < 1 ){
|
||||
recLen = data.length;
|
||||
|
||||
@@ -281,7 +281,7 @@ public class SEND_KFB0310 extends DefaultTelegram implements TelegramService {
|
||||
this.batchDoc.getBatchMsg().getBody().setErrorMsg(errMsg);
|
||||
return false;
|
||||
}
|
||||
byte[] data = block_data.get( new Integer(SEQUENCE_NO -1) );
|
||||
byte[] data = block_data.get(SEQUENCE_NO -1);
|
||||
this.REAL_BYTE = data.length;
|
||||
fileData = new byte[REAL_BYTE];
|
||||
System.arraycopy( data, 0, fileData, 0, data.length);
|
||||
|
||||
@@ -432,7 +432,7 @@ public class SEND_KFB0320 extends DefaultTelegram implements TelegramService {
|
||||
System.arraycopy( fileLine, 0, fileData, inx * batchDoc.getBatchMsg().getHeader().getRecLen(), batchDoc.getBatchMsg().getHeader().getRecLen());
|
||||
}
|
||||
|
||||
block_data.put( new Integer(SEQUENCE_NO-1) , fileData);
|
||||
block_data.put(SEQUENCE_NO-1, fileData);
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
}
|
||||
|
||||
|
||||
@@ -89,8 +89,8 @@ public class RECV_KFTCB_0310 extends DefaultTelegram implements TelegramService
|
||||
int recv_seq_no = Integer.parseInt(_seq_no);
|
||||
|
||||
logger.info("{} doInformalField >> missing telegram receive : [" + (recv_seq_no-1) + "]", logHeader);
|
||||
if (block_data.get(new Integer(recv_seq_no-1)) == null) {
|
||||
block_data.put(new Integer(recv_seq_no-1), bout.toByteArray());
|
||||
if (block_data.get(recv_seq_no - 1) == null) {
|
||||
block_data.put(recv_seq_no - 1, bout.toByteArray());
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ public class RECV_KFTCB_0320 extends DefaultTelegram implements TelegramService
|
||||
String _seq_no = new String ((byte[]) al_Field.get(10));
|
||||
int recv_seq_no = Integer.parseInt(_seq_no);
|
||||
|
||||
block_data.put( new Integer(recv_seq_no-1) , bout.toByteArray());
|
||||
block_data.put(recv_seq_no - 1, bout.toByteArray());
|
||||
hm.put(JobProcessData.PROCDATA_BLOCKDATA, block_data);
|
||||
|
||||
//DB로그에 남길 전문 헤더 설정
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user