diff --git a/datatrans/.classpath b/datatrans/.classpath new file mode 100644 index 00000000..cf67b54a --- /dev/null +++ b/datatrans/.classpath @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/datatrans/.gitattributes b/datatrans/.gitattributes new file mode 100644 index 00000000..00a51aff --- /dev/null +++ b/datatrans/.gitattributes @@ -0,0 +1,6 @@ +# +# https://help.github.com/articles/dealing-with-line-endings/ +# +# These are explicitly windows files and should use crlf +*.bat text eol=crlf + diff --git a/datatrans/.gitignore b/datatrans/.gitignore new file mode 100644 index 00000000..1b6985c0 --- /dev/null +++ b/datatrans/.gitignore @@ -0,0 +1,5 @@ +# Ignore Gradle project-specific cache directory +.gradle + +# Ignore Gradle build output directory +build diff --git a/datatrans/.project b/datatrans/.project new file mode 100644 index 00000000..b6733e9e --- /dev/null +++ b/datatrans/.project @@ -0,0 +1,41 @@ + + + ncmsToIamsDataTrans + Project lib created by Buildship. + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.eclipse.buildship.core.gradleprojectbuilder + + + + + org.springframework.ide.eclipse.boot.validation.springbootbuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.buildship.core.gradleprojectnature + + diff --git a/datatrans/.project.bak b/datatrans/.project.bak new file mode 100644 index 00000000..5949b2c1 --- /dev/null +++ b/datatrans/.project.bak @@ -0,0 +1,28 @@ + + + urpBaseResource + Project lib created by Buildship. + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.buildship.core.gradleprojectbuilder + + + + + org.springframework.ide.eclipse.boot.validation.springbootbuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.buildship.core.gradleprojectnature + + diff --git a/datatrans/.settings/org.eclipse.buildship.core.prefs b/datatrans/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 00000000..e8895216 --- /dev/null +++ b/datatrans/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir= +eclipse.preferences.version=1 diff --git a/datatrans/.settings/org.eclipse.jdt.core.prefs b/datatrans/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..18ad8952 --- /dev/null +++ b/datatrans/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.source=11 diff --git a/datatrans/.settings/org.eclipse.wst.common.component b/datatrans/.settings/org.eclipse.wst.common.component new file mode 100644 index 00000000..81ccd76f --- /dev/null +++ b/datatrans/.settings/org.eclipse.wst.common.component @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/datatrans/.settings/org.eclipse.wst.common.project.facet.core.xml b/datatrans/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 00000000..14e5ac12 --- /dev/null +++ b/datatrans/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/datatrans/.settings/org.springframework.ide.eclipse.prefs b/datatrans/.settings/org.springframework.ide.eclipse.prefs new file mode 100644 index 00000000..a12794d6 --- /dev/null +++ b/datatrans/.settings/org.springframework.ide.eclipse.prefs @@ -0,0 +1,2 @@ +boot.validation.initialized=true +eclipse.preferences.version=1 diff --git a/datatrans/bin/main/application-local.yml b/datatrans/bin/main/application-local.yml new file mode 100644 index 00000000..8348fa60 --- /dev/null +++ b/datatrans/bin/main/application-local.yml @@ -0,0 +1,67 @@ + # Service port + server: + port: 9002 + +# JPA 설정, JSP 설정 + spring: + devtools: + livereload: + enabled: true + mvc: + pathmatch: + matching-strategy: ANT_PATH_MATCHER + # 인증서버에서 JWT 보안키 확인 + security: + oauth2: + resourceserver: + jwt: + jwk-set-uri: + http://localhost:9001/oauth/token_key + +# Primary db information + ncmsdb: + driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy + jdbcUrl: jdbc:log4jdbc:mysql://192.168.8.138:3307/kccfnova?characterEncoding=UTF-8&serverTimezone=Asia/Seoul&rewriteBatchedStatements=true + username: yT4l55I/Xl4v8LeoTQhh1w== + password: aqmsYeReTVvoQ4r2bfAjYg== + maximumPoolSize: 35 + minimumIdle: 2 + connectionTimeout: 3000 + idleTimeout: 300000 + testOnBorrow: true + validationQuery: SELECT 1 + iamsdb: + driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy + jdbcUrl: jdbc:log4jdbc:mysql://192.168.8.138:3307/uac_cltr_db?characterEncoding=UTF-8&serverTimezone=Asia/Seoul&rewriteBatchedStatements=true + username: kSLzt543nkDJ/ta9rnLTCA== + password: kSLzt543nkDJ/ta9rnLTCA== + maximumPoolSize: 35 + minimumIdle: 2 + connectionTimeout: 3000 + idleTimeout: 300000 + testOnBorrow: true + validationQuery: SELECT 1 + +# SQL Log 관련 setting + log4jdbc: + spylogdelegator: + name: net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator + dump: + sql: + maxlinelength: 0 + + logging.level.jdbc.sqlonly: info + logging.level.jdbc.sqltiming: false + logging.level.jdbc.audit: false + logging.level.jdbc.resultset: false + logging.level.jdbc.resultsettable: info + logging.level.jdbc.connection: false + + file: + ncms: + basefolder : D:/z_temp_pro/kccf_temp + iams: + basefolder : D:/z_temp_pro/kccf_temp/repo + fileCpYn : N + + \ No newline at end of file diff --git a/datatrans/bin/main/application-ncms_server.yml b/datatrans/bin/main/application-ncms_server.yml new file mode 100644 index 00000000..29bd63eb --- /dev/null +++ b/datatrans/bin/main/application-ncms_server.yml @@ -0,0 +1,67 @@ + # Service port + server: + port: 9002 + +# JPA 설정, JSP 설정 + spring: + devtools: + livereload: + enabled: true + mvc: + pathmatch: + matching-strategy: ANT_PATH_MATCHER + # 인증서버에서 JWT 보안키 확인 + security: + oauth2: + resourceserver: + jwt: + jwk-set-uri: + http://localhost:9001/oauth/token_key + +# Primary db information + ncmsdb: + driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy + jdbcUrl: jdbc:log4jdbc:mysql://127.0.0.1:3306/kccfnova?characterEncoding=UTF-8&serverTimezone=Asia/Seoul&rewriteBatchedStatements=true + username: yT4l55I/Xl4v8LeoTQhh1w== + password: aqmsYeReTVvoQ4r2bfAjYg== + maximumPoolSize: 35 + minimumIdle: 2 + connectionTimeout: 3000 + idleTimeout: 300000 + testOnBorrow: true + validationQuery: SELECT 1 + iamsdb: + driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy + jdbcUrl: jdbc:log4jdbc:mysql://10.10.30.237:3306/uac_cltr_db?characterEncoding=UTF-8&serverTimezone=Asia/Seoul&rewriteBatchedStatements=true + username: kSLzt543nkDJ/ta9rnLTCA== + password: kSLzt543nkDJ/ta9rnLTCA== + maximumPoolSize: 35 + minimumIdle: 2 + connectionTimeout: 3000 + idleTimeout: 300000 + testOnBorrow: true + validationQuery: SELECT 1 + +# SQL Log 관련 setting + log4jdbc: + spylogdelegator: + name: net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator + dump: + sql: + maxlinelength: 0 + + logging.level.jdbc.sqlonly: info + logging.level.jdbc.sqltiming: false + logging.level.jdbc.audit: false + logging.level.jdbc.resultset: false + logging.level.jdbc.resultsettable: info + logging.level.jdbc.connection: false + + file: + ncms: + basefolder : /nfs_nas/minio/amsweb-opt + iams: + basefolder : /nfs_nas/uac/repo + fileCpYn : Y + + \ No newline at end of file diff --git a/datatrans/bin/main/com/urpsys/kccfbat/Aes256Test.class b/datatrans/bin/main/com/urpsys/kccfbat/Aes256Test.class new file mode 100644 index 00000000..c5a267f2 Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/Aes256Test.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/common/crypto/Aes256Cipher.class b/datatrans/bin/main/com/urpsys/kccfbat/common/crypto/Aes256Cipher.class new file mode 100644 index 00000000..148ef75d Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/common/crypto/Aes256Cipher.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/common/exception/CustomException.class b/datatrans/bin/main/com/urpsys/kccfbat/common/exception/CustomException.class new file mode 100644 index 00000000..27b35c25 Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/common/exception/CustomException.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/common/util/CommonUtil.class b/datatrans/bin/main/com/urpsys/kccfbat/common/util/CommonUtil.class new file mode 100644 index 00000000..1343c58c Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/common/util/CommonUtil.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/common/util/CommonUtils.class b/datatrans/bin/main/com/urpsys/kccfbat/common/util/CommonUtils.class new file mode 100644 index 00000000..32078f22 Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/common/util/CommonUtils.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/common/util/DataSourceUtil.class b/datatrans/bin/main/com/urpsys/kccfbat/common/util/DataSourceUtil.class new file mode 100644 index 00000000..4c0c6d16 Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/common/util/DataSourceUtil.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/common/util/ResultData.class b/datatrans/bin/main/com/urpsys/kccfbat/common/util/ResultData.class new file mode 100644 index 00000000..cf2a84d1 Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/common/util/ResultData.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/config/EncryptConfig.class b/datatrans/bin/main/com/urpsys/kccfbat/config/EncryptConfig.class new file mode 100644 index 00000000..4b6a21cb Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/config/EncryptConfig.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/config/Oauth2ResourceConfig.class b/datatrans/bin/main/com/urpsys/kccfbat/config/Oauth2ResourceConfig.class new file mode 100644 index 00000000..79d86db0 Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/config/Oauth2ResourceConfig.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/config/SwaggerConfig.class b/datatrans/bin/main/com/urpsys/kccfbat/config/SwaggerConfig.class new file mode 100644 index 00000000..307f7adc Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/config/SwaggerConfig.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/config/iamsDbConfig.class b/datatrans/bin/main/com/urpsys/kccfbat/config/iamsDbConfig.class new file mode 100644 index 00000000..e57432bf Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/config/iamsDbConfig.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/config/ncmsDbConfig.class b/datatrans/bin/main/com/urpsys/kccfbat/config/ncmsDbConfig.class new file mode 100644 index 00000000..c3adc14e Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/config/ncmsDbConfig.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/domain/CommonVO.class b/datatrans/bin/main/com/urpsys/kccfbat/domain/CommonVO.class new file mode 100644 index 00000000..40f2cfd4 Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/domain/CommonVO.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/domain/JWTKey.class b/datatrans/bin/main/com/urpsys/kccfbat/domain/JWTKey.class new file mode 100644 index 00000000..2739627c Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/domain/JWTKey.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/domain/TokenInfo.class b/datatrans/bin/main/com/urpsys/kccfbat/domain/TokenInfo.class new file mode 100644 index 00000000..29485bc3 Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/domain/TokenInfo.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/iams/dao/IamsDataDao.class b/datatrans/bin/main/com/urpsys/kccfbat/iams/dao/IamsDataDao.class new file mode 100644 index 00000000..ab2e5afe Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/iams/dao/IamsDataDao.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/ncms/dao/CommonDao.class b/datatrans/bin/main/com/urpsys/kccfbat/ncms/dao/CommonDao.class new file mode 100644 index 00000000..809f8a8a Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/ncms/dao/CommonDao.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/ncms/dao/NcmsDataDao.class b/datatrans/bin/main/com/urpsys/kccfbat/ncms/dao/NcmsDataDao.class new file mode 100644 index 00000000..271f6c61 Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/ncms/dao/NcmsDataDao.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/ncmsToIamsDataTransApplication.class b/datatrans/bin/main/com/urpsys/kccfbat/ncmsToIamsDataTransApplication.class new file mode 100644 index 00000000..eee8dda0 Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/ncmsToIamsDataTransApplication.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/scheduler/ConsoleScheduler.class b/datatrans/bin/main/com/urpsys/kccfbat/scheduler/ConsoleScheduler.class new file mode 100644 index 00000000..6812a235 Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/scheduler/ConsoleScheduler.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/service/CommonService.class b/datatrans/bin/main/com/urpsys/kccfbat/service/CommonService.class new file mode 100644 index 00000000..13dd2f0c Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/service/CommonService.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/service/IamsDataService.class b/datatrans/bin/main/com/urpsys/kccfbat/service/IamsDataService.class new file mode 100644 index 00000000..37c0fcf2 Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/service/IamsDataService.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/service/NcmsDataService.class b/datatrans/bin/main/com/urpsys/kccfbat/service/NcmsDataService.class new file mode 100644 index 00000000..5e9cebb2 Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/service/NcmsDataService.class differ diff --git a/datatrans/bin/main/com/urpsys/kccfbat/service/NcmsToIamsDataTransService.class b/datatrans/bin/main/com/urpsys/kccfbat/service/NcmsToIamsDataTransService.class new file mode 100644 index 00000000..c453d153 Binary files /dev/null and b/datatrans/bin/main/com/urpsys/kccfbat/service/NcmsToIamsDataTransService.class differ diff --git a/datatrans/bin/main/log4jdbc.log4j2.properties b/datatrans/bin/main/log4jdbc.log4j2.properties new file mode 100644 index 00000000..85d1ede9 --- /dev/null +++ b/datatrans/bin/main/log4jdbc.log4j2.properties @@ -0,0 +1,2 @@ +log4jdbc.spylogdelegator.name = net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator +log4jdbc.dump.sql.maxlinelength=0 \ No newline at end of file diff --git a/datatrans/bin/main/logback-spring.xml b/datatrans/bin/main/logback-spring.xml new file mode 100644 index 00000000..31ad4bcc --- /dev/null +++ b/datatrans/bin/main/logback-spring.xml @@ -0,0 +1,98 @@ + + + ${HOSTNAME} + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/datatrans/bin/main/mapper/iamsdb/config/MybatisIamsConfig.xml b/datatrans/bin/main/mapper/iamsdb/config/MybatisIamsConfig.xml new file mode 100644 index 00000000..dfb0172e --- /dev/null +++ b/datatrans/bin/main/mapper/iamsdb/config/MybatisIamsConfig.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/datatrans/bin/main/mapper/iamsdb/sqlmap/iamsDataMapper.xml b/datatrans/bin/main/mapper/iamsdb/sqlmap/iamsDataMapper.xml new file mode 100644 index 00000000..196eed55 --- /dev/null +++ b/datatrans/bin/main/mapper/iamsdb/sqlmap/iamsDataMapper.xml @@ -0,0 +1,185 @@ + + + + + + + + + + insert into rg_master + ( + master_id + , use_flag + , set_id + , reg_status + , title + , keyword + , type_div_cd + , erecord_flag + , org_nm + , creat_yyyy + , presv_term_cd + , expt_disuse_yyyy + , oper_read_range_cd + , open_div_cd + , reg_id + , reg_dd + , mod_id + , mod_dd + , mng_org_cd + , page_cnt + , series_id + , digital_yn + , oper_out_range_cd + , mng_org_nm + , asset_type + , tags + , management_code + , interface_id + , set_no + , digital_read_yn + , prsvn_proc_trgt_yn + , dtls_type_div_cd + ) + values + ( + #{master_id } + , #{use_flag } + , #{set_id } + , #{reg_status } + , #{title } + , #{keyword } + , #{type_div_cd } + , #{erecord_flag } + , #{org_nm } + , #{creat_yyyy } + , #{presv_term_cd } + , #{expt_disuse_yyyy } + , #{oper_read_range_cd } + , #{open_div_cd } + , #{reg_id } + , sysdate() + , #{mod_id } + , sysdate() + , #{mng_org_cd } + , #{page_cnt } + , #{series_id } + , #{digital_yn } + , #{oper_out_range_cd } + , #{mng_org_nm } + , #{asset_type } + , #{tag } + , #{management_code } + , #{interface_id } + , #{set_no } + , #{digital_read_yn } + , #{prsvn_proc_trgt_yn } + , '' + ) + + + + insert into j_attachfile + ( + file_mask + , file_id + , file_seq + , file_name + , file_size + , download_count + , atch_type_cd + , digital_read_yn + ) + values + ( + #{file_mask } + , #{file_id } + , #{file_seq } + , #{file_name } + , #{file_size } + , #{download_count } + , #{atch_type_cd } + , #{digital_read_yn } + ) + + + + insert into uare_master + ( + f_id + , org_name + , volume_id + , v_seq + , length + , comp_yn + , encrypt_yn + , org_date + , reg_date + , reg_time + , commit_stat + , session_key + , reg_user_id + , file_key + , f_group + , f_index + , bef_commit_stat + , repository + , clipid + , offset + ) + values + ( + #{f_id } + , #{org_name } + , #{volume_id } + , #{v_seq } + , #{length } + , #{comp_yn } + , #{encrypt_yn } + , #{org_date } + , #{reg_date } + , #{reg_time } + , #{commit_stat } + , #{session_key } + , #{reg_user_id } + , #{file_key } + , #{f_group } + , #{f_index } + , #{bef_commit_stat } + , #{repository } + , #{clipid } + , #{offset } + ) + + + + insert into uac_record + ( + record_id + , type_div_cd + , book_spcm_cpy_yn + ) + values + ( + #{record_id } + , #{type_div_cd } + , 'N' + ) + + + + + + + + + + \ No newline at end of file diff --git a/datatrans/bin/main/mapper/ncmsdb/config/MybatisNcmsConfig.xml b/datatrans/bin/main/mapper/ncmsdb/config/MybatisNcmsConfig.xml new file mode 100644 index 00000000..a61361c1 --- /dev/null +++ b/datatrans/bin/main/mapper/ncmsdb/config/MybatisNcmsConfig.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/datatrans/bin/main/mapper/ncmsdb/sqlmap/CommonMapper.xml b/datatrans/bin/main/mapper/ncmsdb/sqlmap/CommonMapper.xml new file mode 100644 index 00000000..4f9b446d --- /dev/null +++ b/datatrans/bin/main/mapper/ncmsdb/sqlmap/CommonMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/datatrans/bin/main/mapper/ncmsdb/sqlmap/ncmsDataMapper.xml b/datatrans/bin/main/mapper/ncmsdb/sqlmap/ncmsDataMapper.xml new file mode 100644 index 00000000..024e71f6 --- /dev/null +++ b/datatrans/bin/main/mapper/ncmsdb/sqlmap/ncmsDataMapper.xml @@ -0,0 +1,243 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + /* ncmsDataDao.updateResultMultimediaAssets */ + update multimedia_assets + SET iams_tran_yn = #{iams_tran_yn} + , iams_tran_dt = sysdate() + , iams_tran_remark = #{iams_tran_remark} + , iams_tran_master_id = #{iams_tran_master_id} + WHERE id = #{id} + + + + + + \ No newline at end of file diff --git a/datatrans/bin/main/secrets/UrpSystem.keystore b/datatrans/bin/main/secrets/UrpSystem.keystore new file mode 100644 index 00000000..39528f7c --- /dev/null +++ b/datatrans/bin/main/secrets/UrpSystem.keystore @@ -0,0 +1 @@ +aes256.key=52f48aa1c7435bc11bf909d9d7d1d5932f4bacd8184ec5c1eed6d03ee17fe126 \ No newline at end of file diff --git a/datatrans/bin/test/UrpKeyMng/LibraryTest.class b/datatrans/bin/test/UrpKeyMng/LibraryTest.class new file mode 100644 index 00000000..822d2ac9 Binary files /dev/null and b/datatrans/bin/test/UrpKeyMng/LibraryTest.class differ diff --git a/datatrans/build.gradle b/datatrans/build.gradle new file mode 100644 index 00000000..aebd4555 --- /dev/null +++ b/datatrans/build.gradle @@ -0,0 +1,96 @@ +plugins +{ + id 'org.springframework.boot' version '2.6.2' + id 'io.spring.dependency-management' version '1.0.11.RELEASE' + id 'org.asciidoctor.convert' version '1.5.8' + id 'java' + id 'war' +} + +group = 'com.urpsys' +version = '1.0.0-SNAPSHOT' +sourceCompatibility = '11' + +configurations +{ + compileOnly + { + extendsFrom annotationProcessor + } +} + +repositories +{ + mavenCentral() + maven { url "https://maven.egovframe.go.kr/maven/" } // egovframe maven 원격 저장소 +} + +ext +{ + set('snippetsDir', file("build/generated-snippets")) +} + +dependencies +{ + + implementation 'org.springframework.boot:spring-boot-starter-batch' + implementation 'org.springframework.boot:spring-boot-starter-cache' + implementation 'org.springframework.boot:spring-boot-starter-integration' + implementation 'org.springframework.boot:spring-boot-starter-mail' + implementation 'org.springframework.boot:spring-boot-starter-quartz' + implementation 'org.springframework.boot:spring-boot-starter-security' + implementation 'org.springframework.boot:spring-boot-starter-validation' + + implementation ('org.springframework.boot:spring-boot-starter-web') + { + exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat' + } + + implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2' // DB 처리 + + // oracle connect lib + // implementation group: 'com.oracle.database.jdbc', name: 'ojdbc8', version: '21.8.0.0' + // runtimeOnly 'org.mariadb.jdbc:mariadb-java-client' // mariadb 연결처리 + implementation 'com.mysql:mysql-connector-j:8.2.0' + + implementation 'org.springframework.boot:spring-boot-starter-undertow' + implementation 'org.springframework.boot:spring-boot-starter-webflux' + implementation 'org.apache.tomcat.embed:tomcat-embed-jasper' + + implementation 'org.apache.commons:commons-lang3:3.12.0' + + compileOnly 'org.projectlombok:lombok:1.18.20' + annotationProcessor 'org.projectlombok:lombok:1.18.20' + testCompileOnly 'org.projectlombok:lombok:1.18.20' + testAnnotationProcessor 'org.projectlombok:lombok:1.18.20' + + developmentOnly 'org.springframework.boot:spring-boot-devtools' + + implementation 'commons-codec:commons-codec:1.15' // 암호화처리 + implementation 'org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4.1:1.16' // sql log 처리 + + + implementation 'org.springframework.security.oauth:spring-security-oauth2:2.3.8.RELEASE' + implementation group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '2.3.3' // javax.xml.bind.JAXBException 오류시 추가 + implementation 'org.springframework.security:spring-security-jwt:1.0.9.RELEASE' + implementation 'com.konghq:unirest-java:3.7.02' // http 통신을 쉽게 하기 위함 + + // 2023.07.31 나혁제 swagger 추가 처리 + implementation 'io.springfox:springfox-swagger2:2.9.2' + implementation 'io.springfox:springfox-swagger-ui:2.9.2' + + +} + +test +{ + outputs.dir snippetsDir + useJUnitPlatform() +} + +asciidoctor +{ + inputs.dir snippetsDir + dependsOn test +} + diff --git a/datatrans/gradle/wrapper/gradle-wrapper.jar b/datatrans/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..41d9927a Binary files /dev/null and b/datatrans/gradle/wrapper/gradle-wrapper.jar differ diff --git a/datatrans/gradle/wrapper/gradle-wrapper.properties b/datatrans/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..aa991fce --- /dev/null +++ b/datatrans/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/datatrans/gradlew b/datatrans/gradlew new file mode 100644 index 00000000..1b6c7873 --- /dev/null +++ b/datatrans/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/datatrans/gradlew.bat b/datatrans/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/datatrans/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/datatrans/settings.gradle b/datatrans/settings.gradle new file mode 100644 index 00000000..504d8c91 --- /dev/null +++ b/datatrans/settings.gradle @@ -0,0 +1,10 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * The settings file is used to specify which projects to include in your build. + * + * Detailed information about configuring a multi-project build in Gradle can be found + * in the user manual at https://docs.gradle.org/7.4.2/userguide/multi_project_builds.html + */ + +rootProject.name = 'ncmsToIamsDataTrans' diff --git a/datatrans/settings.gradle.bak b/datatrans/settings.gradle.bak new file mode 100644 index 00000000..8d6054fc --- /dev/null +++ b/datatrans/settings.gradle.bak @@ -0,0 +1,11 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * The settings file is used to specify which projects to include in your build. + * + * Detailed information about configuring a multi-project build in Gradle can be found + * in the user manual at https://docs.gradle.org/7.4.2/userguide/multi_project_builds.html + */ + +rootProject.name = 'urpBaseResource' + diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/Aes256Test.java b/datatrans/src/main/java/com/urpsys/kccfbat/Aes256Test.java new file mode 100644 index 00000000..14d12072 --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/Aes256Test.java @@ -0,0 +1,124 @@ +package com.urpsys.kccfbat; + +import java.io.InputStream; +import java.security.InvalidKeyException; + +import javax.crypto.Cipher; +import javax.crypto.SecretKey; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; + +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.codec.binary.Hex; + +/** + * Hello world! + * + */ +public class Aes256Test +{ + private static SecretKey keySpec; // keySpec + private static IvParameterSpec ivSpec; // ivSpec + + + public static void main( String[] args ) + { + InputStream fis = null; + String secretKey = null; + + System.out.println( "Hello World!" ); + + secretKey = "52f48aa1c7435bc11bf909d9d7d1d5932f4bacd8184ec5c1eed6d03ee17fe126"; + + /* + if(args.length !=2 ) + { + System.out.println("Invalid args , args length 2 input "); + System.exit(0); + } + */ + + args = new String[2]; + args[0] = "enc"; + args[1] = "uac_cltr"; + + + try + { + byte[] secretKeyBytes = Hex.decodeHex(secretKey); + + if (secretKeyBytes.length != 32) + { + System.out.println("Invalid key (key length is not valid) "); + System.exit(0); + } + + byte[] ivBytes = new byte[16]; + + System.arraycopy(secretKeyBytes, 0, ivBytes, 0, 16); + + keySpec = new SecretKeySpec(secretKeyBytes, "AES"); + ivSpec = new IvParameterSpec(ivBytes); + + if(args[0].equals("enc")) + { + System.out.println( "암호로 변경" ); + + if (args[1] == null) + { + System.out.println("변경할 문자열이 없습니다."); + } + + String encryptedStr = null; + + try + { + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec); + byte[] encrypted = cipher.doFinal(args[1].getBytes("UTF-8")); + encryptedStr = new String(Base64.encodeBase64(encrypted)); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + + System.out.println( "["+ args[1] +"] 암호화로 변경 =============>"+ encryptedStr); + } + else if(args[0].equals("dec")) + { + System.out.println( "평문으로 변경" ); + + if (args[1] == null) + { + System.out.println("변경할 문자열이 없습니다."); + } + + String decryptedStr = null; + + try { + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + + cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec); + byte[] byteStr = Base64.decodeBase64(args[1].getBytes("UTF-8")); + decryptedStr = new String(cipher.doFinal(byteStr), "UTF-8"); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + + System.out.println( "["+ args[1] +"] 평문으로 변경 =============>"+ decryptedStr); + } + + + + } + catch(Exception e) + { + e.printStackTrace(); + } + + + } +} diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/common/crypto/Aes256Cipher.java b/datatrans/src/main/java/com/urpsys/kccfbat/common/crypto/Aes256Cipher.java new file mode 100644 index 00000000..3e0d3461 --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/common/crypto/Aes256Cipher.java @@ -0,0 +1,145 @@ +package com.urpsys.kccfbat.common.crypto; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.security.InvalidKeyException; +import java.util.Properties; + +import javax.crypto.Cipher; +import javax.crypto.SecretKey; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; + +import org.apache.commons.codec.DecoderException; +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.codec.binary.Hex; +import org.springframework.core.io.ClassPathResource; + +import com.urpsys.kccfbat.common.util.CommonUtil; + +/** + * aes 256 암호화 클래스 + * + * @author 나혁제 + * @since 2023.02.28 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일         수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2023.02.28     나혁제         최초작성
+ *
+ * 
+ */ + +public class Aes256Cipher +{ + private SecretKey keySpec; // keySpec + private IvParameterSpec ivSpec; // ivSpec + + /** + * Aes256Cipher 생성자 + * + * @param keyFile 키 파일 위치를 입력 받음 + * @throws IOException 파일 io 시 발생하는 익셉션 + * @throws InvalidKeyException key가 잘못되었을 경우 발생하는 익셉션 + * @throws DecoderException 암호화된 문자열을 decoding할 때 발생하는 익셉션 + */ + public Aes256Cipher() throws IOException, InvalidKeyException, DecoderException + { + + String activeProfile = (CommonUtil.nvl(System.getProperty("spring.profiles.active"))); + + InputStream fis = null; + String secretKey = null; + + try + { + fis = new ClassPathResource("secrets/UrpSystem.keystore").getInputStream(); + + Properties props = new Properties(); + props.load(fis); + secretKey = props.getProperty("aes256.key"); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + finally + { + fis.close(); + } + + byte[] secretKeyBytes = Hex.decodeHex(secretKey); + + if (secretKeyBytes.length != 32) { + throw new InvalidKeyException("Invalid key (key length is not valid) "); + } + + byte[] ivBytes = new byte[16]; + + System.arraycopy(secretKeyBytes, 0, ivBytes, 0, 16); + + keySpec = new SecretKeySpec(secretKeyBytes, "AES"); + ivSpec = new IvParameterSpec(ivBytes); + } + + /** + * encryption 하는 메소드 + * + * @param plainStr 평문을 입력 받음 + * @return 암호화된 문자열 + */ + public String encrypt(String plainStr) + { + if (plainStr == null) { + return null; + } + + String encryptedStr = null; + + try { + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec); + byte[] encrypted = cipher.doFinal(plainStr.getBytes("UTF-8")); + encryptedStr = new String(Base64.encodeBase64(encrypted)); + } catch (Exception ex) { + ex.printStackTrace(); + } + + return encryptedStr; + } + + /** + * 암호화된 문자열을 복호화하는 메소드 + * + * @param encryptedStr 암호화된 문자열 + * @return 암호화가 해제된 문자열 + */ + public String decrypt(String encryptedStr) + { + if (encryptedStr == null) + { + return null; + } + + String decryptedStr = null; + + try { + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + + cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec); + byte[] byteStr = Base64.decodeBase64(encryptedStr.getBytes("UTF-8")); + decryptedStr = new String(cipher.doFinal(byteStr), "UTF-8"); + } catch (Exception ex) { + ex.printStackTrace(); + } + + return decryptedStr; + } +} diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/common/exception/CustomException.java b/datatrans/src/main/java/com/urpsys/kccfbat/common/exception/CustomException.java new file mode 100644 index 00000000..74f1f592 --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/common/exception/CustomException.java @@ -0,0 +1,114 @@ +package com.urpsys.kccfbat.common.exception; + +import java.sql.SQLSyntaxErrorException; + +import lombok.Getter; + +/** + * Custom exception 클래스 + * + * @author 나혁제 + * @since 2023.02.28 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일        수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2023.02.28    나혁제         최초작성
+ *
+ * 
+ */ + +public class CustomException extends Exception +{ + private static final long serialVersionUID = 3559302713942492181L; + + @Getter + private String errorCode; + + @Getter + private String errorMsg; + + /** + * 생성자(throwable를 받아서 exception 종류에 따라 에러 코드 정의하는 클래스) + * 에러코드 처리 부분은 향후 db에서 에러코드 읽어와서 매핑하는 것으로 + * 변경 가능성 있음 + * @param throwable + */ + public CustomException(Throwable throwable) { + Throwable rootThrowable = getRootCause(throwable); + + // TODO 에러 코드는 상세 정의해서 define 해야 함 + if(rootThrowable instanceof SQLSyntaxErrorException) { + this.errorCode = "100"; + this.errorMsg = "SQL 오류"; + } else if(rootThrowable instanceof ArithmeticException) { + this.errorCode = "200"; + this.errorMsg = "연산 오류"; + } else { + this.errorCode = "900"; + this.errorMsg = "Unknown Error"; + } + } + + /** + * 생성자(에러메시지만 받을 경우 에러코드를 0을 default로 세팅) + * @param errorMsg + */ + public CustomException(String errorMsg) { + super(errorMsg); + this.errorCode = "0"; + this.errorMsg = errorMsg; + } + + /** + * 생성자(errorcode, errmsg를 받아 세팅, 소스코드에서 편하게 사용하기 위해 + * 에러코드를 int 값으로 받으면 string으로 변환하여 저장) + * @param errorCode + * @param errorMsg + */ + public CustomException(int errorCode, String errorMsg) { + super(errorMsg); + this.errorCode = String.valueOf(errorCode); + this.errorMsg = errorMsg; + } + + /** + * 생성자(에러코드, 에러메시지를 받아 세팅) + * @param errorCode + * @param errorMsg + */ + public CustomException(String errorCode, String errorMsg) { + super(errorMsg); + this.errorCode = errorCode; + this.errorMsg = errorMsg; + } + + /** + * stack에서 에러코드 중 root cause를 찾아내는 메소드 + * @param throwable + * @return + */ + private Throwable getRootCause(Throwable throwable) { + Throwable cause = throwable.getCause(); + + if (cause == null) { + return throwable; + } + + while (true) { + + if(cause.getCause() == null) { + break; + } else { + cause = cause.getCause(); + } + } + + return cause; + } +} diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/common/util/CommonUtil.java b/datatrans/src/main/java/com/urpsys/kccfbat/common/util/CommonUtil.java new file mode 100644 index 00000000..fe2b0869 --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/common/util/CommonUtil.java @@ -0,0 +1,503 @@ +package com.urpsys.kccfbat.common.util; + +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.SimpleTimeZone; +import java.util.Vector; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.lang3.StringUtils; +import org.codehaus.jettison.json.JSONException; +import org.codehaus.jettison.json.JSONObject; +import org.springframework.http.HttpHeaders; +import org.springframework.security.jwt.Jwt; +import org.springframework.security.jwt.JwtHelper; +import org.springframework.security.oauth2.provider.token.RemoteTokenServices; + +import com.google.gson.FieldNamingPolicy; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.urpsys.kccfbat.common.exception.CustomException; +import com.urpsys.kccfbat.domain.TokenInfo; + +/** + * 공통 유틸리티를 모아둔 클래스 + * + * @author 나혁제 + * @since 2023.02.28 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일        수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2023.02.28    나혁제         최초작성
+ *
+ *      
+ */ + +public class CommonUtil +{ + /** + * nvl 메소드 + * @param inputStr + * @return + */ + public static String nvl(String inputStr) { + return (inputStr != null) ? inputStr.trim() : ""; + } + + /** + * nvl 메소드 + * @param inputStr + * @param defaultValue + * @return + */ + public static String nvl(String inputStr, String defaultValue) { + return nvl(inputStr).contentEquals("") ? defaultValue : inputStr.trim(); + } + + /** + * nvl 메소드 + * @param inputObj + * @return + */ + public static String nvl(Object inputObj) { + return (inputObj != null) ? String.valueOf(inputObj).trim() : ""; + } + + /** + * long 타입의 시간을 입력받아 날짜 형태로 변환해서 리턴해주는 함수 + * + * @param longTime long type 시간 + * @param dateFormat 변환할 포맷 + * @return 변환된 날짜 String + * @throws SystemException + */ + public static String getTimeString(long longTime, String dateFormat) throws CustomException { + SimpleDateFormat sdf = new SimpleDateFormat(dateFormat, Locale.KOREA); + + if (longTime < 0) + { + return ""; + } + else { + try { + return sdf.format(new Date(longTime)); + } catch (Exception e) { + throw new CustomException("Date 변환 오류"); + } + } + } + + /** + * 현재(한국기준) 시간정보를 얻는다.
+ * (예) 입력파리미터인 format string에 "yyyyMMddhh"를 셋팅하면 1998121011과 같이 Return.
+ * (예) format string에 "yyyyMMddHHmmss"를 셋팅하면 19990114232121과 같이 + * 0~23시간 타입으로 Return.
+ * String CurrentDate = CtosUtil2.getKST("yyyyMMddHH");
+ * @param format 얻고자하는 현재시간의 Type + * @return str 현재 한국 시간. + */ + public static String getKST(String format) + { + //1hour(ms) = 60s * 60m * 1000ms + int millisPerHour = 60 * 60 * 1000; + SimpleDateFormat fmt= new SimpleDateFormat(format); + + SimpleTimeZone timeZone = new SimpleTimeZone(9*millisPerHour,"KST"); + fmt.setTimeZone(timeZone); + + long time=System.currentTimeMillis(); + String str=fmt.format(new java.util.Date(time)); + return str; + } + + /** + * 입력한 날짜 기준으로 몇일 전,후 (주의)입력날짜는 구분자가 없는 string형 + * + * @param date + * string date (19991002) + * @param Day + * 기준이 되는 시간 + * @return String + */ + public static String getDatewithSpan(String date, long Day) + { + /* + * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new + * SimpleDateFormat("yyyy/MM/dd"); SimpleTimeZone timeZone = new + * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); + * + * int year = Integer.valueOf(date.substring(0,4)).intValue(); int month + * = Integer.valueOf(date.substring(4,6)).intValue(); int day = + * Integer.valueOf(date.substring(6,8)).intValue(); + * + * java.util.Calendar aDay = Calendar.getInstance(); + * aDay.set(year+1900,month,day); java.util.Calendar bDay + * =Calendar.getInstance(); bDay.set(1970+1900,1,1); java.util.Date cDay + * = new java.util.Date((aDay.getTime()).getTime() - + * (bDay.getTime()).getTime() + ((Day+1)*86400000) ); + * + * return fmt.format(cDay); + */ + // 2006-09-04 7:03오후 오동원수정 + String vFORMAT = "yyyy/MM/dd"; + return getDatewithSpan(date, Day, "D", vFORMAT); + + } + + /** + * 입력한 날짜 기준으로 몇(일,시간,분) 전,후 (주의)입력날짜는 구분자가 없는 string형
+ * + * @param date + * string date (20000315/2000031509/200003150915) + * @param unit + * long unit: 몇(일,시간,분) 전, 몇(일,시간,분) 후 + * @param type + * String type: D:Day H:Hour M:Minute + * @return String 계산된 문자열의 값. + */ + public static String getDatewithSpan(String date, long unit, String type, String strFormatType) + { + /* + * String formatType = strFormatType; int ihour = 0; int itime = 0; + * + * long dhm = 24 * 60 * 60 * 1000; + * + * if (type.equals("D")) { dhm =dhm + unit * 24 * 60 * 60 * 1000; } else + * if (type.equals("H")){ dhm =dhm + unit * 60 * 60 * 1000; } else if + * (type.equals("M")){ dhm =dhm + unit * 60 * 1000; } else{ return type + * + "은 부적절한 Type값입니다"; } + * + * switch (date.length()){ case (8): if (type.equals("H") || + * type.equals("M")) { return "HM-ERROR"; } + * + * break; case (10): if (type.equals("M")) { return "M-ERROR"; } + * + * ihour = Integer.valueOf(date.substring(8,10)).intValue(); break; case + * (12): + * + * ihour = Integer.valueOf(date.substring(8,10)).intValue(); itime = + * Integer.valueOf(date.substring(10,12)).intValue(); break; default: + * return "date Length Error"; } + * + * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new + * SimpleDateFormat(formatType); SimpleTimeZone timeZone = new + * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); + * + * int iyear = Integer.valueOf(date.substring(0,4)).intValue(); int + * imonth = Integer.valueOf(date.substring(4,6)).intValue(); int iday = + * Integer.valueOf(date.substring(6,8)).intValue(); java.util.Calendar + * aDay = Calendar.getInstance(); + * aDay.set(iyear+1900,imonth,iday,ihour,itime); java.util.Calendar bDay + * = Calendar.getInstance(); bDay.set(1970+1900,1,1,9,0); java.util.Date + * cDay = new java.util.Date((aDay.getTime()).getTime() - + * (bDay.getTime()).getTime() + dhm); return fmt.format(cDay); + */ + // 2006-09-04 7:03오후 오동원수정 + String formatType = strFormatType; + int ihour = 0; + int itime = 0; + if(!(type.equals("D") || type.equals("H") || type.equals("M"))) + { + return type + "은 부적절한 Type값입니다"; + } + + switch(date.length()) + { + case (8): + if(type.equals("H") || type.equals("M")) + { + return "HM-ERROR"; + } + break; + case (10): + if(type.equals("M")) + { + return "M-ERROR"; + } + ihour = Integer.parseInt(date.substring(8, 10)); + // ihour = Integer.valueOf(date.substring(8, 10)).intValue(); + break; + case (12): + ihour = Integer.parseInt(date.substring(8, 10)); + itime = Integer.parseInt(date.substring(10, 12)); + + // ihour = Integer.valueOf(date.substring(8, 10)).intValue(); + // itime = Integer.valueOf(date.substring(10, 12)).intValue(); + break; + default: + return "date Length Error"; + } + int iyear = Integer.parseInt(date.substring(0, 4)); + int imonth = Integer.parseInt(date.substring(4, 6)); + int iday = Integer.parseInt(date.substring(6, 8)); + + /* + int iyear = Integer.valueOf(date.substring(0, 4)).intValue(); + int imonth = Integer.valueOf(date.substring(4, 6)).intValue(); + int iday = Integer.valueOf(date.substring(6, 8)).intValue(); + */ + + int imonth1 = imonth - 1; // 달은 0달부터 시작한다. + java.util.Calendar zDay = Calendar.getInstance(); + zDay.set(iyear, imonth1, iday, ihour, itime); + + if(type.equals("D")) + { + zDay.add(Calendar.DATE, (int) unit); + } + else if(type.equals("H")) + { + zDay.add(Calendar.HOUR_OF_DAY, (int) unit); + } + else if(type.equals("M")) + { + zDay.add(Calendar.MINUTE, (int) unit); + } + else + { + return type + "은 부적절한 Type값입니다"; + } + java.util.Date z1Day = zDay.getTime(); + java.text.SimpleDateFormat fmt2 = new java.text.SimpleDateFormat(formatType); + return fmt2.format(z1Day); + + } + + /** + * 현재 시간을 기준으로 몇 일후 시간 시간의 형태는 (yyyy/mm/dd) + * + * @param day + * 더하려는 날짜 + * @return str 현재 시간에 입력 시간을 더한 DATE형 시간 + */ + public static String getDatewithSpan(long day) + { + /* + * int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt= new + * SimpleDateFormat("yyyy/MM/dd"); SimpleTimeZone timeZone = new + * SimpleTimeZone(9*millisPerHour,"KST"); fmt.setTimeZone(timeZone); + * + * long time = System.currentTimeMillis(); long span = ( 60 * 60 * 1000 + * * 24 ) * day; //하루에 대한 millisecond... long time2 = time + span; + * String str=fmt.format(new java.util.Date(time2)); + * + * return str; + */ + String strSYSDATE = CommonUtil.getKST("yyyyMMddHH"); // 지금 시간 + String vFORMAT = "yyyy/MM/dd"; + return getDatewithSpan(strSYSDATE, day, "D", vFORMAT); + + } + + public static long stol(String str) + { + if(str == null ) return 0; + return (Long.valueOf(str).longValue()); + } + + /** + 문자열을 중 특정 문자열을 변환시킨다. + @version 1.0 + @author Yoon Su-wan + @since JDK1.0 + @param targeter 대상문자열 + @param target_str 변환될 대상문자열 + @param replace_str 변환될 문자열 + @return target_str이 replace_str로 변환된 문자열 + */ + public static String getReplacedString(String targeter, String target_str, String replace_str) + { + if( targeter == null + || target_str == null + || replace_str == null ) + return "debug : parameter value is null"; + + if(target_str.length() == 0) + return targeter; + + StringBuffer str = new StringBuffer(); + int start_ptr = 0; + int current_ptr = 0; + int increment_size = replace_str.length(); + if(increment_size == 0 ) increment_size = 1; + + while((current_ptr = targeter.indexOf(target_str, start_ptr)) != -1) + { + str.append(targeter.substring(start_ptr, current_ptr)); + str.append(replace_str); + start_ptr = current_ptr + increment_size; + if(start_ptr >= targeter.length()) + break; + }//end while + + if(start_ptr == 0) + return targeter; + + if(start_ptr < targeter.length()) + str.append(targeter.substring(start_ptr)); + + return str.toString(); + }//getReplacedString(String targeter, String target_str, String replace_str) + + /** + 받은메세지에서 v_s1값을 찾아서 v_s2로 대치한다. + @version 1.0 + @author Yoon Su-wan + @since JDK1.0 + @param v_msg 대상문자열 + @param v_s1 변환될 대상문자열 + @param v_s2 변환될 문자열 + @return v_s1이 v_s2 변환된 문자열 + */ + + public static String getReplacedString2(String v_msg, String v_s1, String v_s2) + { + int idx = v_msg.indexOf(v_s1); + + if (idx == -1) return v_msg; + else + { + try + { + return v_msg.substring(0, idx) + v_s2 + v_msg.substring(idx+2); + } catch (Exception e) + { + return v_msg.substring(0, idx) + v_s2; + } + } + + } + + public static String getReplacedString3(String sStr, String n1, String n2) + { + int iTmp = 0; + if (sStr == null) return ""; + + String sTmp = sStr; + StringBuffer sbSave = new StringBuffer(); + sbSave.append(""); + while (sTmp.indexOf(n1) > -1) + { + iTmp = sTmp.indexOf(n1); + sbSave.append(sTmp.substring(0,iTmp)); + sbSave.append(n2); + sTmp = sTmp.substring(iTmp + n1.length()); + } + sbSave.append(sTmp); + return sbSave.toString(); + } + + public static Vector arrToDouVector(String strArray, String strDelimt) + { + String[] stArray = strArray.split(strDelimt); + + double[] dArray = Arrays.stream(stArray).mapToDouble(Double::parseDouble).toArray(); + Vector vReturn = new Vector(); + + if(dArray==null) return vReturn; + + for(double dTemp: dArray) + { + vReturn.add(dTemp); + } + + return vReturn; + + } + + public static String arrListToString(List list) + { + String strReturn=""; + + if(list == null ) return ""; + + for(int i=0; i"+strTemp); + // double dou = Double.parseDouble(strTemp); + // strReturn = strReturn+","+dou; + strReturn = strReturn+","+strTemp; + } + + strReturn = strReturn.substring(1); + + return strReturn; + + } + + /** + Map 데이터를 JSONObject로 변환. + @version 1.0 + @author Yoon Su-wan + @since JDK1.0 + @param v_msg Map + @return JSONObject + */ + public static JSONObject getJsonFromMap(Map map) throws JSONException + { + JSONObject jsonData = new JSONObject(); + + for (String key : map.keySet()) + { + Object value = map.get(key); + if (value instanceof Map) + { + value = getJsonFromMap((Map) value); + } + jsonData.put(key, value); + } + return jsonData; + } + + public static TokenInfo getAccessTokenInfo(HttpServletRequest request) + { + TokenInfo tokenInfo = null; + String authorization = request.getHeader(HttpHeaders.AUTHORIZATION); + RemoteTokenServices tokenServices = new RemoteTokenServices(); + + if(StringUtils.startsWithIgnoreCase(authorization, "Bearer")) + { + /* + * FieldNamingPolicy 옵션 + * IDENTITY : 변경 없음 + * LOWER_CASE_WITH_DASHES : '-' 붙이기 + * LOWER_CASE_WITH_DOTS : '.' 붙이기 + * LOWER_CASE_WITH_UNDERSCORES : '_' 붙이기 + * UPPER_CAMEL_CASE : 첫문자 대문자로 + * UPPER_CAMEL_CASE_WITH_SPACES : 첫문자 대문자 + ' ' 공택붙이기 + * + */ + + String strTocken = ""; + strTocken = StringUtils.replace(authorization, "Bearer ",""); + strTocken = StringUtils.replace(authorization, "bearer ",""); + + Jwt jwt = JwtHelper.decode(strTocken); + + // Jwt jwt = JwtHelper.decode(StringUtils.replace(authorization, "Bearer ","")); + // Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create(); // snakecase to camelcase + Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.IDENTITY).create(); // snakecase to camelcase + + tokenInfo = gson.fromJson(jwt.getClaims(), TokenInfo.class); + } + + return tokenInfo; + } + + + + +} diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/common/util/CommonUtils.java b/datatrans/src/main/java/com/urpsys/kccfbat/common/util/CommonUtils.java new file mode 100644 index 00000000..4b2352cf --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/common/util/CommonUtils.java @@ -0,0 +1,76 @@ +package com.urpsys.kccfbat.common.util; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.UUID; + +import io.undertow.util.DateUtils; + +/** + * 통합자료관리시스펨 공통 유틸리티를 모아둔 클래스 + * + * @author 나혁제 + * @since 2026.03.03 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일        수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2026.03.03    나혁제         최초작성
+ *
+ *      
+ */ + +public class CommonUtils +{ + /** + *
+	 * - PK로 사용 가능한 유니크 키 생성
+	 * - UUID 32byte + prefix 3byte = 총 35byte
+	 * 
+ * + * @param prefix 생성된 UUID을 구분해줄수 있는 업무코드 + * @return 인자값으로 입력된 prefix와 UUID를 합친 문자열 ex) + * LR-356015096E2542779E11C946DB93B952 + */ + public static String getUUID(String prefix) + { + return prefix.toUpperCase() + "-" + UUID.randomUUID().toString().toUpperCase().replaceAll("-", ""); + } + + public static String getUUID() + { + return UUID.randomUUID().toString().toUpperCase().replaceAll("-", ""); + } + + public static String getFileMask() + { + return getSysDate("yyyyMMddHHmmss") + CommonUtils.getUUID(); + } + + /** + * 날짜 입력양식을 전달받아 현재 날짜를 반환. + * @param pattern 입력 양식. + * @return String 날짜 입력 양식. + */ + public static String getSysDate(String pattern) + { + return getDateString(new Date(), pattern); + } + + /** + * Date 객체와 입력양식을 전달받아 날짜를 반환. + * @param date Date 객체. + * @param pattern 입력 양식. + * @return String 날짜. + */ + public static String getDateString(Date date, String pattern) + { + SimpleDateFormat sdf = new SimpleDateFormat(pattern); + return sdf.format(date); + } +} diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/common/util/DataSourceUtil.java b/datatrans/src/main/java/com/urpsys/kccfbat/common/util/DataSourceUtil.java new file mode 100644 index 00000000..840be922 --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/common/util/DataSourceUtil.java @@ -0,0 +1,113 @@ +package com.urpsys.kccfbat.common.util; + +import java.sql.Connection; + +import javax.sql.DataSource; + +import org.apache.ibatis.session.SqlSessionFactory; +import org.mybatis.spring.SqlSessionFactoryBean; +import org.springframework.core.env.Environment; +import org.springframework.core.io.Resource; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; + +import com.urpsys.kccfbat.common.crypto.Aes256Cipher; +import com.urpsys.kccfbat.common.exception.CustomException; +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; + +/** + * Datasource 생성하는 유틸리티 + * + * @author 나혁제 + * @since 2023.02.28 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일        수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2023.02.28    나혁제         최초작성
+ *
+ * 
+ */ + +public class DataSourceUtil +{ + /** + * 데이터 소스 만드는 메소드 + * @param dataSourceName + * @param env + * @param cipher + * @return + */ + public static DataSource createDataSource(String dataSourceName, Environment env, Aes256Cipher cipher) + { + HikariConfig config = new HikariConfig(); + + config.setDriverClassName (env.getProperty(dataSourceName + ".driverClassName" )); + config.setJdbcUrl (env.getProperty(dataSourceName + ".jdbcUrl" )); + + config.setUsername (cipher.decrypt(env.getProperty(dataSourceName + ".username"))); + config.setPassword (cipher.decrypt(env.getProperty(dataSourceName + ".password"))); + + config.setAutoCommit(false); + + config.setMaximumPoolSize (Integer.parseInt(env.getProperty(dataSourceName + ".maximumPoolSize" ))); + config.setMinimumIdle (Integer.parseInt(env.getProperty(dataSourceName + ".minimumIdle" ))); + config.setConnectionTimeout (Long.parseLong (env.getProperty(dataSourceName + ".connectionTimeout" ))); + config.setIdleTimeout (Long.parseLong (env.getProperty(dataSourceName + ".idleTimeout" ))); + + config.addDataSourceProperty("cachePrepStmts" , "true"); + config.addDataSourceProperty("prepStmtCacheSize" , "250"); + config.addDataSourceProperty("prepStmtCacheSqlLimit" , "2048"); + + return new HikariDataSource(config); + } + + /** + * SqlSessionFactory 만드는 메소드 + * @param dataSource + * @param configLocation + * @param mapperLocation + * @return + * @throws CustomException + */ + public static SqlSessionFactory createSqlSessionFactory(DataSource dataSource, Resource configLocation, + Resource[] mapperLocation) throws CustomException + { + SqlSessionFactory sqlSessionFactory; + + try { + SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean(); + sessionFactoryBean.setDataSource(dataSource); + sessionFactoryBean.setConfigLocation(configLocation); + sessionFactoryBean.setMapperLocations(mapperLocation); + + sqlSessionFactory = sessionFactoryBean.getObject(); + } + catch (Exception ex) + { + throw new CustomException(ex.getMessage()); + } + + return sqlSessionFactory; + } + + /** + * 트랜잭션 처리 메소드 + * @param dataSource + * @return + */ + public static DataSourceTransactionManager createTxManager(DataSource dataSource) + { + DataSourceTransactionManager txManager = new DataSourceTransactionManager(dataSource); + txManager.setGlobalRollbackOnParticipationFailure(false); + + return txManager; + } + + //end method +} diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/common/util/ResultData.java b/datatrans/src/main/java/com/urpsys/kccfbat/common/util/ResultData.java new file mode 100644 index 00000000..217ab5d5 --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/common/util/ResultData.java @@ -0,0 +1,222 @@ +package com.urpsys.kccfbat.common.util; + +import java.util.Date; + +import org.springframework.http.ResponseEntity; + +import com.fasterxml.jackson.annotation.JsonInclude; + +import lombok.Data; + +/** + * Result Data 처리을 하는 유틸리티 + * + * @author 나혁제 + * @since 2023.02.28 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일        수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2023.02.28    나혁제         최초작성
+ *
+ * 
+ */ + +@Data +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ResultData +{ + private Object data; + private Integer status = 200; + private Integer totalCount; + private String code = "OK"; + private String message = "Success"; + private Date timestamp = new Date(); + + /** + * + */ + public ResultData() + { + } + + /** + * @param messageOrCode + */ + public ResultData(Object data) + { + this.data = data; + } + + /** + * @param messageOrCode + */ + public ResultData(Object data, String code) + { + this.data = data; + this.code = code; + this.message = ""; + // this.message = MsgUtil.getMessage(code); + } + + /** + * Method Name : setCodeAndMessage + * Description : + * + * @param messageOrCode 지정된 파라미터 값으로 서비스 호출시 사용 + * @param params 지정된 파라미터 값으로 서비스 호출시 사용 + * @return ResultData + */ + public void setCodeAndMessage(String code, Object... params) + { + this.setCode(code); + this.setMessage(""); + // this.setMessage(MsgUtil.getMessage(code, params)); + } + + /** + * Method Name : ok + * Description : + * + * @param messageOrCode 지정된 파라미터 값으로 서비스 호출시 사용 + * @param params 지정된 파라미터 값으로 서비스 호출시 사용 + * @return ResultData + */ + public static ResponseEntity ok(Object data) + { + var resultData = new ResultData(); + resultData.setData(data); + + return ResponseEntity.ok(resultData); + } + + /** + * Method Name : ok + * Description : + * + * @param messageOrCode 지정된 파라미터 값으로 서비스 호출시 사용 + * @param params 지정된 파라미터 값으로 서비스 호출시 사용 + * @return ResultData + */ + public static ResponseEntity ok(ResultData resultData) + { + return ResponseEntity.ok(resultData); + } + + /** + * Method Name : ok + * Description : + * + * @param messageOrCode 지정된 파라미터 값으로 서비스 호출시 사용 + * @param params 지정된 파라미터 값으로 서비스 호출시 사용 + * @return ResultData + */ + public static ResponseEntity ok(int totalCount, Object data) + { + var resultData = new ResultData(); + resultData.setData(data); + resultData.setTotalCount(totalCount); + + return ResponseEntity.ok(resultData); + } + + /** + * Method Name : ok + * Description : + * + * @param messageOrCode 지정된 파라미터 값으로 서비스 호출시 사용 + * @param params 지정된 파라미터 값으로 서비스 호출시 사용 + * @return ResultData + */ + public static ResponseEntity ok(Object data, String code) + { + var resultData = new ResultData(); + resultData.setData(data); + resultData.setCode(code); + resultData.setMessage(""); + // resultData.setMessage(MsgUtil.getMessage(code)); + + return ResponseEntity.ok(resultData); + } + + /** + * Method Name : ok + * Description : + * + * @param messageOrCode 지정된 파라미터 값으로 서비스 호출시 사용 + * @param params 지정된 파라미터 값으로 서비스 호출시 사용 + * @return ResultData + */ + public static ResponseEntity ok(int totalCount, Object data, String code) + { + var resultData = new ResultData(); + resultData.setData(data); + resultData.setCode(code); + resultData.setTotalCount(totalCount); + resultData.setMessage(""); + // resultData.setMessage(MsgUtil.getMessage(code)); + + return ResponseEntity.ok(resultData); + } + + /** + * Method Name : ok + * Description : + * + * @param messageOrCode 지정된 파라미터 값으로 서비스 호출시 사용 + * @param params 지정된 파라미터 값으로 서비스 호출시 사용 + * @return ResultData + */ + public static ResponseEntity ok(Object data, String code, Object... params) + { + var resultData = new ResultData(); + resultData.setData(data); + resultData.setCode(code); + resultData.setMessage(""); + // resultData.setMessage(MsgUtil.getMessage(code, params)); + + return ResponseEntity.ok(resultData); + } + + /** + * Method Name : okMessage + * Description : + * + * @param messageOrCode 지정된 파라미터 값으로 서비스 호출시 사용 + * @param params 지정된 파라미터 값으로 서비스 호출시 사용 + * @return ResultData + */ + public static ResponseEntity okMessage(String code) + { + var resultData = new ResultData(); + resultData.setCode(code); + resultData.setMessage(""); + // resultData.setMessage(MsgUtil.getMessage(code)); + + return ResponseEntity.ok(resultData); + } + + /** + * Method Name : okMessage + * Description : + * + * @param messageOrCode 지정된 파라미터 값으로 서비스 호출시 사용 + * @param params 지정된 파라미터 값으로 서비스 호출시 사용 + * @return ResultData + */ + public static ResponseEntity okMessage(String code, Object... params) + { + var resultData = new ResultData(); + resultData.setCode(code); + resultData.setMessage(""); + + // resultData.setMessage(MsgUtil.getMessage(code, params)); + + return ResponseEntity.ok(resultData); + } +} diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/config/EncryptConfig.java b/datatrans/src/main/java/com/urpsys/kccfbat/config/EncryptConfig.java new file mode 100644 index 00000000..1dd03f66 --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/config/EncryptConfig.java @@ -0,0 +1,38 @@ +package com.urpsys.kccfbat.config; + +import java.io.IOException; +import java.security.InvalidKeyException; +import org.apache.commons.codec.DecoderException; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.urpsys.kccfbat.common.crypto.Aes256Cipher; + +/** + * 암호화 유틸리티를 등록하는 클래스 + * + * @author 나혁제 + * @since 2023.02.28 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일       수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2023.02.28   나혁제         최초작성
+ *
+ * 
+ */ + +@Configuration +public class EncryptConfig +{ + @Bean(name="aes256Cipher") + public Aes256Cipher aes256Cipher() throws InvalidKeyException, IOException, DecoderException + { + return new Aes256Cipher(); + } +} diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/config/Oauth2ResourceConfig.java b/datatrans/src/main/java/com/urpsys/kccfbat/config/Oauth2ResourceConfig.java new file mode 100644 index 00000000..79eefb5a --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/config/Oauth2ResourceConfig.java @@ -0,0 +1,166 @@ +package com.urpsys.kccfbat.config; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpMethod; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter; +import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer; +import org.springframework.security.oauth2.provider.token.TokenStore; +import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; +import org.springframework.security.oauth2.provider.token.store.JwtTokenStore; + +import com.google.gson.Gson; + +import kong.unirest.JsonNode; +import kong.unirest.Unirest; +import lombok.extern.slf4j.Slf4j; + +import com.urpsys.kccfbat.common.exception.CustomException; +import com.urpsys.kccfbat.domain.CommonVO; +import com.urpsys.kccfbat.domain.JWTKey; +import com.urpsys.kccfbat.service.CommonService; + +/** + * Resource 서버 기본세팅 + * + * @author 나혁제 + * @since 2023.02.28 + * @version 1.0.0 + * @see + * @comment : + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일       수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2023.02.28  나혁제         최초작성
+ *
+ * 
+ */ + +@Slf4j +@Configuration +public class Oauth2ResourceConfig extends ResourceServerConfigurerAdapter +{ + @Autowired + CommonService commonService; // 공통 서비스 + + @Override + public void configure(ResourceServerSecurityConfigurer resources) throws Exception + { + resources.resourceId("event"); // 최소한 리소스ID 정도는 설정 필요 + } + + @Value("${spring.security.oauth2.resourceserver.jwt.jwk-set-uri}") + private String publicKeyUri; // key 정보를 받아오기 위한 인증서버 URL 선언 + + @Override + public void configure(HttpSecurity http) throws Exception + { + http.authorizeRequests().mvcMatchers("/test/**" ).permitAll(); // test API + http.authorizeRequests().mvcMatchers("/api/**" ).permitAll(); // test API + http.authorizeRequests().mvcMatchers("/server/**" ).permitAll(); // test API + + http.authorizeRequests().mvcMatchers("/swagger-resources/**" ).permitAll(); // api 문서 관련 + http.authorizeRequests().mvcMatchers("/swagger-ui**" ).permitAll(); // api 문서 관련 + http.authorizeRequests().mvcMatchers("/swagger-ui/**" ).permitAll(); // api 문서 관련 + http.authorizeRequests().mvcMatchers("/webjars/**" ).permitAll(); // api 문서 관련 + http.authorizeRequests().mvcMatchers("/v2/**" ).permitAll(); // api 문서 관련 + http.authorizeRequests().mvcMatchers("/swagger/**" ).permitAll(); // api 문서 관련 + + http.authorizeRequests().anyRequest().authenticated(); + } + + @Bean + public TokenStore tokenStore() + { + log.info(">>>>>>>>>> Oauth2ResourceConfig tokenStore <<<<<<<<<<"); + log.info("<<<<<<<<<< Oauth2ResourceConfig tokenStore >>>>>>>>>>"); + + return new JwtTokenStore(jwtAccessTokenConverter()); + } + + @Bean + public JwtAccessTokenConverter jwtAccessTokenConverter() + { + log.info(">>>>>>>>>> Oauth2ResourceConfig jwtAccessTokenConverter <<<<<<<<<<"); + + try + { + /*** * 직접 oauth 서버를 호출하여 공개키 읽어서 jwt 디코드 키 등록 */ + JwtAccessTokenConverter converter = new JwtAccessTokenConverter(); + + // 보안키 획득 + String strPrivKey = getPublicKeyValue(publicKeyUri); + + // + if(strPrivKey==null || strPrivKey.equals("")) + { + throw new CustomException("보안키 획득 실패1"); + + } + + converter.setVerifierKey(strPrivKey); + + log.info("<<<<<<<<<< Oauth2ResourceConfig jwtAccessTokenConverter >>>>>>>>>>"); + + return converter; + } + catch (Exception e) + { + log.info("보안키 획득 실패2"); + log.info("<<<<<<<<<< Oauth2ResourceConfig jwtAccessTokenConverter >>>>>>>>>>"); + + return new JwtAccessTokenConverter(); + } + } + + private String getPublicKeyValue(String uriKey) + { + log.info(">>>>>>>>>> Oauth2ResourceConfig getPublicKeyValue <<<<<<<<<<"); + + String strReturn = ""; + JsonNode response = null; + + try + { + response = Unirest.get(uriKey) + .asJson().getBody(); + + strReturn = response.toString(); + } + catch(Exception e) + { + return strReturn; + } + + + if(StringUtils.isEmpty(strReturn)) + { + strReturn =""; + } + else + { + strReturn =new Gson().fromJson(response.toString(), JWTKey.class).getValue();; + } + + log.info("<<<<<<<<<< Oauth2ResourceConfig getPublicKeyValue : {} >>>>>>>>>>", strReturn); + + return strReturn; + + + } + + + + + + + +} diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/config/SwaggerConfig.java b/datatrans/src/main/java/com/urpsys/kccfbat/config/SwaggerConfig.java new file mode 100644 index 00000000..0e757d43 --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/config/SwaggerConfig.java @@ -0,0 +1,124 @@ +package com.urpsys.kccfbat.config; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpHeaders; + +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.ParameterBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.schema.ModelRef; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.AuthorizationScope; +import springfox.documentation.service.GrantType; +import springfox.documentation.service.OAuth; +import springfox.documentation.service.Parameter; +import springfox.documentation.service.ResourceOwnerPasswordCredentialsGrant; +import springfox.documentation.service.SecurityReference; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spi.service.contexts.SecurityContext; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +/** + * API 문서 처리 config 클래스 + * + * @author 나혁제 + * @since 2023.07.31 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일       수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2023.07.31.  나혁제         최초작성
+ *
+ * 
+ */ + +@Configuration +@EnableSwagger2 +public class SwaggerConfig +{ + private static final String API_NAME = "uWorks Test API"; + private static final String API_VERSION = "0.0.1"; + private static final String API_DESCRIPTION = "uWorks Test API 명세서"; + + @Bean + public Docket api() + { + Parameter parameterBuilder = new ParameterBuilder() + .name(HttpHeaders.AUTHORIZATION) + .description("Access Tocken") + .modelRef(new ModelRef("string")) + .parameterType("header") + .required(false) + .build(); + + List globalParamters = new ArrayList<>(); + globalParamters.add(parameterBuilder); + + return new Docket(DocumentationType.SWAGGER_2) + .globalOperationParameters(globalParamters) + .apiInfo(apiInfo()) +// .ignoredParameterTypes(AuthPrincipal.class) + .select() + .apis(RequestHandlerSelectors.basePackage("com.urpsys.baseapi")) + .paths(PathSelectors.any()) + .build() + .securityContexts(Collections.singletonList(securityContext())) + .securitySchemes(Arrays.asList(securitySchema())) + ; + } + + public ApiInfo apiInfo() + { + return new ApiInfoBuilder() + .title(API_NAME) + .version(API_VERSION) + .description(API_DESCRIPTION) + .build(); + } + + private SecurityContext securityContext() + { + return SecurityContext.builder() + .securityReferences(defaultAuth()) + .build(); + } + + private List defaultAuth() + { + final AuthorizationScope[] authorizationScopes = new AuthorizationScope[] + { + new AuthorizationScope("read", "read all"), + new AuthorizationScope("write", "write all") + }; + + return Collections.singletonList(new SecurityReference("oauth2", authorizationScopes)); + } + + private OAuth securitySchema() + { + final List authorizationScopeList = new ArrayList<>(2); + + authorizationScopeList.add(new AuthorizationScope("read", "read all")); + authorizationScopeList.add(new AuthorizationScope("write", "access all")); + + final List grantTypes = new ArrayList<>(1); + // 토큰 end point (http://localhost:3000/oauth/token) + grantTypes.add(new ResourceOwnerPasswordCredentialsGrant("http://localhost:9011/oauth/token")); + + return new OAuth("oauth2", authorizationScopeList, grantTypes); + } + +} \ No newline at end of file diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/config/iamsDbConfig.java b/datatrans/src/main/java/com/urpsys/kccfbat/config/iamsDbConfig.java new file mode 100644 index 00000000..ba68852b --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/config/iamsDbConfig.java @@ -0,0 +1,112 @@ +package com.urpsys.kccfbat.config; + +import java.io.IOException; +import java.sql.Connection; + +import javax.sql.DataSource; +import org.apache.ibatis.session.ExecutorType; +import org.apache.ibatis.session.SqlSessionFactory; +import org.mybatis.spring.SqlSessionTemplate; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import com.urpsys.kccfbat.common.crypto.Aes256Cipher; +import com.urpsys.kccfbat.common.exception.CustomException; +import com.urpsys.kccfbat.common.util.DataSourceUtil; + +/** + * iams(통합자료관리시스템) db config 클래스 + * + * @author 나혁제 + * @since 2026.02.24 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일        수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2026.02.24    나혁제         최초작성
+ *
+ * 
+ */ + +@Configuration +@EnableTransactionManagement +@MapperScan(value="com.urpsys.kccfbat.iams.dao", sqlSessionFactoryRef="iamsSqlSessionFactory") +public class iamsDbConfig +{ + @Autowired + private Environment env; + + @Autowired + private Aes256Cipher aes256Cipher; + + + /** + * 데이터소스 등록하는 메소드 + * @return + */ + @Bean(name="iamsDataSource") + public DataSource iamsDataSource() + { + return new LazyConnectionDataSourceProxy(DataSourceUtil.createDataSource("iamsdb", env, aes256Cipher)); + } + + /** + * sqlsessionfactory 등록하는 메소드 + * + * @param dataSource + * @param context + * @return + * @throws SchedulerException + * @throws IOException + */ + @Bean(name="iamsSqlSessionFactory") + public SqlSessionFactory iamsSqlSessionFactory( @Qualifier("iamsDataSource") DataSource dataSource + , ApplicationContext context) + throws CustomException, IOException + { + SqlSessionFactory sqlSessionFactory = DataSourceUtil.createSqlSessionFactory( dataSource + , context.getResource ("classpath:mapper/iamsdb/config/MybatisIamsConfig.xml") + , context.getResources("classpath:mapper/iamsdb/sqlmap/**/*Mapper*.xml") + ); + + sqlSessionFactory.getConfiguration().setDefaultExecutorType(ExecutorType.SIMPLE); + + return sqlSessionFactory; + } + + /** + * sqlsessiontemplate 등록하는 메소드 + * @param primarySqlSessionFactory + * @return + */ + @Bean("iamsSqlSessionTemplate") + public SqlSessionTemplate mainSqlSessionTemplate(@Qualifier("iamsSqlSessionFactory") SqlSessionFactory iamsSqlSessionFactory) + { + return new SqlSessionTemplate(iamsSqlSessionFactory); + } + + /** + * 트랜잭션 매니저 등록하는 메소드 + * @param dataSource + * @return + */ + @Bean(name="iamsTxManager") + public PlatformTransactionManager primaryTxManager(@Qualifier("iamsDataSource") DataSource dataSource) + { + return DataSourceUtil.createTxManager(dataSource); + } +} + diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/config/ncmsDbConfig.java b/datatrans/src/main/java/com/urpsys/kccfbat/config/ncmsDbConfig.java new file mode 100644 index 00000000..5c08b882 --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/config/ncmsDbConfig.java @@ -0,0 +1,112 @@ +package com.urpsys.kccfbat.config; + +import java.io.IOException; +import java.sql.Connection; + +import javax.sql.DataSource; +import org.apache.ibatis.session.ExecutorType; +import org.apache.ibatis.session.SqlSessionFactory; +import org.mybatis.spring.SqlSessionTemplate; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import com.urpsys.kccfbat.common.crypto.Aes256Cipher; +import com.urpsys.kccfbat.common.exception.CustomException; +import com.urpsys.kccfbat.common.util.DataSourceUtil; + +/** + * ncms(자산관리시스템) db config 클래스 + * + * @author 나혁제 + * @since 2026.02.24 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일        수정자         수정내용
+ * -----------  ---------    ------------------------
+ * 2026.02.24    나혁제         최초작성
+ *
+ * 
+ */ + +@Configuration +@EnableTransactionManagement +@MapperScan(value="com.urpsys.kccfbat.ncms.dao", sqlSessionFactoryRef="ncmsSqlSessionFactory") +public class ncmsDbConfig +{ + @Autowired + private Environment env; + + @Autowired + private Aes256Cipher aes256Cipher; + + + /** + * 데이터소스 등록하는 메소드 + * @return + */ + @Bean(name="ncmsDataSource") + public DataSource iamsDataSource() + { + return new LazyConnectionDataSourceProxy(DataSourceUtil.createDataSource("ncmsdb", env, aes256Cipher)); + } + + /** + * sqlsessionfactory 등록하는 메소드 + * + * @param dataSource + * @param context + * @return + * @throws SchedulerException + * @throws IOException + */ + @Bean(name="ncmsSqlSessionFactory") + public SqlSessionFactory ncmsSqlSessionFactory( @Qualifier("ncmsDataSource") DataSource dataSource + , ApplicationContext context) + throws CustomException, IOException + { + SqlSessionFactory sqlSessionFactory = DataSourceUtil.createSqlSessionFactory( dataSource + , context.getResource ("classpath:mapper/ncmsdb/config/MybatisNcmsConfig.xml") + , context.getResources("classpath:mapper/ncmsdb/sqlmap/**/*Mapper*.xml") + ); + + sqlSessionFactory.getConfiguration().setDefaultExecutorType(ExecutorType.SIMPLE); + + return sqlSessionFactory; + } + + /** + * sqlsessiontemplate 등록하는 메소드 + * @param primarySqlSessionFactory + * @return + */ + @Bean("ncmsSqlSessionTemplate") + public SqlSessionTemplate mainSqlSessionTemplate(@Qualifier("ncmsSqlSessionFactory") SqlSessionFactory ncmsSqlSessionFactory) + { + return new SqlSessionTemplate(ncmsSqlSessionFactory); + } + + /** + * 트랜잭션 매니저 등록하는 메소드 + * @param dataSource + * @return + */ + @Bean(name="ncmsTxManager") + public PlatformTransactionManager ncmsTxManager(@Qualifier("ncmsDataSource") DataSource dataSource) + { + return DataSourceUtil.createTxManager(dataSource); + } +} + diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/domain/CommonVO.java b/datatrans/src/main/java/com/urpsys/kccfbat/domain/CommonVO.java new file mode 100644 index 00000000..078da708 --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/domain/CommonVO.java @@ -0,0 +1,52 @@ +package com.urpsys.kccfbat.domain; + +public class CommonVO +{ + private String val1 ; // test1 + private String val2 ; // test1 + private String val3 ; // test1 + private String val4 ; // test1 + private String val5 ; // test1 + + public String getVal1() { + return val1; + } + public void setVal1(String val1) { + this.val1 = val1; + } + public String getVal2() { + return val2; + } + public void setVal2(String val2) { + this.val2 = val2; + } + public String getVal3() { + return val3; + } + public void setVal3(String val3) { + this.val3 = val3; + } + public String getVal4() { + return val4; + } + public void setVal4(String val4) { + this.val4 = val4; + } + public String getVal5() { + return val5; + } + public void setVal5(String val5) { + this.val5 = val5; + } + + + + + + + + + + + +} \ No newline at end of file diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/domain/JWTKey.java b/datatrans/src/main/java/com/urpsys/kccfbat/domain/JWTKey.java new file mode 100644 index 00000000..8c6db14a --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/domain/JWTKey.java @@ -0,0 +1,24 @@ +package com.urpsys.kccfbat.domain; + +import org.springframework.util.StringUtils; + +import lombok.Data; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Data +public class JWTKey +{ + + String alg = ""; + String value = ""; + + public String getValue() + { + if (!StringUtils.isEmpty(value)) + { + return value; + } + return ""; + } +} diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/domain/TokenInfo.java b/datatrans/src/main/java/com/urpsys/kccfbat/domain/TokenInfo.java new file mode 100644 index 00000000..8eeea8ee --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/domain/TokenInfo.java @@ -0,0 +1,46 @@ +package com.urpsys.kccfbat.domain; + +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; + +import lombok.Data; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@Data +public class TokenInfo +{ + private String userName; + private String clientId; + + private String strMEM_ID; + private String strPWD; + private String strPWD_HINT; + private String strPWD_RANS; + private String strRRNO; + private String strMEM_NM; + private String strZIP_NO; + private String strADDR; + private String strREGN_NO; + private String strMEM_STACD; + private String strADDR2; + private String strEND_TELNO; + private String strMOVE_TELNO; + private String strGRP_ID; + private String strMEM_FAX_NO; + private String strMEM_EML_ADDR; + private String strMDL_TELNO; + private String strJOIN_DTM; + private String strSEX_CD; + private String strESNTL_ID; + private String strLOCK_AT; + private String strLOCK_NCNT; + private String strLAST_CHG_DTM; + private String strLAST_PWD_CHG_DTM; + private String userSe; + private String orgnztId; + + private List authorities; +} diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/iams/dao/IamsDataDao.java b/datatrans/src/main/java/com/urpsys/kccfbat/iams/dao/IamsDataDao.java new file mode 100644 index 00000000..71320b8a --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/iams/dao/IamsDataDao.java @@ -0,0 +1,49 @@ +package com.urpsys.kccfbat.iams.dao; + +import java.util.LinkedHashMap; +import java.util.List; + +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import com.urpsys.kccfbat.domain.CommonVO; + +/** + * 자산관리시스템에 대한 DAO 클래스를 정의 + * + * @author urp 인프라본부 나혁제 + * @since 2026.02.25 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일     수정자            수정내용
+ * -----------  ---------    ------------------------
+ * 2026.02.25   나혁제          최초작성
+ *
+ *      
+ */ + +@Mapper +@Repository +public interface IamsDataDao +{ + // 기존이관자료 여부 확인 + public String selectExistMaster(String strIn) throws Exception; + + // 자료 마스터 테이블 입력처리 + public int insertRgMaster(LinkedHashMap inMap) throws Exception; + + // file 정보 입력처리 + public int insertJattchfile(LinkedHashMap inMap) throws Exception; + + // uac 정보 입력처리 + public int insertUareMaster(LinkedHashMap inMap) throws Exception; + + // 자료건 정보 입력처리 + public int insertUacRecord(LinkedHashMap inMap) throws Exception; + +} diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/ncms/dao/CommonDao.java b/datatrans/src/main/java/com/urpsys/kccfbat/ncms/dao/CommonDao.java new file mode 100644 index 00000000..720db28a --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/ncms/dao/CommonDao.java @@ -0,0 +1,18 @@ +package com.urpsys.kccfbat.ncms.dao; + +import java.util.List; + +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import com.urpsys.kccfbat.domain.CommonVO; + +@Mapper +@Repository +public interface CommonDao +{ + public String selectTest1(String strVal1); // TestCode1 + public CommonVO selectTest2(String strVal1); // TestCode2 + + +} diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/ncms/dao/NcmsDataDao.java b/datatrans/src/main/java/com/urpsys/kccfbat/ncms/dao/NcmsDataDao.java new file mode 100644 index 00000000..d1286d6a --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/ncms/dao/NcmsDataDao.java @@ -0,0 +1,57 @@ +package com.urpsys.kccfbat.ncms.dao; + +import java.util.LinkedHashMap; +import java.util.List; + +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import com.urpsys.kccfbat.domain.CommonVO; + +/** + * 자산관리시스템에 대한 DAO 클래스를 정의 + * + * @author urp 인프라본부 나혁제 + * @since 2026.02.25 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일     수정자            수정내용
+ * -----------  ---------    ------------------------
+ * 2026.02.25   나혁제          최초작성
+ *
+ *      
+ */ + +@Mapper +@Repository +public interface NcmsDataDao +{ + // 이관대상 멀티미디어 자산 조회 + public List> selectMultimediaAssets() throws Exception; + + // culter_resource 추출 + public LinkedHashMap selectCulterResource(String strIn) throws Exception; + + // media 추출 + public List> selectMedia(String strIn) throws Exception; + + // 유형값 찾기 + public String selectTypeDivCd(int iIn) throws Exception; + + // 관리부서 찾기 + public String selectMngOrgCd(int iIn) throws Exception; + + // 관리부서명 찾기 + public String selectMngOrgNm(int iIn) throws Exception; + + + + // 결과값 반경 + public int updateResultMultimediaAssets(LinkedHashMap inMap) throws Exception; + +} diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/ncmsToIamsDataTransApplication.java b/datatrans/src/main/java/com/urpsys/kccfbat/ncmsToIamsDataTransApplication.java new file mode 100644 index 00000000..29c7f45e --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/ncmsToIamsDataTransApplication.java @@ -0,0 +1,60 @@ +package com.urpsys.kccfbat; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; + +import com.urpsys.kccfbat.common.util.CommonUtil; + +/** + * Resource 서버 기본 실행 클래스1 + * + * @author 나혁제 + * @since 2026.02.24 + * @version 1.0.0 + * @see + * + *
+ *
+ * << 개정이력(Modification information) >>
+ *
+ *   수정일     수정자      수정내용
+ * -----------  ---------    ------------------------
+ * 2026.02.24   나혁제      최초작성
+ *
+ *      
+ */ + +@SpringBootApplication +@EnableScheduling +@ComponentScan(basePackages = {"com.urpsys.kccfbat"}) +public class ncmsToIamsDataTransApplication +{ + public static void main(String[] args) + { + String activeProfile = (CommonUtil.nvl(System.getProperty("spring.profiles.active"))); + + if(activeProfile.equals("local")) + { + System.out.println("################################################"); + System.out.println("############# local Env ########################"); + System.out.println("################################################"); + } + else if(activeProfile.equals("ncms_server")) + { + System.out.println("################################################"); + System.out.println("############# ncms_server Env ##################"); + System.out.println("################################################"); + } + else + { + System.out.println("################################################"); + System.out.println("############# No Define ########################"); + System.out.println("################################################"); + } + + SpringApplication.run(ncmsToIamsDataTransApplication.class, args); + } +} diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/scheduler/ConsoleScheduler.java b/datatrans/src/main/java/com/urpsys/kccfbat/scheduler/ConsoleScheduler.java new file mode 100644 index 00000000..ecf178e9 --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/scheduler/ConsoleScheduler.java @@ -0,0 +1,70 @@ +package com.urpsys.kccfbat.scheduler; + +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import com.urpsys.kccfbat.ncms.dao.NcmsDataDao; +import com.urpsys.kccfbat.service.NcmsDataService; +import com.urpsys.kccfbat.service.NcmsToIamsDataTransService; + +import lombok.extern.slf4j.Slf4j; + +/** + * 자료이관처리 스케쥴러 클래스 + * @author urp 인프라본부 나혁제 + * @since 2026.02.25 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *  수정일         수정자       수정내용
+ *  ----------   --------   ---------------------------
+ *  2026.02.25   나혁제       최초 생성
+ *
+ * 
+ * + */ + +@Slf4j +@Component +public class ConsoleScheduler +{ + @Autowired + NcmsToIamsDataTransService ncmsToIamsDataTransService; + + NcmsDataService ncmsDataService; + + + @Scheduled(cron = "1 * * * * *") + public void NcmsToIamsDataTranMain () + { + log.info(">>>>>>>>>>>>>>> NcmsToIamsDataTranMain <<<<<<<<<<<<<<<"); + + // ams => 통합자료관리 시스템 데이터이관 + + try + { + ncmsToIamsDataTransService.processNcmsToIamsDataTrans(); + } + catch(Exception e) + { + e.printStackTrace(); + log.error("데이터 이관중 오류 발생[{}] ", e); + + } + + + + + + log.info("<<<<<<<<<<<<<<< NcmsToIamsDataTranMain >>>>>>>>>>>>>>>"); + } + +} \ No newline at end of file diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/service/CommonService.java b/datatrans/src/main/java/com/urpsys/kccfbat/service/CommonService.java new file mode 100644 index 00000000..661a5aff --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/service/CommonService.java @@ -0,0 +1,35 @@ +package com.urpsys.kccfbat.service; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.urpsys.kccfbat.domain.CommonVO; +import com.urpsys.kccfbat.ncms.dao.CommonDao; + +@Service +@Transactional +public class CommonService +{ + @Autowired + CommonDao commonDao; + + + // TestCode1 + public String selectTest1(String strVal1) + { + return commonDao.selectTest1(strVal1); + } + + // TestCode2 + public CommonVO selectTest2(String strVal1) + { + return commonDao.selectTest2(strVal1); + } + + + + +} diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/service/IamsDataService.java b/datatrans/src/main/java/com/urpsys/kccfbat/service/IamsDataService.java new file mode 100644 index 00000000..d4ea73bf --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/service/IamsDataService.java @@ -0,0 +1,92 @@ +package com.urpsys.kccfbat.service; + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; +import java.util.LinkedHashMap; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.urpsys.kccfbat.iams.dao.IamsDataDao; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +public class IamsDataService +{ + @Autowired + IamsDataDao iamsDataDao; + + @Value("${file.fileCpYn}") + private String strFileCpYn; // 파일처리여부 + + // 멀티미디어 자산 조회 + public String selectExistMaster(String strIn) throws Exception + { + return iamsDataDao.selectExistMaster(strIn); + } + + @Transactional(value = "iamsTxManager") + public int processIams( LinkedHashMap inRgMaster + , LinkedHashMap inUacRecord + , List> inJFile + , List> inUareMaster + ) throws Exception + { + // 파일처리 부터 먼저 시작 + // 1. 원본 File, 복사할 File 준비 + for( LinkedHashMap mapUare : inUareMaster) + { + log.info(" ncms_full_file_path [{}]", mapUare.get("ncms_full_file_path")); + log.info(" iams_full_file_path [{}]", mapUare.get("iams_full_file_path")); + + if(strFileCpYn.equals("Y")) + { + File file = new File((String)mapUare.get("ncms_full_file_path")); + File newFile = new File((String)mapUare.get("iams_full_file_path")); + + Files.copy(file.toPath(), newFile.toPath(), StandardCopyOption.REPLACE_EXISTING); + } + } + + int iRgRet = iamsDataDao.insertRgMaster (inRgMaster ); + int iRgRet2 = iamsDataDao.insertUacRecord(inUacRecord); + + for( LinkedHashMap mapUare : inUareMaster) + { + log.info(" f_id [{}]", mapUare.get("f_id")); + log.info(" length [{}]", mapUare.get("length")); + log.info(" ncms_full_file_path [{}]", mapUare.get("ncms_full_file_path")); + log.info(" iams_full_file_path [{}]", mapUare.get("iams_full_file_path")); + } + + // j_attachfile 처리 + for(LinkedHashMap inMap : inJFile) + { + int iJFRet = iamsDataDao.insertJattchfile(inMap); + } + + // uare_master 처리 + for(LinkedHashMap inMap : inUareMaster) + { + int iJFRet = iamsDataDao.insertUareMaster(inMap); + } + + return iRgRet; + } + + + // 자료 마스터 테이블 입력처리 + public int insertRgMaster(LinkedHashMap inMap) throws Exception + { + return iamsDataDao.insertRgMaster(inMap); + } + + + +} diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/service/NcmsDataService.java b/datatrans/src/main/java/com/urpsys/kccfbat/service/NcmsDataService.java new file mode 100644 index 00000000..351fa283 --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/service/NcmsDataService.java @@ -0,0 +1,67 @@ +package com.urpsys.kccfbat.service; + +import java.util.LinkedHashMap; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.urpsys.kccfbat.ncms.dao.NcmsDataDao; + +@Service +@Transactional(value = "ncmsTxManager") +public class NcmsDataService +{ + @Autowired + NcmsDataDao ncmsDataDao; + + // 멀티미디어 자산 조회 + public List> selectMultimediaAssets() throws Exception + { + return ncmsDataDao.selectMultimediaAssets(); + } + + // culter_resource 추출 + public LinkedHashMap selectCulterResource(String strIn) throws Exception + { + return ncmsDataDao.selectCulterResource(strIn); + } + + // media 추출 + public List> selectMedia(String strIn) throws Exception + { + return ncmsDataDao.selectMedia(strIn); + } + + // 유형값 찾기 + public String selectTypeDivCd(int iIn) throws Exception + { + return ncmsDataDao.selectTypeDivCd(iIn); + } + + // 관리부서 찾기 + public String selectMngOrgCd(int iIn) throws Exception + { + return ncmsDataDao.selectMngOrgCd(iIn); + } + + // 관리부서 찾기 + public String selectMngOrgNm(int iIn) throws Exception + { + return ncmsDataDao.selectMngOrgNm(iIn); + } + + + + + + // 결과값 반경 + public int updateResultMultimediaAssets(LinkedHashMap inMap) throws Exception + { + return ncmsDataDao.updateResultMultimediaAssets(inMap); + } + + + +} diff --git a/datatrans/src/main/java/com/urpsys/kccfbat/service/NcmsToIamsDataTransService.java b/datatrans/src/main/java/com/urpsys/kccfbat/service/NcmsToIamsDataTransService.java new file mode 100644 index 00000000..93814fb2 --- /dev/null +++ b/datatrans/src/main/java/com/urpsys/kccfbat/service/NcmsToIamsDataTransService.java @@ -0,0 +1,558 @@ +package com.urpsys.kccfbat.service; + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.urpsys.kccfbat.common.util.CommonUtil; +import com.urpsys.kccfbat.common.util.CommonUtils; +import com.urpsys.kccfbat.ncms.dao.NcmsDataDao; +import com.urpsys.kccfbat.scheduler.ConsoleScheduler; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +public class NcmsToIamsDataTransService +{ + @Autowired + NcmsDataService ncmsDataService; + + @Autowired + IamsDataService iamsDataService; + + @Value("${file.ncms.basefolder}") + private String strNcmsBaseFolder; // ncms base folder + + @Value("${file.iams.basefolder}") + private String strIcmsBaseFolder; // icms base folder + + @Value("${file.fileCpYn}") + private String strFileCpYn; // icms base folder + + // 데이터 이관작업 + public void processNcmsToIamsDataTrans() throws Exception + { + log.info(" >>>>> processNcmsToIamsDataTrans <<<<< "); + + int iNcmsTransAllCnt = 0; // 이관대상 전체 건수 + int iNcmsTransSkipCnt = 0; // 이관대상 Skip 대상 건수 + + // 이관대상 데이터 추출 + List> nCmsList = ncmsDataService.selectMultimediaAssets(); + + // 이관대상이 없는 경우 + if(nCmsList == null || nCmsList.size()==0) return; + + iNcmsTransAllCnt += nCmsList.size(); + + for(LinkedHashMap ncmsDataMap : nCmsList ) + { + LinkedHashMap inMultiResultMap = new LinkedHashMap(); + + String strMultiId = ncmsDataMap.get("id")+""; + + // 이관완료여부 체크 + String strRgYn = iamsDataService.selectExistMaster(strMultiId); + + log.info(" 기존이관여부 확인 [{}] ", strRgYn); + + // 이관자료가 있는경우 Skip + if(strRgYn.equals("Y")) + { + inMultiResultMap.put("iams_tran_yn" , "Y"); + inMultiResultMap.put("iams_tran_remark" , "이미 이관처리 완료된 자료"); + inMultiResultMap.put("id" , strMultiId ); + + ncmsDataService.updateResultMultimediaAssets(inMultiResultMap); + + continue; + } + + String strCulterResourceId = ncmsDataMap.get("culture_resource_id")+""; + LinkedHashMap mapCulterResources = ncmsDataService.selectCulterResource(strCulterResourceId); + List> listMedia = ncmsDataService.selectMedia(strMultiId); + + // 기초자료가 없는경우 Skip + if(mapCulterResources == null || mapCulterResources.get("id") == null || mapCulterResources.get("id").equals("")) + { + inMultiResultMap.put("iams_tran_yn" , "Y"); + inMultiResultMap.put("iams_tran_remark" , "CulterResources 자료없음"); + inMultiResultMap.put("id" , strMultiId ); + + ncmsDataService.updateResultMultimediaAssets(inMultiResultMap); + + continue; + } + + LinkedHashMap inRgMaster = new LinkedHashMap(); // 자료 마스터 정보 + LinkedHashMap inUacRecord = new LinkedHashMap(); // 자료 건 정보 + List> inJFile = new ArrayList(); // 파일정보 + List> inUareMaster = new ArrayList(); // 클라우드 파일정보 + + // ncmsDataMap : multimedia_assets + // mapCulterResources : culter_resources + + String strMasterId = CommonUtils.getUUID("UR"); + + String keyword = CommonUtil.nvl(mapCulterResources.get("keywords")); + + keyword = keyword.replaceAll("\"", ""); + keyword = keyword.replaceAll("\\[", ""); + keyword = keyword.replaceAll("\\]", ""); + + String creat_yyyy=""; + if( isLong(CommonUtil.nvl(mapCulterResources.get("genyear"))) ) + { + creat_yyyy = CommonUtil.nvl(mapCulterResources.get("genyear"))+"0101"; + } + + int iCouncilId = Long.valueOf((long)mapCulterResources.get("council_id")).intValue(); + String type_div_cd = ncmsDataService.selectTypeDivCd((int)ncmsDataMap.get("major_category_id")); + + // iams rg_master 세팅 + inRgMaster.put("master_id" , strMasterId ); + inRgMaster.put("use_flag" , "Y" ); + inRgMaster.put("set_id" , CommonUtils.getUUID("SE") ); + inRgMaster.put("reg_status" , "REG_ING" ); + inRgMaster.put("title" , (String)ncmsDataMap.get("title") ); + inRgMaster.put("keyword" , keyword ); + inRgMaster.put("type_div_cd" , type_div_cd ); + inRgMaster.put("erecord_flag" , "2" ); + inRgMaster.put("org_nm" , (String)ncmsDataMap.get("publisher") ); + inRgMaster.put("creat_yyyy" , creat_yyyy ); + inRgMaster.put("presv_term_cd" , "10" ); + inRgMaster.put("expt_disuse_yyyy" , "2031" ); + inRgMaster.put("oper_read_range_cd" , "01" ); + inRgMaster.put("open_div_cd" , "1" ); + inRgMaster.put("reg_id" , "U1000000000" ); + inRgMaster.put("mod_id" , "U1000000000" ); + inRgMaster.put("mng_org_cd" , ncmsDataService.selectMngOrgCd(iCouncilId) ); + inRgMaster.put("page_cnt" , ncmsDataMap.get("total_page_count")+"" ); + inRgMaster.put("series_id" , "0" ); + inRgMaster.put("digital_yn" , "N" ); + inRgMaster.put("oper_out_range_cd" , "01" ); + inRgMaster.put("mng_org_nm" , ncmsDataService.selectMngOrgNm(iCouncilId) ); + inRgMaster.put("asset_type" , "문화원소장" ); + inRgMaster.put("tag" , keyword ); + inRgMaster.put("management_code" , "KCCF" ); + inRgMaster.put("interface_id" , (long)ncmsDataMap.get("culture_resource_id")+"" ); + inRgMaster.put("set_no" , strMultiId ); + inRgMaster.put("digital_read_yn" , "Y" ); + inRgMaster.put("prsvn_proc_trgt_yn" , "N" ); + + // 자료건 정보 처리 + inUacRecord.put("record_id", strMasterId); + inUacRecord.put("type_div_cd", type_div_cd); + + // 파일처리 + String orgThumbnail2 = CommonUtil.nvl(ncmsDataMap.get("thumbnail2")); + String orgThumbnail_manual = CommonUtil.nvl(ncmsDataMap.get("thumbnail_manual")); + + String thumbnail2 = getFileName(orgThumbnail2); + String thumbnail_manual = getFileName(orgThumbnail_manual); + + log.info(" orgThumbnail2 [{}]", orgThumbnail2); + log.info(" orgThumbnail_manual [{}]", orgThumbnail_manual); + log.info(" thumbnail2 [{}]", thumbnail2); + log.info(" thumbnail_manual [{}]", thumbnail_manual); + + LinkedHashMap mapJFile = new LinkedHashMap(); + LinkedHashMap mapUareMaster = new LinkedHashMap(); + + int iSeq=1; + + // thumbnail_manual 파일처리 + if(!orgThumbnail2.equals("")) + { + String strNcmsFileFullPath = strNcmsBaseFolder + "/" + orgThumbnail2; + String strFileMask = CommonUtils.getFileMask(); + + Path path = Paths.get(strNcmsFileFullPath); + long lFileSize = 0; + if(strFileCpYn.equals("Y")) + { + lFileSize = Files.size(path); + } + + mapJFile = new LinkedHashMap(); + mapJFile.put("file_mask" , strFileMask ); + mapJFile.put("file_id" , strMasterId); + mapJFile.put("file_seq" , iSeq); + mapJFile.put("file_name" , thumbnail2); + mapJFile.put("file_size" , lFileSize+""); + mapJFile.put("download_count" , "0"); + mapJFile.put("atch_type_cd" , "image"); + mapJFile.put("digital_read_yn" , "Y"); + + String strCurFullTime = CommonUtil.getKST("yyyyMMddHHmmss"); + String strCurDate = CommonUtil.getKST("yyyyMMdd"); + String strCurTime = CommonUtil.getKST("HHmmss"); + + String strFid = CommonUtil.getKST("yyyy") +"-"+strMultiId+"-"+iSeq; + + mapUareMaster = new LinkedHashMap(); + mapUareMaster.put("f_id" , strFid); + mapUareMaster.put("org_name" , thumbnail2); + mapUareMaster.put("volume_id" , "VOL001"); + mapUareMaster.put("v_seq" , "0000"); + mapUareMaster.put("length" , lFileSize+""); + mapUareMaster.put("comp_yn" , "N"); + mapUareMaster.put("encrypt_yn" , "N"); + mapUareMaster.put("org_date" , strCurDate); + mapUareMaster.put("reg_date" , strCurDate); + mapUareMaster.put("reg_time" , strCurTime); + mapUareMaster.put("commit_stat" , "1"); + mapUareMaster.put("session_key" , "473640583"); + mapUareMaster.put("reg_user_id" , "uac"); + mapUareMaster.put("file_key" , strFileMask); + mapUareMaster.put("f_group" , "1"); + mapUareMaster.put("f_index" , iSeq); + mapUareMaster.put("bef_commit_stat", "0"); + + String strIameFileFullDir = strIcmsBaseFolder + + "/" + strCurFullTime.substring(0,4) + + "/" + strCurFullTime.substring(4,6) + + "/" + strCurFullTime.substring(6,8) + + "/" + strCurFullTime.substring(8,10) + + "/" + "0000" + ; + + String strIameFileFullPath = strIameFileFullDir +"/"+strFid+"."+getFileExt(orgThumbnail2); + + // 폴더생성 + File file = new File(strIameFileFullDir); + Files.createDirectories(file.toPath()); + + mapUareMaster.put("ncms_full_file_path", strNcmsFileFullPath ); + mapUareMaster.put("iams_full_file_path", strIameFileFullPath ); + + log.info(" lFileSize [{}]", lFileSize); + log.info(" strNcmsFileFullPath [{}]", strNcmsFileFullPath); + log.info(" strIameFileFullPath [{}]", strIameFileFullPath); + + inJFile .add(mapJFile ); + inUareMaster.add(mapUareMaster); + + iSeq++; + } + + // thumbnail_manual 파일처리 + if(!orgThumbnail_manual.equals("")) + { + String strNcmsFileFullPath = strNcmsBaseFolder + "/" + orgThumbnail_manual; + String strFileMask = CommonUtils.getFileMask(); + + Path path = Paths.get(strNcmsFileFullPath); + long lFileSize = 0; + if(strFileCpYn.equals("Y")) + { + lFileSize = Files.size(path); + } + + mapJFile = new LinkedHashMap(); + mapJFile.put("file_mask" , strFileMask ); + mapJFile.put("file_id" , strMasterId); + mapJFile.put("file_seq" , iSeq); + mapJFile.put("file_name" , thumbnail_manual); + mapJFile.put("file_size" , lFileSize+""); + mapJFile.put("download_count" , "0"); + mapJFile.put("atch_type_cd" , "image"); + mapJFile.put("digital_read_yn" , "Y"); + + String strCurFullTime = CommonUtil.getKST("yyyyMMddHHmmss"); + String strCurDate = CommonUtil.getKST("yyyyMMdd"); + String strCurTime = CommonUtil.getKST("HHmmss"); + + String strFid = CommonUtil.getKST("yyyy") +"-"+strMultiId+"-"+iSeq; + + mapUareMaster = new LinkedHashMap(); + mapUareMaster.put("f_id" , strFid); + mapUareMaster.put("org_name" , thumbnail_manual); + mapUareMaster.put("volume_id" , "VOL001"); + mapUareMaster.put("v_seq" , "0000"); + mapUareMaster.put("length" , lFileSize+""); + mapUareMaster.put("comp_yn" , "N"); + mapUareMaster.put("encrypt_yn" , "N"); + mapUareMaster.put("org_date" , strCurDate); + mapUareMaster.put("reg_date" , strCurDate); + mapUareMaster.put("reg_time" , strCurTime); + mapUareMaster.put("commit_stat" , "1"); + mapUareMaster.put("session_key" , "473640583"); + mapUareMaster.put("reg_user_id" , "uac"); + mapUareMaster.put("file_key" , strFileMask); + mapUareMaster.put("f_group" , "1"); + mapUareMaster.put("f_index" , iSeq); + mapUareMaster.put("bef_commit_stat", "0"); + + String strIameFileFullDir = strIcmsBaseFolder + + "/" + strCurFullTime.substring(0,4) + + "/" + strCurFullTime.substring(4,6) + + "/" + strCurFullTime.substring(6,8) + + "/" + strCurFullTime.substring(8,10) + + "/" + "0000" + ; + + String strIameFileFullPath = strIameFileFullDir +"/"+strFid+"."+getFileExt(orgThumbnail_manual); + + // 폴더생성 + File file = new File(strIameFileFullDir); + Files.createDirectories(file.toPath()); + + mapUareMaster.put("ncms_full_file_path", strNcmsFileFullPath ); + mapUareMaster.put("iams_full_file_path", strIameFileFullPath ); + + inJFile .add(mapJFile ); + inUareMaster.add(mapUareMaster); + + iSeq++; + } + + // media 처리 + for( LinkedHashMap mapMedia : listMedia) + { + long lCulter = (long)mapCulterResources .get("id"); + long lMulti = (long)ncmsDataMap .get("id"); + long iMe = (long)mapMedia .get("id"); + + String strNcmsFileFullPath = getFixPath(lCulter, lMulti, iMe , (String)mapMedia.get("collection_name"))+"/"+ mapMedia.get("file_name"); + String strFileMask = CommonUtils.getFileMask(); + + Path path = Paths.get(strNcmsFileFullPath); + + mapJFile = new LinkedHashMap(); + mapJFile.put("file_mask" , strFileMask ); + mapJFile.put("file_id" , strMasterId); + mapJFile.put("file_seq" , iSeq); + mapJFile.put("file_name" , (String)mapMedia.get("file_name")); + mapJFile.put("file_size" , mapMedia.get("size")+""); + mapJFile.put("download_count" , "0"); + mapJFile.put("atch_type_cd" , getAtchTypeCd((String)mapMedia.get("collection_name"))); + mapJFile.put("digital_read_yn" , "Y"); + + String strCurFullTime = CommonUtil.getKST("yyyyMMddHHmmss"); + String strCurDate = CommonUtil.getKST("yyyyMMdd"); + String strCurTime = CommonUtil.getKST("HHmmss"); + + String strFid = CommonUtil.getKST("yyyy") +"-"+strMultiId+"-"+iSeq; + + mapUareMaster = new LinkedHashMap(); + mapUareMaster.put("f_id" , strFid); + mapUareMaster.put("org_name" , (String)mapMedia.get("file_name")); + mapUareMaster.put("volume_id" , "VOL001"); + mapUareMaster.put("v_seq" , "0000"); + mapUareMaster.put("length" , mapMedia.get("size")+""); + mapUareMaster.put("comp_yn" , "N"); + mapUareMaster.put("encrypt_yn" , "N"); + mapUareMaster.put("org_date" , strCurDate); + mapUareMaster.put("reg_date" , strCurDate); + mapUareMaster.put("reg_time" , strCurTime); + mapUareMaster.put("commit_stat" , "1"); + mapUareMaster.put("session_key" , "473640583"); + mapUareMaster.put("reg_user_id" , "uac"); + mapUareMaster.put("file_key" , strFileMask); + mapUareMaster.put("f_group" , "1"); + mapUareMaster.put("f_index" , iSeq); + mapUareMaster.put("bef_commit_stat", "0"); + mapUareMaster.put("repository" , ""); + mapUareMaster.put("clipid" , ""); + mapUareMaster.put("offset" , "0"); + + String strIameFileFullDir = strIcmsBaseFolder + + "/" + strCurFullTime.substring(0,4) + + "/" + strCurFullTime.substring(4,6) + + "/" + strCurFullTime.substring(6,8) + + "/" + strCurFullTime.substring(8,10) + + "/" + "0000" + ; + + String strIameFileFullPath = strIameFileFullDir +"/"+strFid+"."+getFileExt((String)mapMedia.get("file_name")); + + // 폴더생성 + File file = new File(strIameFileFullDir); + Files.createDirectories(file.toPath()); + + mapUareMaster.put("ncms_full_file_path", strNcmsFileFullPath ); + mapUareMaster.put("iams_full_file_path", strIameFileFullPath ); + + inJFile .add(mapJFile ); + inUareMaster.add(mapUareMaster); + + iSeq++; + } + + log.info(" mapUareMaster [{}]", mapUareMaster.toString()); + + int iSucc = iamsDataService.processIams(inRgMaster, inUacRecord, inJFile, inUareMaster); + + if(iSucc>0) + { + inMultiResultMap.put("iams_tran_yn" , "Y"); + inMultiResultMap.put("iams_tran_remark" , "이관완료"); + inMultiResultMap.put("id" , strMultiId ); + inMultiResultMap.put("iams_tran_master_id" , strMasterId ); + } + else + { + inMultiResultMap.put("iams_tran_yn" , "X" ); + inMultiResultMap.put("iams_tran_remark" , "이관실패" ); + inMultiResultMap.put("id" , strMultiId );; + } + + ncmsDataService.updateResultMultimediaAssets(inMultiResultMap); + } + + + log.info(" <<<<< processNcmsToIamsDataTrans >>>>> "); + } + + // 데이터 이관작업 + public LinkedHashMap iamsDataSetting(LinkedHashMap ncmsDataMap ) throws Exception + { + LinkedHashMap returnMap = new LinkedHashMap(); + + returnMap.put("MASTER_ID", CommonUtils.getUUID("UR")); + + + return returnMap; + } + + public String getFileName(String strOrgFileName) + { + String strReFileName =""; + + int iLastIndex = strOrgFileName.lastIndexOf("/"); + + if(iLastIndex < 0) + { + strReFileName = strOrgFileName; + } + else + { + strReFileName = strOrgFileName.substring(iLastIndex+1); + } + + return strReFileName; + } + + public String getFileExt(String strOrgFileName) + { + String strReFileExt =""; + + int iLastIndex = strOrgFileName.lastIndexOf("."); + + if(iLastIndex < 0) + { + strReFileExt = ""; + } + else + { + strReFileExt = strOrgFileName.substring(iLastIndex+1); + } + + return strReFileExt; + } + + public String getAtchTypeCd(String collection_name) + { + String strReAtchTypeCd = ""; + if(collection_name.equals("media_images")) + { + strReAtchTypeCd = "image"; + } + else if(collection_name.equals("media_videos")) + { + strReAtchTypeCd = "videos"; + } + else if(collection_name.equals("media_audios")) + { + strReAtchTypeCd = "audios"; + } + else if(collection_name.equals("media_pdfs")) + { + strReAtchTypeCd = "doc"; + } + else if(collection_name.equals("media_3ds")) + { + strReAtchTypeCd = "3d"; + } + + return strReAtchTypeCd; + } + + public String getFixPath(long lculterResourceId, long lMaId, long lMediaId, String collection_name) + { + long iFreFolder = lculterResourceId%250; + + String strFixPath = ""; + String strFullFixPath = ""; + + if(collection_name.equals("media_images")) + { + strFixPath = "multimedia_assets"; + } + else if(collection_name.equals("media_videos")) + { + strFixPath = "videos"; + } + else if(collection_name.equals("media_audios")) + { + strFixPath = "audios"; + } + else if(collection_name.equals("media_pdfs")) + { + strFixPath = "pdfs"; + } + else if(collection_name.equals("media_3ds")) + { + strFixPath = "3ds"; + } + + + if(collection_name.equals("media_images")) + { + strFullFixPath = strNcmsBaseFolder + + "/" + strFixPath + + "/" + iFreFolder + + "/" + lMaId + + "/" + lMediaId + ; + } + else + { + strFullFixPath = strNcmsBaseFolder + + "/" + strFixPath + + "/" + iFreFolder + + "/" + lMaId + ; + } + + return strFullFixPath; + } + + public static boolean isLong(String strValue) + { + try + { + Long.parseLong(strValue); + return true; + } + catch (NumberFormatException ex) + { + return false; + } + } + + + + +} diff --git a/datatrans/src/main/resources/application-local.yml b/datatrans/src/main/resources/application-local.yml new file mode 100644 index 00000000..8348fa60 --- /dev/null +++ b/datatrans/src/main/resources/application-local.yml @@ -0,0 +1,67 @@ + # Service port + server: + port: 9002 + +# JPA 설정, JSP 설정 + spring: + devtools: + livereload: + enabled: true + mvc: + pathmatch: + matching-strategy: ANT_PATH_MATCHER + # 인증서버에서 JWT 보안키 확인 + security: + oauth2: + resourceserver: + jwt: + jwk-set-uri: + http://localhost:9001/oauth/token_key + +# Primary db information + ncmsdb: + driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy + jdbcUrl: jdbc:log4jdbc:mysql://192.168.8.138:3307/kccfnova?characterEncoding=UTF-8&serverTimezone=Asia/Seoul&rewriteBatchedStatements=true + username: yT4l55I/Xl4v8LeoTQhh1w== + password: aqmsYeReTVvoQ4r2bfAjYg== + maximumPoolSize: 35 + minimumIdle: 2 + connectionTimeout: 3000 + idleTimeout: 300000 + testOnBorrow: true + validationQuery: SELECT 1 + iamsdb: + driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy + jdbcUrl: jdbc:log4jdbc:mysql://192.168.8.138:3307/uac_cltr_db?characterEncoding=UTF-8&serverTimezone=Asia/Seoul&rewriteBatchedStatements=true + username: kSLzt543nkDJ/ta9rnLTCA== + password: kSLzt543nkDJ/ta9rnLTCA== + maximumPoolSize: 35 + minimumIdle: 2 + connectionTimeout: 3000 + idleTimeout: 300000 + testOnBorrow: true + validationQuery: SELECT 1 + +# SQL Log 관련 setting + log4jdbc: + spylogdelegator: + name: net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator + dump: + sql: + maxlinelength: 0 + + logging.level.jdbc.sqlonly: info + logging.level.jdbc.sqltiming: false + logging.level.jdbc.audit: false + logging.level.jdbc.resultset: false + logging.level.jdbc.resultsettable: info + logging.level.jdbc.connection: false + + file: + ncms: + basefolder : D:/z_temp_pro/kccf_temp + iams: + basefolder : D:/z_temp_pro/kccf_temp/repo + fileCpYn : N + + \ No newline at end of file diff --git a/datatrans/src/main/resources/application-ncms_server.yml b/datatrans/src/main/resources/application-ncms_server.yml new file mode 100644 index 00000000..29bd63eb --- /dev/null +++ b/datatrans/src/main/resources/application-ncms_server.yml @@ -0,0 +1,67 @@ + # Service port + server: + port: 9002 + +# JPA 설정, JSP 설정 + spring: + devtools: + livereload: + enabled: true + mvc: + pathmatch: + matching-strategy: ANT_PATH_MATCHER + # 인증서버에서 JWT 보안키 확인 + security: + oauth2: + resourceserver: + jwt: + jwk-set-uri: + http://localhost:9001/oauth/token_key + +# Primary db information + ncmsdb: + driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy + jdbcUrl: jdbc:log4jdbc:mysql://127.0.0.1:3306/kccfnova?characterEncoding=UTF-8&serverTimezone=Asia/Seoul&rewriteBatchedStatements=true + username: yT4l55I/Xl4v8LeoTQhh1w== + password: aqmsYeReTVvoQ4r2bfAjYg== + maximumPoolSize: 35 + minimumIdle: 2 + connectionTimeout: 3000 + idleTimeout: 300000 + testOnBorrow: true + validationQuery: SELECT 1 + iamsdb: + driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy + jdbcUrl: jdbc:log4jdbc:mysql://10.10.30.237:3306/uac_cltr_db?characterEncoding=UTF-8&serverTimezone=Asia/Seoul&rewriteBatchedStatements=true + username: kSLzt543nkDJ/ta9rnLTCA== + password: kSLzt543nkDJ/ta9rnLTCA== + maximumPoolSize: 35 + minimumIdle: 2 + connectionTimeout: 3000 + idleTimeout: 300000 + testOnBorrow: true + validationQuery: SELECT 1 + +# SQL Log 관련 setting + log4jdbc: + spylogdelegator: + name: net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator + dump: + sql: + maxlinelength: 0 + + logging.level.jdbc.sqlonly: info + logging.level.jdbc.sqltiming: false + logging.level.jdbc.audit: false + logging.level.jdbc.resultset: false + logging.level.jdbc.resultsettable: info + logging.level.jdbc.connection: false + + file: + ncms: + basefolder : /nfs_nas/minio/amsweb-opt + iams: + basefolder : /nfs_nas/uac/repo + fileCpYn : Y + + \ No newline at end of file diff --git a/datatrans/src/main/resources/log4jdbc.log4j2.properties b/datatrans/src/main/resources/log4jdbc.log4j2.properties new file mode 100644 index 00000000..85d1ede9 --- /dev/null +++ b/datatrans/src/main/resources/log4jdbc.log4j2.properties @@ -0,0 +1,2 @@ +log4jdbc.spylogdelegator.name = net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator +log4jdbc.dump.sql.maxlinelength=0 \ No newline at end of file diff --git a/datatrans/src/main/resources/logback-spring.xml b/datatrans/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..31ad4bcc --- /dev/null +++ b/datatrans/src/main/resources/logback-spring.xml @@ -0,0 +1,98 @@ + + + ${HOSTNAME} + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/datatrans/src/main/resources/mapper/iamsdb/config/MybatisIamsConfig.xml b/datatrans/src/main/resources/mapper/iamsdb/config/MybatisIamsConfig.xml new file mode 100644 index 00000000..dfb0172e --- /dev/null +++ b/datatrans/src/main/resources/mapper/iamsdb/config/MybatisIamsConfig.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/datatrans/src/main/resources/mapper/iamsdb/sqlmap/iamsDataMapper.xml b/datatrans/src/main/resources/mapper/iamsdb/sqlmap/iamsDataMapper.xml new file mode 100644 index 00000000..196eed55 --- /dev/null +++ b/datatrans/src/main/resources/mapper/iamsdb/sqlmap/iamsDataMapper.xml @@ -0,0 +1,185 @@ + + + + + + + + + + insert into rg_master + ( + master_id + , use_flag + , set_id + , reg_status + , title + , keyword + , type_div_cd + , erecord_flag + , org_nm + , creat_yyyy + , presv_term_cd + , expt_disuse_yyyy + , oper_read_range_cd + , open_div_cd + , reg_id + , reg_dd + , mod_id + , mod_dd + , mng_org_cd + , page_cnt + , series_id + , digital_yn + , oper_out_range_cd + , mng_org_nm + , asset_type + , tags + , management_code + , interface_id + , set_no + , digital_read_yn + , prsvn_proc_trgt_yn + , dtls_type_div_cd + ) + values + ( + #{master_id } + , #{use_flag } + , #{set_id } + , #{reg_status } + , #{title } + , #{keyword } + , #{type_div_cd } + , #{erecord_flag } + , #{org_nm } + , #{creat_yyyy } + , #{presv_term_cd } + , #{expt_disuse_yyyy } + , #{oper_read_range_cd } + , #{open_div_cd } + , #{reg_id } + , sysdate() + , #{mod_id } + , sysdate() + , #{mng_org_cd } + , #{page_cnt } + , #{series_id } + , #{digital_yn } + , #{oper_out_range_cd } + , #{mng_org_nm } + , #{asset_type } + , #{tag } + , #{management_code } + , #{interface_id } + , #{set_no } + , #{digital_read_yn } + , #{prsvn_proc_trgt_yn } + , '' + ) + + + + insert into j_attachfile + ( + file_mask + , file_id + , file_seq + , file_name + , file_size + , download_count + , atch_type_cd + , digital_read_yn + ) + values + ( + #{file_mask } + , #{file_id } + , #{file_seq } + , #{file_name } + , #{file_size } + , #{download_count } + , #{atch_type_cd } + , #{digital_read_yn } + ) + + + + insert into uare_master + ( + f_id + , org_name + , volume_id + , v_seq + , length + , comp_yn + , encrypt_yn + , org_date + , reg_date + , reg_time + , commit_stat + , session_key + , reg_user_id + , file_key + , f_group + , f_index + , bef_commit_stat + , repository + , clipid + , offset + ) + values + ( + #{f_id } + , #{org_name } + , #{volume_id } + , #{v_seq } + , #{length } + , #{comp_yn } + , #{encrypt_yn } + , #{org_date } + , #{reg_date } + , #{reg_time } + , #{commit_stat } + , #{session_key } + , #{reg_user_id } + , #{file_key } + , #{f_group } + , #{f_index } + , #{bef_commit_stat } + , #{repository } + , #{clipid } + , #{offset } + ) + + + + insert into uac_record + ( + record_id + , type_div_cd + , book_spcm_cpy_yn + ) + values + ( + #{record_id } + , #{type_div_cd } + , 'N' + ) + + + + + + + + + + \ No newline at end of file diff --git a/datatrans/src/main/resources/mapper/ncmsdb/config/MybatisNcmsConfig.xml b/datatrans/src/main/resources/mapper/ncmsdb/config/MybatisNcmsConfig.xml new file mode 100644 index 00000000..a61361c1 --- /dev/null +++ b/datatrans/src/main/resources/mapper/ncmsdb/config/MybatisNcmsConfig.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/datatrans/src/main/resources/mapper/ncmsdb/sqlmap/CommonMapper.xml b/datatrans/src/main/resources/mapper/ncmsdb/sqlmap/CommonMapper.xml new file mode 100644 index 00000000..4f9b446d --- /dev/null +++ b/datatrans/src/main/resources/mapper/ncmsdb/sqlmap/CommonMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/datatrans/src/main/resources/mapper/ncmsdb/sqlmap/ncmsDataMapper.xml b/datatrans/src/main/resources/mapper/ncmsdb/sqlmap/ncmsDataMapper.xml new file mode 100644 index 00000000..024e71f6 --- /dev/null +++ b/datatrans/src/main/resources/mapper/ncmsdb/sqlmap/ncmsDataMapper.xml @@ -0,0 +1,243 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + /* ncmsDataDao.updateResultMultimediaAssets */ + update multimedia_assets + SET iams_tran_yn = #{iams_tran_yn} + , iams_tran_dt = sysdate() + , iams_tran_remark = #{iams_tran_remark} + , iams_tran_master_id = #{iams_tran_master_id} + WHERE id = #{id} + + + + + + \ No newline at end of file diff --git a/datatrans/src/main/resources/secrets/UrpSystem.keystore b/datatrans/src/main/resources/secrets/UrpSystem.keystore new file mode 100644 index 00000000..39528f7c --- /dev/null +++ b/datatrans/src/main/resources/secrets/UrpSystem.keystore @@ -0,0 +1 @@ +aes256.key=52f48aa1c7435bc11bf909d9d7d1d5932f4bacd8184ec5c1eed6d03ee17fe126 \ No newline at end of file diff --git a/datatrans/src/main/webapp/WEB-INF/jsp/bodyTest.jsp b/datatrans/src/main/webapp/WEB-INF/jsp/bodyTest.jsp new file mode 100644 index 00000000..ab57ea1f --- /dev/null +++ b/datatrans/src/main/webapp/WEB-INF/jsp/bodyTest.jsp @@ -0,0 +1,6 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %> + + + +여기는 body test jsp \ No newline at end of file diff --git a/datatrans/src/main/webapp/WEB-INF/jsp/tilesLayout/base-main.jsp b/datatrans/src/main/webapp/WEB-INF/jsp/tilesLayout/base-main.jsp new file mode 100644 index 00000000..995fa00e --- /dev/null +++ b/datatrans/src/main/webapp/WEB-INF/jsp/tilesLayout/base-main.jsp @@ -0,0 +1,38 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %> + +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> + + +<% +response.setHeader("Cache-Control","no-store"); +response.setHeader("Pragma","no-cache"); +response.setDateHeader("Expires",0); +if (request.getProtocol().equals("HTTP/1.1")) response.setHeader("Cache-Control", "no-cache"); +%> + + + + + + + + 이미지 편집 시스템 + + + + + +
+ 여기는 base-main.jsp + + + + +
+ + \ No newline at end of file diff --git a/datatrans/src/main/webapp/WEB-INF/jsp/tilesLayout/footer.jsp b/datatrans/src/main/webapp/WEB-INF/jsp/tilesLayout/footer.jsp new file mode 100644 index 00000000..8e4b43c1 --- /dev/null +++ b/datatrans/src/main/webapp/WEB-INF/jsp/tilesLayout/footer.jsp @@ -0,0 +1,10 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + +
+
+ 여기는 footer +
+
+ + \ No newline at end of file diff --git a/datatrans/src/main/webapp/WEB-INF/jsp/tilesLayout/header.jsp b/datatrans/src/main/webapp/WEB-INF/jsp/tilesLayout/header.jsp new file mode 100644 index 00000000..4ce32cf8 --- /dev/null +++ b/datatrans/src/main/webapp/WEB-INF/jsp/tilesLayout/header.jsp @@ -0,0 +1,32 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + + + + + + GDSC 이미지 저장 시스템 + + + + + + + + + + +
+
+
+ 여기는 header jsp +
+
+
+ + + + \ No newline at end of file diff --git a/datatrans/src/main/webapp/WEB-INF/tiles/tiles.xml b/datatrans/src/main/webapp/WEB-INF/tiles/tiles.xml new file mode 100644 index 00000000..61de8b5a --- /dev/null +++ b/datatrans/src/main/webapp/WEB-INF/tiles/tiles.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file