Compare commits
35 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
09feb8c43b | |
|
|
3e610f1e1f | |
|
|
8f15867119 | |
|
|
0a7d904872 | |
|
|
46fc40e096 | |
|
|
c0c96f2c94 | |
|
|
36937b8056 | |
|
|
bd79cb3518 | |
|
|
13c09d8e5d | |
|
|
01919a73a7 | |
|
|
e0387fa4ff | |
|
|
1b5b5cef3c | |
|
|
d07184e8ba | |
|
|
3aa0f85f5b | |
|
|
ace8836fce | |
|
|
42705fa756 | |
|
|
c084c316b8 | |
|
|
df7bd880c1 | |
|
|
2d4cc61dd0 | |
|
|
284f401312 | |
|
|
f3eb65591a | |
|
|
1e12734275 | |
|
|
190a462520 | |
|
|
5978e6f83a | |
|
|
a015964611 | |
|
|
9711921384 | |
|
|
1158ca332e | |
|
|
8a05a7ff87 | |
|
|
d59fa9348f | |
|
|
6b046fe976 | |
|
|
226a269d88 | |
|
|
779096bf95 | |
|
|
0a8c841073 | |
|
|
2072d0b814 | |
|
|
702bc24847 |
|
|
@ -3,3 +3,6 @@
|
||||||
/RemoteSystemsTempFiles
|
/RemoteSystemsTempFiles
|
||||||
/bin/
|
/bin/
|
||||||
.settings
|
.settings
|
||||||
|
.idea/
|
||||||
|
WebContent/WEB-INF/lib/servlet-api-6.0.29.jar
|
||||||
|
data_manager_backend.iml
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
#强烈建议数据的存储目录按如下目录结构 根目录/年度/批次/地区编码_系统编码_版本
|
||||||
|
|
||||||
|
#操作系统识别,linux为0,windows为1
|
||||||
|
operate-system=1
|
||||||
|
|
||||||
#=============================================================================================================
|
#=============================================================================================================
|
||||||
# MySQL
|
# MySQL
|
||||||
#=============================================================================================================
|
#=============================================================================================================
|
||||||
|
|
@ -27,22 +32,7 @@ gather-user-password=oracle
|
||||||
gather-port=1521
|
gather-port=1521
|
||||||
#
|
#
|
||||||
gather-service-name=orcl
|
gather-service-name=orcl
|
||||||
#=============================================================================================================
|
|
||||||
# 数据库公共配置
|
|
||||||
#=============================================================================================================
|
|
||||||
jdbc.initialSize=5
|
|
||||||
jdbc.minIdle=5
|
|
||||||
jdbc.maxIdle=20
|
|
||||||
jdbc.maxActive=100
|
|
||||||
jdbc.maxWait=100000
|
|
||||||
jdbc.defaultAutoCommit=false
|
|
||||||
jdbc.removeAbandoned=true
|
|
||||||
jdbc.removeAbandonedTimeout=600
|
|
||||||
jdbc.testWhileIdle=true
|
|
||||||
jdbc.timeBetweenEvictionRunsMillis=60000
|
|
||||||
jdbc.numTestsPerEvictionRun=20
|
|
||||||
jdbc.minEvictableIdleTimeMillis=300000
|
|
||||||
#==============================================================================================================
|
|
||||||
#
|
#
|
||||||
#==============================================================================================================
|
#==============================================================================================================
|
||||||
table-suffix=_20152016
|
table-suffix=_20152016
|
||||||
|
|
@ -67,6 +57,8 @@ collect-service-name=orcl
|
||||||
collect-user-table=U_BZBJY
|
collect-user-table=U_BZBJY
|
||||||
collect-exec-table=KZXZB
|
collect-exec-table=KZXZB
|
||||||
collect-pay-table=ZFXXB
|
collect-pay-table=ZFXXB
|
||||||
|
# 其他的标准表名称,用逗号分隔
|
||||||
|
other_standard_tables=ZYSKJ
|
||||||
#gfs cluster master IP
|
#gfs cluster master IP
|
||||||
gfs_control_ip=192.168.191.120
|
gfs_control_ip=192.168.191.120
|
||||||
#gfs web password of root
|
#gfs web password of root
|
||||||
|
|
@ -83,23 +75,6 @@ oracle-orcl=orcl
|
||||||
oracle-user=system
|
oracle-user=system
|
||||||
oracle-psw=oracle
|
oracle-psw=oracle
|
||||||
|
|
||||||
#=============================================================================================================
|
|
||||||
# windows path
|
|
||||||
#=============================================================================================================
|
|
||||||
#
|
|
||||||
#extract-log-localtion=D:\\test\\log\\
|
|
||||||
#extract-standard-log-localtion=D:\\test\\log2\\
|
|
||||||
#
|
|
||||||
#file_upload_path=D:\\test\\
|
|
||||||
#file_download_path=D:\\test\\export.xlsx
|
|
||||||
#
|
|
||||||
#package_download_path=D:\\test\\
|
|
||||||
#package_name=sql_script_standard
|
|
||||||
#
|
|
||||||
#sql_script_path_last=D:\\test\\sql_script_last\\
|
|
||||||
#sql_script_path_standard=D:\\test\\sql_script_standard\\
|
|
||||||
|
|
||||||
#=============================================================================================================
|
|
||||||
# linux path
|
# linux path
|
||||||
#=============================================================================================================
|
#=============================================================================================================
|
||||||
|
|
||||||
|
|
@ -110,6 +85,16 @@ data_path=/aggregation-platform_data_path/
|
||||||
extract-log-localtion=extract_log/
|
extract-log-localtion=extract_log/
|
||||||
# standard extract's log file location
|
# standard extract's log file location
|
||||||
extract-standard-log-localtion=extract_standard_log/
|
extract-standard-log-localtion=extract_standard_log/
|
||||||
|
|
||||||
|
#数据导出路径
|
||||||
|
export-data-localtion=export-data-localtion/
|
||||||
|
|
||||||
|
#数据导出日志路径
|
||||||
|
export-data-log-localtion=export-data-log-localtion/
|
||||||
|
# 导出数据原始库sql脚本
|
||||||
|
export_data_origin_sql_script = origin_sql_script/
|
||||||
|
# 导出数据汇总平台sql脚本
|
||||||
|
export_data_platform_sql_script = platform_sql_script/
|
||||||
#import excel file's location
|
#import excel file's location
|
||||||
file_upload_path=excel_import_dir/
|
file_upload_path=excel_import_dir/
|
||||||
|
|
||||||
|
|
@ -123,3 +108,26 @@ package_name=package.zip
|
||||||
sql_script_path_last=sql_last/
|
sql_script_path_last=sql_last/
|
||||||
#location of sql script standard
|
#location of sql script standard
|
||||||
sql_script_path_standard=sql_standard/
|
sql_script_path_standard=sql_standard/
|
||||||
|
|
||||||
|
#oracle原始数据目录
|
||||||
|
origin_database_utf8=origin_database/UTF8/app/
|
||||||
|
origin_database_gbk=origin_database/gbk/app/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#=============================================================================================================
|
||||||
|
# 数据库公共配置
|
||||||
|
#=============================================================================================================
|
||||||
|
jdbc.initialSize=5
|
||||||
|
jdbc.minIdle=5
|
||||||
|
jdbc.maxIdle=20
|
||||||
|
jdbc.maxActive=100
|
||||||
|
jdbc.maxWait=100000
|
||||||
|
jdbc.defaultAutoCommit=false
|
||||||
|
jdbc.removeAbandoned=true
|
||||||
|
jdbc.removeAbandonedTimeout=600
|
||||||
|
jdbc.testWhileIdle=true
|
||||||
|
jdbc.timeBetweenEvictionRunsMillis=60000
|
||||||
|
jdbc.numTestsPerEvictionRun=20
|
||||||
|
jdbc.minEvictableIdleTimeMillis=300000
|
||||||
|
#==============================================================================================================
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,11 @@
|
||||||
<layout class="org.apache.log4j.PatternLayout">
|
<layout class="org.apache.log4j.PatternLayout">
|
||||||
<param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss\} %-5p] [%t] {%c:%L}-%m%n"></param>
|
<param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss\} %-5p] [%t] {%c:%L}-%m%n"></param>
|
||||||
</layout>
|
</layout>
|
||||||
<filter class="org.apache.log4j.varia.LevelRangeFilter">
|
<filter class="org.apache.log4j.varia.LevelRangeFilter">
|
||||||
<param name="LevelMin" value="DEBUG" />
|
<param name="LevelMin" value="DEBUG" />
|
||||||
<param name="LevelMax" value="ERROR" />
|
<param name="LevelMax" value="ERROR" />
|
||||||
</filter>
|
</filter>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<!-- 输出日志到文件 每天一个文件 -->
|
<!-- 输出日志到文件 每天一个文件 -->
|
||||||
<appender name="dailyRollingFile" class="org.apache.log4j.DailyRollingFileAppender">
|
<appender name="dailyRollingFile" class="org.apache.log4j.DailyRollingFileAppender">
|
||||||
<param name="Threshold" value="info"></param>
|
<param name="Threshold" value="info"></param>
|
||||||
|
|
@ -23,12 +22,11 @@
|
||||||
<layout class="org.apache.log4j.PatternLayout">
|
<layout class="org.apache.log4j.PatternLayout">
|
||||||
<param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss\} %-5p] [%t] {%c:%L}-%m%n"></param>
|
<param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss\} %-5p] [%t] {%c:%L}-%m%n"></param>
|
||||||
</layout>
|
</layout>
|
||||||
<filter class="org.apache.log4j.varia.LevelRangeFilter">
|
<filter class="org.apache.log4j.varia.LevelRangeFilter">
|
||||||
<param name="LevelMin" value="DEBUG" />
|
<param name="LevelMin" value="DEBUG" />
|
||||||
<param name="LevelMax" value="ERROR" />
|
<param name="LevelMax" value="ERROR" />
|
||||||
</filter>
|
</filter>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<!-- 输出日志到文件 文件大小到达指定尺寸的时候产生一个新的文件 -->
|
<!-- 输出日志到文件 文件大小到达指定尺寸的时候产生一个新的文件 -->
|
||||||
<appender name="railyFile" class="org.apache.log4j.RollingFileAppender">
|
<appender name="railyFile" class="org.apache.log4j.RollingFileAppender">
|
||||||
<param name="File" value="logs/railyFile.log"></param>
|
<param name="File" value="logs/railyFile.log"></param>
|
||||||
|
|
@ -41,29 +39,21 @@
|
||||||
<param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss\} %-5p] [%t] {%c:%L}-%m%n"></param>
|
<param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss\} %-5p] [%t] {%c:%L}-%m%n"></param>
|
||||||
</layout>
|
</layout>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<logger name="com.ibatis" additivity="true">
|
<logger name="com.ibatis" additivity="true">
|
||||||
<level value="DEBUG" />
|
<level value="DEBUG" />
|
||||||
</logger>
|
</logger>
|
||||||
|
|
||||||
<logger name="java.sql.Connection" additivity="true">
|
<logger name="java.sql.Connection" additivity="true">
|
||||||
<level value="DEBUG" />
|
<level value="DEBUG" />
|
||||||
</logger>
|
</logger>
|
||||||
|
|
||||||
<logger name="java.sql.Statement" additivity="true">
|
<logger name="java.sql.Statement" additivity="true">
|
||||||
<level value="DEBUG" />
|
<level value="DEBUG" />
|
||||||
</logger>
|
</logger>
|
||||||
|
|
||||||
<logger name="java.sql.PreparedStatement" additivity="true">
|
<logger name="java.sql.PreparedStatement" additivity="true">
|
||||||
<level value="DEBUG" />
|
<level value="DEBUG" />
|
||||||
<appender-ref ref="IBatis" />
|
|
||||||
</logger>
|
</logger>
|
||||||
|
|
||||||
<logger name="java.sql.ResultSet" additivity="true">
|
<logger name="java.sql.ResultSet" additivity="true">
|
||||||
<level value="DEBUG" />
|
<level value="DEBUG" />
|
||||||
<appender-ref ref="IBatis" />
|
|
||||||
</logger>
|
</logger>
|
||||||
|
|
||||||
<!-- 定义全局的日志输出级别,但是在输出目的地的配置中配置的具体输出级别优先级高于全局定义的优先级。 如果在railyFile中定义<param
|
<!-- 定义全局的日志输出级别,但是在输出目的地的配置中配置的具体输出级别优先级高于全局定义的优先级。 如果在railyFile中定义<param
|
||||||
name="Threshold" value="info"></param>,那么将会把info以上级别的信息输出 -->
|
name="Threshold" value="info"></param>,那么将会把info以上级别的信息输出 -->
|
||||||
<root>
|
<root>
|
||||||
|
|
|
||||||
|
|
@ -4,32 +4,31 @@
|
||||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||||
<configuration>
|
<configuration>
|
||||||
<typeAliases>
|
<typeAliases>
|
||||||
<typeAlias alias="string" type="java.lang.String" />
|
<typeAlias alias="String" type="java.lang.String" />
|
||||||
<typeAlias alias="EncodedInfoEntity" type="com.platform.entities.EncodedInfoEntity" />
|
<typeAlias alias="EncodedInfoEntity" type="com.platform.entities.EncodedInfoEntity" />
|
||||||
<typeAlias alias="DataInfoEntity" type="com.platform.entities.DataInfoEntity" />
|
<typeAlias alias="DataInfoEntity" type="com.platform.entities.DataInfoEntity" />
|
||||||
<typeAlias alias="PagerOptions" type="com.platform.form.PagerOptions"/>
|
<typeAlias alias="PagerOptions" type="com.platform.form.PagerOptions" />
|
||||||
<typeAlias alias="GatherOracleInfo" type="com.platform.entities.GatherOracleInfo"/>
|
<typeAlias alias="GatherOracleInfo" type="com.platform.entities.GatherOracleInfo" />
|
||||||
<typeAlias alias="DataInfoEntityMoveTmp" type="com.platform.entities.DataInfoEntityMoveTmp"/>
|
<typeAlias alias="DataInfoEntityMoveTmp"
|
||||||
<typeAlias alias="SystemEntity" type="com.platform.entities.SystemEntity"/>
|
type="com.platform.entities.DataInfoEntityMoveTmp" />
|
||||||
<typeAlias alias="RegionalismEntity" type="com.platform.entities.RegionalismEntity"/>
|
<typeAlias alias="SystemEntity" type="com.platform.entities.SystemEntity" />
|
||||||
<typeAlias alias="oracleForm" type="com.platform.form.oracleForm"/>
|
<typeAlias alias="RegionalismEntity" type="com.platform.entities.RegionalismEntity" />
|
||||||
|
<typeAlias alias="OracleForm" type="com.platform.form.OracleForm" />
|
||||||
</typeAliases>
|
</typeAliases>
|
||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin interceptor="com.platform.utils.page.PageInterceptor">
|
<plugin interceptor="com.platform.utils.page.PageInterceptor">
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|
||||||
|
<!-- <mappers>
|
||||||
<!-- <mappers>
|
<mapper resource="com/dao/mapper/dataDetails-mapper.xml" />
|
||||||
<mapper resource="com/dao/mapper/data-details-mapper.xml" />
|
<mapper resource="com/dao/mapper/dataInfoMoveTmp-mapper.xml" />
|
||||||
<mapper resource="com/dao/mapper/config-details-mapper.xml"/>
|
<mapper resource="com/dao/mapper/gatherOracle-mapper.xml" />
|
||||||
<mapper resource="com/dao/mapper/dataInfoMoveTmpmapper.xml"/>
|
<mapper resource="com/dao/mapper/regionalism-mapper.xml" />
|
||||||
<mapper resource="com/dao/mapper/standard_data_details-mapper.xml" />
|
<mapper resource="com/dao/mapper/standardDataDetails-mapper.xml" />
|
||||||
<mapper resource="com/dao/mapper/RegionalismMapper.xml"/>
|
<mapper resource="com/dao/mapper/systemCode-mapper.xml" />
|
||||||
<mapper resource="com/dao/mapper/SystemCodeMapper.xml"/>
|
<mapper resource="com/dao/mapper/volume-mapper.xml" />
|
||||||
<mapper resource="com/dao/mapper/VolumeMapper.xml"/>
|
</mappers> -->
|
||||||
</mappers>
|
|
||||||
-->
|
|
||||||
|
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
|
||||||
xmlns:p="http://www.springframework.org/schema/p"
|
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
|
||||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
|
||||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
|
||||||
xmlns:context="http://www.springframework.org/schema/context"
|
xmlns:context="http://www.springframework.org/schema/context"
|
||||||
xmlns:task="http://www.springframework.org/schema/task"
|
xmlns:task="http://www.springframework.org/schema/task"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||||
|
|
@ -41,35 +39,41 @@
|
||||||
<property name="username" value="${jdbc.mysql.username}" />
|
<property name="username" value="${jdbc.mysql.username}" />
|
||||||
<property name="password" value="${jdbc.mysql.password}" />
|
<property name="password" value="${jdbc.mysql.password}" />
|
||||||
</bean>
|
</bean>
|
||||||
<!-- <bean id="mySQLSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
<!-- <bean id="mySQLSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
||||||
<property name="configLocation" value="WEB-INF/config/mybatis-applicationConfig.xml" />
|
<property name="configLocation" value="WEB-INF/config/mybatis-applicationConfig.xml"
|
||||||
<property name="dataSource" ref="mySQLDataSource" />
|
/> <property name="dataSource" ref="mySQLDataSource" /> </bean> -->
|
||||||
</bean> -->
|
|
||||||
<bean id="mySQLSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
<bean id="mySQLSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
||||||
<property name="configLocation" value="WEB-INF/config/mybatis-applicationConfig.xml" />
|
<property name="configLocation" value="WEB-INF/config/mybatis-applicationConfig.xml" />
|
||||||
<property name="dataSource" ref="mySQLDataSource" />
|
<property name="dataSource" ref="mySQLDataSource" />
|
||||||
<property name="mapperLocations">
|
<property name="mapperLocations">
|
||||||
<list>
|
<list>
|
||||||
<value>classpath:com/dao/mapper/*apper.xml</value>
|
<value>classpath:com/dao/mapper/*.xml</value>
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- mapper扫描器 -->
|
<!-- mapper扫描器 -->
|
||||||
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
|
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
|
||||||
<!-- 扫描包路径,如果需要扫描多个包,中间使用半角逗号隔开 -->
|
<!-- 扫描包路径,如果需要扫描多个包,中间使用半角逗号隔开 -->
|
||||||
<property name="basePackage" value="com/platform/dao"></property>
|
<property name="basePackage" value="com.platform.dao"></property>
|
||||||
<property name="sqlSessionFactoryBeanName" value="mySQLSessionFactory" />
|
<property name="sqlSessionFactoryBeanName" value="mySQLSessionFactory" />
|
||||||
</bean>
|
</bean>
|
||||||
<!-- <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
|
|
||||||
<property name="basePackage" value="com.platform.dao" />
|
|
||||||
</bean> -->
|
|
||||||
<!-- 配置声明式事物 事物管理器 -->
|
<!-- 配置声明式事物 事物管理器 -->
|
||||||
<!-- 配置声明式事物 -->
|
<!-- 配置声明式事物 -->
|
||||||
<bean id="mySQLTxManager"
|
<bean id="mySQLTxManager"
|
||||||
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||||
<property name="dataSource" ref="mySQLDataSource" />
|
<property name="dataSource" ref="mySQLDataSource" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 使用注解事务,需要添加Transactional注解属性 -->
|
||||||
|
<bean id="transactionManager"
|
||||||
|
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||||
|
<property name="dataSource" ref="mySQLDataSource" />
|
||||||
|
</bean>
|
||||||
|
<tx:annotation-driven transaction-manager="transactionManager" />
|
||||||
|
|
||||||
<tx:advice id="txAdvice" transaction-manager="mySQLTxManager">
|
<tx:advice id="txAdvice" transaction-manager="mySQLTxManager">
|
||||||
<tx:attributes>
|
<tx:attributes>
|
||||||
<tx:method name="delete*" propagation="REQUIRED" />
|
<tx:method name="delete*" propagation="REQUIRED" />
|
||||||
|
|
@ -103,17 +107,19 @@
|
||||||
<context:exclude-filter type="annotation"
|
<context:exclude-filter type="annotation"
|
||||||
expression="org.springframework.stereotype.Controller" />
|
expression="org.springframework.stereotype.Controller" />
|
||||||
</context:component-scan>
|
</context:component-scan>
|
||||||
<!-- Enables the Spring Task @Scheduled programming model -->
|
<!-- Enables the Spring Task @Scheduled programming model -->
|
||||||
<task:executor id="executor" pool-size="5" />
|
<task:executor id="executor" pool-size="5" />
|
||||||
<task:scheduler id="scheduler" pool-size="10" />
|
<task:scheduler id="scheduler" pool-size="10" />
|
||||||
<task:annotation-driven executor="executor" scheduler="scheduler" />
|
<task:annotation-driven executor="executor"
|
||||||
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
|
scheduler="scheduler" />
|
||||||
<!-- set the max upload size100MB -->
|
<bean id="multipartResolver"
|
||||||
<property name="maxUploadSize">
|
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
|
||||||
<value>104857600</value>
|
<!-- set the max upload size100MB -->
|
||||||
</property>
|
<property name="maxUploadSize">
|
||||||
<property name="maxInMemorySize">
|
<value>104857600</value>
|
||||||
<value>4096</value>
|
</property>
|
||||||
</property>
|
<property name="maxInMemorySize">
|
||||||
|
<value>4096</value>
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
</beans>
|
</beans>
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
|
||||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx"
|
||||||
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:context="http://www.springframework.org/schema/context"
|
||||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
|
||||||
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
|
||||||
xmlns:context="http://www.springframework.org/schema/context"
|
|
||||||
xmlns:websocket="http://www.springframework.org/schema/websocket"
|
xmlns:websocket="http://www.springframework.org/schema/websocket"
|
||||||
xsi:schemaLocation="
|
xsi:schemaLocation="
|
||||||
http://www.springframework.org/schema/context
|
http://www.springframework.org/schema/context
|
||||||
|
|
@ -22,16 +19,30 @@
|
||||||
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
|
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
|
||||||
http://www.springframework.org/schema/websocket
|
http://www.springframework.org/schema/websocket
|
||||||
http://www.springframework.org/schema/websocket/spring-websocket-4.0.xsd"
|
http://www.springframework.org/schema/websocket/spring-websocket-4.0.xsd"
|
||||||
default-autowire="byName">
|
default-autowire="byName">
|
||||||
|
|
||||||
<context:component-scan base-package="com.platform.controller,com.platform.test,com.platform.websocket;" >
|
<context:component-scan
|
||||||
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
|
base-package="com.platform.controller,com.platform.test,com.platform.websocket;">
|
||||||
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service"/>
|
<context:include-filter type="annotation"
|
||||||
|
expression="org.springframework.stereotype.Controller" />
|
||||||
|
<context:exclude-filter type="annotation"
|
||||||
|
expression="org.springframework.stereotype.Service" />
|
||||||
</context:component-scan>
|
</context:component-scan>
|
||||||
|
|
||||||
<context:annotation-config />
|
<context:annotation-config />
|
||||||
|
|
||||||
<mvc:annotation-driven/>
|
<mvc:annotation-driven>
|
||||||
|
<mvc:message-converters>
|
||||||
|
<bean id="mappingJacksonHttpMessageConverter"
|
||||||
|
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
|
||||||
|
<property name="supportedMediaTypes">
|
||||||
|
<list>
|
||||||
|
<value>application/json;charset=UTF-8</value>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
</mvc:message-converters>
|
||||||
|
</mvc:annotation-driven>
|
||||||
|
|
||||||
<!-- 用于将对象转换为JSON -->
|
<!-- 用于将对象转换为JSON -->
|
||||||
<bean id="stringConverter"
|
<bean id="stringConverter"
|
||||||
|
|
@ -39,19 +50,20 @@
|
||||||
<property name="supportedMediaTypes">
|
<property name="supportedMediaTypes">
|
||||||
<list>
|
<list>
|
||||||
<value>application/json;charset=UTF-8</value>
|
<value>application/json;charset=UTF-8</value>
|
||||||
<value>text/html;charset=UTF-8</value>
|
<value>text/html;charset=UTF-8</value>
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
<bean id="jsonConverter"
|
<bean id="jsonConverter"
|
||||||
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/>
|
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" />
|
||||||
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
|
<bean
|
||||||
<property name="messageConverters">
|
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
|
||||||
<list>
|
<property name="messageConverters">
|
||||||
<ref bean="stringConverter" />
|
<list>
|
||||||
<ref bean="jsonConverter" />
|
<ref bean="stringConverter" />
|
||||||
</list>
|
<ref bean="jsonConverter" />
|
||||||
</property>
|
</list>
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
Binary file not shown.
|
|
@ -0,0 +1,54 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
|
||||||
|
|
||||||
|
|
||||||
|
<generatorConfiguration>
|
||||||
|
<context id="testTables" targetRuntime="MyBatis3">
|
||||||
|
<commentGenerator>
|
||||||
|
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
|
||||||
|
<property name="suppressAllComments" value="true" />
|
||||||
|
</commentGenerator>
|
||||||
|
<!--数据库连接的信息:驱动类、连接地址、用户名、密码 -->
|
||||||
|
<!--
|
||||||
|
<jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver"
|
||||||
|
connectionURL="jdbc:oracle:thin:@150.16.17.22:1521/wsbs" userId="hr"
|
||||||
|
password="hr123">
|
||||||
|
</jdbcConnection>-->
|
||||||
|
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
|
||||||
|
connectionURL="jdbc:mysql://192.168.191.120:3306/ftpdata"
|
||||||
|
userId="root"
|
||||||
|
password="root">
|
||||||
|
</jdbcConnection>
|
||||||
|
|
||||||
|
<!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL 和
|
||||||
|
NUMERIC 类型解析为java.math.BigDecimal -->
|
||||||
|
<javaTypeResolver>
|
||||||
|
<property name="forceBigDecimals" value="false" />
|
||||||
|
</javaTypeResolver>
|
||||||
|
|
||||||
|
<!-- targetProject:生成PO类的位置 -->
|
||||||
|
<javaModelGenerator targetPackage="com.platform.entities"
|
||||||
|
targetProject="aggregation-platform/src">
|
||||||
|
<!-- enableSubPackages:是否让schema作为包的后缀 -->
|
||||||
|
<property name="enableSubPackages" value="false" />
|
||||||
|
<!-- 从数据库返回的值被清理前后的空格 -->
|
||||||
|
<property name="trimStrings" value="true" />
|
||||||
|
</javaModelGenerator>
|
||||||
|
<!-- targetProject:mapper映射文件生成的位置 -->
|
||||||
|
<sqlMapGenerator targetPackage="com.dao.mapper"
|
||||||
|
targetProject="aggregation-platform/src">
|
||||||
|
<!-- enableSubPackages:是否让schema作为包的后缀 -->
|
||||||
|
<property name="enableSubPackages" value="false" />
|
||||||
|
</sqlMapGenerator>
|
||||||
|
<!-- targetPackage:mapper接口生成的位置 -->
|
||||||
|
<javaClientGenerator type="XMLMAPPER"
|
||||||
|
targetPackage="com.platform.dao"
|
||||||
|
targetProject="aggregation-platform/src">
|
||||||
|
<!-- enableSubPackages:是否让schema作为包的后缀 -->
|
||||||
|
<property name="enableSubPackages" value="false" />
|
||||||
|
</javaClientGenerator>
|
||||||
|
<!-- 指定数据库表 -->
|
||||||
|
<!--<table tableName="items"></table> -->
|
||||||
|
<table tableName="operate_record"></table>
|
||||||
|
</context>
|
||||||
|
</generatorConfiguration>
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件名 : BaseController.java
|
* 文件名 : BaseController.java 版权 : XX科技有限公司。 描述 : <描述> 修改时间:2016年9月7日 修改内容:<修改内容>
|
||||||
* 版权 : XX科技有限公司。
|
|
||||||
* 描述 : <描述>
|
|
||||||
* 修改时间:2016年9月7日
|
|
||||||
* 修改内容:<修改内容>
|
|
||||||
*/
|
*/
|
||||||
package com.base;
|
package com.base;
|
||||||
|
|
||||||
|
|
@ -21,59 +17,65 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import com.platform.enums.ResponseStatusEnum;
|
||||||
import com.platform.utils.Configs;
|
import com.platform.utils.Configs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <一句话功能简述>
|
* <一句话功能简述> <功能详细描述>
|
||||||
* <功能详细描述>
|
*
|
||||||
* @author chen
|
* @author chen
|
||||||
* @version [版本号,2016年9月7日]
|
* @version [版本号,2016年9月7日]
|
||||||
* @see [相关类/方法]
|
* @see [相关类/方法]
|
||||||
* @since [产品/模块版本]
|
* @since [产品/模块版本]
|
||||||
*/
|
*/
|
||||||
@ControllerAdvice
|
@ControllerAdvice
|
||||||
public class BaseController {
|
public class BaseController {
|
||||||
|
|
||||||
/** log4j */
|
|
||||||
public final static Logger log = Logger.getLogger(BaseController.class);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <一句话功能简述> 基于@ExceptionHandler异常处理----全局异常处理
|
|
||||||
* <功能详细描述>
|
|
||||||
* @param request
|
|
||||||
* @param ex 异常
|
|
||||||
* @return
|
|
||||||
* @see [类、类#方法、类#成员]
|
|
||||||
*/
|
|
||||||
@ExceptionHandler
|
|
||||||
@ResponseBody
|
|
||||||
public Object exp(HttpServletRequest request, HttpServletResponse response,Exception ex) {
|
|
||||||
log.error("URI"+request.getRequestURI());
|
|
||||||
log.error("BaseController --exp " + ex);
|
|
||||||
new CustomException("base_code_", ex);
|
|
||||||
// 根据不同错误转向不同页面
|
|
||||||
ModelMap modelMap = new ModelMap ();
|
|
||||||
Map<String, String> errmsg = new HashMap<>();
|
|
||||||
if(ex instanceof CustomException) {
|
|
||||||
//返回异常信息
|
|
||||||
CustomException cuse = (CustomException) ex;
|
|
||||||
errmsg.put("code", cuse.getCode());
|
|
||||||
errmsg.put("msg", cuse.getMsg());
|
|
||||||
errmsg.put("err", "网络问题请稍后再试!");
|
|
||||||
// request.setAttribute("msg", cuse.getMsg());
|
|
||||||
// request.setAttribute("err", "网络问题请稍后再试!");
|
|
||||||
modelMap.addAllAttributes(errmsg);
|
|
||||||
log.error(cuse.getCode());
|
|
||||||
response.setStatus(500);
|
|
||||||
return modelMap;
|
|
||||||
} else {
|
|
||||||
//其他错误则 调到指定页面
|
|
||||||
log.error(Configs.GLOBAL_EXP_NOT_CUSTOM, ex);
|
|
||||||
response.setStatus(500);
|
|
||||||
errmsg.put("err", "系统问题请稍后再试!");
|
|
||||||
modelMap.addAllAttributes(errmsg);
|
|
||||||
return modelMap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
/** log4j */
|
||||||
|
public final static Logger log = Logger.getLogger(BaseController.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <一句话功能简述> 基于@ExceptionHandler异常处理----全局异常处理 <功能详细描述>
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @param ex
|
||||||
|
* 异常
|
||||||
|
* @return
|
||||||
|
* @see [类、类#方法、类#成员]
|
||||||
|
*/
|
||||||
|
@ExceptionHandler
|
||||||
|
@ResponseBody
|
||||||
|
public Object exp(HttpServletRequest request, HttpServletResponse response, Exception ex) {
|
||||||
|
log.error("URI" + request.getRequestURI());
|
||||||
|
log.error("BaseController --exp " + ex);
|
||||||
|
new CustomException("base_code_", ex);
|
||||||
|
// 根据不同错误转向不同页面
|
||||||
|
ModelMap modelMap = new ModelMap();
|
||||||
|
Map<String, String> errmsg = new HashMap<>();
|
||||||
|
if (ex instanceof MyException) {
|
||||||
|
// 返回异常信息
|
||||||
|
MyException myException = (MyException) ex;
|
||||||
|
log.info(myException.getMessage());
|
||||||
|
response.setStatus(ResponseStatusEnum.INTERNAL_SERVER_ERROR.getCode());
|
||||||
|
return myException.getMessage();
|
||||||
|
} else if (ex instanceof CustomException) {
|
||||||
|
// 返回异常信息
|
||||||
|
CustomException cuse = (CustomException) ex;
|
||||||
|
errmsg.put("code", cuse.getCode());
|
||||||
|
errmsg.put("msg", cuse.getMsg());
|
||||||
|
errmsg.put("err", "网络问题请稍后再试!");
|
||||||
|
modelMap.addAllAttributes(errmsg);
|
||||||
|
log.error(cuse.getCode());
|
||||||
|
response.setStatus(500);
|
||||||
|
return modelMap;
|
||||||
|
} else {
|
||||||
|
// 其他错误则 调到指定页面
|
||||||
|
log.error(Configs.GLOBAL_EXP_NOT_CUSTOM, ex);
|
||||||
|
response.setStatus(500);
|
||||||
|
errmsg.put("err", "系统问题请稍后再试!");
|
||||||
|
modelMap.addAllAttributes(errmsg);
|
||||||
|
return modelMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,65 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd">
|
|
||||||
|
|
||||||
<mapper namespace="com.platform.dao.ISystemCodeDao">
|
|
||||||
<resultMap id="getEntityByText" type="com.platform.entities.SystemEntity">
|
|
||||||
<id property="code" column="code" jdbcType="INTEGER" />
|
|
||||||
<result property="systemName" column="system_name" jdbcType="VARCHAR" />
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
|
||||||
code,system_name
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<!-- 获取数据全部记录信息 -->
|
|
||||||
<select id="findAllSystem" resultMap="getEntityByText">
|
|
||||||
SELECT
|
|
||||||
<include refid="Base_Column_List" />
|
|
||||||
FROM system_info
|
|
||||||
order by code
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="findSubSystemByName" parameterType="com.platform.entities.SystemEntity" resultMap="getEntityByText">
|
|
||||||
SELECT
|
|
||||||
<include refid="Base_Column_List" />
|
|
||||||
FROM system_info
|
|
||||||
WHERE system_name=#{systemName}
|
|
||||||
</select>
|
|
||||||
<select id="findSubSystemByCode" parameterType="com.platform.entities.SystemEntity" resultMap="getEntityByText">
|
|
||||||
SELECT
|
|
||||||
<include refid="Base_Column_List" />
|
|
||||||
FROM system_info
|
|
||||||
WHERE code=#{code}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="findByName" parameterType="java.util.List" resultMap="getEntityByText">
|
|
||||||
SELECT
|
|
||||||
<include refid="Base_Column_List" />
|
|
||||||
FROM system_info
|
|
||||||
WHERE system_name in
|
|
||||||
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
|
|
||||||
#{item}
|
|
||||||
</foreach>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="findByCode" parameterType="java.util.List" resultMap="getEntityByText">
|
|
||||||
SELECT
|
|
||||||
<include refid="Base_Column_List" />
|
|
||||||
FROM system_info
|
|
||||||
WHERE code in
|
|
||||||
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
|
|
||||||
#{item}
|
|
||||||
</foreach>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- 批量插入 -->
|
|
||||||
<select id="insertBatch" parameterType="java.util.List">
|
|
||||||
INSERT INTO system_info (system_name)
|
|
||||||
VALUES
|
|
||||||
<foreach collection="list" item="item" index="index" separator=",">
|
|
||||||
(#{item,jdbcType=VARCHAR})
|
|
||||||
</foreach>
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
||||||
|
|
@ -20,7 +20,8 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
|
||||||
<result property="collectorContacts" column="collector_contacts"/>
|
<result property="collectorContacts" column="collector_contacts"/>
|
||||||
<result property="collectorName" column="collector_name"/>
|
<result property="collectorName" column="collector_name"/>
|
||||||
<result property="extractStatus" column="extract_status"/>
|
<result property="extractStatus" column="extract_status"/>
|
||||||
|
<result property="execResult" column="checkout_indicate"/>
|
||||||
|
<result property="payResult" column="checkout_pay"/>
|
||||||
<result property="year" column="data_year"/>
|
<result property="year" column="data_year"/>
|
||||||
<result property="startYear" column="start_year"/>
|
<result property="startYear" column="start_year"/>
|
||||||
<result property="endYear" column="end_year"/>
|
<result property="endYear" column="end_year"/>
|
||||||
|
|
@ -36,6 +37,9 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
|
||||||
<result property="checkoutFlag" column="checkout_flag"/>
|
<result property="checkoutFlag" column="checkout_flag"/>
|
||||||
<result property="mark" column="mark"/>
|
<result property="mark" column="mark"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
<sql id="allFields">
|
||||||
|
id,regionalism_code,city_name,district_name,system_code,system_name,data_type,data_version,submitted_batch,data_path,data_charset,collection_time,collector_name,collector_contacts,extract_status,checkout_indicate,checkout_pay,data_year,start_year,end_year,volume_ip,volume_path,data_base_type,standard_extract_status,checkout_indicate_last,checkout_pay_last,checkout_flag,mark,src_id
|
||||||
|
</sql>
|
||||||
<sql id="conditionsFilters">
|
<sql id="conditionsFilters">
|
||||||
<if test="dataType!=null">
|
<if test="dataType!=null">
|
||||||
AND data_details.data_type=#{dataType}
|
AND data_details.data_type=#{dataType}
|
||||||
|
|
@ -82,7 +86,7 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
|
||||||
<where>
|
<where>
|
||||||
<include refid="conditionsFilters" />
|
<include refid="conditionsFilters" />
|
||||||
<choose>
|
<choose>
|
||||||
<when test="offset > 0">
|
<when test="offset>0">
|
||||||
and data_details.id>= #{offset}
|
and data_details.id>= #{offset}
|
||||||
</when>
|
</when>
|
||||||
<otherwise>
|
<otherwise>
|
||||||
|
|
@ -111,7 +115,7 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
|
||||||
<!-- 获取数据符合筛选条件的全部记录信息 -->
|
<!-- 获取数据符合筛选条件的全部记录信息 -->
|
||||||
<select id="findAll" resultMap="getEntityByText">
|
<select id="findAll" resultMap="getEntityByText">
|
||||||
SELECT
|
SELECT
|
||||||
id,regionalism_code,city_name,district_name,system_code,system_name,data_type,data_version,submitted_batch,data_path,data_charset,collection_time,collector_name,collector_contacts,extract_status,data_year,start_year,end_year,volume_ip,volume_path,data_base_type,standard_extract_status,checkout_flag,mark
|
<include refid="allFields"/>
|
||||||
FROM data_details
|
FROM data_details
|
||||||
ORDER BY data_details.id
|
ORDER BY data_details.id
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -125,13 +129,32 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
|
||||||
<!-- 获取数据符合筛选条件的全部记录信息 -->
|
<!-- 获取数据符合筛选条件的全部记录信息 -->
|
||||||
<select id="findById" resultMap="getEntityByText" parameterType="java.lang.Integer">
|
<select id="findById" resultMap="getEntityByText" parameterType="java.lang.Integer">
|
||||||
SELECT
|
SELECT
|
||||||
id,regionalism_code,city_name,district_name,system_code,system_name,data_type,data_version,submitted_batch,data_path,data_charset,collection_time,collector_name,collector_contacts,extract_status,data_year,start_year,end_year,volume_ip,volume_path,data_base_type,standard_extract_status,checkout_indicate_last,checkout_pay_last,checkout_flag,mark,src_id
|
<include refid="allFields"/>
|
||||||
FROM data_details
|
FROM data_details
|
||||||
WHERE id =#{id}
|
WHERE id =#{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 根据dataPath查找是否存在数据 -->
|
||||||
|
<select id="findByDataPath" resultMap="getEntityByText" parameterType="java.lang.String">
|
||||||
|
SELECT
|
||||||
|
<include refid="allFields"/>
|
||||||
|
FROM data_details
|
||||||
|
WHERE data_path =#{dataPath}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 获取数据符合筛选条件的全部记录信息 -->
|
||||||
|
<select id="findByIds" resultMap="getEntityByText" parameterType="java.util.List">
|
||||||
|
SELECT
|
||||||
|
<include refid="allFields"/>
|
||||||
|
FROM data_details
|
||||||
|
WHERE id in
|
||||||
|
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
<!-- 获取数据 条件:采集时间 -->
|
<!-- 获取数据 条件:采集时间 -->
|
||||||
<select id="findByParam" resultType="com.platform.entities.DataInfoEntity" parameterType="com.platform.entities.DataInfoEntity">
|
<select id="findByParam" resultMap="getEntityByText" parameterType="com.platform.entities.DataInfoEntity">
|
||||||
SELECT
|
SELECT
|
||||||
regionalism_code regionalismCode,system_code systemCode,checkout_indicate execResult,checkout_pay payResult
|
regionalism_code regionalismCode,system_code systemCode,checkout_indicate execResult,checkout_pay payResult
|
||||||
FROM data_details
|
FROM data_details
|
||||||
|
|
@ -84,7 +84,7 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<update id="update" parameterType="com.platform.entities.DataInfoEntityMoveTmp">
|
<update id="update" parameterType="com.platform.entities.DataInfoEntityMoveTmp">
|
||||||
UPDATE
|
UPDATE
|
||||||
move_data_tmp
|
move_data_tmp
|
||||||
<set >
|
<set >
|
||||||
<trim suffixOverrides=",">
|
<trim suffixOverrides=",">
|
||||||
<if test="dstPath != null and dstPath != ''">
|
<if test="dstPath != null and dstPath != ''">
|
||||||
|
|
@ -100,10 +100,8 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
|
||||||
lasttime= #{lastTime},
|
lasttime= #{lastTime},
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</set>
|
</set>
|
||||||
<where>
|
where id = #{id}
|
||||||
id = #{id}
|
|
||||||
</where>
|
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<insert id="save" parameterType="com.platform.entities.DataInfoEntityMoveTmp">
|
<insert id="save" parameterType="com.platform.entities.DataInfoEntityMoveTmp">
|
||||||
|
|
@ -29,6 +29,13 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
|
||||||
WHERE remove = "0"
|
WHERE remove = "0"
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectOracleById" parameterType="java.lang.Integer" resultType="com.platform.entities.GatherOracleInfo">
|
||||||
|
SELECT
|
||||||
|
<include refid="baseOracleInfo" />
|
||||||
|
FROM services_info
|
||||||
|
WHERE id=#{id} and remove = "0"
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertOracle" parameterType="com.platform.entities.GatherOracleInfo">
|
<insert id="insertOracle" parameterType="com.platform.entities.GatherOracleInfo">
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
services_info(
|
services_info(
|
||||||
|
|
@ -0,0 +1,276 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.platform.dao.OperateRecordMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.platform.entities.OperateRecordEntity">
|
||||||
|
<id column="id" jdbcType="INTEGER" property="id" />
|
||||||
|
<result column="taskType" jdbcType="CHAR" property="tasktype" />
|
||||||
|
<result column="taskStatus" jdbcType="CHAR" property="taskstatus" />
|
||||||
|
<result column="taskProgress" jdbcType="INTEGER" property="taskprogress" />
|
||||||
|
<result column="taskDesc" jdbcType="VARCHAR" property="taskdesc" />
|
||||||
|
<result column="startTime" jdbcType="TIMESTAMP" property="starttime" />
|
||||||
|
<result column="endTime" jdbcType="TIMESTAMP" property="endtime" />
|
||||||
|
<result column="updateTime" jdbcType="TIMESTAMP" property="updatetime" />
|
||||||
|
<result column="feature" jdbcType="VARCHAR" property="feature" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Example_Where_Clause">
|
||||||
|
<where>
|
||||||
|
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||||
|
<if test="criteria.valid">
|
||||||
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||||
|
<foreach collection="criteria.criteria" item="criterion">
|
||||||
|
<choose>
|
||||||
|
<when test="criterion.noValue">
|
||||||
|
and ${criterion.condition}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.singleValue">
|
||||||
|
and ${criterion.condition} #{criterion.value}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.betweenValue">
|
||||||
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.listValue">
|
||||||
|
and ${criterion.condition}
|
||||||
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||||
|
#{listItem}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</foreach>
|
||||||
|
</trim>
|
||||||
|
</if>
|
||||||
|
</foreach>
|
||||||
|
</where>
|
||||||
|
</sql>
|
||||||
|
<sql id="Update_By_Example_Where_Clause">
|
||||||
|
<where>
|
||||||
|
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||||
|
<if test="criteria.valid">
|
||||||
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||||
|
<foreach collection="criteria.criteria" item="criterion">
|
||||||
|
<choose>
|
||||||
|
<when test="criterion.noValue">
|
||||||
|
and ${criterion.condition}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.singleValue">
|
||||||
|
and ${criterion.condition} #{criterion.value}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.betweenValue">
|
||||||
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.listValue">
|
||||||
|
and ${criterion.condition}
|
||||||
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||||
|
#{listItem}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</foreach>
|
||||||
|
</trim>
|
||||||
|
</if>
|
||||||
|
</foreach>
|
||||||
|
</where>
|
||||||
|
</sql>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, taskType, taskStatus, taskProgress, taskDesc, startTime, endTime, updateTime,
|
||||||
|
feature
|
||||||
|
</sql>
|
||||||
|
<select id="selectByExample" parameterType="com.platform.entities.OperateRecordEntity" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<if test="distinct">
|
||||||
|
distinct
|
||||||
|
</if>
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from operate_record
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Example_Where_Clause" />
|
||||||
|
</if>
|
||||||
|
<if test="orderByClause != null">
|
||||||
|
order by ${orderByClause}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from operate_record
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</select>
|
||||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||||
|
delete from operate_record
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</delete>
|
||||||
|
<delete id="deleteByExample" parameterType="com.platform.entities.OperateRecordEntity">
|
||||||
|
delete from operate_record
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Example_Where_Clause" />
|
||||||
|
</if>
|
||||||
|
</delete>
|
||||||
|
<insert id="insert" parameterType="com.platform.entities.OperateRecordEntity">
|
||||||
|
insert into operate_record (id, taskType, taskStatus,
|
||||||
|
taskProgress, taskDesc, startTime,
|
||||||
|
endTime, updateTime, feature
|
||||||
|
)
|
||||||
|
values (#{id,jdbcType=INTEGER}, #{tasktype,jdbcType=CHAR}, #{taskstatus,jdbcType=CHAR},
|
||||||
|
#{taskprogress,jdbcType=INTEGER}, #{taskdesc,jdbcType=VARCHAR}, #{starttime,jdbcType=TIMESTAMP},
|
||||||
|
#{endtime,jdbcType=TIMESTAMP}, #{updatetime,jdbcType=TIMESTAMP}, #{feature,jdbcType=VARCHAR}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
<insert id="insertSelective" parameterType="com.platform.entities.OperateRecordEntity">
|
||||||
|
insert into operate_record
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
id,
|
||||||
|
</if>
|
||||||
|
<if test="tasktype != null">
|
||||||
|
taskType,
|
||||||
|
</if>
|
||||||
|
<if test="taskstatus != null">
|
||||||
|
taskStatus,
|
||||||
|
</if>
|
||||||
|
<if test="taskprogress != null">
|
||||||
|
taskProgress,
|
||||||
|
</if>
|
||||||
|
<if test="taskdesc != null">
|
||||||
|
taskDesc,
|
||||||
|
</if>
|
||||||
|
<if test="starttime != null">
|
||||||
|
startTime,
|
||||||
|
</if>
|
||||||
|
<if test="endtime != null">
|
||||||
|
endTime,
|
||||||
|
</if>
|
||||||
|
<if test="updatetime != null">
|
||||||
|
updateTime,
|
||||||
|
</if>
|
||||||
|
<if test="feature != null">
|
||||||
|
feature,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
#{id,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="tasktype != null">
|
||||||
|
#{tasktype,jdbcType=CHAR},
|
||||||
|
</if>
|
||||||
|
<if test="taskstatus != null">
|
||||||
|
#{taskstatus,jdbcType=CHAR},
|
||||||
|
</if>
|
||||||
|
<if test="taskprogress != null">
|
||||||
|
#{taskprogress,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="taskdesc != null">
|
||||||
|
#{taskdesc,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="starttime != null">
|
||||||
|
#{starttime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="endtime != null">
|
||||||
|
#{endtime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="updatetime != null">
|
||||||
|
#{updatetime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="feature != null">
|
||||||
|
#{feature,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<select id="countByExample" parameterType="com.platform.entities.OperateRecordEntity" resultType="java.lang.Long">
|
||||||
|
select count(*) from operate_record
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Example_Where_Clause" />
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<update id="updateByExampleSelective" parameterType="map">
|
||||||
|
update operate_record
|
||||||
|
<set>
|
||||||
|
<if test="record.id != null">
|
||||||
|
id = #{record.id,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="record.tasktype != null">
|
||||||
|
taskType = #{record.tasktype,jdbcType=CHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.taskstatus != null">
|
||||||
|
taskStatus = #{record.taskstatus,jdbcType=CHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.taskprogress != null">
|
||||||
|
taskProgress = #{record.taskprogress,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="record.taskdesc != null">
|
||||||
|
taskDesc = #{record.taskdesc,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.starttime != null">
|
||||||
|
startTime = #{record.starttime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="record.endtime != null">
|
||||||
|
endTime = #{record.endtime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="record.updatetime != null">
|
||||||
|
updateTime = #{record.updatetime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="record.feature != null">
|
||||||
|
feature = #{record.feature,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
|
</if>
|
||||||
|
</update>
|
||||||
|
<update id="updateByExample" parameterType="map">
|
||||||
|
update operate_record
|
||||||
|
set id = #{record.id,jdbcType=INTEGER},
|
||||||
|
taskType = #{record.tasktype,jdbcType=CHAR},
|
||||||
|
taskStatus = #{record.taskstatus,jdbcType=CHAR},
|
||||||
|
taskProgress = #{record.taskprogress,jdbcType=INTEGER},
|
||||||
|
taskDesc = #{record.taskdesc,jdbcType=VARCHAR},
|
||||||
|
startTime = #{record.starttime,jdbcType=TIMESTAMP},
|
||||||
|
endTime = #{record.endtime,jdbcType=TIMESTAMP},
|
||||||
|
updateTime = #{record.updatetime,jdbcType=TIMESTAMP},
|
||||||
|
feature = #{record.feature,jdbcType=VARCHAR}
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
|
</if>
|
||||||
|
</update>
|
||||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.platform.entities.OperateRecordEntity">
|
||||||
|
update operate_record
|
||||||
|
<set>
|
||||||
|
<if test="tasktype != null">
|
||||||
|
taskType = #{tasktype,jdbcType=CHAR},
|
||||||
|
</if>
|
||||||
|
<if test="taskstatus != null">
|
||||||
|
taskStatus = #{taskstatus,jdbcType=CHAR},
|
||||||
|
</if>
|
||||||
|
<if test="taskprogress != null">
|
||||||
|
taskProgress = #{taskprogress,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="taskdesc != null">
|
||||||
|
taskDesc = #{taskdesc,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="starttime != null">
|
||||||
|
startTime = #{starttime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="endtime != null">
|
||||||
|
endTime = #{endtime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="updatetime != null">
|
||||||
|
updateTime = #{updatetime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="feature != null">
|
||||||
|
feature = #{feature,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
<update id="updateByPrimaryKey" parameterType="com.platform.entities.OperateRecordEntity">
|
||||||
|
update operate_record
|
||||||
|
set taskType = #{tasktype,jdbcType=CHAR},
|
||||||
|
taskStatus = #{taskstatus,jdbcType=CHAR},
|
||||||
|
taskProgress = #{taskprogress,jdbcType=INTEGER},
|
||||||
|
taskDesc = #{taskdesc,jdbcType=VARCHAR},
|
||||||
|
startTime = #{starttime,jdbcType=TIMESTAMP},
|
||||||
|
endTime = #{endtime,jdbcType=TIMESTAMP},
|
||||||
|
updateTime = #{updatetime,jdbcType=TIMESTAMP},
|
||||||
|
feature = #{feature,jdbcType=VARCHAR}
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
|
||||||
"http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd">
|
"http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd">
|
||||||
|
|
||||||
<mapper namespace="com.platform.dao.IRegionalismCodeDao">
|
<mapper namespace="com.platform.dao.RegionalismCodeDao">
|
||||||
<resultMap id="getEntityByText" type="com.platform.entities.RegionalismEntity">
|
<resultMap id="getEntityByText" type="com.platform.entities.RegionalismEntity">
|
||||||
<id property="code" column="code" jdbcType="VARCHAR" />
|
<id property="code" column="code" jdbcType="VARCHAR" />
|
||||||
<result property="cityName" column="city_name" jdbcType="VARCHAR" />
|
<result property="cityName" column="city_name" jdbcType="VARCHAR" />
|
||||||
|
|
@ -0,0 +1,92 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.platform.dao.SystemCodeDao">
|
||||||
|
<resultMap id="getEntityByText" type="com.platform.entities.SystemEntity">
|
||||||
|
<id property="code" column="code" jdbcType="INTEGER" />
|
||||||
|
<result property="systemName" column="system_name" jdbcType="VARCHAR" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
code,system_name
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 获取数据全部记录信息 -->
|
||||||
|
<select id="findAllSystem" resultMap="getEntityByText">
|
||||||
|
SELECT
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
FROM system_info
|
||||||
|
order by code
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findSubSystemByName" parameterType="com.platform.entities.SystemEntity"
|
||||||
|
resultMap="getEntityByText">
|
||||||
|
SELECT
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
FROM system_info
|
||||||
|
WHERE system_name=#{systemName}
|
||||||
|
</select>
|
||||||
|
<select id="findSubSystemByCode" parameterType="com.platform.entities.SystemEntity"
|
||||||
|
resultMap="getEntityByText">
|
||||||
|
SELECT
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
FROM system_info
|
||||||
|
WHERE code=#{code}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findByName" parameterType="java.util.List"
|
||||||
|
resultMap="getEntityByText">
|
||||||
|
SELECT
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
FROM system_info
|
||||||
|
WHERE system_name in
|
||||||
|
<foreach item="item" index="index" collection="list" open="("
|
||||||
|
separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findBySystemName" parameterType="java.lang.String"
|
||||||
|
resultType="java.lang.Integer">
|
||||||
|
SELECT code FROM system_info WHERE system_name=
|
||||||
|
#{system_name}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findByCode" parameterType="java.util.List"
|
||||||
|
resultMap="getEntityByText">
|
||||||
|
SELECT
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
FROM system_info
|
||||||
|
WHERE code in
|
||||||
|
<foreach item="item" index="index" collection="list" open="("
|
||||||
|
separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 单条插入 -->
|
||||||
|
<insert id="insert" parameterType="java.lang.String">
|
||||||
|
INSERT INTO system_info (system_name)
|
||||||
|
VALUES(TRIM(#{system_name}))
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 批量插入 -->
|
||||||
|
<insert id="insertBatch" parameterType="java.util.List">
|
||||||
|
INSERT INTO system_info (system_name)
|
||||||
|
VALUES
|
||||||
|
<foreach collection="list" item="item" index="index"
|
||||||
|
separator=",">
|
||||||
|
(TRIM(#{item,jdbcType=VARCHAR}))
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!-- 根据系统名称删除 -->
|
||||||
|
<delete id="deleteBySystemName" parameterType="java.lang.String">
|
||||||
|
DELETE FROM system_info WHERE system_name=
|
||||||
|
TRIM(#{system_name})
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
|
|
@ -16,7 +16,6 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
|
||||||
jdbcType="VARCHAR" />
|
jdbcType="VARCHAR" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- 获取数据全部记录信息 -->
|
|
||||||
<select id="findAll" resultType="com.platform.entities.VolumeInitEntity">
|
<select id="findAll" resultType="com.platform.entities.VolumeInitEntity">
|
||||||
SELECT
|
SELECT
|
||||||
id,name,ip,path,mark
|
id,name,ip,path,mark
|
||||||
|
|
@ -29,8 +29,9 @@ import com.platform.entities.DataInfoEntityMoveTmp;
|
||||||
import com.platform.entities.GatherOracleInfo;
|
import com.platform.entities.GatherOracleInfo;
|
||||||
import com.platform.entities.OracleConnectorParams;
|
import com.platform.entities.OracleConnectorParams;
|
||||||
import com.platform.entities.OracleExtractExecuter;
|
import com.platform.entities.OracleExtractExecuter;
|
||||||
|
import com.platform.enums.ResponseStatusEnum;
|
||||||
|
import com.platform.form.OracleForm;
|
||||||
import com.platform.form.PagerOptions;
|
import com.platform.form.PagerOptions;
|
||||||
import com.platform.form.oracleForm;
|
|
||||||
import com.platform.form.volumeMoveForm;
|
import com.platform.form.volumeMoveForm;
|
||||||
import com.platform.service.DataInfoService;
|
import com.platform.service.DataInfoService;
|
||||||
import com.platform.service.ICodeService;
|
import com.platform.service.ICodeService;
|
||||||
|
|
@ -44,6 +45,8 @@ import com.platform.service.OracleStatusService;
|
||||||
import com.platform.utils.CacheSetCantDelete;
|
import com.platform.utils.CacheSetCantDelete;
|
||||||
import com.platform.utils.Configs;
|
import com.platform.utils.Configs;
|
||||||
import com.platform.utils.Constant;
|
import com.platform.utils.Constant;
|
||||||
|
import com.platform.utils.ExceptionMsg;
|
||||||
|
import com.platform.utils.Result;
|
||||||
import com.platform.utils.ThreadVolumeImm;
|
import com.platform.utils.ThreadVolumeImm;
|
||||||
import com.platform.utils.UtilsHelper;
|
import com.platform.utils.UtilsHelper;
|
||||||
|
|
||||||
|
|
@ -62,7 +65,7 @@ public class DataModelController extends BaseController {
|
||||||
* 数据管理--业务类
|
* 数据管理--业务类
|
||||||
*/
|
*/
|
||||||
@Resource(name = "dataInfoService")
|
@Resource(name = "dataInfoService")
|
||||||
private DataInfoService dfs;
|
private DataInfoService dataInfoService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gfs业务类
|
* gfs业务类
|
||||||
|
|
@ -73,8 +76,8 @@ public class DataModelController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* mysql相关业务
|
* mysql相关业务
|
||||||
*/
|
*/
|
||||||
@Resource(name = "mySqlService")
|
@Resource(name = "gatherOracleService")
|
||||||
private IGatherOracleService mySqlService;
|
private IGatherOracleService gatherOracleService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* oracle汇总功能业务
|
* oracle汇总功能业务
|
||||||
|
|
@ -100,8 +103,28 @@ public class DataModelController extends BaseController {
|
||||||
@Resource(name = "logReadService")
|
@Resource(name = "logReadService")
|
||||||
private ILogRead logReadService;
|
private ILogRead logReadService;
|
||||||
|
|
||||||
public void setDfsImp(DataInfoService dfs) {
|
public void setDfsImp(DataInfoService dataInfoService) {
|
||||||
this.dfs = dfs;
|
this.dataInfoService = dataInfoService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据中的所有数据,可以根据传递参数确定是否需要滤掉相同数据
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@RequestMapping("/getAllData")
|
||||||
|
@ResponseBody
|
||||||
|
public List<DataInfoEntity> getAllData(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
|
log.info(request.getServletPath());
|
||||||
|
Result<List<DataInfoEntity>> result = dataInfoService.getAllData(true);
|
||||||
|
if (result.getStatus() == false) {
|
||||||
|
response.setStatus(ResponseStatusEnum.BAD_REQUEST.getCode());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return result.getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -135,7 +158,7 @@ public class DataModelController extends BaseController {
|
||||||
pagerOptions.setCurrentPageNum(Integer.valueOf(params.get("currentPageNum")));
|
pagerOptions.setCurrentPageNum(Integer.valueOf(params.get("currentPageNum")));
|
||||||
// 冷热区查询字段mark
|
// 冷热区查询字段mark
|
||||||
pagerOptions.setMark(pagerOptions.getVolumeType().trim());
|
pagerOptions.setMark(pagerOptions.getVolumeType().trim());
|
||||||
return dfs.getPagerTableData(pagerOptions);
|
return dataInfoService.getPagerTableData(pagerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -165,7 +188,7 @@ public class DataModelController extends BaseController {
|
||||||
}
|
}
|
||||||
if (list.size() > 0) {
|
if (list.size() > 0) {
|
||||||
String[] ids = list.toArray(new String[list.size()]);
|
String[] ids = list.toArray(new String[list.size()]);
|
||||||
dfs.deleteData(ids);
|
dataInfoService.deleteData(ids);
|
||||||
req.setStatus(200);
|
req.setStatus(200);
|
||||||
}
|
}
|
||||||
if (errList.size() > 0) {
|
if (errList.size() > 0) {
|
||||||
|
|
@ -282,25 +305,33 @@ public class DataModelController extends BaseController {
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/oracle/{name}/extract", method = RequestMethod.POST)
|
@RequestMapping(value = "/oracle/{name}/extract", method = RequestMethod.POST)
|
||||||
public void oracleExtract(HttpServletRequest res, HttpServletResponse req, @RequestBody oracleForm form)
|
public String oracleExtract(HttpServletRequest res, HttpServletResponse req, @RequestBody OracleForm form)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
log.info(res.getServletPath());
|
log.info(res.getServletPath());
|
||||||
if (null != form.getTarget()) { // 检查请求参数中是否包含汇总库信息
|
|
||||||
boolean isConnect = OracleExtract.isConnectTotalOracle(form.getTarget()); // 检查汇总库是否可以连接成功,连接成功返回200状态吗,连接失败返回500状态吗
|
if (null == form.getTarget() || null == form.getInneed() || form.getInneed().size() == 0) { // 检查请求参数中是否包含汇总库信息
|
||||||
if (isConnect) {
|
return ExceptionMsg.PARAMATER_ERROR;
|
||||||
req.setStatus(200);
|
|
||||||
if (null != form.getInneed() && form.getInneed().size() > 0) {
|
|
||||||
for (OracleConnectorParams oracleParams : form.getInneed()) {
|
|
||||||
BasedTask task = new OracleExtractTask(oracleParams.getName(), form.getTarget(), oracleParams,
|
|
||||||
OracleExtract);
|
|
||||||
OracleExtractExecuter oee = new OracleExtractExecuter(task);
|
|
||||||
new Thread(oee, oracleParams.getName()).start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
req.setStatus(500);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 参数转换传递
|
||||||
|
form.getTarget().setIsCover(form.getIsCover());
|
||||||
|
|
||||||
|
boolean isConnect = OracleExtract.isConnectTotalOracle(form.getTarget()); // 检查汇总库是否可以连接成功,连接成功返回200状态吗,连接失败返回500状态吗
|
||||||
|
if (!isConnect) {
|
||||||
|
req.setStatus(500);
|
||||||
|
return ExceptionMsg.GATHER_ORACLE_NOT_CONNECT;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (OracleConnectorParams oracleParams : form.getInneed()) {
|
||||||
|
BasedTask task = new OracleExtractTask(oracleParams.getName(), form.getTarget(), oracleParams,
|
||||||
|
OracleExtract);
|
||||||
|
OracleExtractExecuter oee = new OracleExtractExecuter(task);
|
||||||
|
new Thread(oee, oracleParams.getName()).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
req.setStatus(200);
|
||||||
|
return ExceptionMsg.GATHER_ORACLE_NOT_CONNECT;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -312,8 +343,8 @@ public class DataModelController extends BaseController {
|
||||||
@RequestMapping(value = "/oracle/list", method = RequestMethod.POST)
|
@RequestMapping(value = "/oracle/list", method = RequestMethod.POST)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<GatherOracleInfo> oracleList() throws Exception {
|
public List<GatherOracleInfo> oracleList() throws Exception {
|
||||||
log.info("----------getOracleInfo-----------------------");
|
log.info("----------/oracle/list-----------------------");
|
||||||
List<GatherOracleInfo> result = mySqlService.findAllOracle();
|
List<GatherOracleInfo> result = gatherOracleService.findAllOracle();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -330,13 +361,13 @@ public class DataModelController extends BaseController {
|
||||||
throws Exception {
|
throws Exception {
|
||||||
log.info("----------deleteOracleInfo----------------");
|
log.info("----------deleteOracleInfo----------------");
|
||||||
Integer num = Integer.valueOf(id);
|
Integer num = Integer.valueOf(id);
|
||||||
Integer result = mySqlService.deleteOracle(num);
|
Integer result = gatherOracleService.deleteOracle(num);
|
||||||
log.info("oracleDelete : " + result);
|
log.info("oracleDelete : " + result);
|
||||||
res.setStatus(200);
|
res.setStatus(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* oracle汇总、抽取库的 新增
|
* oracle汇总、抽取库的 新增 该方法没有调用,新增也调用的是oracleUpdate方法
|
||||||
*
|
*
|
||||||
* @param res
|
* @param res
|
||||||
* @param req
|
* @param req
|
||||||
|
|
@ -346,16 +377,18 @@ public class DataModelController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/oracle/{id}/insert", method = RequestMethod.POST)
|
@RequestMapping(value = "/oracle/{id}/insert", method = RequestMethod.POST)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public void oracleInsert(HttpServletRequest res, HttpServletResponse req, @PathVariable String id,
|
public String oracleInsert(HttpServletRequest res, HttpServletResponse req, @PathVariable String id,
|
||||||
@RequestBody GatherOracleInfo oracle) throws Exception {
|
@RequestBody GatherOracleInfo oracle) throws Exception {
|
||||||
log.info(res.getServletPath());
|
log.info(res.getServletPath());
|
||||||
|
|
||||||
oracle.setId(Integer.valueOf(id));
|
oracle.setId(Integer.valueOf(id));
|
||||||
mySqlService.insertOracle(oracle);
|
gatherOracleService.insertOracle(oracle);
|
||||||
req.setStatus(200);
|
req.setStatus(200);
|
||||||
|
return ExceptionMsg.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* oracle汇总、抽取库的 更新
|
* oracle汇总、抽取库的 增加、更新
|
||||||
*
|
*
|
||||||
* @param res
|
* @param res
|
||||||
* @param req
|
* @param req
|
||||||
|
|
@ -364,13 +397,52 @@ public class DataModelController extends BaseController {
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/oracle/{id}/update", method = RequestMethod.POST)
|
@RequestMapping(value = "/oracle/{id}/update", method = RequestMethod.POST)
|
||||||
@ResponseBody
|
public @ResponseBody String oracleUpdate(HttpServletRequest res, HttpServletResponse req,
|
||||||
public void oracleUpdate(HttpServletRequest res, HttpServletResponse req, @PathVariable("id") String id,
|
|
||||||
@RequestBody GatherOracleInfo oracle) throws Exception {
|
@RequestBody GatherOracleInfo oracle) throws Exception {
|
||||||
log.info(res.getServletPath());
|
log.info(res.getServletPath());
|
||||||
log.info(oracle);
|
|
||||||
mySqlService.updateOracle(oracle);
|
if (oracle == null) {
|
||||||
|
req.setStatus(ResponseStatusEnum.BAD_REQUEST.getCode());
|
||||||
|
log.error("汇总库更新失败!参数为空!");
|
||||||
|
return ExceptionMsg.PARAMATER_ERROR;
|
||||||
|
}
|
||||||
|
int updateRes = gatherOracleService.updateOracle(oracle);
|
||||||
|
|
||||||
|
if (updateRes == 0) {
|
||||||
|
req.setStatus(ResponseStatusEnum.BAD_REQUEST.getCode());
|
||||||
|
log.error("汇总库更新失败!");
|
||||||
|
return ExceptionMsg.DATABASE_ERROR;
|
||||||
|
}
|
||||||
|
log.info("汇总库更新成功!");
|
||||||
|
req.setStatus(ResponseStatusEnum.OK.getCode());
|
||||||
|
|
||||||
|
return ExceptionMsg.SUCCESS;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建oracle汇总库
|
||||||
|
*
|
||||||
|
* @param res
|
||||||
|
* @param req
|
||||||
|
* @param id
|
||||||
|
* @param oracle
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/oracle/createDatabase", method = RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Result<DataInfoEntity> createGatherDatabase(HttpServletRequest res, HttpServletResponse req,
|
||||||
|
@RequestBody GatherOracleInfo oracle) throws Exception {
|
||||||
|
log.info(res.getServletPath());
|
||||||
|
Result<DataInfoEntity> result = gatherOracleService.createGatherDatabase(oracle);
|
||||||
|
if (result.getData() == null) {
|
||||||
|
result.setMsg(ExceptionMsg.CREATE_GATHER_DATABASE_ERROR);
|
||||||
|
result.setCode(ExceptionMsg.EXCEPTION_CODE);
|
||||||
|
req.setStatus(ResponseStatusEnum.INTERNAL_SERVER_ERROR.getCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
req.setStatus(200);
|
req.setStatus(200);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -447,7 +519,7 @@ public class DataModelController extends BaseController {
|
||||||
public Object taskTransferSave(HttpServletRequest res, HttpServletResponse req, @RequestBody DataInfoEntity move)
|
public Object taskTransferSave(HttpServletRequest res, HttpServletResponse req, @RequestBody DataInfoEntity move)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
log.info("---------/task/transfer/save-----------------------");
|
log.info("---------/task/transfer/save-----------------------");
|
||||||
// int result = dfs.save(move);
|
// int result = dataInfoService.save(move);
|
||||||
req.setStatus(200);
|
req.setStatus(200);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
@ -486,4 +558,5 @@ public class DataModelController extends BaseController {
|
||||||
log.put(name, result + "\r\n");
|
log.put(name, result + "\r\n");
|
||||||
return log;
|
return log;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.platform.controller;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.io.RandomAccessFile;
|
import java.io.RandomAccessFile;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
@ -16,13 +17,8 @@ import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.springframework.http.HttpHeaders;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
@ -34,11 +30,11 @@ import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||||
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
|
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
|
||||||
|
|
||||||
import com.base.BaseController;
|
import com.base.BaseController;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.platform.entities.PreDataInfo;
|
import com.platform.entities.PreDataInfo;
|
||||||
import com.platform.entities.ResumableInfo;
|
import com.platform.entities.ResumableInfo;
|
||||||
import com.platform.entities.ResumableInfoStorage;
|
import com.platform.entities.ResumableInfoStorage;
|
||||||
|
import com.platform.enums.ResponseStatusEnum;
|
||||||
import com.platform.form.PagerOptions;
|
import com.platform.form.PagerOptions;
|
||||||
import com.platform.service.IPreDataInfoService;
|
import com.platform.service.IPreDataInfoService;
|
||||||
import com.platform.utils.Configs;
|
import com.platform.utils.Configs;
|
||||||
|
|
@ -47,58 +43,56 @@ import com.platform.utils.HttpUtils;
|
||||||
import com.platform.utils.ThreadRemoveFile;
|
import com.platform.utils.ThreadRemoveFile;
|
||||||
import com.platform.utils.UtilsHelper;
|
import com.platform.utils.UtilsHelper;
|
||||||
|
|
||||||
/** 信息系统--清单(包含excel操作)
|
/**
|
||||||
|
* 信息系统--清单(包含excel操作)
|
||||||
|
*
|
||||||
* @author chen
|
* @author chen
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/fileOperation")
|
@RequestMapping("/fileOperation")
|
||||||
public class ExcelController extends BaseController{
|
public class ExcelController extends BaseController {
|
||||||
|
|
||||||
private static ObjectMapper mapper = new ObjectMapper();
|
private static ObjectMapper mapper = new ObjectMapper();
|
||||||
/**
|
/**
|
||||||
* 日志
|
* 日志
|
||||||
*/
|
*/
|
||||||
public final static Logger log = Logger.getLogger(ExcelController.class);
|
public final static Logger log = Logger.getLogger(ExcelController.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 信息系统--清单--业务类
|
* 信息系统--清单--业务类
|
||||||
*/
|
*/
|
||||||
@Resource(name = "preDataInfoService")
|
@Resource(name = "preDataInfoService")
|
||||||
private IPreDataInfoService preDataInfoService;
|
private IPreDataInfoService preDataInfoService;
|
||||||
|
|
||||||
/** 信息系统--清单--文件上传处理函数
|
/**
|
||||||
|
* 信息系统--清单--文件上传处理函数
|
||||||
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param response
|
* @param response
|
||||||
* @throws ServletException
|
* @throws ServletException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/file/upload", method = RequestMethod.POST)
|
@RequestMapping(value = "/file/upload", method = RequestMethod.POST)
|
||||||
public void upload(HttpServletRequest request, HttpServletResponse response)
|
public void upload(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
throws ServletException, IOException {
|
|
||||||
log.info("---------/file/upload--- ");
|
log.info("---------/file/upload--- ");
|
||||||
int resumableChunkNumber = HttpUtils.toInt(
|
int resumableChunkNumber = HttpUtils.toInt(request.getParameter("resumableChunkNumber"), -1);
|
||||||
request.getParameter("resumableChunkNumber"), -1);
|
|
||||||
ResumableInfo info = getResumableInfo(request);
|
ResumableInfo info = getResumableInfo(request);
|
||||||
|
|
||||||
String requestMethod = request.getMethod();
|
String requestMethod = request.getMethod();
|
||||||
// 处理GET请求
|
// 处理GET请求
|
||||||
if ("GET".equals(requestMethod)) {
|
if ("GET".equals(requestMethod)) {
|
||||||
if (info.uploadedChunks
|
if (info.uploadedChunks.contains(new ResumableInfo.ResumableChunkNumber(resumableChunkNumber))) {
|
||||||
.contains(new ResumableInfo.ResumableChunkNumber(
|
|
||||||
resumableChunkNumber))) {
|
|
||||||
response.getWriter().print("Uploaded."); // This Chunk has been
|
response.getWriter().print("Uploaded."); // This Chunk has been
|
||||||
// Uploaded.
|
// Uploaded.
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
||||||
}
|
}
|
||||||
} else if ("POST".equals(requestMethod)) { // 处理POST请求
|
} else if ("POST".equals(requestMethod)) { // 处理POST请求
|
||||||
RandomAccessFile raf = new RandomAccessFile(info.resumableFilePath,
|
RandomAccessFile raf = new RandomAccessFile(info.resumableFilePath, "rw");
|
||||||
"rw");
|
|
||||||
// Seek to position
|
// Seek to position
|
||||||
raf.seek((resumableChunkNumber - 1)
|
raf.seek((resumableChunkNumber - 1) * (long) info.resumableChunkSize);
|
||||||
* (long) info.resumableChunkSize);
|
|
||||||
|
|
||||||
// Save to file
|
// Save to file
|
||||||
InputStream is = request.getInputStream();
|
InputStream is = request.getInputStream();
|
||||||
long readed = 0;
|
long readed = 0;
|
||||||
|
|
@ -113,16 +107,15 @@ public class ExcelController extends BaseController{
|
||||||
readed += r;
|
readed += r;
|
||||||
}
|
}
|
||||||
raf.close();
|
raf.close();
|
||||||
|
|
||||||
// Mark as uploaded.
|
// Mark as uploaded.
|
||||||
info.uploadedChunks.add(new ResumableInfo.ResumableChunkNumber(
|
info.uploadedChunks.add(new ResumableInfo.ResumableChunkNumber(resumableChunkNumber));
|
||||||
resumableChunkNumber));
|
|
||||||
if (info.checkIfUploadFinished()) { // Check if all chunks uploaded,
|
if (info.checkIfUploadFinished()) { // Check if all chunks uploaded,
|
||||||
// and change filename
|
// and change filename
|
||||||
log.info(info.resumableFilename);
|
log.info(info.resumableFilename);
|
||||||
ResumableInfoStorage.getInstance().remove(info);
|
ResumableInfoStorage.getInstance().remove(info);
|
||||||
response.getWriter().print("All finished.");
|
response.getWriter().print("All finished.");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
response.getWriter().print("Upload");
|
response.getWriter().print("Upload");
|
||||||
}
|
}
|
||||||
|
|
@ -131,66 +124,66 @@ public class ExcelController extends BaseController{
|
||||||
}
|
}
|
||||||
log.info("----");
|
log.info("----");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 信息系统--清单--文件下载处理函数(导出excel)
|
/**
|
||||||
|
* 信息系统--清单--文件下载处理函数(导出excel)
|
||||||
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param response
|
* @param response
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/file/download")
|
@RequestMapping(value = "/file/download")
|
||||||
public ResponseEntity<byte[]> download(HttpServletRequest request,
|
public void download(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
HttpServletResponse response) throws Exception {
|
|
||||||
log.info("---------/file/download--- ");
|
log.info("---------/file/download--- ");
|
||||||
//先导出
|
// 先导出
|
||||||
preDataInfoService.exportExcel(Configs.FILE_DOWNLOAD_PATH);
|
preDataInfoService.exportExcel(Configs.FILE_DOWNLOAD_PATH);
|
||||||
|
byte[] data = null;
|
||||||
File file = new File(Configs.FILE_DOWNLOAD_PATH);
|
File file = new File(Configs.FILE_DOWNLOAD_PATH);
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
HttpHeaders headers = new HttpHeaders();
|
String fileName = new String(file.getName().getBytes("UTF-8"), "iso-8859-1");// 为了解决中文名称乱码问题
|
||||||
String fileName = new String(file.getName().getBytes("UTF-8"),
|
data = FileOperateHelper.readFiletoByteArray(Configs.FILE_DOWNLOAD_PATH);
|
||||||
"iso-8859-1");// 为了解决中文名称乱码问题
|
// headers.setContentDispositionFormData("attachment", fileName);
|
||||||
headers.setContentDispositionFormData("attachment", fileName);
|
// headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||||
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
response.setCharacterEncoding("utf-8");
|
||||||
return new ResponseEntity<byte[]>(
|
response.setContentType("application/octet-stream");
|
||||||
FileUtils.readFileToByteArray(file), headers,
|
response.setHeader("Content-Disposition", "attachment;fileName=" + fileName);
|
||||||
HttpStatus.CREATED);
|
response.setHeader("Content-type", "charset=UTF-8");
|
||||||
|
response.setStatus(ResponseStatusEnum.OK.getCode());
|
||||||
|
OutputStream os = response.getOutputStream();
|
||||||
|
os.write(data);
|
||||||
|
os.flush();
|
||||||
|
os.close();
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(500);
|
response.setStatus(500);
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 文件上传处理函数
|
/**
|
||||||
|
* 文件上传处理函数
|
||||||
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
* @throws ServletException
|
* @throws ServletException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
private ResumableInfo getResumableInfo(HttpServletRequest request)
|
private ResumableInfo getResumableInfo(HttpServletRequest request) throws ServletException, IOException {
|
||||||
throws ServletException, IOException {
|
|
||||||
String base_dir = Configs.FILE_UPLOAD_PATH;
|
String base_dir = Configs.FILE_UPLOAD_PATH;
|
||||||
|
|
||||||
int resumableChunkSize = HttpUtils.toInt(
|
int resumableChunkSize = HttpUtils.toInt(request.getParameter("resumableChunkSize"), -1);
|
||||||
request.getParameter("resumableChunkSize"), -1);
|
long resumableTotalSize = HttpUtils.toLong(request.getParameter("resumableTotalSize"), -1);
|
||||||
long resumableTotalSize = HttpUtils.toLong(
|
String resumableIdentifier = request.getParameter("resumableIdentifier");
|
||||||
request.getParameter("resumableTotalSize"), -1);
|
String fileName = new String(request.getParameter("resumableFilename").getBytes("iso-8859-1"), "UTF-8");// 为了解决中文名称乱码问题
|
||||||
String resumableIdentifier = request
|
|
||||||
.getParameter("resumableIdentifier");
|
|
||||||
String fileName = new String(request.getParameter("resumableFilename").getBytes("iso-8859-1"),
|
|
||||||
"UTF-8");// 为了解决中文名称乱码问题
|
|
||||||
String resumableFilename = fileName /*request.getParameter("resumableFilename")*/;
|
String resumableFilename = fileName /*request.getParameter("resumableFilename")*/;
|
||||||
String resumableRelativePath = request
|
String resumableRelativePath = request.getParameter("resumableRelativePath");
|
||||||
.getParameter("resumableRelativePath");
|
|
||||||
// Here we add a ".temp" to every upload file to indicate NON-FINISHED
|
// Here we add a ".temp" to every upload file to indicate NON-FINISHED
|
||||||
new File(base_dir).mkdir();
|
new File(base_dir).mkdir();
|
||||||
String resumableFilePath = new File(base_dir, resumableFilename)
|
String resumableFilePath = new File(base_dir, resumableFilename).getAbsolutePath() + ".temp";
|
||||||
.getAbsolutePath() + ".temp";
|
|
||||||
|
|
||||||
ResumableInfoStorage storage = ResumableInfoStorage.getInstance();
|
ResumableInfoStorage storage = ResumableInfoStorage.getInstance();
|
||||||
|
|
||||||
ResumableInfo info = storage.get(resumableChunkSize,
|
ResumableInfo info = storage.get(resumableChunkSize, resumableTotalSize, resumableIdentifier, resumableFilename,
|
||||||
resumableTotalSize, resumableIdentifier, resumableFilename,
|
|
||||||
resumableRelativePath, resumableFilePath);
|
resumableRelativePath, resumableFilePath);
|
||||||
if (!info.vaild()) {
|
if (!info.vaild()) {
|
||||||
storage.remove(info);
|
storage.remove(info);
|
||||||
|
|
@ -199,7 +192,9 @@ public class ExcelController extends BaseController{
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 信息系统--清单--条件查询
|
/**
|
||||||
|
* 信息系统--清单--条件查询
|
||||||
|
*
|
||||||
* @param res
|
* @param res
|
||||||
* @param req
|
* @param req
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -224,18 +219,18 @@ public class ExcelController extends BaseController{
|
||||||
sb.append(str).append(":").append("null").append(",");
|
sb.append(str).append(":").append("null").append(",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Configs.CONSOLE_LOGGER.info(sb.deleteCharAt(sb.length() - 1)
|
Configs.CONSOLE_LOGGER.info(sb.deleteCharAt(sb.length() - 1).append("}").toString());
|
||||||
.append("}").toString());
|
PagerOptions pagerOptions = (PagerOptions) UtilsHelper.newObjAndSetAttrsByClass(PagerOptions.class, params);
|
||||||
PagerOptions pagerOptions = (PagerOptions) UtilsHelper
|
|
||||||
.newObjAndSetAttrsByClass(PagerOptions.class, params);
|
|
||||||
|
|
||||||
List<PreDataInfo> result = preDataInfoService.findByParam(pagerOptions);
|
List<PreDataInfo> result = preDataInfoService.findByParam(pagerOptions);
|
||||||
modelMap.addAttribute("data", result);
|
modelMap.addAttribute("data", result);
|
||||||
modelMap.addAttribute("length", result.size());
|
modelMap.addAttribute("length", result.size());
|
||||||
return modelMap;
|
return modelMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 信息系统--清单--查询所有
|
/**
|
||||||
|
* 信息系统--清单--查询所有
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
|
@ -249,8 +244,10 @@ public class ExcelController extends BaseController{
|
||||||
modelMap.addAttribute("length", result.size());
|
modelMap.addAttribute("length", result.size());
|
||||||
return modelMap;
|
return modelMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 信息系统--清单--导入excel
|
/**
|
||||||
|
* 信息系统--清单--导入excel
|
||||||
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param response
|
* @param response
|
||||||
* @param fileNameList
|
* @param fileNameList
|
||||||
|
|
@ -259,93 +256,85 @@ public class ExcelController extends BaseController{
|
||||||
*/
|
*/
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequestMapping(produces = "application/json", value = "/importExcel", method = RequestMethod.POST)
|
@RequestMapping(produces = "application/json", value = "/importExcel", method = RequestMethod.POST)
|
||||||
public ModelMap importExcel(HttpServletRequest request,
|
public ModelMap importExcel(HttpServletRequest request, HttpServletResponse response,
|
||||||
HttpServletResponse response, @RequestBody String fileNameList) throws Exception {
|
@RequestBody String[] fileNameList) throws Exception {
|
||||||
log.info("---importExcel---" + fileNameList);
|
log.info("---importExcel---" + fileNameList);
|
||||||
List<String> jsonlist = mapper.readValue(fileNameList, new TypeReference<List<String>>() {});
|
List<String> listPath = new ArrayList<>();
|
||||||
// JavaType javaType = mapper.getTypeFactory().constructParametricType(List.class, String.class);
|
|
||||||
|
|
||||||
// JSONArray jsonArray = JSONArray.fromObject(fileNameList);
|
|
||||||
// List<String> jsonlist = (List<String>) JSONArray.toCollection(jsonArray, String.class);
|
|
||||||
|
|
||||||
ModelMap modelMap = new ModelMap();
|
ModelMap modelMap = new ModelMap();
|
||||||
if (null == jsonlist || jsonlist.size() == 0) {
|
|
||||||
modelMap.addAttribute("returncode","3002");
|
|
||||||
return modelMap;
|
|
||||||
}
|
|
||||||
log.info(jsonlist.size());
|
|
||||||
List<String> listPath = new ArrayList<String>();
|
|
||||||
// 末尾 含有 /(linux)
|
// 末尾 含有 /(linux)
|
||||||
// 加上 最后 的 /
|
// 加上 最后 的 /
|
||||||
String dirPath = FileOperateHelper.addLastSeparator(Configs.FILE_UPLOAD_PATH);;
|
String dirPath = FileOperateHelper.addLastLinuxSeparator(Configs.FILE_UPLOAD_PATH);
|
||||||
for (String p : jsonlist) {
|
for (String path : fileNameList) {
|
||||||
listPath.add(dirPath + p);
|
listPath.add(dirPath + path);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object> result = new HashMap<String, Object>();
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
if (listPath.size() > 0) {
|
if (listPath.size() > 0) {
|
||||||
//导入
|
// 导入
|
||||||
result = preDataInfoService.importExcel(listPath);
|
result = preDataInfoService.importExcel(listPath);
|
||||||
//导入成功后再次请求数据
|
// 导入成功后再次请求数据
|
||||||
List<PreDataInfo> datalist = preDataInfoService.findAll();
|
List<PreDataInfo> datalist = preDataInfoService.findAll();
|
||||||
modelMap.addAttribute("data", datalist);
|
modelMap.addAttribute("data", datalist);
|
||||||
modelMap.addAttribute("length", datalist.size());
|
modelMap.addAttribute("length", datalist.size());
|
||||||
modelMap.addAttribute("code","1001");
|
modelMap.addAttribute("code", "1001");
|
||||||
modelMap.addAllAttributes(result);
|
modelMap.addAllAttributes(result);
|
||||||
//失败
|
// 失败
|
||||||
if (result.keySet().contains("err")) {
|
if (result.keySet().contains("err")) {
|
||||||
modelMap.addAttribute("code","3001");
|
modelMap.addAttribute("code", "3001");
|
||||||
response.setStatus(500);
|
response.setStatus(500);
|
||||||
}
|
}
|
||||||
//删除文件
|
// 删除文件
|
||||||
List<String> failedDelete = new ArrayList<String>();
|
List<String> failedDelete = new ArrayList<String>();
|
||||||
for (String filePath : listPath) {
|
for (String filePath : listPath) {
|
||||||
//读取完后删除源文件(不管是否成功导入)
|
// 读取完后删除源文件(不管是否成功导入)
|
||||||
File tmpf = new File(filePath + ".temp");
|
File tmpf = new File(filePath + ".temp");
|
||||||
File f = new File(filePath);
|
File f = new File(filePath);
|
||||||
if(!tmpf.delete()){
|
if (!tmpf.delete()) {
|
||||||
failedDelete.add(tmpf.getAbsolutePath());
|
failedDelete.add(tmpf.getAbsolutePath());
|
||||||
}
|
}
|
||||||
if(!f.delete()){
|
if (!f.delete()) {
|
||||||
failedDelete.add(f.getAbsolutePath());
|
failedDelete.add(f.getAbsolutePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//删除失败时--启用线程去删除
|
// 删除失败时--启用线程去删除
|
||||||
new ThreadRemoveFile(failedDelete).start();
|
new ThreadRemoveFile(failedDelete).start();
|
||||||
}
|
}
|
||||||
return modelMap;
|
return modelMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uploadSpring(HttpServletRequest request, HttpServletResponse respone){
|
public void uploadSpring(HttpServletRequest request, HttpServletResponse respone) {
|
||||||
//解析器解析request的上下文
|
// 解析器解析request的上下文
|
||||||
CommonsMultipartResolver multipartResolver =
|
CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver(
|
||||||
new CommonsMultipartResolver(request.getSession().getServletContext());
|
request.getSession().getServletContext());
|
||||||
//先判断request中是否包涵multipart类型的数据,
|
// 先判断request中是否包涵multipart类型的数据,
|
||||||
if(multipartResolver.isMultipart(request)){
|
if (multipartResolver.isMultipart(request)) {
|
||||||
//再将request中的数据转化成multipart类型的数据
|
// 再将request中的数据转化成multipart类型的数据
|
||||||
MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request;
|
MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request;
|
||||||
Iterator<String> iter = multiRequest.getFileNames();
|
Iterator<String> iter = multiRequest.getFileNames();
|
||||||
while(iter.hasNext()){
|
while (iter.hasNext()) {
|
||||||
//这里的name为fileItem的alias属性值,相当于form表单中name
|
// 这里的name为fileItem的alias属性值,相当于form表单中name
|
||||||
String name= iter.next();
|
String name = iter.next();
|
||||||
//根据name值拿取文件
|
// 根据name值拿取文件
|
||||||
MultipartFile file = multiRequest.getFile(name);
|
MultipartFile file = multiRequest.getFile(name);
|
||||||
if(file != null){
|
if (file != null) {
|
||||||
String fileName = file.getOriginalFilename();
|
String fileName = file.getOriginalFilename();
|
||||||
String path = "D:/test/" + fileName;
|
String path = "D:/test/" + fileName;
|
||||||
File localFile = new File(path);
|
File localFile = new File(path);
|
||||||
if(!localFile.getParentFile().exists()) {
|
if (!localFile.getParentFile().exists()) {
|
||||||
//如果目标文件所在的目录不存在,则创建父目录
|
// 如果目标文件所在的目录不存在,则创建父目录
|
||||||
localFile.getParentFile().mkdirs();
|
localFile.getParentFile().mkdirs();
|
||||||
}
|
}
|
||||||
//写文件到本地
|
// 写文件到本地
|
||||||
try {
|
try {
|
||||||
file.transferTo(localFile);
|
file.transferTo(localFile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
log.error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.platform.controller;
|
package com.platform.controller;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -8,12 +9,7 @@ import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.springframework.http.HttpHeaders;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
@ -24,10 +20,11 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.base.BaseController;
|
import com.base.BaseController;
|
||||||
import com.platform.entities.SqlFileInfoEntity;
|
import com.platform.entities.SqlFileInfoEntity;
|
||||||
|
import com.platform.enums.ResponseStatusEnum;
|
||||||
import com.platform.form.ScriptForm;
|
import com.platform.form.ScriptForm;
|
||||||
import com.platform.service.IScriptMakeService;
|
import com.platform.service.IScriptMakeService;
|
||||||
import com.platform.utils.Configs;
|
import com.platform.utils.Configs;
|
||||||
import com.platform.utils.Constant;
|
import com.platform.utils.FileOperateHelper;
|
||||||
import com.platform.utils.ZipCompressUtils;
|
import com.platform.utils.ZipCompressUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -48,14 +45,14 @@ public class FilePackageController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 信息系统--脚本管理--文件包导出
|
* 信息系统--脚本管理--文件包导出
|
||||||
* 将sql_script_path_standard中的所有文件压缩,保存到package_download_path下,然后下载该文件
|
* 将sql_script_path_standard中的所有文件压缩,保存到package_download_path下,然后下载该文件
|
||||||
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param response
|
* @param response
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/download")
|
@RequestMapping("/download")
|
||||||
public ResponseEntity<byte[]> downloadFile(HttpServletRequest request, HttpServletResponse response)
|
public void downloadFile(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
throws Exception {
|
|
||||||
log.info("---------/download--- ");
|
log.info("---------/download--- ");
|
||||||
scriptMakeService.makeCfg();
|
scriptMakeService.makeCfg();
|
||||||
scriptMakeService.makeXml();
|
scriptMakeService.makeXml();
|
||||||
|
|
@ -64,19 +61,23 @@ public class FilePackageController extends BaseController {
|
||||||
ZipCompressUtils.zip(new File(Configs.SQL_SCRIPT_PATH_STANDARD), packageFilePath); // 产生压缩文件
|
ZipCompressUtils.zip(new File(Configs.SQL_SCRIPT_PATH_STANDARD), packageFilePath); // 产生压缩文件
|
||||||
File file = new File(packageFilePath);
|
File file = new File(packageFilePath);
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
HttpHeaders headers = new HttpHeaders();
|
String fileName = new String(file.getName().getBytes("UTF-8"), "iso-8859-1");// 为了解决中文名称乱码问题
|
||||||
String fileName = new String(file.getName());// 为了解决中文名称乱码问题
|
byte[] data = FileOperateHelper.readFiletoByteArray(packageFilePath);
|
||||||
log.info(fileName);
|
// headers.setContentDispositionFormData("attachment", fileName);
|
||||||
headers.setContentDispositionFormData("attachment", fileName);
|
// headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||||
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
response.setCharacterEncoding("utf-8");
|
||||||
ResponseEntity<byte[]> responseEntity = new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),
|
response.setContentType("application/octet-stream");
|
||||||
headers, HttpStatus.CREATED);
|
response.setHeader("Content-Disposition", "attachment;fileName=" + fileName);
|
||||||
file.delete(); //
|
response.setHeader("Content-type", "charset=UTF-8");
|
||||||
return responseEntity;
|
response.setStatus(ResponseStatusEnum.OK.getCode());
|
||||||
|
OutputStream os = response.getOutputStream();
|
||||||
|
os.write(data);
|
||||||
|
os.flush();
|
||||||
|
os.close();
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(500);
|
response.setStatus(500);
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
package com.platform.controller;
|
package com.platform.controller;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
@ -19,63 +21,164 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.base.BaseController;
|
import com.base.BaseController;
|
||||||
import com.platform.dao.GatherOracleDao;
|
import com.platform.dao.GatherOracleDao;
|
||||||
import com.platform.entities.GatherOracleInfo;
|
import com.platform.entities.GatherOracleInfo;
|
||||||
import com.platform.form.oracleForm;
|
import com.platform.enums.ExportDataTypeEnum;
|
||||||
|
import com.platform.enums.ResponseStatusEnum;
|
||||||
|
import com.platform.form.ExportDataFrom;
|
||||||
|
import com.platform.form.OracleForm;
|
||||||
|
import com.platform.service.IGatherOracleService;
|
||||||
import com.platform.service.ILogRead;
|
import com.platform.service.ILogRead;
|
||||||
import com.platform.service.IOracleExtractService;
|
import com.platform.service.IOracleExtractService;
|
||||||
import com.platform.service.thread.ThreadExtractStandardOracle;
|
import com.platform.service.thread.ThreadExtractStandardOracle;
|
||||||
import com.platform.service.thread.ThreadGainOracleConnect;
|
import com.platform.service.thread.ThreadGainOracleConnect;
|
||||||
import com.platform.utils.Configs;
|
import com.platform.utils.Configs;
|
||||||
import com.platform.utils.Constant;
|
import com.platform.utils.Constant;
|
||||||
|
import com.platform.utils.ExceptionMsg;
|
||||||
|
import com.platform.utils.Result;
|
||||||
|
|
||||||
/** oracle相关业务
|
/**
|
||||||
|
* oracle相关业务
|
||||||
|
*
|
||||||
* @author chen
|
* @author chen
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
public class OracleController extends BaseController {
|
public class OracleController extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日志
|
* 日志
|
||||||
*/
|
*/
|
||||||
public final static Logger log = Logger.getLogger(OracleController.class);
|
public final static Logger log = Logger.getLogger(OracleController.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* oracle汇总 业务类
|
* oracle汇总 业务类
|
||||||
*/
|
*/
|
||||||
@Resource(name = "OracleExtract")
|
@Resource(name = "OracleExtract")
|
||||||
private IOracleExtractService OracleExtract;
|
private IOracleExtractService OracleExtract;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* oracle汇总日志记录类
|
* oracle汇总日志记录类
|
||||||
*/
|
*/
|
||||||
@Resource(name = "logReadService")
|
@Resource(name = "logReadService")
|
||||||
private ILogRead logReadService;
|
private ILogRead logReadService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* oracle汇总库,抽取库持久层
|
* oracle汇总库,抽取库持久层
|
||||||
*/
|
*/
|
||||||
@Resource(name = "gatherOracleDao")
|
@Resource(name = "gatherOracleDao")
|
||||||
private GatherOracleDao gatherOracleDao;
|
private GatherOracleDao gatherOracleDao;
|
||||||
|
|
||||||
/** oracle 标准表抽取,是将该库中的标准用户名下的标准表抽取到配置的标准库中
|
@Resource(name = "gatherOracleService")
|
||||||
|
private IGatherOracleService gatherOracleService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* oracle数据导出,可以选择全部导出、部分系统导出,导出的数据可以选择汇总库、原始数据、标准表脚本 <功能详细描述>
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @see [类、类#方法、类#成员]
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/oracle/exportData", method = RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public String oracleExport(HttpServletRequest res, HttpServletResponse req,
|
||||||
|
@RequestBody ExportDataFrom exportDataFrom) throws Exception {
|
||||||
|
log.info(res.getServletPath());
|
||||||
|
|
||||||
|
// 已经有导出任务,不允许同时导出
|
||||||
|
if (((ThreadPoolExecutor) Constant.DATA_EXPORT_THREAD_POOL)
|
||||||
|
.getActiveCount() >= Constant.DATA_EXPORT_THREAD_MAX_COUNT) {
|
||||||
|
String msg = " 正在进行数据导出,不能同时进行导出操作!";
|
||||||
|
log.error(ExceptionMsg.PARAMATER_ERROR + msg);
|
||||||
|
req.setStatus(ResponseStatusEnum.BAD_REQUEST.getCode());
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Integer> idList = exportDataFrom.getIdList();
|
||||||
|
List<Integer> typeList = exportDataFrom.getTypeList();
|
||||||
|
List<Integer> gatherOracleList = exportDataFrom.getGatherOracleList();
|
||||||
|
|
||||||
|
Result<String> result = new Result<String>();
|
||||||
|
// 检查参数错误
|
||||||
|
if (idList == null || idList.size() == 0) {
|
||||||
|
log.error(ExceptionMsg.PARAMATER_ERROR + " " + idList + " 为空或者没有选中");
|
||||||
|
req.setStatus(ResponseStatusEnum.BAD_REQUEST.getCode());
|
||||||
|
return ExceptionMsg.PARAMATER_ERROR;
|
||||||
|
}
|
||||||
|
if (typeList == null || typeList.size() == 0) {
|
||||||
|
log.error(ExceptionMsg.PARAMATER_ERROR + " " + typeList + " 为空或者没有选中");
|
||||||
|
req.setStatus(ResponseStatusEnum.BAD_REQUEST.getCode());
|
||||||
|
return ExceptionMsg.PARAMATER_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 暂时不支持同时选择多个汇总库
|
||||||
|
if (typeList.contains(ExportDataTypeEnum.GATHER_DATA.getValue())
|
||||||
|
&& (gatherOracleList == null || gatherOracleList.size() == 0 || gatherOracleList.size() > 1)) {
|
||||||
|
log.error(ExceptionMsg.PARAMATER_ERROR + " 汇总库为空或者没有选中或者为多个,目前只支持单汇总库导出!");
|
||||||
|
result.setStatus(false);
|
||||||
|
req.setStatus(ResponseStatusEnum.BAD_REQUEST.getCode());
|
||||||
|
return ExceptionMsg.PARAMATER_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ExportDataTypeEnum> exportDataTypeEnums = new ArrayList<ExportDataTypeEnum>();
|
||||||
|
for (int type : typeList) {
|
||||||
|
ExportDataTypeEnum exportDataTypeEnum = ExportDataTypeEnum.getEnumFromValue(type);
|
||||||
|
if (exportDataTypeEnum == null) {
|
||||||
|
log.error(ExceptionMsg.PARAMATER_ERROR + " " + type + " 不能识别");
|
||||||
|
req.setStatus(ResponseStatusEnum.BAD_REQUEST.getCode());
|
||||||
|
return ExceptionMsg.PARAMATER_ERROR;
|
||||||
|
}
|
||||||
|
exportDataTypeEnums.add(exportDataTypeEnum);
|
||||||
|
}
|
||||||
|
result = gatherOracleService.oracleDataExport(idList, exportDataTypeEnums, gatherOracleList);
|
||||||
|
if (result.getStatus() == false) {
|
||||||
|
req.setStatus(ResponseStatusEnum.BAD_REQUEST.getCode());
|
||||||
|
return result.getData();
|
||||||
|
}
|
||||||
|
req.setStatus(ResponseStatusEnum.OK.getCode());
|
||||||
|
return result.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* oracle 数据导出 日志 读取
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @param res
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/oracle/exportData/log", method = RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Object getExportDataLog(HttpServletRequest res, HttpServletResponse req) throws Exception {
|
||||||
|
log.info("---------/oracle/exportData/log-------------------");
|
||||||
|
String result = logReadService.readExportDataLog();
|
||||||
|
// "查看相应日志"
|
||||||
|
Map<String, String> log = new HashMap<String, String>();
|
||||||
|
log.put(Configs.EXPORT_DATA_LOG_NAME, result + "\r\n");
|
||||||
|
return log;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* oracle 标准表抽取,是将该库中的标准用户名下的标准表抽取到配置的标准库中
|
||||||
|
*
|
||||||
* @param res
|
* @param res
|
||||||
* @param req
|
* @param req
|
||||||
* @param form
|
* @param form
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@RequestMapping(value = "/oracle/standardextract/{name}/extract", method = RequestMethod.POST)
|
@RequestMapping(value = "/oracle/standardextract/{name}/extract", method = RequestMethod.POST)
|
||||||
public void oracleStandardExtract(HttpServletRequest res, HttpServletResponse req,
|
@ResponseBody
|
||||||
@RequestBody oracleForm form) throws Exception {
|
public void oracleStandardExtract(HttpServletRequest res, HttpServletResponse req, @RequestBody OracleForm form)
|
||||||
log.info(res.getServletPath()+ "?" + res.getQueryString());
|
throws Exception {
|
||||||
|
log.info(res.getServletPath() + "?" + res.getQueryString());
|
||||||
log.info(form.getInneed().get(0).getName());
|
log.info(form.getInneed().get(0).getName());
|
||||||
boolean isConnect = false;
|
boolean isConnect = false;
|
||||||
//5秒内是否能获得oracle连接,否则认为超时。
|
// 5秒内是否能获得oracle连接,否则认为超时。
|
||||||
if (null != form.getTarget()) {
|
if (null != form.getTarget()) {
|
||||||
// 汇总库的信息
|
// 汇总库的信息
|
||||||
GatherOracleInfo oracleInfo = null;
|
GatherOracleInfo oracleInfo = null;
|
||||||
List<GatherOracleInfo> oracleConnects = gatherOracleDao.selectAllOracle();
|
List<GatherOracleInfo> oracleConnects = gatherOracleDao.selectAllOracle();
|
||||||
for (GatherOracleInfo info : oracleConnects) {
|
for (GatherOracleInfo info : oracleConnects) {
|
||||||
//抽取标准表的汇总库
|
// 抽取标准表的汇总库
|
||||||
if (Constant.ORACLE_EXTRACT_TYPE_ONE.equals(info.getType())) {
|
if (Constant.ORACLE_EXTRACT_TYPE_ONE.equals(info.getType())) {
|
||||||
oracleInfo = info;
|
oracleInfo = info;
|
||||||
break;
|
break;
|
||||||
|
|
@ -83,8 +186,7 @@ public class OracleController extends BaseController {
|
||||||
}
|
}
|
||||||
if (null == oracleInfo) {
|
if (null == oracleInfo) {
|
||||||
isConnect = false;
|
isConnect = false;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
form.setTarget(oracleInfo);
|
form.setTarget(oracleInfo);
|
||||||
ThreadGainOracleConnect thOrcl = new ThreadGainOracleConnect(form, OracleExtract);
|
ThreadGainOracleConnect thOrcl = new ThreadGainOracleConnect(form, OracleExtract);
|
||||||
thOrcl.start();
|
thOrcl.start();
|
||||||
|
|
@ -93,8 +195,7 @@ public class OracleController extends BaseController {
|
||||||
isConnect = thOrcl.isConnect();
|
isConnect = thOrcl.isConnect();
|
||||||
if (isConnect) {
|
if (isConnect) {
|
||||||
break;
|
break;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (thOrcl.isExcept()) {
|
if (thOrcl.isExcept()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -102,7 +203,7 @@ public class OracleController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (isConnect)
|
if (isConnect)
|
||||||
req.setStatus(200);
|
req.setStatus(200);
|
||||||
|
|
@ -114,8 +215,10 @@ public class OracleController extends BaseController {
|
||||||
thExtra.start();
|
thExtra.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 读取标准表 抽取的日志,包括sqlserver,oracle
|
/**
|
||||||
|
* 读取标准表 抽取的日志,包括sqlserver,oracle
|
||||||
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* @param res
|
* @param res
|
||||||
* @param req
|
* @param req
|
||||||
|
|
@ -124,14 +227,14 @@ public class OracleController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/standardextract/log", method = RequestMethod.POST)
|
@RequestMapping(value = "/standardextract/log", method = RequestMethod.POST)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Object getStandardExtractLog(@RequestParam("rcName") String name,
|
public Object getStandardExtractLog(@RequestParam("rcName") String name, HttpServletRequest res,
|
||||||
HttpServletRequest res, HttpServletResponse req) throws Exception {
|
HttpServletResponse req) throws Exception {
|
||||||
Configs.CONSOLE_LOGGER.info("/StandardExtract/log");
|
log.info("/StandardExtract/log");
|
||||||
String result = logReadService.readStandardLog(name);
|
String result = logReadService.readStandardLog(name);
|
||||||
// StringBuilder sb = new StringBuilder();
|
// StringBuilder sb = new StringBuilder();
|
||||||
// sb.append("查看相应日志").append("\n").append("看到了");
|
// sb.append("查看相应日志").append("\n").append("看到了");
|
||||||
Map<String, String> log = new HashMap<String, String>();
|
Map<String, String> log = new HashMap<String, String>();
|
||||||
log.put(name, result+"\r\n");
|
log.put(name, result + "\r\n");
|
||||||
return log;
|
return log;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ import com.platform.utils.Configs;
|
||||||
@RestController
|
@RestController
|
||||||
public class ShowGlusterfsController {
|
public class ShowGlusterfsController {
|
||||||
|
|
||||||
public static Logger log = Configs.DAILY_ROLLING_LOGGER.getLogger(ShowGlusterfsController.class);
|
public static Logger log = Logger.getLogger(ShowGlusterfsController.class);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
package com.platform.dao;
|
package com.platform.dao;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import com.platform.entities.DataInfoEntity;
|
import com.platform.entities.DataInfoEntity;
|
||||||
|
|
@ -17,27 +15,31 @@ public interface DataInfoDao {
|
||||||
int getLimitedBeginId(PagerOptions pagerOptions);
|
int getLimitedBeginId(PagerOptions pagerOptions);
|
||||||
|
|
||||||
List<DataInfoEntity> getLimitedDataInfoEntities(PagerOptions pagerOptions);
|
List<DataInfoEntity> getLimitedDataInfoEntities(PagerOptions pagerOptions);
|
||||||
|
|
||||||
List<DataInfoEntity> getLimitedDataInfoByPage(PagerOptions pagerOptions);
|
List<DataInfoEntity> getLimitedDataInfoByPage(PagerOptions pagerOptions);
|
||||||
|
|
||||||
List<String> getIdIsExist(List<Integer> list)throws Exception;
|
List<String> getIdIsExist(List<Integer> list) throws Exception;
|
||||||
|
|
||||||
List<DataInfoEntity> getExistBySrcIds(List<Integer> list)throws Exception;
|
List<DataInfoEntity> getExistBySrcIds(List<Integer> list) throws Exception;
|
||||||
|
|
||||||
List<DataInfoEntity> findAll()throws Exception;
|
List<DataInfoEntity> findAll() throws Exception;
|
||||||
|
|
||||||
DataInfoEntity findById(int id)throws Exception;
|
DataInfoEntity findById(int id) throws Exception;
|
||||||
|
|
||||||
List<DataInfoEntity> findByParam(DataInfoEntity data)throws Exception;
|
List<DataInfoEntity> findByIds(List<Integer> ids) throws Exception;
|
||||||
|
|
||||||
int countByDataPath(DataInfoEntity data)throws Exception;
|
List<DataInfoEntity> findByParam(DataInfoEntity data) throws Exception;
|
||||||
|
|
||||||
int removes(List<Integer> list)throws Exception;
|
DataInfoEntity findByDataPath(String DataPath) throws Exception;
|
||||||
|
|
||||||
|
int countByDataPath(DataInfoEntity data) throws Exception;
|
||||||
|
|
||||||
|
int removes(List<Integer> list) throws Exception;
|
||||||
|
|
||||||
int save(DataInfoEntity data) throws Exception;
|
int save(DataInfoEntity data) throws Exception;
|
||||||
|
|
||||||
int update(DataInfoEntity data) throws Exception;
|
int update(DataInfoEntity data) throws Exception;
|
||||||
|
|
||||||
int updateExtract(DataInfoEntity data) throws Exception;
|
int updateExtract(DataInfoEntity data) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,12 @@ public interface GatherOracleDao {
|
||||||
*/
|
*/
|
||||||
public List<GatherOracleInfo> selectAllOracle() throws Exception;
|
public List<GatherOracleInfo> selectAllOracle() throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param id
|
||||||
|
* @return 查询单个服务记录
|
||||||
|
* @throws Exception 异常
|
||||||
|
*/
|
||||||
|
public GatherOracleInfo selectOracleById(int id) throws Exception;
|
||||||
/**
|
/**
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.platform.dao;
|
||||||
|
|
||||||
|
import com.platform.entities.OperateRecordEntity;
|
||||||
|
import com.platform.entities.OperateRecordEntity;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
public interface OperateRecordDao {
|
||||||
|
long countByExample(OperateRecordEntity example);
|
||||||
|
|
||||||
|
int deleteByExample(OperateRecordEntity example);
|
||||||
|
|
||||||
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int insert(OperateRecordEntity record);
|
||||||
|
|
||||||
|
int insertSelective(OperateRecordEntity record);
|
||||||
|
|
||||||
|
List<OperateRecordEntity> selectByExample(OperateRecordEntity example);
|
||||||
|
|
||||||
|
OperateRecordEntity selectByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int updateByExampleSelective(@Param("record") OperateRecordEntity record, @Param("example") OperateRecordEntity example);
|
||||||
|
|
||||||
|
int updateByExample(@Param("record") OperateRecordEntity record, @Param("example") OperateRecordEntity example);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(OperateRecordEntity record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(OperateRecordEntity record);
|
||||||
|
}
|
||||||
|
|
@ -15,7 +15,7 @@ import com.platform.form.PagerOptions;
|
||||||
* 数据迁移状态 临时 存放 ,
|
* 数据迁移状态 临时 存放 ,
|
||||||
*/
|
*/
|
||||||
@Repository(value = "regionalismCodeDao")
|
@Repository(value = "regionalismCodeDao")
|
||||||
public interface IRegionalismCodeDao {
|
public interface RegionalismCodeDao {
|
||||||
|
|
||||||
/** 查
|
/** 查
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -8,10 +8,10 @@ import com.platform.entities.SystemEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author chen
|
* @author chen
|
||||||
* 数据迁移状态 临时 存放 ,
|
* 系统名称表操作
|
||||||
*/
|
*/
|
||||||
@Repository(value = "systemCodeDao")
|
@Repository(value = "systemCodeDao")
|
||||||
public interface ISystemCodeDao {
|
public interface SystemCodeDao {
|
||||||
|
|
||||||
/** 查
|
/** 查
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -27,5 +27,11 @@ public interface ISystemCodeDao {
|
||||||
|
|
||||||
List<SystemEntity> findByCode(List<String> list) throws Exception;
|
List<SystemEntity> findByCode(List<String> list) throws Exception;
|
||||||
|
|
||||||
void insertBatch(List<String> list) throws Exception;
|
Integer findBySystemName(String systemName) throws Exception;
|
||||||
|
|
||||||
|
Integer insertBatch(List<String> list) throws Exception;
|
||||||
|
|
||||||
|
Integer insert(String systemName) throws Exception;
|
||||||
|
|
||||||
|
Integer deleteBySystemName(String systemName) throws Exception;
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,10 @@
|
||||||
package com.platform.entities;
|
package com.platform.entities;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import com.platform.utils.Constant;
|
||||||
|
import com.platform.utils.ExceptionMsg;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据信息实体类
|
* 数据信息实体类
|
||||||
*
|
*
|
||||||
|
|
@ -7,6 +12,8 @@ package com.platform.entities;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DataInfoEntity {
|
public class DataInfoEntity {
|
||||||
|
public final static Logger log = Logger.getLogger(DataInfoEntity.class);
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
private String regionalismCode; // 行政区划编码
|
private String regionalismCode; // 行政区划编码
|
||||||
private String cityName; // 市
|
private String cityName; // 市
|
||||||
|
|
@ -22,68 +29,66 @@ public class DataInfoEntity {
|
||||||
private String charset; // 数据的字符编码
|
private String charset; // 数据的字符编码
|
||||||
private String collectorName; // 采集人姓名
|
private String collectorName; // 采集人姓名
|
||||||
private String year; // 数据年度
|
private String year; // 数据年度
|
||||||
|
|
||||||
/** 是否抽取 ,0标示为未汇总,1标示汇总中,2标示汇总完成 */
|
/** 是否抽取 ,0标示为未汇总,1标示汇总中,2标示汇总完成 */
|
||||||
private int extractStatus;
|
private int extractStatus;
|
||||||
/** 数据年度起始 */
|
/** 数据年度起始 */
|
||||||
private String startYear;
|
private String startYear;
|
||||||
/** 数据年度结束 */
|
/** 数据年度结束 */
|
||||||
private String endYear;
|
private String endYear;
|
||||||
|
|
||||||
/** volume的ip */
|
/** volume的ip */
|
||||||
private String volumeIp;
|
private String volumeIp;
|
||||||
/** volume的path */
|
/** volume的path */
|
||||||
private String volumePath;
|
private String volumePath;
|
||||||
|
|
||||||
private String volumeType;
|
private String volumeType;
|
||||||
|
|
||||||
/** 数据库类型 */
|
/** 数据库类型 */
|
||||||
private String dataBaseType;
|
private String dataBaseType;
|
||||||
|
|
||||||
private String mark;
|
private String mark;
|
||||||
|
|
||||||
/** 支付信息表校验--采集 */
|
/** 支付信息表校验--采集 */
|
||||||
private String payResult;
|
private String payResult;
|
||||||
|
|
||||||
/** 执行信息表校验--采集 */
|
/** 执行信息表校验--采集 */
|
||||||
private String execResult;
|
private String execResult;
|
||||||
|
|
||||||
/** 支付信息表校验--汇总 */
|
/** 支付信息表校验--汇总 */
|
||||||
private String payResultLast;
|
private String payResultLast;
|
||||||
|
|
||||||
/** 执行信息表校验--汇总 */
|
/** 执行信息表校验--汇总 */
|
||||||
private String execResultLast;
|
private String execResultLast;
|
||||||
|
|
||||||
/** 是否进行了校验 */
|
/** 是否进行了校验 */
|
||||||
private String checkoutFlag;
|
private String checkoutFlag;
|
||||||
|
|
||||||
/** 起始月份 */
|
/** 起始月份 */
|
||||||
private String startMonth;
|
private String startMonth;
|
||||||
|
|
||||||
/** 结束月份 */
|
/** 结束月份 */
|
||||||
private String endMonth;
|
private String endMonth;
|
||||||
|
|
||||||
/** 是否进行了抽取 */
|
/** 是否进行了抽取 */
|
||||||
private String standardExtractStatus;
|
private String standardExtractStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 迁移来源的数据id
|
* 迁移来源的数据id
|
||||||
*/
|
*/
|
||||||
private int srcId;
|
private int srcId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 该条数据是否迁移过热区 0:没有, 1:有
|
* 该条数据是否迁移过热区 0:没有, 1:有
|
||||||
*/
|
*/
|
||||||
private int existHotData;
|
private int existHotData;
|
||||||
|
|
||||||
public DataInfoEntity() {
|
public DataInfoEntity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataInfoEntity(int id, String regionalismCode, String cityName,
|
public DataInfoEntity(int id, String regionalismCode, String cityName, String districtName, int systemCode,
|
||||||
String districtName, int systemCode, String systemName,
|
String systemName, String dataType, int dataVersion, String submittedBatch, String dataPath,
|
||||||
String dataType, int dataVersion, String submittedBatch,
|
String collectingTime, String collectorContacts, String charset, String collectorName, String year) {
|
||||||
String dataPath, String collectingTime, String collectorContacts,
|
|
||||||
String charset, String collectorName, String year) {
|
|
||||||
super();
|
super();
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.regionalismCode = regionalismCode;
|
this.regionalismCode = regionalismCode;
|
||||||
|
|
@ -102,6 +107,95 @@ public class DataInfoEntity {
|
||||||
this.year = year;
|
this.year = year;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 判断两个数据是否是相同数据
|
||||||
|
*
|
||||||
|
* @param originData
|
||||||
|
* @return
|
||||||
|
* @see [类、类#方法、类#成员]
|
||||||
|
*/
|
||||||
|
public Boolean isSameData(DataInfoEntity originData) {
|
||||||
|
if (originData == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (originData.getRegionalismCode().equals(this.regionalismCode)
|
||||||
|
&& originData.getSystemCode() == this.systemCode && originData.getStartYear().equals(this.startYear)
|
||||||
|
&& originData.getSubmittedBatch().equals(this.submittedBatch)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据数据路径获取版本号
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @see [类、类#方法、类#成员]
|
||||||
|
*/
|
||||||
|
public int getDataVersionFromDataPath() {
|
||||||
|
if (dataPath == null || dataPath.equals("")) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (dataPath.endsWith(Constant.LINUX_FILE_SEPERATOR)) {
|
||||||
|
int startIndex = (dataPath.substring(0, dataPath.length() - 1))
|
||||||
|
.lastIndexOf(Constant.LINUX_FILE_SEPERATOR) + 1;
|
||||||
|
int endIndex = dataPath.length() - 1;
|
||||||
|
return Integer.parseInt(dataPath.substring(startIndex, endIndex));
|
||||||
|
} else {
|
||||||
|
int startIndex = dataPath.lastIndexOf(Constant.LINUX_FILE_SEPERATOR) + 1;
|
||||||
|
int endIndex = dataPath.length();
|
||||||
|
return Integer.parseInt(dataPath.substring(startIndex, endIndex));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(ExceptionMsg.exceptionStackToStr(e));
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组合数据的存储路径
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @see [类、类#方法、类#成员]
|
||||||
|
*/
|
||||||
|
public String generateDataPath() {
|
||||||
|
String dataPath = this.volumePath + Constant.LINUX_FILE_SEPERATOR + this.getStartYear()
|
||||||
|
+ Constant.LINUX_FILE_SEPERATOR
|
||||||
|
+ (this.getSubmittedBatch().contains(Constant.BATCH_A) ? Constant.A : Constant.B)
|
||||||
|
+ Constant.LINUX_FILE_SEPERATOR + this.getRegionalismCode() + Constant.ONLINE_SEPERATOR
|
||||||
|
+ this.getSystemCode() + Constant.LINUX_FILE_SEPERATOR + this.getDataVersion()
|
||||||
|
+ Constant.LINUX_FILE_SEPERATOR;
|
||||||
|
this.dataPath = dataPath;
|
||||||
|
return dataPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据新的版本号组合不包含volume路径的数据的存储路径
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @see [类、类#方法、类#成员]
|
||||||
|
*/
|
||||||
|
public String generateNoVolumePathDataPathFromVersion(int newVersion) {
|
||||||
|
String dataPath = this.getStartYear() + Constant.LINUX_FILE_SEPERATOR
|
||||||
|
+ (this.getSubmittedBatch().contains(Constant.BATCH_A) ? Constant.A : Constant.B)
|
||||||
|
+ Constant.LINUX_FILE_SEPERATOR + this.getRegionalismCode() + Constant.ONLINE_SEPERATOR
|
||||||
|
+ this.getSystemCode() + Constant.LINUX_FILE_SEPERATOR + newVersion + Constant.LINUX_FILE_SEPERATOR;
|
||||||
|
this.dataPath = dataPath;
|
||||||
|
return dataPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGatherUserName() {
|
||||||
|
if (this.regionalismCode == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return Constant.GATHER_ORACLE_USERNAME_PREFIX + this.getRegionalismCode() + Constant.SHORT_LINE
|
||||||
|
+ this.getSystemCode() + Constant.SHORT_LINE + this.getDataVersion();
|
||||||
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
@ -230,7 +324,8 @@ public class DataInfoEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param startYear the startYear to set
|
* @param startYear
|
||||||
|
* the startYear to set
|
||||||
*/
|
*/
|
||||||
public void setStartYear(String startYear) {
|
public void setStartYear(String startYear) {
|
||||||
this.startYear = startYear;
|
this.startYear = startYear;
|
||||||
|
|
@ -244,7 +339,8 @@ public class DataInfoEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param endYear the endYear to set
|
* @param endYear
|
||||||
|
* the endYear to set
|
||||||
*/
|
*/
|
||||||
public void setEndYear(String endYear) {
|
public void setEndYear(String endYear) {
|
||||||
this.endYear = endYear;
|
this.endYear = endYear;
|
||||||
|
|
@ -258,7 +354,8 @@ public class DataInfoEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param extractStatus the extractStatus to set
|
* @param extractStatus
|
||||||
|
* the extractStatus to set
|
||||||
*/
|
*/
|
||||||
public void setExtractStatus(int extractStatus) {
|
public void setExtractStatus(int extractStatus) {
|
||||||
this.extractStatus = extractStatus;
|
this.extractStatus = extractStatus;
|
||||||
|
|
@ -272,7 +369,8 @@ public class DataInfoEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param volumeIp the volumeIp to set
|
* @param volumeIp
|
||||||
|
* the volumeIp to set
|
||||||
*/
|
*/
|
||||||
public void setVolumeIp(String volumeIp) {
|
public void setVolumeIp(String volumeIp) {
|
||||||
this.volumeIp = volumeIp;
|
this.volumeIp = volumeIp;
|
||||||
|
|
@ -286,7 +384,8 @@ public class DataInfoEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param volumePath the volumePath to set
|
* @param volumePath
|
||||||
|
* the volumePath to set
|
||||||
*/
|
*/
|
||||||
public void setVolumePath(String volumePath) {
|
public void setVolumePath(String volumePath) {
|
||||||
this.volumePath = volumePath;
|
this.volumePath = volumePath;
|
||||||
|
|
@ -300,7 +399,8 @@ public class DataInfoEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param volumeType the volumeType to set
|
* @param volumeType
|
||||||
|
* the volumeType to set
|
||||||
*/
|
*/
|
||||||
public void setVolumeType(String volumeType) {
|
public void setVolumeType(String volumeType) {
|
||||||
this.volumeType = volumeType;
|
this.volumeType = volumeType;
|
||||||
|
|
@ -314,7 +414,8 @@ public class DataInfoEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mark the mark to set
|
* @param mark
|
||||||
|
* the mark to set
|
||||||
*/
|
*/
|
||||||
public void setMark(String mark) {
|
public void setMark(String mark) {
|
||||||
this.mark = mark;
|
this.mark = mark;
|
||||||
|
|
@ -328,7 +429,8 @@ public class DataInfoEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param dataBaseType the dataBaseType to set
|
* @param dataBaseType
|
||||||
|
* the dataBaseType to set
|
||||||
*/
|
*/
|
||||||
public void setDataBaseType(String dataBaseType) {
|
public void setDataBaseType(String dataBaseType) {
|
||||||
this.dataBaseType = dataBaseType;
|
this.dataBaseType = dataBaseType;
|
||||||
|
|
@ -342,7 +444,8 @@ public class DataInfoEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param payResult the payResult to set
|
* @param payResult
|
||||||
|
* the payResult to set
|
||||||
*/
|
*/
|
||||||
public void setPayResult(String payResult) {
|
public void setPayResult(String payResult) {
|
||||||
this.payResult = payResult;
|
this.payResult = payResult;
|
||||||
|
|
@ -356,7 +459,8 @@ public class DataInfoEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param execResult the execResult to set
|
* @param execResult
|
||||||
|
* the execResult to set
|
||||||
*/
|
*/
|
||||||
public void setExecResult(String execResult) {
|
public void setExecResult(String execResult) {
|
||||||
this.execResult = execResult;
|
this.execResult = execResult;
|
||||||
|
|
@ -370,7 +474,8 @@ public class DataInfoEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param payResultLast the payResultLast to set
|
* @param payResultLast
|
||||||
|
* the payResultLast to set
|
||||||
*/
|
*/
|
||||||
public void setPayResultLast(String payResultLast) {
|
public void setPayResultLast(String payResultLast) {
|
||||||
this.payResultLast = payResultLast;
|
this.payResultLast = payResultLast;
|
||||||
|
|
@ -384,7 +489,8 @@ public class DataInfoEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param execResultLast the execResultLast to set
|
* @param execResultLast
|
||||||
|
* the execResultLast to set
|
||||||
*/
|
*/
|
||||||
public void setExecResultLast(String execResultLast) {
|
public void setExecResultLast(String execResultLast) {
|
||||||
this.execResultLast = execResultLast;
|
this.execResultLast = execResultLast;
|
||||||
|
|
@ -398,7 +504,8 @@ public class DataInfoEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param checkoutFlag the checkoutFlag to set
|
* @param checkoutFlag
|
||||||
|
* the checkoutFlag to set
|
||||||
*/
|
*/
|
||||||
public void setCheckoutFlag(String checkoutFlag) {
|
public void setCheckoutFlag(String checkoutFlag) {
|
||||||
this.checkoutFlag = checkoutFlag;
|
this.checkoutFlag = checkoutFlag;
|
||||||
|
|
@ -412,7 +519,8 @@ public class DataInfoEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param standardExtractStatus the standardExtractStatus to set
|
* @param standardExtractStatus
|
||||||
|
* the standardExtractStatus to set
|
||||||
*/
|
*/
|
||||||
public void setStandardExtractStatus(String standardExtractStatus) {
|
public void setStandardExtractStatus(String standardExtractStatus) {
|
||||||
this.standardExtractStatus = standardExtractStatus;
|
this.standardExtractStatus = standardExtractStatus;
|
||||||
|
|
@ -426,7 +534,8 @@ public class DataInfoEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param startMonth the startMonth to set
|
* @param startMonth
|
||||||
|
* the startMonth to set
|
||||||
*/
|
*/
|
||||||
public void setStartMonth(String startMonth) {
|
public void setStartMonth(String startMonth) {
|
||||||
this.startMonth = startMonth;
|
this.startMonth = startMonth;
|
||||||
|
|
@ -440,7 +549,8 @@ public class DataInfoEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param endMonth the endMonth to set
|
* @param endMonth
|
||||||
|
* the endMonth to set
|
||||||
*/
|
*/
|
||||||
public void setEndMonth(String endMonth) {
|
public void setEndMonth(String endMonth) {
|
||||||
this.endMonth = endMonth;
|
this.endMonth = endMonth;
|
||||||
|
|
@ -454,7 +564,8 @@ public class DataInfoEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param srcId the srcId to set
|
* @param srcId
|
||||||
|
* the srcId to set
|
||||||
*/
|
*/
|
||||||
public void setSrcId(int srcId) {
|
public void setSrcId(int srcId) {
|
||||||
this.srcId = srcId;
|
this.srcId = srcId;
|
||||||
|
|
@ -468,7 +579,8 @@ public class DataInfoEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param existHotData the existHotData to set
|
* @param existHotData
|
||||||
|
* the existHotData to set
|
||||||
*/
|
*/
|
||||||
public void setExistHotData(int existHotData) {
|
public void setExistHotData(int existHotData) {
|
||||||
this.existHotData = existHotData;
|
this.existHotData = existHotData;
|
||||||
|
|
@ -476,17 +588,13 @@ public class DataInfoEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "id=" + this.id + " ,regionalismCode=" + this.regionalismCode
|
return "id=" + this.id + " ,regionalismCode=" + this.regionalismCode + " ,cityName=" + this.cityName
|
||||||
+ " ,cityName=" + this.cityName + " ,districtName="
|
+ " ,districtName=" + this.districtName + " ,systemCode=" + this.systemCode + " ,systemName"
|
||||||
+ this.districtName + " ,systemCode=" + this.systemCode
|
+ this.systemName + " ,dataType=" + this.dataType + " ,dataVersion=" + this.dataVersion
|
||||||
+ " ,systemName" + this.systemName + " ,dataType="
|
+ " ,submittedBatch=" + this.submittedBatch + " ,dataPath=" + this.dataPath + " ,collectingTime="
|
||||||
+ this.dataType + " ,dataVersion=" + this.dataVersion
|
+ this.collectingTime + " ,collectorContacts=" + this.collectorContacts + " ,charset=" + this.charset
|
||||||
+ " ,submittedBatch=" + this.submittedBatch + " ,dataPath="
|
+ " ,collectorName=" + this.collectorName + " ,year=" + this.year + " startYear=" + this.startYear
|
||||||
+ this.dataPath + " ,collectingTime=" + this.collectingTime
|
+ " endYear=" + this.endYear;
|
||||||
+ " ,collectorContacts=" + this.collectorContacts
|
|
||||||
+ " ,charset=" + this.charset + " ,collectorName="
|
|
||||||
+ this.collectorName + " ,year=" + this.year + " startYear="
|
|
||||||
+this.startYear +" endYear="+this.endYear;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,46 +1,53 @@
|
||||||
package com.platform.entities;
|
package com.platform.entities;
|
||||||
|
|
||||||
import com.platform.entities.OracleConnectorParams;
|
|
||||||
|
|
||||||
public class GatherOracleInfo extends OracleConnectorParams {
|
public class GatherOracleInfo extends OracleConnectorParams {
|
||||||
|
|
||||||
private String tableName;
|
private String tableName;
|
||||||
|
|
||||||
private String suffix;
|
private String suffix;
|
||||||
|
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
|
|
||||||
private String remove;
|
private String remove;
|
||||||
|
|
||||||
|
private String systemName;
|
||||||
|
private String startTime;
|
||||||
|
private String endTime;
|
||||||
|
private String contact;
|
||||||
|
private String phone;
|
||||||
|
private String encoding;
|
||||||
|
private int isCreateGatherOracle;
|
||||||
|
private int dataVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否覆盖汇总
|
||||||
|
*/
|
||||||
|
private Boolean isCover;
|
||||||
/**
|
/**
|
||||||
* 0:未知状态, 1:连接成功 ,2:在使用 ,3 :失败
|
* 0:未知状态, 1:连接成功 ,2:在使用 ,3 :失败
|
||||||
*/
|
*/
|
||||||
private int status;
|
private int status;
|
||||||
|
|
||||||
public GatherOracleInfo() {
|
public GatherOracleInfo() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public GatherOracleInfo(String port, String ip, String name, String user,
|
public GatherOracleInfo(String port, String ip, String name, String user, String password, String database) {
|
||||||
String password, String database) {
|
|
||||||
super(port, ip, name, user, password, database);
|
super(port, ip, name, user, password, database);
|
||||||
// TODO Auto-generated constructor stub
|
// TODO Auto-generated constructor stub
|
||||||
}
|
}
|
||||||
|
|
||||||
public GatherOracleInfo(String port, String ip, String name, String user,
|
public GatherOracleInfo(String port, String ip, String name, String user, String password, String database, int _id,
|
||||||
String password, String database, int _id, String tableName, String suffix, int status) {
|
String tableName, String suffix, int status) {
|
||||||
super(port, ip, name, user, password, database);
|
super(port, ip, name, user, password, database);
|
||||||
this.tableName = tableName;
|
this.tableName = tableName;
|
||||||
this.suffix = suffix;
|
this.suffix = suffix;
|
||||||
this.id=_id;
|
this.id = _id;
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String getTableName() {
|
public String getTableName() {
|
||||||
return tableName;
|
return tableName;
|
||||||
}
|
}
|
||||||
|
|
@ -65,7 +72,8 @@ public class GatherOracleInfo extends OracleConnectorParams {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param type the type to set
|
* @param type
|
||||||
|
* the type to set
|
||||||
*/
|
*/
|
||||||
public void setType(String type) {
|
public void setType(String type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
@ -93,6 +101,140 @@ public class GatherOracleInfo extends OracleConnectorParams {
|
||||||
|
|
||||||
public void setRemove(String remove) {
|
public void setRemove(String remove) {
|
||||||
this.remove = remove;
|
this.remove = remove;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the startTime
|
||||||
|
*/
|
||||||
|
public String getStartTime() {
|
||||||
|
return startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param startTime
|
||||||
|
* the startTime to set
|
||||||
|
*/
|
||||||
|
public void setStartTime(String startTime) {
|
||||||
|
this.startTime = startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the endTime
|
||||||
|
*/
|
||||||
|
public String getEndTime() {
|
||||||
|
return endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param endTime
|
||||||
|
* the endTime to set
|
||||||
|
*/
|
||||||
|
public void setEndTime(String endTime) {
|
||||||
|
this.endTime = endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the contact
|
||||||
|
*/
|
||||||
|
public String getContact() {
|
||||||
|
return contact;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param contact
|
||||||
|
* the contact to set
|
||||||
|
*/
|
||||||
|
public void setContact(String contact) {
|
||||||
|
this.contact = contact;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the phone
|
||||||
|
*/
|
||||||
|
public String getPhone() {
|
||||||
|
return phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param phone
|
||||||
|
* the phone to set
|
||||||
|
*/
|
||||||
|
public void setPhone(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the isCreateGatherOracle
|
||||||
|
*/
|
||||||
|
public int getIsCreateGatherOracle() {
|
||||||
|
return isCreateGatherOracle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isCreateGatherOracle
|
||||||
|
* the isCreateGatherOracle to set
|
||||||
|
*/
|
||||||
|
public void setIsCreateGatherOracle(int isCreateGatherOracle) {
|
||||||
|
this.isCreateGatherOracle = isCreateGatherOracle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the encoding
|
||||||
|
*/
|
||||||
|
public String getEncoding() {
|
||||||
|
return encoding;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param encoding
|
||||||
|
* the encoding to set
|
||||||
|
*/
|
||||||
|
public void setEncoding(String encoding) {
|
||||||
|
this.encoding = encoding;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the isCover
|
||||||
|
*/
|
||||||
|
public Boolean getIsCover() {
|
||||||
|
return isCover;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isCover
|
||||||
|
* the isCover to set
|
||||||
|
*/
|
||||||
|
public void setIsCover(Boolean isCover) {
|
||||||
|
this.isCover = isCover;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the dataVersion
|
||||||
|
*/
|
||||||
|
public int getDataVersion() {
|
||||||
|
return dataVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dataVersion
|
||||||
|
* the dataVersion to set
|
||||||
|
*/
|
||||||
|
public void setDataVersion(int dataVersion) {
|
||||||
|
this.dataVersion = dataVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the systemName
|
||||||
|
*/
|
||||||
|
public String getSystemName() {
|
||||||
|
return systemName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param systemName the systemName to set
|
||||||
|
*/
|
||||||
|
public void setSystemName(String systemName) {
|
||||||
|
this.systemName = systemName;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
package com.platform.entities;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class OperateRecordEntity {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
private String taskType;
|
||||||
|
private String taskStatus;
|
||||||
|
private Integer taskProgress;
|
||||||
|
private String taskDesc;
|
||||||
|
private Date startTime;
|
||||||
|
private Date endTime;
|
||||||
|
private Date updateTime;
|
||||||
|
private String feature;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTasktype() {
|
||||||
|
return taskType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTasktype(String tasktype) {
|
||||||
|
this.taskType = tasktype == null ? null : tasktype.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTaskstatus() {
|
||||||
|
return taskStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskstatus(String taskstatus) {
|
||||||
|
this.taskStatus = taskstatus == null ? null : taskstatus.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getTaskprogress() {
|
||||||
|
return taskProgress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskprogress(Integer taskprogress) {
|
||||||
|
this.taskProgress = taskprogress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTaskdesc() {
|
||||||
|
return taskDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskdesc(String taskdesc) {
|
||||||
|
this.taskDesc = taskdesc == null ? null : taskdesc.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getStarttime() {
|
||||||
|
return startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStarttime(Date starttime) {
|
||||||
|
this.startTime = starttime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getEndtime() {
|
||||||
|
return endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndtime(Date endtime) {
|
||||||
|
this.endTime = endtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getUpdatetime() {
|
||||||
|
return updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdatetime(Date updatetime) {
|
||||||
|
this.updateTime = updatetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFeature() {
|
||||||
|
return feature;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFeature(String feature) {
|
||||||
|
this.feature = feature == null ? null : feature.trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,131 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名 : TaskRecordEntity.java
|
||||||
|
* 版权 : <版权/公司名>
|
||||||
|
* 描述 : <描述>
|
||||||
|
* @author liliy
|
||||||
|
* 版本 : <版本>
|
||||||
|
* 修改时间: 2018年1月25日
|
||||||
|
* 修改内容: <修改内容>
|
||||||
|
*/
|
||||||
|
package com.platform.entities;
|
||||||
|
|
||||||
|
import java.sql.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务状态表实体
|
||||||
|
* <功能详细描述>
|
||||||
|
* @author liliy
|
||||||
|
* @version [版本号,2018年1月25日]
|
||||||
|
* @see [相关类/方法]
|
||||||
|
* @since [产品/模块版本]
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class TaskRecordEntity {
|
||||||
|
private int id;
|
||||||
|
private int taskType;
|
||||||
|
private int taskStatus;
|
||||||
|
private String taskProcess;
|
||||||
|
private String taskDesc;
|
||||||
|
private Date startTime;
|
||||||
|
private Date endTime;
|
||||||
|
private Date updateTime;
|
||||||
|
/**
|
||||||
|
* @return the id
|
||||||
|
*/
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param id the id to set
|
||||||
|
*/
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the taskType
|
||||||
|
*/
|
||||||
|
public int getTaskType() {
|
||||||
|
return taskType;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param taskType the taskType to set
|
||||||
|
*/
|
||||||
|
public void setTaskType(int taskType) {
|
||||||
|
this.taskType = taskType;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the taskStatus
|
||||||
|
*/
|
||||||
|
public int getTaskStatus() {
|
||||||
|
return taskStatus;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param taskStatus the taskStatus to set
|
||||||
|
*/
|
||||||
|
public void setTaskStatus(int taskStatus) {
|
||||||
|
this.taskStatus = taskStatus;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the taskProcess
|
||||||
|
*/
|
||||||
|
public String getTaskProcess() {
|
||||||
|
return taskProcess;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param taskProcess the taskProcess to set
|
||||||
|
*/
|
||||||
|
public void setTaskProcess(String taskProcess) {
|
||||||
|
this.taskProcess = taskProcess;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the taskDesc
|
||||||
|
*/
|
||||||
|
public String getTaskDesc() {
|
||||||
|
return taskDesc;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param taskDesc the taskDesc to set
|
||||||
|
*/
|
||||||
|
public void setTaskDesc(String taskDesc) {
|
||||||
|
this.taskDesc = taskDesc;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the startTime
|
||||||
|
*/
|
||||||
|
public Date getStartTime() {
|
||||||
|
return startTime;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param startTime the startTime to set
|
||||||
|
*/
|
||||||
|
public void setStartTime(Date startTime) {
|
||||||
|
this.startTime = startTime;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the endTime
|
||||||
|
*/
|
||||||
|
public Date getEndTime() {
|
||||||
|
return endTime;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param endTime the endTime to set
|
||||||
|
*/
|
||||||
|
public void setEndTime(Date endTime) {
|
||||||
|
this.endTime = endTime;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the updateTime
|
||||||
|
*/
|
||||||
|
public Date getUpdateTime() {
|
||||||
|
return updateTime;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param updateTime the updateTime to set
|
||||||
|
*/
|
||||||
|
public void setUpdateTime(Date updateTime) {
|
||||||
|
this.updateTime = updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名 : DataBaseTypeEnum.java 版权 : <版权/公司名> 描述 : <描述>
|
||||||
|
*
|
||||||
|
* @author liliy 版本 : <版本> 修改时间: 2018年3月26日 修改内容: <修改内容>
|
||||||
|
*/
|
||||||
|
package com.platform.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <一句话功能简述>
|
||||||
|
*
|
||||||
|
* @author liliy
|
||||||
|
* @version [版本号,2018年3月26日]
|
||||||
|
* @see [相关类/方法]
|
||||||
|
* @since [产品/模块版本]
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum DataBaseTypeEnum {
|
||||||
|
ORACLE("ORACLE", "oracle数据库数据"), SQL_SERVER("SQL SERVER", "sql server数据库数据");
|
||||||
|
private String type;
|
||||||
|
private String desc;
|
||||||
|
|
||||||
|
private DataBaseTypeEnum(String type, String desc) {
|
||||||
|
this.type = type;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the type
|
||||||
|
*/
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param type
|
||||||
|
* the type to set
|
||||||
|
*/
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the desc
|
||||||
|
*/
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param desc
|
||||||
|
* the desc to set
|
||||||
|
*/
|
||||||
|
public void setDesc(String desc) {
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名 : DataCheckoutStatusEnum.java 版权 : <版权/公司名> 描述 : <描述>
|
||||||
|
*
|
||||||
|
* @author liliy 版本 : <版本> 修改时间: 2018年1月23日 修改内容: <修改内容>
|
||||||
|
*/
|
||||||
|
package com.platform.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <一句话功能简述> <功能详细描述>
|
||||||
|
*
|
||||||
|
* @author liliy
|
||||||
|
* @version [版本号,2018年1月23日]
|
||||||
|
* @see [相关类/方法]
|
||||||
|
* @since [产品/模块版本]
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum DataCheckoutStatusEnum {
|
||||||
|
NO("n", "数据未校验"), YES("y", "数据已校验");
|
||||||
|
private String value;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private DataCheckoutStatusEnum(String value, String description) {
|
||||||
|
this.value = value;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the value
|
||||||
|
*/
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param value
|
||||||
|
* the value to set
|
||||||
|
*/
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the description
|
||||||
|
*/
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description
|
||||||
|
* the description to set
|
||||||
|
*/
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名 : CheckoutFlagEnum.java 版权 : <版权/公司名> 描述 : <描述>
|
||||||
|
*
|
||||||
|
* @author liliy 版本 : <版本> 修改时间: 2018年1月20日 修改内容: <修改内容>
|
||||||
|
*/
|
||||||
|
package com.platform.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据状态枚举
|
||||||
|
*
|
||||||
|
* @author liliy
|
||||||
|
* @version [版本号,2018年1月20日]
|
||||||
|
* @see [相关类/方法]
|
||||||
|
* @since [产品/模块版本]
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum DataStatusEnum {
|
||||||
|
NOT_CHECKOUT(0, "未校验"),
|
||||||
|
CHECKED(1, "不需要校验"),
|
||||||
|
CHECKING(2, "正在校验"),
|
||||||
|
CHECKOUT_SUCCESS(3, "校验成功"),
|
||||||
|
CHECKOUT_FAIL(4,"校验失败"),
|
||||||
|
WAIT_EXTRAACT(5,"待抽取"),
|
||||||
|
EXTRACTING(6, "正在抽取"),
|
||||||
|
EXTRACTED(7, "抽取完成");
|
||||||
|
private DataStatusEnum(int code, String description) {
|
||||||
|
this.setCode(code);
|
||||||
|
this.setDescription(description);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int code;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the description
|
||||||
|
*/
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description
|
||||||
|
* the description to set
|
||||||
|
*/
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the code
|
||||||
|
*/
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param code
|
||||||
|
* the code to set
|
||||||
|
*/
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名 : EncodeTypeEnum.java 版权 : <版权/公司名> 描述 : <描述>
|
||||||
|
*
|
||||||
|
* @author liliy 版本 : <版本> 修改时间: 2018年1月23日 修改内容: <修改内容>
|
||||||
|
*/
|
||||||
|
package com.platform.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <一句话功能简述> <功能详细描述>
|
||||||
|
*
|
||||||
|
* @author liliy
|
||||||
|
* @version [版本号,2018年1月23日]
|
||||||
|
* @see [相关类/方法]
|
||||||
|
* @since [产品/模块版本]
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum EncodeTypeEnum {
|
||||||
|
UTF8("UTF8"), GBK("GBK");
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
private EncodeTypeEnum(String value) {
|
||||||
|
this.setValue(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the value
|
||||||
|
*/
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param value
|
||||||
|
* the value to set
|
||||||
|
*/
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名 : ExportDataType.java 版权 : <版权/公司名> 描述 : <描述>
|
||||||
|
*
|
||||||
|
* @author liliy 版本 : <版本> 修改时间: 2018年1月25日 修改内容: <修改内容>
|
||||||
|
*/
|
||||||
|
package com.platform.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出数据类型枚举
|
||||||
|
*
|
||||||
|
* @author liliy
|
||||||
|
* @version [版本号,2018年1月25日]
|
||||||
|
* @see [相关类/方法]
|
||||||
|
* @since [产品/模块版本]
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum ExportDataTypeEnum {
|
||||||
|
ORIGIN_DATA(1, "原始数据"), GATHER_DATA(2, "汇总库"), EXTRACT_STANDARD_TABLE_SCRIPT(3, "标准表抽取脚本");
|
||||||
|
private int value;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private ExportDataTypeEnum(int value, String description) {
|
||||||
|
this.value = value;
|
||||||
|
this.description = description;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ExportDataTypeEnum getEnumFromValue(int value) {
|
||||||
|
for (ExportDataTypeEnum exportDataTypeEnum : ExportDataTypeEnum.values()) {
|
||||||
|
if (exportDataTypeEnum.getValue() == value) {
|
||||||
|
return exportDataTypeEnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the value
|
||||||
|
*/
|
||||||
|
public int getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param value
|
||||||
|
* the value to set
|
||||||
|
*/
|
||||||
|
public void setValue(int value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the description
|
||||||
|
*/
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description
|
||||||
|
* the description to set
|
||||||
|
*/
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名 : GatherOracleStatus.java 版权 : <版权/公司名> 描述 : <描述>
|
||||||
|
*
|
||||||
|
* @author liliy 版本 : <版本> 修改时间: 2018年3月30日 修改内容: <修改内容>
|
||||||
|
*/
|
||||||
|
package com.platform.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <一句话功能简述>
|
||||||
|
*
|
||||||
|
* @author liliy
|
||||||
|
* @version [版本号,2018年3月30日]
|
||||||
|
* @see [相关类/方法]
|
||||||
|
* @since [产品/模块版本]
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum GatherOracleStatusEnum {
|
||||||
|
STARTED(1, "汇总库已经启动,可以连接"), STOPPED(0, "汇总库未启动,不能连接");
|
||||||
|
|
||||||
|
private int status;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private GatherOracleStatusEnum(int status, String description) {
|
||||||
|
this.status = status;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the status
|
||||||
|
*/
|
||||||
|
public int getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param status
|
||||||
|
* the status to set
|
||||||
|
*/
|
||||||
|
public void setStatus(int status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the description
|
||||||
|
*/
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description
|
||||||
|
* the description to set
|
||||||
|
*/
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名 : GatherOracleTypeEnum.java 版权 : <版权/公司名> 描述 : <描述>
|
||||||
|
*
|
||||||
|
* @author liliy 版本 : <版本> 修改时间: 2018年3月29日 修改内容: <修改内容>
|
||||||
|
*/
|
||||||
|
package com.platform.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <一句话功能简述>
|
||||||
|
*
|
||||||
|
* @author liliy
|
||||||
|
* @version [版本号,2018年3月29日]
|
||||||
|
* @see [相关类/方法]
|
||||||
|
* @since [产品/模块版本]
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum GatherOracleTypeEnum {
|
||||||
|
NO("0", "非标准表汇总库"), YES("1", "标准表汇总库");
|
||||||
|
private String value;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private GatherOracleTypeEnum(String value, String description) {
|
||||||
|
this.value = value;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the value
|
||||||
|
*/
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param value
|
||||||
|
* the value to set
|
||||||
|
*/
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the description
|
||||||
|
*/
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description
|
||||||
|
* the description to set
|
||||||
|
*/
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名 : IsCreateGatherOracleEnum.java 版权 : <版权/公司名> 描述 : <描述>
|
||||||
|
*
|
||||||
|
* @author liliy 版本 : <版本> 修改时间: 2018年1月23日 修改内容: <修改内容>
|
||||||
|
*/
|
||||||
|
package com.platform.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <一句话功能简述> <功能详细描述>
|
||||||
|
*
|
||||||
|
* @author liliy
|
||||||
|
* @version [版本号,2018年1月23日]
|
||||||
|
* @see [相关类/方法]
|
||||||
|
* @since [产品/模块版本]
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum IsCreateGatherOracleEnum {
|
||||||
|
NO(0, ""),YES(1, "");
|
||||||
|
private int value;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private IsCreateGatherOracleEnum(int value, String description) {
|
||||||
|
this.value = value;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the value
|
||||||
|
*/
|
||||||
|
public int getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param value
|
||||||
|
* the value to set
|
||||||
|
*/
|
||||||
|
public void setValue(int value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the description
|
||||||
|
*/
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description
|
||||||
|
* the description to set
|
||||||
|
*/
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名 : OperatingSystemEnum.java 版权 : <版权/公司名> 描述 : <描述>
|
||||||
|
*
|
||||||
|
* @author liliy 版本 : <版本> 修改时间: 2018年4月1日 修改内容: <修改内容>
|
||||||
|
*/
|
||||||
|
package com.platform.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <一句话功能简述>
|
||||||
|
*
|
||||||
|
* @author liliy
|
||||||
|
* @version [版本号,2018年4月1日]
|
||||||
|
* @see [相关类/方法]
|
||||||
|
* @since [产品/模块版本]
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum OperatingSystemEnum {
|
||||||
|
|
||||||
|
LINUX("0", "linux"), WINDOWS("1", "windows");
|
||||||
|
private String value;
|
||||||
|
private String desc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <一句话功能简述> <功能详细描述>
|
||||||
|
*
|
||||||
|
* @see [类、类#方法、类#成员]
|
||||||
|
*/
|
||||||
|
private OperatingSystemEnum(String value, String desc) {
|
||||||
|
this.value = value;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the value
|
||||||
|
*/
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param value
|
||||||
|
* the value to set
|
||||||
|
*/
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the desc
|
||||||
|
*/
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param desc
|
||||||
|
* the desc to set
|
||||||
|
*/
|
||||||
|
public void setDesc(String desc) {
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名 : ReponseStatusEnum.java 版权 : <版权/公司名> 描述 : <描述>
|
||||||
|
*
|
||||||
|
* @author liliy 版本 : <版本> 修改时间: 2018年1月25日 修改内容: <修改内容>
|
||||||
|
*/
|
||||||
|
package com.platform.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <一句话功能简述> <功能详细描述>
|
||||||
|
*
|
||||||
|
* @author liliy
|
||||||
|
* @version [版本号,2018年1月25日]
|
||||||
|
* @see [相关类/方法]
|
||||||
|
* @since [产品/模块版本]
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum ResponseStatusEnum {
|
||||||
|
|
||||||
|
OK(200, "OK"),
|
||||||
|
BAD_REQUEST(400,"Bad Request"),
|
||||||
|
INTERNAL_SERVER_ERROR(500,"Internal Server Error");
|
||||||
|
|
||||||
|
private int code;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private ResponseStatusEnum(int code, String description) {
|
||||||
|
this.code = code;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the code
|
||||||
|
*/
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param code the code to set
|
||||||
|
*/
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the description
|
||||||
|
*/
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description the description to set
|
||||||
|
*/
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名 : TaskStatusEnum.java 版权 : <版权/公司名> 描述 : <描述>
|
||||||
|
*
|
||||||
|
* @author liliy 版本 : <版本> 修改时间: 2018年1月25日 修改内容: <修改内容>
|
||||||
|
*/
|
||||||
|
package com.platform.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务状态枚举
|
||||||
|
*
|
||||||
|
* @author liliy
|
||||||
|
* @version [版本号,2018年1月25日]
|
||||||
|
* @see [相关类/方法]
|
||||||
|
* @since [产品/模块版本]
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum TaskStatusEnum {
|
||||||
|
WAITING(0, "任务等待中"), PROCESSING(1, "任务正在执行中"), FINISHED(2, "任务已完成");
|
||||||
|
private int status;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private TaskStatusEnum(int status, String description) {
|
||||||
|
this.status = status;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the status
|
||||||
|
*/
|
||||||
|
public int getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param status the status to set
|
||||||
|
*/
|
||||||
|
public void setStatus(int status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the description
|
||||||
|
*/
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description the description to set
|
||||||
|
*/
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名 : TaskTypeEnum.java
|
||||||
|
* 版权 : <版权/公司名>
|
||||||
|
* 描述 : <描述>
|
||||||
|
* @author liliy
|
||||||
|
* 版本 : <版本>
|
||||||
|
* 修改时间: 2018年1月25日
|
||||||
|
* 修改内容: <修改内容>
|
||||||
|
*/
|
||||||
|
package com.platform.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务类型枚举
|
||||||
|
* <功能详细描述>
|
||||||
|
* @author liliy
|
||||||
|
* @version [版本号,2018年1月25日]
|
||||||
|
* @see [相关类/方法]
|
||||||
|
* @since [产品/模块版本]
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum TaskTypeEnum {
|
||||||
|
EXPORT_DATA(1, "数据导出");
|
||||||
|
private int type;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private TaskTypeEnum(int type, String description) {
|
||||||
|
this.type = type;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the type
|
||||||
|
*/
|
||||||
|
public int getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param type the type to set
|
||||||
|
*/
|
||||||
|
public void setType(int type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the description
|
||||||
|
*/
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description the description to set
|
||||||
|
*/
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名 : VolumeMarkEnum.java 版权 : <版权/公司名> 描述 : <描述>
|
||||||
|
*
|
||||||
|
* @author liliy 版本 : <版本> 修改时间: 2018年3月26日 修改内容: <修改内容>
|
||||||
|
*/
|
||||||
|
package com.platform.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <一句话功能简述>
|
||||||
|
*
|
||||||
|
* @author liliy
|
||||||
|
* @version [版本号,2018年3月26日]
|
||||||
|
* @see [相关类/方法]
|
||||||
|
* @since [产品/模块版本]
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum VolumeMarkEnum {
|
||||||
|
ONLINE("0", "热区"), OFFLINE("1", "冷区");
|
||||||
|
private String mark;
|
||||||
|
private String desc;
|
||||||
|
|
||||||
|
private VolumeMarkEnum(String mark, String desc) {
|
||||||
|
this.setMark(mark);
|
||||||
|
this.setDesc(desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the desc
|
||||||
|
*/
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param desc
|
||||||
|
* the desc to set
|
||||||
|
*/
|
||||||
|
public void setDesc(String desc) {
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the mark
|
||||||
|
*/
|
||||||
|
public String getMark() {
|
||||||
|
return mark;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mark
|
||||||
|
* the mark to set
|
||||||
|
*/
|
||||||
|
public void setMark(String mark) {
|
||||||
|
this.mark = mark;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名 : exportDataFrom.java 版权 : <版权/公司名> 描述 : <描述>
|
||||||
|
*
|
||||||
|
* @author liliy 版本 : <版本> 修改时间: 2018年3月29日 修改内容: <修改内容>
|
||||||
|
*/
|
||||||
|
package com.platform.form;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <一句话功能简述>
|
||||||
|
*
|
||||||
|
* @author liliy
|
||||||
|
* @version [版本号,2018年3月29日]
|
||||||
|
* @see [相关类/方法]
|
||||||
|
* @since [产品/模块版本]
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ExportDataFrom implements Serializable {
|
||||||
|
/** */
|
||||||
|
private static final long serialVersionUID = -909963603780380125L;
|
||||||
|
private List<Integer> idList;
|
||||||
|
private List<Integer> typeList;
|
||||||
|
private List<Integer> gatherOracleList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <一句话功能简述> <功能详细描述>
|
||||||
|
*
|
||||||
|
* @see [类、类#方法、类#成员]
|
||||||
|
*/
|
||||||
|
public ExportDataFrom() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExportDataFrom(List<Integer> idList, List<Integer> typeList, List<Integer> gatherOracleList) {
|
||||||
|
this.setIdList(idList);
|
||||||
|
this.setTypeList(typeList);
|
||||||
|
this.setGatherOracleList(gatherOracleList);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the idList
|
||||||
|
*/
|
||||||
|
public List<Integer> getIdList() {
|
||||||
|
return idList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param idList
|
||||||
|
* the idList to set
|
||||||
|
*/
|
||||||
|
public void setIdList(List<Integer> idList) {
|
||||||
|
this.idList = idList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the typeList
|
||||||
|
*/
|
||||||
|
public List<Integer> getTypeList() {
|
||||||
|
return typeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param typeList
|
||||||
|
* the typeList to set
|
||||||
|
*/
|
||||||
|
public void setTypeList(List<Integer> typeList) {
|
||||||
|
this.typeList = typeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the gatherOracleList
|
||||||
|
*/
|
||||||
|
public List<Integer> getGatherOracleList() {
|
||||||
|
return gatherOracleList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param gatherOracleList
|
||||||
|
* the gatherOracleList to set
|
||||||
|
*/
|
||||||
|
public void setGatherOracleList(List<Integer> gatherOracleList) {
|
||||||
|
this.gatherOracleList = gatherOracleList;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -5,13 +5,15 @@ import java.util.List;
|
||||||
import com.platform.entities.GatherOracleInfo;
|
import com.platform.entities.GatherOracleInfo;
|
||||||
import com.platform.entities.OracleConnectorParams;
|
import com.platform.entities.OracleConnectorParams;
|
||||||
|
|
||||||
public class oracleForm {
|
public class OracleForm {
|
||||||
|
|
||||||
private GatherOracleInfo target;
|
private GatherOracleInfo target;
|
||||||
|
|
||||||
private List<OracleConnectorParams> inneed;
|
private List<OracleConnectorParams> inneed;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
private Boolean isCover=true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the totalOracle
|
* @return the totalOracle
|
||||||
|
|
@ -21,7 +23,8 @@ public class oracleForm {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param totalOracle the totalOracle to set
|
* @param totalOracle
|
||||||
|
* the totalOracle to set
|
||||||
*/
|
*/
|
||||||
public void setTarget(GatherOracleInfo target) {
|
public void setTarget(GatherOracleInfo target) {
|
||||||
this.target = target;
|
this.target = target;
|
||||||
|
|
@ -35,7 +38,8 @@ public class oracleForm {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param collOracle the collOracle to set
|
* @param collOracle
|
||||||
|
* the collOracle to set
|
||||||
*/
|
*/
|
||||||
public void setInneed(List<OracleConnectorParams> inneed) {
|
public void setInneed(List<OracleConnectorParams> inneed) {
|
||||||
this.inneed = inneed;
|
this.inneed = inneed;
|
||||||
|
|
@ -49,10 +53,25 @@ public class oracleForm {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param totalOracleName the totalOracleName to set
|
* @param totalOracleName
|
||||||
|
* the totalOracleName to set
|
||||||
*/
|
*/
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the isCover
|
||||||
|
*/
|
||||||
|
public Boolean getIsCover() {
|
||||||
|
return isCover;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isCover the isCover to set
|
||||||
|
*/
|
||||||
|
public void setIsCover(Boolean isCover) {
|
||||||
|
this.isCover = isCover;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -5,10 +5,15 @@ package com.platform.http;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class HttpClientConstant {
|
public class HttpClientConstant {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gfs的 web 服务的 IP、端口
|
* gfs的 web 服务的 IP、端口
|
||||||
*/
|
*/
|
||||||
public static String URL_IP_PORT = "http://192.168.0.110:9001/";
|
public static String URL_IP_PORT = "";
|
||||||
|
|
||||||
|
public static String getIP(){
|
||||||
|
int beginIndex=URL_IP_PORT.indexOf("1");
|
||||||
|
int endIndex=URL_IP_PORT.lastIndexOf(":");
|
||||||
|
return URL_IP_PORT.substring(beginIndex, endIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,6 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.sf.json.JSONArray;
|
|
||||||
import net.sf.json.JSONObject;
|
|
||||||
|
|
||||||
import org.apache.http.HttpEntity;
|
import org.apache.http.HttpEntity;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.NameValuePair;
|
import org.apache.http.NameValuePair;
|
||||||
|
|
@ -30,29 +27,37 @@ import com.fasterxml.jackson.databind.JsonMappingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.platform.utils.Bean2MapUtils;
|
import com.platform.utils.Bean2MapUtils;
|
||||||
|
|
||||||
/** http请求客户端
|
import net.sf.json.JSONArray;
|
||||||
|
import net.sf.json.JSONObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* http请求客户端
|
||||||
|
*
|
||||||
* @author chen
|
* @author chen
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class HttpUtils {
|
public class HttpUtils {
|
||||||
|
|
||||||
private static ObjectMapper mapper = new ObjectMapper();
|
private static ObjectMapper mapper = new ObjectMapper();
|
||||||
/**
|
/**
|
||||||
* 日志
|
* 日志
|
||||||
*/
|
*/
|
||||||
public final static Logger log = Logger.getLogger(HttpUtils.class);
|
public final static Logger log = Logger.getLogger(HttpUtils.class);
|
||||||
|
|
||||||
/** post请求前 对象 转成 json
|
/**
|
||||||
|
* post请求前 对象 转成 json
|
||||||
|
*
|
||||||
* @param subUrl
|
* @param subUrl
|
||||||
* @param data
|
* @param data
|
||||||
* @return
|
* @return
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws JsonMappingException
|
* @throws JsonMappingException
|
||||||
* @throws JsonGenerationException
|
* @throws JsonGenerationException
|
||||||
*/
|
*/
|
||||||
public String sendAjaxPost(String subUrl, Object data) throws JsonGenerationException, JsonMappingException, IOException {
|
public String sendAjaxPost(String subUrl, Object data)
|
||||||
|
throws JsonGenerationException, JsonMappingException, IOException {
|
||||||
String jsondata = null;
|
String jsondata = null;
|
||||||
//转成json
|
// 转成json
|
||||||
if (null != data) {
|
if (null != data) {
|
||||||
Writer strWriter = new StringWriter();
|
Writer strWriter = new StringWriter();
|
||||||
mapper.writeValue(strWriter, data);
|
mapper.writeValue(strWriter, data);
|
||||||
|
|
@ -60,8 +65,10 @@ public class HttpUtils {
|
||||||
}
|
}
|
||||||
return sendAjaxPost(subUrl, jsondata);
|
return sendAjaxPost(subUrl, jsondata);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 发post请求
|
/**
|
||||||
|
* 发post请求
|
||||||
|
*
|
||||||
* @param subUrl
|
* @param subUrl
|
||||||
* @param map
|
* @param map
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -69,22 +76,22 @@ public class HttpUtils {
|
||||||
public String sendAjaxPost(String subUrl, String json) {
|
public String sendAjaxPost(String subUrl, String json) {
|
||||||
String resultStr = "";
|
String resultStr = "";
|
||||||
HttpClient client = new DefaultHttpClient();
|
HttpClient client = new DefaultHttpClient();
|
||||||
|
|
||||||
HttpPost post = new HttpPost(HttpClientConstant.URL_IP_PORT + subUrl);
|
HttpPost post = new HttpPost(HttpClientConstant.URL_IP_PORT + subUrl);
|
||||||
try {
|
try {
|
||||||
// 传参
|
// 传参
|
||||||
if (null != json && !"".equals(json)) {
|
if (null != json && !"".equals(json)) {
|
||||||
// 建立一个NameValuePair数组,用于存储欲传送的参数
|
// 建立一个NameValuePair数组,用于存储欲传送的参数
|
||||||
StringEntity entity = new StringEntity(json,"UTF-8");
|
StringEntity entity = new StringEntity(json, "UTF-8");
|
||||||
entity.setContentEncoding("UTF-8");
|
entity.setContentEncoding("UTF-8");
|
||||||
entity.setContentType("application/json");
|
entity.setContentType("application/json");
|
||||||
|
|
||||||
post.setEntity(entity);
|
post.setEntity(entity);
|
||||||
}
|
}
|
||||||
// 发送
|
// 发送
|
||||||
HttpResponse respone = client.execute(post);
|
HttpResponse respone = client.execute(post);
|
||||||
//接收返回值
|
// 接收返回值
|
||||||
if(respone.getStatusLine().getStatusCode() == HttpStatus.OK.value()){
|
if (respone.getStatusLine().getStatusCode() == HttpStatus.OK.value()) {
|
||||||
HttpEntity result = respone.getEntity();
|
HttpEntity result = respone.getEntity();
|
||||||
if (null != result) {
|
if (null != result) {
|
||||||
resultStr = EntityUtils.toString(result);
|
resultStr = EntityUtils.toString(result);
|
||||||
|
|
@ -96,8 +103,10 @@ public class HttpUtils {
|
||||||
}
|
}
|
||||||
return resultStr;
|
return resultStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** post请求前 对象 转成 map
|
/**
|
||||||
|
* post请求前 对象 转成 map
|
||||||
|
*
|
||||||
* @param subUrl
|
* @param subUrl
|
||||||
* @param data
|
* @param data
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -105,8 +114,8 @@ public class HttpUtils {
|
||||||
public String sendPost(String subUrl, Object data) {
|
public String sendPost(String subUrl, Object data) {
|
||||||
Map<String, Object> map = null;
|
Map<String, Object> map = null;
|
||||||
if (null != data) {
|
if (null != data) {
|
||||||
//转成json
|
// 转成json
|
||||||
try {
|
try {
|
||||||
map = Bean2MapUtils.convertBean(data);
|
map = Bean2MapUtils.convertBean(data);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
log.error(e);
|
log.error(e);
|
||||||
|
|
@ -118,8 +127,10 @@ public class HttpUtils {
|
||||||
}
|
}
|
||||||
return sendPost(subUrl, map);
|
return sendPost(subUrl, map);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 普通map 发送
|
/**
|
||||||
|
* 普通map 发送
|
||||||
|
*
|
||||||
* @param subUrl
|
* @param subUrl
|
||||||
* @param map
|
* @param map
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -127,7 +138,7 @@ public class HttpUtils {
|
||||||
public String sendPost(String subUrl, Map<String, Object> map) {
|
public String sendPost(String subUrl, Map<String, Object> map) {
|
||||||
String resultStr = "";
|
String resultStr = "";
|
||||||
HttpClient client = new DefaultHttpClient();
|
HttpClient client = new DefaultHttpClient();
|
||||||
|
|
||||||
HttpPost post = new HttpPost(HttpClientConstant.URL_IP_PORT + subUrl);
|
HttpPost post = new HttpPost(HttpClientConstant.URL_IP_PORT + subUrl);
|
||||||
try {
|
try {
|
||||||
// 传参
|
// 传参
|
||||||
|
|
@ -138,25 +149,25 @@ public class HttpUtils {
|
||||||
String value = "";
|
String value = "";
|
||||||
Object obj = map.get(key);
|
Object obj = map.get(key);
|
||||||
String type = obj.getClass().getName();
|
String type = obj.getClass().getName();
|
||||||
//字符串
|
// 字符串
|
||||||
if (type.equals("java.lang.String")) {
|
if (type.equals("java.lang.String")) {
|
||||||
value = (String) obj;
|
value = (String) obj;
|
||||||
}
|
}
|
||||||
//数组
|
// 数组
|
||||||
else if(type.contains("[L")){
|
else if (type.contains("[L")) {
|
||||||
JSONArray jsonarr = JSONArray.fromObject(obj);
|
JSONArray jsonarr = JSONArray.fromObject(obj);
|
||||||
value = jsonarr.toString();
|
value = jsonarr.toString();
|
||||||
}
|
}
|
||||||
//集合
|
// 集合
|
||||||
else if(type.contains("java.util.")){
|
else if (type.contains("java.util.")) {
|
||||||
JSONArray jsonarr = JSONArray.fromObject(obj);
|
JSONArray jsonarr = JSONArray.fromObject(obj);
|
||||||
value = jsonarr.toString();
|
value = jsonarr.toString();
|
||||||
}
|
}
|
||||||
//除字符外的 其他 基本类型
|
// 除字符外的 其他 基本类型
|
||||||
else if(type.contains("java.lang.")){
|
else if (type.contains("java.lang.")) {
|
||||||
value = String.valueOf(obj);
|
value = String.valueOf(obj);
|
||||||
}
|
}
|
||||||
//对象
|
// 对象
|
||||||
else {
|
else {
|
||||||
JSONObject jsondata = JSONObject.fromObject(obj);
|
JSONObject jsondata = JSONObject.fromObject(obj);
|
||||||
value = jsondata.toString();
|
value = jsondata.toString();
|
||||||
|
|
@ -164,11 +175,10 @@ public class HttpUtils {
|
||||||
parameters.add(new BasicNameValuePair(key, value));
|
parameters.add(new BasicNameValuePair(key, value));
|
||||||
}
|
}
|
||||||
// 传参 放入 url的 form中
|
// 传参 放入 url的 form中
|
||||||
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(parameters,
|
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(parameters, "UTF-8");
|
||||||
"UTF-8");
|
|
||||||
post.setEntity(entity);
|
post.setEntity(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送
|
// 发送
|
||||||
HttpResponse respone = client.execute(post);
|
HttpResponse respone = client.execute(post);
|
||||||
HttpEntity result = respone.getEntity();
|
HttpEntity result = respone.getEntity();
|
||||||
|
|
@ -181,34 +191,4 @@ public class HttpUtils {
|
||||||
}
|
}
|
||||||
return resultStr;
|
return resultStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static void main(String[] args) {
|
|
||||||
// HttpUtils ht = new HttpUtils();
|
|
||||||
// Volume v = new Volume("a", 200, 10, null, null);
|
|
||||||
// String rest = ht.sendPost("data/getOperateTasks", v);
|
|
||||||
// System.out.println(rest);
|
|
||||||
// Map<String, Object> m = new HashMap<String, Object>();
|
|
||||||
// m.put("a", 1);
|
|
||||||
// rest = ht.sendPost("data/getOperateTasks", m);
|
|
||||||
// System.out.println(rest);
|
|
||||||
// rest = ht.sendPost("data/getOperateTasks", null);
|
|
||||||
// System.out.println(rest);
|
|
||||||
// //
|
|
||||||
// String[] str = new String[2];
|
|
||||||
// str[1] = "1";
|
|
||||||
// str[0] = "0";
|
|
||||||
// m.put("arr", str);
|
|
||||||
//
|
|
||||||
// Volume[] vli = new Volume[2];
|
|
||||||
// vli[1] = new Volume("a", 200, 10, null, null);
|
|
||||||
// vli[0] = new Volume("a", 200, 10, null, null);
|
|
||||||
// m.put("vli", vli);
|
|
||||||
// List<Integer> num = new ArrayList<Integer>();
|
|
||||||
// num.add(2);
|
|
||||||
// m.put("num", num);
|
|
||||||
// m.put("bool", true);
|
|
||||||
// rest = ht.sendPost("data/getOperateTasks", m);
|
|
||||||
// System.out.println(rest);
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,13 @@ import com.base.Custom4exception;
|
||||||
import com.base.CustomException;
|
import com.base.CustomException;
|
||||||
import com.platform.entities.OracleConnectorParams;
|
import com.platform.entities.OracleConnectorParams;
|
||||||
import com.platform.utils.Configs;
|
import com.platform.utils.Configs;
|
||||||
|
import com.platform.utils.ExceptionMsg;
|
||||||
import com.platform.utils.FileOperateHelper;
|
import com.platform.utils.FileOperateHelper;
|
||||||
|
|
||||||
public class OracleConnector {
|
public class OracleConnector {
|
||||||
|
|
||||||
public static Logger log = Configs.DAILY_ROLLING_LOGGER
|
@SuppressWarnings("static-access")
|
||||||
.getLogger(OracleConnector.class);
|
public static Logger log = Configs.DAILY_ROLLING_LOGGER.getLogger(OracleConnector.class);
|
||||||
|
|
||||||
public OracleConnector() {
|
public OracleConnector() {
|
||||||
}
|
}
|
||||||
|
|
@ -31,18 +32,77 @@ public class OracleConnector {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized static Connection connectionBuilder(String url,
|
public static Connection createConnection(String url, String user, String password) throws CustomException {
|
||||||
String user, String password, OracleConnectorParams oc)
|
Connection conn = null;
|
||||||
throws CustomException {
|
try {
|
||||||
|
conn = DriverManager.getConnection(url, user, password);
|
||||||
|
return conn;
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error(ExceptionMsg.exceptionStackToStr(e));
|
||||||
|
}
|
||||||
|
return conn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ResultSet execSqlGetResult(String url, String user, String password, String sql) {
|
||||||
|
Connection conn = null;
|
||||||
|
ResultSet resultSet = null;
|
||||||
|
Statement statement = null;
|
||||||
|
try {
|
||||||
|
conn = createConnection(url, user, password);
|
||||||
|
statement = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
|
||||||
|
resultSet = statement.executeQuery(sql);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(ExceptionMsg.exceptionStackToStr(e));
|
||||||
|
} finally {
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (null != statement) {
|
||||||
|
statement.close();
|
||||||
|
}
|
||||||
|
if (conn != null) {
|
||||||
|
conn.close();
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error(ExceptionMsg.exceptionStackToStr(e));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ResultSet execSqlGetResult(Connection conn, String sql) {
|
||||||
|
ResultSet resultSet = null;
|
||||||
|
Statement statement = null;
|
||||||
|
try {
|
||||||
|
statement = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
|
||||||
|
resultSet = statement.executeQuery(sql);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error(ExceptionMsg.exceptionStackToStr(e));
|
||||||
|
} finally {
|
||||||
|
if (null != statement) {
|
||||||
|
try {
|
||||||
|
statement.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error(ExceptionMsg.exceptionStackToStr(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized static Connection connectionBuilder(String url, String user, String password,
|
||||||
|
OracleConnectorParams oc) throws CustomException {
|
||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
try {
|
try {
|
||||||
conn = DriverManager.getConnection(url, user, password);
|
conn = DriverManager.getConnection(url, user, password);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Configs.CONSOLE_LOGGER.info("创建oracle连接失败: [" + e.getMessage()
|
Configs.CONSOLE_LOGGER.info("创建oracle连接失败: [" + e.getMessage() + "]");
|
||||||
+ "]");
|
|
||||||
if (null != oc) {
|
if (null != oc) {
|
||||||
FileOperateHelper.fileWrite(
|
FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION + oc.getName() + ".log",
|
||||||
Configs.EXTRACT_LOG_LOCALTION + oc.getName() + ".log",
|
|
||||||
"创建oracle连接失败: [" + e.getMessage() + "]\r\n");
|
"创建oracle连接失败: [" + e.getMessage() + "]\r\n");
|
||||||
}
|
}
|
||||||
throw new CustomException(Custom4exception.OracleSQL_Except, e);
|
throw new CustomException(Custom4exception.OracleSQL_Except, e);
|
||||||
|
|
@ -50,15 +110,14 @@ public class OracleConnector {
|
||||||
return conn;
|
return conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized static boolean canConnect(String url, String user,
|
public synchronized static boolean canConnect(String url, String user, String password) {
|
||||||
String password) {
|
|
||||||
Connection result = null;
|
Connection result = null;
|
||||||
try {
|
try {
|
||||||
result = connectionBuilder(url, user, password, null);
|
result = connectionBuilder(url, user, password, null);
|
||||||
} catch (CustomException e) {
|
} catch (CustomException e) {
|
||||||
log.error(Custom4exception.OracleSQL_Except, e);
|
log.error(Custom4exception.OracleSQL_Except, e);
|
||||||
}
|
}
|
||||||
if(null != result){
|
if (null != result) {
|
||||||
try {
|
try {
|
||||||
result.close();
|
result.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
|
@ -66,37 +125,36 @@ public class OracleConnector {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 不要使用这个方法 (statement没法关闭)
|
/**
|
||||||
|
* 不要使用这个方法 (statement没法关闭)
|
||||||
|
*
|
||||||
* @param conn
|
* @param conn
|
||||||
* @param sql
|
* @param sql
|
||||||
* @param filePath
|
* @param filePath
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public synchronized static ResultSet getSQLExecResultSet(Connection conn,
|
public synchronized static ResultSet getSQLExecResultSet(Connection conn, String sql, String filePath) {
|
||||||
String sql, String filePath) {
|
|
||||||
ResultSet resultSet = null;
|
ResultSet resultSet = null;
|
||||||
if (null != filePath) {
|
if (null != filePath) {
|
||||||
filePath = filePath.replace(".log", "");
|
filePath = filePath.replace(".log", "");
|
||||||
}
|
}
|
||||||
|
log.info("getSQLExecResultSet: "+sql+" filePath: "+filePath);
|
||||||
Statement statement = null;
|
Statement statement = null;
|
||||||
try {
|
try {
|
||||||
FileOperateHelper.fileWrite(filePath + ".log", sql + "\r\n");
|
FileOperateHelper.fileWrite(filePath + ".log", sql + "\r\n");
|
||||||
statement = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
|
statement = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
|
||||||
ResultSet.CONCUR_UPDATABLE);
|
|
||||||
resultSet = statement.executeQuery(sql);
|
resultSet = statement.executeQuery(sql);
|
||||||
/*
|
/*
|
||||||
* if(resultSet.next()){ System.out.println(resultSet.getInt(1)); }
|
* if(resultSet.next()){ System.out.println(resultSet.getInt(1)); }
|
||||||
*/
|
*/
|
||||||
FileOperateHelper.fileWrite(filePath + ".log", "OK \r\n");
|
FileOperateHelper.fileWrite(filePath + ".log", "OK \r\n");
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
FileOperateHelper.fileWrite(filePath + ".log",
|
FileOperateHelper.fileWrite(filePath + ".log", e.getMessage() + "\r\n");
|
||||||
e.getMessage() + "\r\n");
|
|
||||||
log.error(Custom4exception.OracleSQL_Except, e);
|
log.error(Custom4exception.OracleSQL_Except, e);
|
||||||
} finally {
|
} finally {
|
||||||
if (null != statement) {
|
if (null != statement) {
|
||||||
|
|
@ -111,7 +169,9 @@ public class OracleConnector {
|
||||||
return resultSet;
|
return resultSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 不要使用这个方法 (statement没法关闭)
|
/**
|
||||||
|
* 不要使用这个方法 (statement没法关闭)
|
||||||
|
*
|
||||||
* @param url
|
* @param url
|
||||||
* @param user
|
* @param user
|
||||||
* @param password
|
* @param password
|
||||||
|
|
@ -119,12 +179,11 @@ public class OracleConnector {
|
||||||
* @param filePath
|
* @param filePath
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public synchronized static ResultSet getSQLExecResultSet(String url,
|
public synchronized static ResultSet getSQLExecResultSet(String url, String user, String password, String sql,
|
||||||
String user, String password, String sql, String filePath) {
|
String filePath) {
|
||||||
ResultSet result = null;
|
ResultSet result = null;
|
||||||
try {
|
try {
|
||||||
result = getSQLExecResultSet(
|
result = getSQLExecResultSet(connectionBuilder(url, user, password, null), sql, filePath);
|
||||||
connectionBuilder(url, user, password, null), sql, filePath);
|
|
||||||
} catch (CustomException e) {
|
} catch (CustomException e) {
|
||||||
log.error(Custom4exception.OracleSQL_Except, e);
|
log.error(Custom4exception.OracleSQL_Except, e);
|
||||||
}
|
}
|
||||||
|
|
@ -138,11 +197,11 @@ public class OracleConnector {
|
||||||
* @param sql
|
* @param sql
|
||||||
* @return true:执行的不返回集合数据的sql成功, 是否执行成功
|
* @return true:执行的不返回集合数据的sql成功, 是否执行成功
|
||||||
*/
|
*/
|
||||||
public synchronized static boolean execOracleSQL(Connection conn,
|
public synchronized static boolean execOracleSQL(Connection conn, String sql, String filePath) {
|
||||||
String sql, String filePath) {
|
|
||||||
if (null != filePath) {
|
if (null != filePath) {
|
||||||
filePath = filePath.replace(".log", "");
|
filePath = filePath.replace(".log", "");
|
||||||
}
|
}
|
||||||
|
log.info("execOracleSQL: "+sql+" filePath: "+filePath);
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
Statement statement = null;
|
Statement statement = null;
|
||||||
try {
|
try {
|
||||||
|
|
@ -150,25 +209,22 @@ public class OracleConnector {
|
||||||
statement = conn.createStatement();
|
statement = conn.createStatement();
|
||||||
int res = statement.executeUpdate(sql);
|
int res = statement.executeUpdate(sql);
|
||||||
flag = true;
|
flag = true;
|
||||||
FileOperateHelper.fileWrite(filePath + ".log", "执行结果:" + res
|
FileOperateHelper.fileWrite(filePath + ".log", "执行结果:" + res + " \r\n");
|
||||||
+ " \r\n");
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
flag = false;
|
flag = false;
|
||||||
FileOperateHelper.fileWrite(filePath + ".log",
|
FileOperateHelper.fileWrite(filePath + ".log", e.getMessage() + "\r\n");
|
||||||
e.getMessage() + "\r\n");
|
|
||||||
log.error(Custom4exception.OracleSQL_Except, e);
|
log.error(Custom4exception.OracleSQL_Except, e);
|
||||||
}
|
} finally {
|
||||||
finally {
|
if (null != statement) {
|
||||||
if (null != statement) {
|
try {
|
||||||
try {
|
statement.close();
|
||||||
statement.close();
|
} catch (SQLException e) {
|
||||||
} catch (SQLException e) {
|
log.error(Custom4exception.OracleSQL_Except, e);
|
||||||
log.error(Custom4exception.OracleSQL_Except, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return flag ;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -178,11 +234,11 @@ public class OracleConnector {
|
||||||
* @param sql
|
* @param sql
|
||||||
* @return true:执行结果大于1,即有数据 是否执行成功
|
* @return true:执行结果大于1,即有数据 是否执行成功
|
||||||
*/
|
*/
|
||||||
public synchronized static boolean execUpdateOracleSQL(Connection conn,
|
public synchronized static boolean execUpdateOracleSQL(Connection conn, String sql, String filePath) {
|
||||||
String sql, String filePath) {
|
|
||||||
if (null != filePath) {
|
if (null != filePath) {
|
||||||
filePath = filePath.replace(".log", "");
|
filePath = filePath.replace(".log", "");
|
||||||
}
|
}
|
||||||
|
log.info("execUpdateOracleSQL: "+sql+" filePath: "+filePath);
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
Statement statement = null;
|
Statement statement = null;
|
||||||
try {
|
try {
|
||||||
|
|
@ -190,20 +246,17 @@ public class OracleConnector {
|
||||||
statement = conn.createStatement();
|
statement = conn.createStatement();
|
||||||
int res = statement.executeUpdate(sql);
|
int res = statement.executeUpdate(sql);
|
||||||
flag = true;
|
flag = true;
|
||||||
FileOperateHelper.fileWrite(filePath + ".log", "执行结果:"+ res
|
FileOperateHelper.fileWrite(filePath + ".log", "执行结果:" + res + " \r\n");
|
||||||
+ " \r\n");
|
|
||||||
|
|
||||||
if (res < 1) {
|
if (res < 1) {
|
||||||
flag = false;
|
flag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
flag = false;
|
flag = false;
|
||||||
FileOperateHelper.fileWrite(filePath + ".log",
|
FileOperateHelper.fileWrite(filePath + ".log", e.getMessage() + "\r\n");
|
||||||
e.getMessage() + "\r\n");
|
|
||||||
log.error(Custom4exception.OracleSQL_Except, e);
|
log.error(Custom4exception.OracleSQL_Except, e);
|
||||||
}
|
} finally {
|
||||||
finally{
|
|
||||||
if (statement != null) {
|
if (statement != null) {
|
||||||
try {
|
try {
|
||||||
statement.close();
|
statement.close();
|
||||||
|
|
|
||||||
|
|
@ -7,32 +7,55 @@ import org.springframework.ui.ModelMap;
|
||||||
|
|
||||||
import com.platform.entities.DataInfoEntity;
|
import com.platform.entities.DataInfoEntity;
|
||||||
import com.platform.form.PagerOptions;
|
import com.platform.form.PagerOptions;
|
||||||
|
import com.platform.utils.Result;
|
||||||
|
|
||||||
/** 数据管理
|
/**
|
||||||
|
* 数据管理
|
||||||
|
*
|
||||||
* @author chen
|
* @author chen
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface DataInfoService {
|
public interface DataInfoService {
|
||||||
|
|
||||||
/** 分页查询数据
|
/**
|
||||||
|
*
|
||||||
|
* @Title: getAllData
|
||||||
|
* @Description: 查询所有数据
|
||||||
|
* @param @param isUnique:是否是唯一数据,即去除重复数据
|
||||||
|
* @param @return
|
||||||
|
* @param @throws Exception 设定文件
|
||||||
|
* @return Result<List<DataInfoEntity>> 返回类型
|
||||||
|
* @throws
|
||||||
|
*/
|
||||||
|
public Result<List<DataInfoEntity>> getAllData(Boolean isUnique) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询数据
|
||||||
|
*
|
||||||
* @param pagerOptions
|
* @param pagerOptions
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ModelMap getPagerTableData(PagerOptions pagerOptions)throws Exception;
|
public ModelMap getPagerTableData(PagerOptions pagerOptions) throws Exception;
|
||||||
|
|
||||||
/** 删除数据
|
/**
|
||||||
|
* 删除数据
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
void deleteData(String[] id) throws Exception;
|
void deleteData(String[] id) throws Exception;
|
||||||
|
|
||||||
/** 删除数据
|
/**
|
||||||
|
* 删除数据
|
||||||
|
*
|
||||||
* @param ids
|
* @param ids
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
void deleteData(List<Integer> ids) throws Exception;
|
void deleteData(List<Integer> ids) throws Exception;
|
||||||
|
|
||||||
/** 新增数据
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*
|
||||||
* @param data
|
* @param data
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
|
|
||||||
|
|
@ -2,34 +2,72 @@ package com.platform.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.platform.entities.DataInfoEntity;
|
||||||
import com.platform.entities.GatherOracleInfo;
|
import com.platform.entities.GatherOracleInfo;
|
||||||
|
import com.platform.enums.ExportDataTypeEnum;
|
||||||
|
import com.platform.utils.Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* oracle数据汇总等服务 <功能详细描述>
|
||||||
|
*
|
||||||
|
* @author liliy
|
||||||
|
* @version [版本号,2018年1月25日]
|
||||||
|
* @see [相关类/方法]
|
||||||
|
* @since [产品/模块版本]
|
||||||
|
*/
|
||||||
public interface IGatherOracleService {
|
public interface IGatherOracleService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return 查询 所有 oracle 总库
|
* @return 查询 所有 oracle 总库
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public List<GatherOracleInfo> findAllOracle() throws Exception;
|
public List<GatherOracleInfo> findAllOracle() throws Exception;
|
||||||
|
|
||||||
/** 删除 oracle 总库
|
/**
|
||||||
|
* 删除 oracle 总库
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public int deleteOracle(int id) throws Exception;
|
public int deleteOracle(int id) throws Exception;
|
||||||
|
|
||||||
/** 新增 oracle 总库
|
/**
|
||||||
|
* 新增 oracle 总库
|
||||||
|
*
|
||||||
* @param oracle
|
* @param oracle
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public int insertOracle(GatherOracleInfo oracle) throws Exception;
|
public int insertOracle(GatherOracleInfo oracle) throws Exception;
|
||||||
|
|
||||||
/** 更新 oracle 总库
|
/**
|
||||||
|
* 更新 oracle 总库
|
||||||
|
*
|
||||||
* @param oracle
|
* @param oracle
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public int updateOracle(GatherOracleInfo oracle) throws Exception;
|
public int updateOracle(GatherOracleInfo oracle) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建 oracle 汇总库
|
||||||
|
*
|
||||||
|
* @param oracle
|
||||||
|
* @return 汇总库数据路径
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public Result<DataInfoEntity> createGatherDatabase(GatherOracleInfo oracle) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据导出服务 <功能详细描述>
|
||||||
|
*
|
||||||
|
* @param ids
|
||||||
|
* @param types
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
* @see [类、类#方法、类#成员]
|
||||||
|
*/
|
||||||
|
public Result<String> oracleDataExport(List<Integer> ids, List<ExportDataTypeEnum> types,
|
||||||
|
List<Integer> gatherOracleList) throws Exception;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,33 @@
|
||||||
package com.platform.service;
|
package com.platform.service;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
public interface ILogRead {
|
public interface ILogRead {
|
||||||
|
public static Logger log = Logger.getLogger(ILogRead.class);
|
||||||
/** 读取汇总的日志
|
|
||||||
|
/**
|
||||||
|
* 读取汇总的日志
|
||||||
|
*
|
||||||
* @param filename
|
* @param filename
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public String readLog(String filename) throws Exception;
|
public String readLog(String filename) throws Exception;
|
||||||
|
|
||||||
/** 读取抽取标准表的日志
|
/**
|
||||||
|
* 读取抽取标准表的日志
|
||||||
|
*
|
||||||
* @param filename
|
* @param filename
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public String readStandardLog(String filename) throws Exception;
|
public String readStandardLog(String filename) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取数据导出的日志
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public String readExportDataLog() throws Exception;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,476 +0,0 @@
|
||||||
package com.platform.service;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.sql.Statement;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
import com.base.Custom4exception;
|
|
||||||
import com.platform.entities.GatherOracleInfo;
|
|
||||||
import com.platform.entities.OracleConnectorParams;
|
|
||||||
import com.platform.oracle.OracleConnector;
|
|
||||||
import com.platform.utils.Configs;
|
|
||||||
import com.platform.utils.FileOperateHelper;
|
|
||||||
|
|
||||||
public class OracleExtractHelper {
|
|
||||||
|
|
||||||
public static Logger log = Logger.getLogger(OracleExtractHelper.class);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断dblink是否已经存在
|
|
||||||
*
|
|
||||||
* @param conn
|
|
||||||
* @param linkName
|
|
||||||
* dblink的名称
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private boolean hasSameNameDBLink(Connection conn, String linkName,
|
|
||||||
String filePath) {
|
|
||||||
|
|
||||||
boolean flag = false;
|
|
||||||
String sql = "SELECT COUNT(*) c FROM ALL_DB_LINKS WHERE DB_LINK='"
|
|
||||||
+ linkName + "'";
|
|
||||||
ResultSet rSet = null;
|
|
||||||
Statement statement = null;
|
|
||||||
try {
|
|
||||||
statement = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
|
|
||||||
ResultSet.CONCUR_UPDATABLE);
|
|
||||||
rSet = statement.executeQuery(sql);
|
|
||||||
if (rSet.next()) {
|
|
||||||
if (rSet.getInt("c") > 0)
|
|
||||||
flag = true;
|
|
||||||
else
|
|
||||||
flag = false;
|
|
||||||
}
|
|
||||||
FileOperateHelper.fileWrite(filePath + ".log", sql + "\r\n"
|
|
||||||
+ "OK \r\n");
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
FileOperateHelper.fileWrite(filePath, sql + "\r\n" + e.getMessage()
|
|
||||||
+ "\r\n,连接异常! \r\n");
|
|
||||||
log.error(Custom4exception.threadVolume_Oracle_Except, e);
|
|
||||||
} finally {
|
|
||||||
if (null != statement) {
|
|
||||||
try {
|
|
||||||
statement.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
log.error(Custom4exception.OracleSQL_Except, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建dblink
|
|
||||||
*
|
|
||||||
* @param conn
|
|
||||||
* 汇总库的连接
|
|
||||||
* @param oc
|
|
||||||
* 采集库 dblink连接参数实体
|
|
||||||
*/
|
|
||||||
public void createDBLink(Connection conn, OracleConnectorParams oc) {
|
|
||||||
String linkName = "LINKTO_J" + oc.getName().replaceAll("-", "_");
|
|
||||||
String sql = "CREATE PUBLIC DATABASE LINK "
|
|
||||||
+ linkName
|
|
||||||
+ " CONNECT TO "
|
|
||||||
+ oc.getUser()
|
|
||||||
+ " IDENTIFIED BY "
|
|
||||||
+ oc.getPassword()
|
|
||||||
+ " USING \'(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = "
|
|
||||||
+ oc.getIp() + ")(PORT = " + oc.getPort()
|
|
||||||
+ ")))(CONNECT_DATA =(SERVICE_NAME =" + oc.getDatabaseName()
|
|
||||||
+ ")))\'";
|
|
||||||
if (null != oc) {
|
|
||||||
if (hasSameNameDBLink(conn, linkName, Configs.EXTRACT_LOG_LOCALTION
|
|
||||||
+ oc.getName())) { // 如果dblink已经存在,先删除dblink,在创建dblink
|
|
||||||
String deleteSql = "DROP PUBLIC DATABASE LINK " + linkName;
|
|
||||||
// 删除 dblink
|
|
||||||
if (OracleConnector.execOracleSQL(conn, deleteSql,
|
|
||||||
Configs.EXTRACT_LOG_LOCALTION + oc.getName())) {
|
|
||||||
if (!OracleConnector.execOracleSQL(conn, sql,
|
|
||||||
Configs.EXTRACT_LOG_LOCALTION + oc.getName())) {
|
|
||||||
OracleConnector.execUpdateOracleSQL(conn, sql,
|
|
||||||
Configs.EXTRACT_LOG_LOCALTION + oc.getName());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Configs.CONSOLE_LOGGER.error("删除已有的DBLink失败,无法创建新的DBLink!");
|
|
||||||
FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION
|
|
||||||
+ oc.getName() + ".log",
|
|
||||||
"删除已有的DBLink失败,无法创建新的DBLink!" + "\r\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// 否则,创建dblink
|
|
||||||
if (!OracleConnector.execOracleSQL(conn, sql,
|
|
||||||
Configs.EXTRACT_LOG_LOCALTION + oc.getName())) {
|
|
||||||
OracleConnector.execUpdateOracleSQL(conn, sql,
|
|
||||||
Configs.EXTRACT_LOG_LOCALTION + oc.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建表空间
|
|
||||||
*
|
|
||||||
* @param conn
|
|
||||||
* 汇总库连接
|
|
||||||
* @param collectOracle
|
|
||||||
* @param oc
|
|
||||||
* 汇总库信息
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean createTableSpace(Connection conn,
|
|
||||||
OracleConnectorParams collectOracle, GatherOracleInfo oc) {
|
|
||||||
String tmpSql = "select TABLESPACE_NAME from dba_tablespaces where TABLESPACE_NAME = '"
|
|
||||||
+ oc.getTableName().toUpperCase() + "'";
|
|
||||||
// 存在 表空间
|
|
||||||
if (OracleConnector.execUpdateOracleSQL(conn, tmpSql,
|
|
||||||
Configs.EXTRACT_LOG_LOCALTION + collectOracle.getName())) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
String sql = "create tablespace " + oc.getTableName().toUpperCase()
|
|
||||||
+ " datafile '" + Configs.GATHER_TABLESPACE_PATH
|
|
||||||
+ oc.getTableName().toUpperCase() + ".dbf"
|
|
||||||
+ "' size 512M autoextend on next 512M maxsize unlimited";
|
|
||||||
return OracleConnector.execOracleSQL(conn, sql,
|
|
||||||
Configs.EXTRACT_LOG_LOCALTION + collectOracle.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建表空间
|
|
||||||
*
|
|
||||||
* @param conn
|
|
||||||
* 汇总库连接
|
|
||||||
* @param collectOracle
|
|
||||||
* @param oc
|
|
||||||
* 汇总库信息
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean createStardardTableSpace(Connection conn,
|
|
||||||
OracleConnectorParams collectOracle, GatherOracleInfo oc) {
|
|
||||||
String tmpSql = "select TABLESPACE_NAME from dba_tablespaces where TABLESPACE_NAME = '"
|
|
||||||
+ oc.getTableName().toUpperCase() + "'";
|
|
||||||
// 存在 表空间
|
|
||||||
if (OracleConnector.execUpdateOracleSQL(conn, tmpSql,
|
|
||||||
Configs.EXTRACT_STANDARD_LOG_LOCALTION + collectOracle.getName())) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
String sql = "create tablespace " + oc.getTableName().toUpperCase()
|
|
||||||
+ " datafile '" + Configs.GATHER_TABLESPACE_PATH
|
|
||||||
+ oc.getTableName().toUpperCase() + ".dbf"
|
|
||||||
+ "' size 512M autoextend on next 512M maxsize unlimited";
|
|
||||||
return OracleConnector.execOracleSQL(conn, sql,
|
|
||||||
Configs.EXTRACT_STANDARD_LOG_LOCALTION + collectOracle.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建用户并授权
|
|
||||||
*
|
|
||||||
* @param conn
|
|
||||||
* 汇总库连接
|
|
||||||
* @param oc
|
|
||||||
* 汇总库信息
|
|
||||||
*/
|
|
||||||
public void createUser(Connection conn, OracleConnectorParams oc,
|
|
||||||
GatherOracleInfo totalOracle) {
|
|
||||||
String strTUser = "J" + oc.getName().replaceAll("-", "_")
|
|
||||||
+ totalOracle.getSuffix();
|
|
||||||
|
|
||||||
String sql = "Create user " + strTUser + " default tablespace "
|
|
||||||
+ totalOracle.getTableName() + " identified by "
|
|
||||||
+ Configs.GATHER_TABLE_PASSWORD;
|
|
||||||
String grantSql = "grant connect, resource, dba to " + strTUser;
|
|
||||||
|
|
||||||
OracleConnector.execOracleSQL(conn, sql, Configs.EXTRACT_LOG_LOCALTION
|
|
||||||
+ oc.getName());
|
|
||||||
|
|
||||||
OracleConnector.execOracleSQL(conn, grantSql,
|
|
||||||
Configs.EXTRACT_LOG_LOCALTION + oc.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建用户并授权
|
|
||||||
*
|
|
||||||
* @param conn
|
|
||||||
* 汇总库连接
|
|
||||||
* @param oc
|
|
||||||
* 汇总库信息
|
|
||||||
*/
|
|
||||||
public void createOnlyUser(Connection conn, OracleConnectorParams oc,
|
|
||||||
GatherOracleInfo totalOracle) {
|
|
||||||
String strTUser = Configs.GATHER_STANDARD_USER_NAME;
|
|
||||||
|
|
||||||
String sql = "Create user " + strTUser.toUpperCase() + " default tablespace "
|
|
||||||
+ totalOracle.getTableName() + " identified by "
|
|
||||||
+ Configs.GATHER_TABLE_PASSWORD;
|
|
||||||
String grantSql = "grant connect, resource, dba to " + strTUser.toUpperCase();
|
|
||||||
|
|
||||||
OracleConnector.execOracleSQL(conn, sql,
|
|
||||||
Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
|
|
||||||
|
|
||||||
OracleConnector.execOracleSQL(conn, grantSql,
|
|
||||||
Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建用户并授权
|
|
||||||
*
|
|
||||||
* @param conn
|
|
||||||
* 汇总库连接
|
|
||||||
* @param oc
|
|
||||||
* 汇总库信息
|
|
||||||
*/
|
|
||||||
public void createTable(Connection conn, OracleConnectorParams oc,
|
|
||||||
GatherOracleInfo totalOracle) {
|
|
||||||
String strTUser = oc.getName() + totalOracle.getSuffix();
|
|
||||||
|
|
||||||
String sql = "Create table " + strTUser + " default tablespace "
|
|
||||||
+ totalOracle.getTableName() + " identified by "
|
|
||||||
+ Configs.GATHER_TABLE_PASSWORD;
|
|
||||||
String grantSql = "grant connect, resource, dba to " + strTUser;
|
|
||||||
|
|
||||||
OracleConnector.execOracleSQL(conn, sql, Configs.EXTRACT_LOG_LOCALTION
|
|
||||||
+ oc.getName());
|
|
||||||
|
|
||||||
OracleConnector.execOracleSQL(conn, grantSql,
|
|
||||||
Configs.EXTRACT_LOG_LOCALTION + oc.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 执行汇总操作
|
|
||||||
*
|
|
||||||
* @param conn
|
|
||||||
* 汇总库连接
|
|
||||||
* @param oc
|
|
||||||
* 采集库
|
|
||||||
*/
|
|
||||||
public void extractColleDB(Connection conn, OracleConnectorParams oc,
|
|
||||||
GatherOracleInfo totalOracle) {
|
|
||||||
String strTUser = "J" + oc.getName().replaceAll("-", "_")
|
|
||||||
+ totalOracle.getSuffix();
|
|
||||||
String sql = "SELECT 'create table "
|
|
||||||
+ strTUser
|
|
||||||
+ ".J'|| substr(t.OWNER||'_'||t.TABLE_NAME,0,29)||' as select * from '||t.OWNER||'.'||t.TABLE_NAME||"
|
|
||||||
+ "'@LINKTO_J"
|
|
||||||
+ oc.getName().replaceAll("-", "_")
|
|
||||||
+ ";' FROM dba_tables@LINKTO_J"
|
|
||||||
+ oc.getName().replaceAll("-", "_")
|
|
||||||
+ " t WHERE t.TABLESPACE_NAME NOT IN ('SYSTEM','SYSAUX')"
|
|
||||||
+ " and t.owner||t.table_name not in (select owner||table_name from dba_tables@LINKTO_J"
|
|
||||||
+ oc.getName().replaceAll("-", "_")
|
|
||||||
+ " where 'data_type'='CLOB')";
|
|
||||||
/*
|
|
||||||
* ResultSet rsSet = OracleConnector.getSQLExecResultSet(conn, sql,
|
|
||||||
* Configs.EXTRACT_LOG_LOCALTION + oc.getName());
|
|
||||||
*/
|
|
||||||
Statement statement = null;
|
|
||||||
try {
|
|
||||||
statement = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
|
|
||||||
ResultSet.CONCUR_UPDATABLE);
|
|
||||||
ResultSet resultSet = statement.executeQuery(sql);
|
|
||||||
FileOperateHelper.fileWrite(
|
|
||||||
Configs.EXTRACT_LOG_LOCALTION + oc.getName() + ".log", sql
|
|
||||||
+ "\r\n" + "OK \r\n");
|
|
||||||
|
|
||||||
while (resultSet.next()) {
|
|
||||||
try {
|
|
||||||
String resultSql = resultSet.getString(1).replace(";", "");
|
|
||||||
OracleConnector.execUpdateOracleSQL(conn, resultSql,
|
|
||||||
Configs.EXTRACT_LOG_LOCALTION + oc.getName());
|
|
||||||
} catch (SQLException e) {
|
|
||||||
log.error(Custom4exception.threadVolume_Oracle_Except, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
log.error(Custom4exception.threadVolume_Oracle_Except, e);
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
if (null != statement) {
|
|
||||||
try {
|
|
||||||
statement.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
log.error(Custom4exception.OracleSQL_Except, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试是否能否连接上?
|
|
||||||
*
|
|
||||||
* @return true:能连接上
|
|
||||||
*/
|
|
||||||
public boolean testConnect(Connection conn) {
|
|
||||||
String testSql = "select count(*) from user_tables";
|
|
||||||
boolean flag = false;
|
|
||||||
Statement statement = null;
|
|
||||||
try {
|
|
||||||
statement = conn.createStatement();
|
|
||||||
if (statement.executeUpdate(testSql) > 0)
|
|
||||||
flag = true;
|
|
||||||
} catch (SQLException e) {
|
|
||||||
flag = false;
|
|
||||||
log.error(Custom4exception.threadVolume_Oracle_Except, e);
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
if (null != statement) {
|
|
||||||
try {
|
|
||||||
statement.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
log.error(Custom4exception.OracleSQL_Except, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 执行抽取操作--支付表
|
|
||||||
*
|
|
||||||
* @param conn
|
|
||||||
* 汇总库连接
|
|
||||||
* @param oc
|
|
||||||
* 采集库
|
|
||||||
*/
|
|
||||||
public void extractStandardPayTable(Connection conn,
|
|
||||||
OracleConnectorParams oc, GatherOracleInfo totalOracle) {
|
|
||||||
String strTUser = Configs.GATHER_STANDARD_USER_NAME;
|
|
||||||
createPay(conn, oc);
|
|
||||||
String sql = "insert into " + strTUser + "."
|
|
||||||
+ Configs.GATHER_STANDARD_PAY_TABLE_NAME + " select * from "
|
|
||||||
+ strTUser + "." + Configs.GATHER_STANDARD_PAY_TABLE_NAME
|
|
||||||
+ "@LINKTOST" + oc.getName();
|
|
||||||
String resultSql = sql.replace(";", "");
|
|
||||||
OracleConnector.execOracleSQL(conn, resultSql,
|
|
||||||
Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 执行抽取操作--执行表
|
|
||||||
*
|
|
||||||
* @param conn
|
|
||||||
* @param collectOracle
|
|
||||||
* @param oracleModel
|
|
||||||
*/
|
|
||||||
public void extractStandardExecTable(Connection conn,
|
|
||||||
OracleConnectorParams collectOracle, GatherOracleInfo oracleModel) {
|
|
||||||
createExec(conn, collectOracle);
|
|
||||||
String strTUser = Configs.GATHER_STANDARD_USER_NAME;
|
|
||||||
|
|
||||||
String sql = "insert into " + strTUser + "."
|
|
||||||
+ Configs.GATHER_STANDARD_EXEC_TABLE_NAME + " select * from "
|
|
||||||
+ strTUser + "." + Configs.GATHER_STANDARD_EXEC_TABLE_NAME
|
|
||||||
+ "@LINKTOST" + collectOracle.getName();
|
|
||||||
String resultSql = sql.replace(";", "");
|
|
||||||
OracleConnector.execOracleSQL(
|
|
||||||
conn,
|
|
||||||
resultSql,
|
|
||||||
Configs.EXTRACT_STANDARD_LOG_LOCALTION
|
|
||||||
+ collectOracle.getName());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createPay(Connection conn, OracleConnectorParams oc) {
|
|
||||||
String payCmd = "CREATE TABLE U_BZBJY.ZFXXB(XZQHDM Varchar(255),XZQHMC Varchar(255),PZBH Varchar(255),LYZBKZH Varchar(255),"
|
|
||||||
+ "ZFDATE Varchar(255),YSDWCODE Varchar(255),YSDWNAME Varchar(255),YWGKCS Varchar(255),XMCODE Varchar(255),XMNAME Varchar(255),"
|
|
||||||
+ "XMLBCODE Varchar(255),XMLBNAME Varchar(255),ZB_NO Varchar(255),GNFLCODE Varchar(255),GNFLNAME Varchar(255),JJFLCODE Varchar(255),"
|
|
||||||
+ "JJFLNAME Varchar(255),ZJXZCODE Varchar(255),ZJXZNAME Varchar(255),JSBFFSNAME Varchar(255),SKR Varchar(255),SKRYH Varchar(255),"
|
|
||||||
+ "SKRZHZH Varchar(255),FKZHCODE Varchar(255),FKZHNAME Varchar(255),FKYHCODE Varchar(255),FKYHNAME Varchar(255),QSZHCODE Varchar(255),"
|
|
||||||
+ "QSZHNAME Varchar(255),QSYHCODE Varchar(255),QSYHNAME Varchar(255),JE Numeric(18,2), SFTK Varchar(255),NIAN Varchar(255),ZY Varchar(255))";
|
|
||||||
|
|
||||||
try {
|
|
||||||
OracleConnector.execOracleSQL(conn, payCmd,
|
|
||||||
Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(Custom4exception.threadVolume_Oracle_Except, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建dblink
|
|
||||||
*
|
|
||||||
* @param conn
|
|
||||||
* 汇总库的连接
|
|
||||||
* @param oc
|
|
||||||
* 采集库 dblink连接参数实体
|
|
||||||
*/
|
|
||||||
public void createStandardDBLink(Connection conn, OracleConnectorParams oc) {
|
|
||||||
String linkName = "LINKTOST" + oc.getName();
|
|
||||||
String sql = "CREATE PUBLIC DATABASE LINK "
|
|
||||||
+ linkName
|
|
||||||
+ " CONNECT TO "
|
|
||||||
+ oc.getUser()
|
|
||||||
+ " IDENTIFIED BY "
|
|
||||||
+ oc.getPassword()
|
|
||||||
+ " USING \'(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = "
|
|
||||||
+ oc.getIp() + ")(PORT = " + oc.getPort()
|
|
||||||
+ ")))(CONNECT_DATA =(SERVICE_NAME =" + oc.getDatabaseName()
|
|
||||||
+ ")))\'";
|
|
||||||
if (null != oc) {
|
|
||||||
if (hasSameNameDBLink(conn, linkName,
|
|
||||||
Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName()
|
|
||||||
+ ".log")) { // 如果dblink已经存在,先删除dblink,在创建dblink
|
|
||||||
String deleteSql = "DROP PUBLIC DATABASE LINK " + linkName;
|
|
||||||
// 删除 dblink
|
|
||||||
if (OracleConnector.execOracleSQL(conn, deleteSql,
|
|
||||||
Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName())) {
|
|
||||||
// OracleConnector.execOracleSQL(conn, sql,
|
|
||||||
// Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
|
|
||||||
if (!OracleConnector.execOracleSQL(
|
|
||||||
conn,
|
|
||||||
sql,
|
|
||||||
Configs.EXTRACT_STANDARD_LOG_LOCALTION
|
|
||||||
+ oc.getName())) {
|
|
||||||
OracleConnector.execUpdateOracleSQL(
|
|
||||||
conn,
|
|
||||||
sql,
|
|
||||||
Configs.EXTRACT_STANDARD_LOG_LOCALTION
|
|
||||||
+ oc.getName());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Configs.CONSOLE_LOGGER.error("删除已有的DBLink失败,无法创建新的DBLink!");
|
|
||||||
FileOperateHelper.fileWrite(
|
|
||||||
Configs.EXTRACT_STANDARD_LOG_LOCALTION
|
|
||||||
+ oc.getName() + ".log",
|
|
||||||
"删除已有的DBLink失败,无法创建新的DBLink!" + "\r\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// 否则,创建dblink
|
|
||||||
// OracleConnector.execOracleSQL(conn, sql,
|
|
||||||
// Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
|
|
||||||
if (!OracleConnector.execOracleSQL(conn, sql,
|
|
||||||
Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName())) {
|
|
||||||
OracleConnector.execUpdateOracleSQL(
|
|
||||||
conn,
|
|
||||||
sql,
|
|
||||||
Configs.EXTRACT_STANDARD_LOG_LOCALTION
|
|
||||||
+ oc.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createExec(Connection conn, OracleConnectorParams oc) {
|
|
||||||
String execCmd = "CREATE TABLE U_BZBJY.KZXZB(XZQHDM Varchar(255),XZQHMC Varchar(255),YSND Varchar(255),ZBCODE Varchar(255),ZB_ID Varchar(255),ZB_NO Varchar(255),"
|
|
||||||
+ "ZBDJLXCODE Varchar(255),ZBDJLXNAME Varchar(255),ZBLXNAME Varchar(255),DOCNO Varchar(255),ZBSM Varchar(255),ZBFWDATE Varchar(255),ZBYSLXCODE Varchar(255),"
|
|
||||||
+ "ZBYSLXNAME Varchar(255),ZBYSLYNAME Varchar(255),YSDWCODE Varchar(255),YSDWNAME Varchar(255),GNFLCODE Varchar(255),GNFLNAME Varchar(255),JJFLCODE Varchar(255),"
|
|
||||||
+ "JJFLNAME Varchar(255),ZBGLCSNAME Varchar(255),SZGLCODE Varchar(255),SZGLNAME Varchar(255),XMCODE Varchar(255),XMNAME Varchar(255),GZBZ Varchar(255),"
|
|
||||||
+ "JJBZ Varchar(255),CGBZ Varchar(255),ZFFSCODE Varchar(255),ZFFSNAME Varchar(255),JZZFBZ Varchar(255),ZBJE Numeric(18,2),ZBTJJE Numeric(18,2),ZBDJJE Numeric(18,2),"
|
|
||||||
+ "ZBKYJE Numeric(18,2),ZYZFBZ Varchar(255),BZ Varchar(255))";
|
|
||||||
|
|
||||||
try {
|
|
||||||
OracleConnector.execOracleSQL(conn, execCmd,
|
|
||||||
Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(Custom4exception.threadVolume_Oracle_Except, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -42,7 +42,7 @@ public class OracleExtractTask extends AbstractOracleExtractTask {
|
||||||
this.OracleExtract = OracleExtract;
|
this.OracleExtract = OracleExtract;
|
||||||
}
|
}
|
||||||
|
|
||||||
private OracleExtractHelper oracleExtract = new OracleExtractHelper();
|
private OracleHelper oracleExtract = new OracleHelper();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handler() {
|
public void handler() {
|
||||||
|
|
@ -55,7 +55,7 @@ public class OracleExtractTask extends AbstractOracleExtractTask {
|
||||||
String cmd = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS + " label --overwrite rc " + oc.getName()
|
String cmd = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS + " label --overwrite rc " + oc.getName()
|
||||||
+ " isExtract=1";
|
+ " isExtract=1";
|
||||||
OracleExtract.updateDataExtractStatus(oc, 1); // 更新数据库的状态
|
OracleExtract.updateDataExtractStatus(oc, 1); // 更新数据库的状态
|
||||||
FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION + oc.getName() + ".log", "["
|
FileOperateHelper.fileReWrite(Configs.EXTRACT_LOG_LOCALTION + oc.getName() + ".log", "["
|
||||||
+ DateForm.date2StringBysecond(new Date()) + "]>>>>>>>>>>>>>>>>开始汇总 >>>>>>>>>>>>>>>>>>\r\n");
|
+ DateForm.date2StringBysecond(new Date()) + "]>>>>>>>>>>>>>>>>开始汇总 >>>>>>>>>>>>>>>>>>\r\n");
|
||||||
List<String> rList = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
|
List<String> rList = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,629 @@
|
||||||
|
package com.platform.service;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import com.base.Custom4exception;
|
||||||
|
import com.platform.entities.DataInfoEntity;
|
||||||
|
import com.platform.entities.GatherOracleInfo;
|
||||||
|
import com.platform.entities.OracleConnectorParams;
|
||||||
|
import com.platform.enums.ExportDataTypeEnum;
|
||||||
|
import com.platform.oracle.OracleConnector;
|
||||||
|
import com.platform.utils.Configs;
|
||||||
|
import com.platform.utils.Constant;
|
||||||
|
import com.platform.utils.DateHandle;
|
||||||
|
import com.platform.utils.ExceptionMsg;
|
||||||
|
import com.platform.utils.FileOperateHelper;
|
||||||
|
import com.platform.utils.Result;
|
||||||
|
import com.platform.utils.RunCommand;
|
||||||
|
import com.platform.utils.StringHandle;
|
||||||
|
|
||||||
|
public class OracleHelper {
|
||||||
|
|
||||||
|
public static Logger log = Logger.getLogger(OracleHelper.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断dblink是否已经存在
|
||||||
|
*
|
||||||
|
* @param conn
|
||||||
|
* @param linkName
|
||||||
|
* dblink的名称
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean hasSameNameDBLink(Connection conn, String linkName, String filePath) {
|
||||||
|
|
||||||
|
boolean flag = false;
|
||||||
|
String sql = "SELECT COUNT(*) c FROM ALL_DB_LINKS WHERE DB_LINK='" + linkName + "'";
|
||||||
|
ResultSet rSet = null;
|
||||||
|
Statement statement = null;
|
||||||
|
try {
|
||||||
|
statement = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
|
||||||
|
rSet = statement.executeQuery(sql);
|
||||||
|
if (rSet.next()) {
|
||||||
|
if (rSet.getInt("c") > 0)
|
||||||
|
flag = true;
|
||||||
|
else
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
FileOperateHelper.fileWrite(filePath, sql + "\r\n" + "OK \r\n");
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileOperateHelper.fileWrite(filePath, sql + "\r\n" + e.getMessage() + "\r\n,连接异常! \r\n");
|
||||||
|
log.error(Custom4exception.threadVolume_Oracle_Except, e);
|
||||||
|
} finally {
|
||||||
|
if (null != statement) {
|
||||||
|
try {
|
||||||
|
statement.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error(Custom4exception.OracleSQL_Except, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建dblink
|
||||||
|
*
|
||||||
|
* @param conn
|
||||||
|
* 汇总库的连接
|
||||||
|
* @param oc
|
||||||
|
* 采集库 dblink连接参数实体
|
||||||
|
*/
|
||||||
|
public void createDBLink(Connection conn, OracleConnectorParams oc) {
|
||||||
|
String linkName = "LINKTO_J" + oc.getName().replaceAll("-", "_");
|
||||||
|
String sql = "CREATE PUBLIC DATABASE LINK " + linkName + " CONNECT TO " + oc.getUser() + " IDENTIFIED BY "
|
||||||
|
+ oc.getPassword() + " USING \'(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = "
|
||||||
|
+ oc.getIp() + ")(PORT = " + oc.getPort() + ")))(CONNECT_DATA =(SERVICE_NAME =" + oc.getDatabaseName()
|
||||||
|
+ ")))\'";
|
||||||
|
if (null != oc) {
|
||||||
|
if (hasSameNameDBLink(conn, linkName, Configs.EXTRACT_LOG_LOCALTION + oc.getName())) { // 如果dblink已经存在,先删除dblink,在创建dblink
|
||||||
|
String deleteSql = "DROP PUBLIC DATABASE LINK " + linkName;
|
||||||
|
// 删除 dblink
|
||||||
|
if (OracleConnector.execOracleSQL(conn, deleteSql, Configs.EXTRACT_LOG_LOCALTION + oc.getName())) {
|
||||||
|
if (!OracleConnector.execOracleSQL(conn, sql, Configs.EXTRACT_LOG_LOCALTION + oc.getName())) {
|
||||||
|
OracleConnector.execUpdateOracleSQL(conn, sql, Configs.EXTRACT_LOG_LOCALTION + oc.getName());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Configs.CONSOLE_LOGGER.error("删除已有的DBLink失败,无法创建新的DBLink!");
|
||||||
|
FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION + oc.getName() + ".log",
|
||||||
|
"删除已有的DBLink失败,无法创建新的DBLink!" + "\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// 否则,创建dblink
|
||||||
|
if (!OracleConnector.execOracleSQL(conn, sql, Configs.EXTRACT_LOG_LOCALTION + oc.getName())) {
|
||||||
|
OracleConnector.execUpdateOracleSQL(conn, sql, Configs.EXTRACT_LOG_LOCALTION + oc.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建表空间
|
||||||
|
*
|
||||||
|
* @param conn
|
||||||
|
* 汇总库连接
|
||||||
|
* @param collectOracle
|
||||||
|
* @param oc
|
||||||
|
* 汇总库信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean createTableSpace(Connection conn, OracleConnectorParams collectOracle, GatherOracleInfo oc,
|
||||||
|
Boolean... isCovers) {
|
||||||
|
|
||||||
|
// 获取可变参数
|
||||||
|
Boolean isCover = true;
|
||||||
|
for (Boolean one : isCovers) {
|
||||||
|
isCover = one;
|
||||||
|
}
|
||||||
|
|
||||||
|
String tmpSql = "select TABLESPACE_NAME from dba_tablespaces where TABLESPACE_NAME = '"
|
||||||
|
+ oc.getTableName().toUpperCase() + "'";
|
||||||
|
|
||||||
|
String tableSpaceName = oc.getTableName().toUpperCase();
|
||||||
|
|
||||||
|
// 存在 表空间
|
||||||
|
if (OracleConnector.execUpdateOracleSQL(conn, tmpSql,
|
||||||
|
Configs.EXTRACT_LOG_LOCALTION + collectOracle.getName())) {
|
||||||
|
// 不需要删除表空间,防止其他用户使用过
|
||||||
|
/*if (isCover.equals(true)) {
|
||||||
|
String dropTableSpace = "drop tablespace " + tableSpaceName
|
||||||
|
+ " including contents and datafiles cascade constraint";
|
||||||
|
OracleConnector.execOracleSQL(conn, dropTableSpace,
|
||||||
|
Configs.EXTRACT_LOG_LOCALTION + collectOracle.getName());
|
||||||
|
}*/
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
String sql = "create tablespace " + tableSpaceName + " datafile '" + Configs.GATHER_TABLESPACE_PATH
|
||||||
|
+ tableSpaceName + ".dbf" + "' size 512M autoextend on next 512M maxsize unlimited";
|
||||||
|
return OracleConnector.execOracleSQL(conn, sql, Configs.EXTRACT_LOG_LOCALTION + collectOracle.getName());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建表空间
|
||||||
|
*
|
||||||
|
* @param conn
|
||||||
|
* 汇总库连接
|
||||||
|
* @param collectOracle
|
||||||
|
* @param oc
|
||||||
|
* 汇总库信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean createStardardTableSpace(Connection conn, OracleConnectorParams collectOracle, GatherOracleInfo oc,
|
||||||
|
Boolean... isCovers) {
|
||||||
|
String tablespaceName = oc.getTableName().toUpperCase();
|
||||||
|
String tmpSql = "select TABLESPACE_NAME from dba_tablespaces where TABLESPACE_NAME = '" + tablespaceName + "'";
|
||||||
|
// 存在 表空间
|
||||||
|
if (OracleConnector.execUpdateOracleSQL(conn, tmpSql,
|
||||||
|
Configs.EXTRACT_STANDARD_LOG_LOCALTION + collectOracle.getName())) {
|
||||||
|
return true;
|
||||||
|
//TODO 不能删除表空间,影响其他用户
|
||||||
|
// String deleteTableSpace = "drop tablespace " + tablespaceName
|
||||||
|
// + " including contents and datafiles CASCADE CONSTRAINTS";
|
||||||
|
//
|
||||||
|
// OracleConnector.execOracleSQL(conn, deleteTableSpace,
|
||||||
|
// Configs.EXTRACT_STANDARD_LOG_LOCALTION + collectOracle.getName());
|
||||||
|
}
|
||||||
|
String sql = "create tablespace " + tablespaceName + " datafile '" + Configs.GATHER_TABLESPACE_PATH
|
||||||
|
+ tablespaceName + ".dbf" + "' size " + Configs.TABLES_SPACE_SIZE + " autoextend on next "
|
||||||
|
+ Configs.TABLES_SPACE_SIZE + " maxsize unlimited";
|
||||||
|
return OracleConnector.execOracleSQL(conn, sql,
|
||||||
|
Configs.EXTRACT_STANDARD_LOG_LOCALTION + collectOracle.getName());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建用户并授权
|
||||||
|
*
|
||||||
|
* @param conn
|
||||||
|
* 汇总库连接
|
||||||
|
* @param oc
|
||||||
|
* 汇总库信息
|
||||||
|
*/
|
||||||
|
public void createUser(Connection conn, OracleConnectorParams oc, GatherOracleInfo totalOracle,
|
||||||
|
Boolean... isCovers) {
|
||||||
|
|
||||||
|
// 获取可变参数
|
||||||
|
Boolean isCover = true;
|
||||||
|
for (Boolean one : isCovers) {
|
||||||
|
isCover = one;
|
||||||
|
}
|
||||||
|
|
||||||
|
String logFileName = Configs.EXTRACT_LOG_LOCALTION + oc.getName();
|
||||||
|
String strTUser = generateExreactStandardTablesUser(oc, totalOracle);
|
||||||
|
|
||||||
|
String selectUserSql = "select username from dba_users where username='" + strTUser + "'";
|
||||||
|
boolean userIsExist = OracleConnector.execUpdateOracleSQL(conn, selectUserSql, logFileName);
|
||||||
|
|
||||||
|
// 用户已经存在
|
||||||
|
if (userIsExist) {
|
||||||
|
// 如果非覆盖汇总,则不创建用户返回
|
||||||
|
if (!isCover) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String deleteUserAndDataSql = "drop user " + strTUser + " cascade";
|
||||||
|
OracleConnector.execOracleSQL(conn, deleteUserAndDataSql, logFileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
String sql = "Create user " + strTUser + " default tablespace " + totalOracle.getTableName() + " identified by "
|
||||||
|
+ Configs.GATHER_TABLE_PASSWORD;
|
||||||
|
String grantSql = "grant connect, resource, dba to " + strTUser;
|
||||||
|
OracleConnector.execOracleSQL(conn, sql, logFileName);
|
||||||
|
OracleConnector.execOracleSQL(conn, grantSql, logFileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建用户并授权
|
||||||
|
*
|
||||||
|
* @param conn
|
||||||
|
* 汇总库连接
|
||||||
|
* @param oc
|
||||||
|
* 汇总库信息
|
||||||
|
*/
|
||||||
|
public void createOnlyUser(Connection conn, OracleConnectorParams oc, GatherOracleInfo totalOracle,
|
||||||
|
Boolean... isCovers) {
|
||||||
|
String strTUser = Configs.GATHER_STANDARD_USER_NAME;
|
||||||
|
|
||||||
|
String sql = "Create user " + strTUser.toUpperCase() + " default tablespace " + totalOracle.getTableName()
|
||||||
|
+ " identified by " + Configs.GATHER_TABLE_PASSWORD;
|
||||||
|
String grantSql = "grant connect, resource, dba to " + strTUser.toUpperCase();
|
||||||
|
|
||||||
|
OracleConnector.execOracleSQL(conn, sql, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
|
||||||
|
|
||||||
|
OracleConnector.execOracleSQL(conn, grantSql, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建用户并授权
|
||||||
|
*
|
||||||
|
* @param conn
|
||||||
|
* 汇总库连接
|
||||||
|
* @param oc
|
||||||
|
* 汇总库信息
|
||||||
|
*/
|
||||||
|
public void createTable(Connection conn, OracleConnectorParams oc, GatherOracleInfo totalOracle,
|
||||||
|
Boolean... isCovers) {
|
||||||
|
String strTUser = oc.getName() + totalOracle.getSuffix();
|
||||||
|
|
||||||
|
String sql = "Create table " + strTUser + " default tablespace " + totalOracle.getTableName()
|
||||||
|
+ " identified by " + Configs.GATHER_TABLE_PASSWORD;
|
||||||
|
String grantSql = "grant connect, resource, dba to " + strTUser;
|
||||||
|
|
||||||
|
OracleConnector.execOracleSQL(conn, sql, Configs.EXTRACT_LOG_LOCALTION + oc.getName());
|
||||||
|
|
||||||
|
OracleConnector.execOracleSQL(conn, grantSql, Configs.EXTRACT_LOG_LOCALTION + oc.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行汇总操作
|
||||||
|
*
|
||||||
|
* @param conn
|
||||||
|
* 汇总库连接
|
||||||
|
* @param oc
|
||||||
|
* 采集库
|
||||||
|
*/
|
||||||
|
public void extractColleDB(Connection conn, OracleConnectorParams oc, GatherOracleInfo totalOracle) {
|
||||||
|
// oc.getName()获取的name是:行政区划代码-系统代码-版本
|
||||||
|
String ocNameReplace = oc.getName().replaceAll(Constant.SHORT_LINE, Constant.ONLINE_SEPERATOR);
|
||||||
|
String strTUser = generateExreactStandardTablesUser(oc, totalOracle);
|
||||||
|
String sql = "SELECT 'create table " + strTUser + "."
|
||||||
|
+ "'|| substr(t.OWNER||'_'||t.TABLE_NAME,0,29)||' as select * from '||t.OWNER||'.'||t.TABLE_NAME||"
|
||||||
|
+ "'@LINKTO_J" + ocNameReplace + ";' FROM dba_tables@LINKTO_J" + ocNameReplace
|
||||||
|
+ " t WHERE t.TABLESPACE_NAME NOT IN ('SYSTEM','SYSAUX')";
|
||||||
|
if (Configs.SYSTEM_USERS != null && !Configs.SYSTEM_USERS.equals("")) {
|
||||||
|
sql += " and t.owner not in (" + Configs.SYSTEM_USERS + ")";
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* ResultSet rsSet = OracleConnector.getSQLExecResultSet(conn, sql,
|
||||||
|
* Configs.EXTRACT_LOG_LOCALTION + oc.getName());
|
||||||
|
*/
|
||||||
|
Statement statement = null;
|
||||||
|
try {
|
||||||
|
statement = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
|
||||||
|
ResultSet resultSet = statement.executeQuery(sql);
|
||||||
|
|
||||||
|
String logFilePath = Configs.EXTRACT_LOG_LOCALTION + oc.getName();
|
||||||
|
FileOperateHelper.fileWrite(logFilePath + ".log", sql + "\r\n" + "OK \r\n");
|
||||||
|
|
||||||
|
while (resultSet.next()) {
|
||||||
|
try {
|
||||||
|
String resultSql = addQuotationMarkToTableName(resultSet.getString(1).replace(";", ""));
|
||||||
|
OracleConnector.execUpdateOracleSQL(conn, resultSql, logFilePath);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error(Custom4exception.threadVolume_Oracle_Except, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
|
||||||
|
log.error(Custom4exception.threadVolume_Oracle_Except, e);
|
||||||
|
} finally {
|
||||||
|
if (null != statement) {
|
||||||
|
try {
|
||||||
|
statement.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error(Custom4exception.OracleSQL_Except, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试是否能否连接上?
|
||||||
|
*
|
||||||
|
* @return true:能连接上
|
||||||
|
*/
|
||||||
|
public boolean testConnect(Connection conn) {
|
||||||
|
String testSql = "select count(*) from user_tables";
|
||||||
|
boolean flag = false;
|
||||||
|
Statement statement = null;
|
||||||
|
try {
|
||||||
|
statement = conn.createStatement();
|
||||||
|
if (statement.executeUpdate(testSql) > 0)
|
||||||
|
flag = true;
|
||||||
|
} catch (SQLException e) {
|
||||||
|
flag = false;
|
||||||
|
log.error(Custom4exception.threadVolume_Oracle_Except, e);
|
||||||
|
} finally {
|
||||||
|
if (null != statement) {
|
||||||
|
try {
|
||||||
|
statement.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error(Custom4exception.OracleSQL_Except, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行抽取操作--支付表
|
||||||
|
*
|
||||||
|
* @param conn
|
||||||
|
* 汇总库连接
|
||||||
|
* @param oc
|
||||||
|
* 采集库
|
||||||
|
*/
|
||||||
|
public void extractStandardPayTable(Connection conn, OracleConnectorParams oc, GatherOracleInfo totalOracle) {
|
||||||
|
|
||||||
|
String strTUser = generateExreactStandardTablesUser(oc, totalOracle);
|
||||||
|
|
||||||
|
String tableName = strTUser + "." + Configs.GATHER_STANDARD_PAY_TABLE_NAME;
|
||||||
|
/*try {
|
||||||
|
String drop_table = "drop table " + tableName;
|
||||||
|
OracleConnector.execOracleSQL(conn, drop_table, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info(tableName + " 不存在!");
|
||||||
|
}*/
|
||||||
|
|
||||||
|
String sql = "create table " + tableName + " as select * from " + Configs.GATHER_STANDARD_USER_NAME + "."
|
||||||
|
+ Configs.GATHER_STANDARD_PAY_TABLE_NAME + "@LINKTOST" + oc.getName();
|
||||||
|
String resultSql = sql.replace(";", "");
|
||||||
|
OracleConnector.execOracleSQL(conn, resultSql, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行抽取操作--执行表
|
||||||
|
*
|
||||||
|
* @param conn
|
||||||
|
* @param oc
|
||||||
|
* @param totalOracle
|
||||||
|
*/
|
||||||
|
public void extractStandardExecTable(Connection conn, OracleConnectorParams oc, GatherOracleInfo totalOracle) {
|
||||||
|
|
||||||
|
String strTUser = generateExreactStandardTablesUser(oc, totalOracle);
|
||||||
|
String tableName = strTUser + "." + Configs.GATHER_STANDARD_PAY_TABLE_NAME;
|
||||||
|
/*try {
|
||||||
|
String drop_table = "drop table " + tableName;
|
||||||
|
OracleConnector.execOracleSQL(conn, drop_table, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info(tableName + " 不存在!");
|
||||||
|
}*/
|
||||||
|
|
||||||
|
String sql = "create table " + strTUser + "." + Configs.GATHER_STANDARD_EXEC_TABLE_NAME + " as select * from "
|
||||||
|
+ Configs.GATHER_STANDARD_USER_NAME + "." + Configs.GATHER_STANDARD_EXEC_TABLE_NAME + "@LINKTOST"
|
||||||
|
+ oc.getName();
|
||||||
|
String resultSql = sql.replace(";", "");
|
||||||
|
OracleConnector.execOracleSQL(conn, resultSql, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行抽取操作--其他标准表
|
||||||
|
*
|
||||||
|
* @param conn
|
||||||
|
* @param oc
|
||||||
|
* @param totalOracle
|
||||||
|
*/
|
||||||
|
public void extractOtherStandardTable(Connection conn, OracleConnectorParams oc, GatherOracleInfo totalOracle) {
|
||||||
|
String strTUser = generateExreactStandardTablesUser(oc, totalOracle);
|
||||||
|
String[] tableNames = Configs.OTHER_STANDARD_TABLES.split(Constant.COMMA);
|
||||||
|
if (tableNames.length == 0 || tableNames[0].equals("")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < tableNames.length; i++) {
|
||||||
|
String sql = "create table " + strTUser + "." + tableNames[i] + " as select * from "
|
||||||
|
+ Configs.GATHER_STANDARD_USER_NAME + "." + tableNames[i] + "@LINKTOST" + oc.getName();
|
||||||
|
String resultSql = sql.replace(";", "");
|
||||||
|
OracleConnector.execOracleSQL(conn, resultSql, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createPay(Connection conn, OracleConnectorParams oc, GatherOracleInfo totalOracle) {
|
||||||
|
String user = generateExreactStandardTablesUser(oc, totalOracle);
|
||||||
|
String payCmd = "CREATE TABLE " + user
|
||||||
|
+ ".ZFXXB(XZQHDM Varchar(255),XZQHMC Varchar(255),PZBH Varchar(255),LYZBKZH Varchar(255),"
|
||||||
|
+ "ZFDATE Varchar(255),YSDWCODE Varchar(255),YSDWNAME Varchar(255),YWGKCS Varchar(255),XMCODE Varchar(255),XMNAME Varchar(255),"
|
||||||
|
+ "XMLBCODE Varchar(255),XMLBNAME Varchar(255),ZB_NO Varchar(255),GNFLCODE Varchar(255),GNFLNAME Varchar(255),JJFLCODE Varchar(255),"
|
||||||
|
+ "JJFLNAME Varchar(255),ZJXZCODE Varchar(255),ZJXZNAME Varchar(255),JSBFFSNAME Varchar(255),SKR Varchar(255),SKRYH Varchar(255),"
|
||||||
|
+ "SKRZHZH Varchar(255),FKZHCODE Varchar(255),FKZHNAME Varchar(255),FKYHCODE Varchar(255),FKYHNAME Varchar(255),QSZHCODE Varchar(255),"
|
||||||
|
+ "QSZHNAME Varchar(255),QSYHCODE Varchar(255),QSYHNAME Varchar(255),JE Numeric(18,2), SFTK Varchar(255),NIAN Varchar(255),ZY Varchar(255))";
|
||||||
|
|
||||||
|
try {
|
||||||
|
OracleConnector.execOracleSQL(conn, payCmd, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(Custom4exception.threadVolume_Oracle_Except, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建dblink
|
||||||
|
*
|
||||||
|
* @param conn
|
||||||
|
* 汇总库的连接
|
||||||
|
* @param oc
|
||||||
|
* 采集库 dblink连接参数实体
|
||||||
|
*/
|
||||||
|
public void createStandardDBLink(Connection conn, OracleConnectorParams oc) {
|
||||||
|
String linkName = "LINKTOST" + oc.getName();
|
||||||
|
String sql = "CREATE PUBLIC DATABASE LINK " + linkName + " CONNECT TO " + oc.getUser() + " IDENTIFIED BY "
|
||||||
|
+ oc.getPassword() + " USING \'(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = "
|
||||||
|
+ oc.getIp() + ")(PORT = " + oc.getPort() + ")))(CONNECT_DATA =(SERVICE_NAME =" + oc.getDatabaseName()
|
||||||
|
+ ")))\'";
|
||||||
|
if (null != oc) {
|
||||||
|
if (hasSameNameDBLink(conn, linkName, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName() + ".log")) { // 如果dblink已经存在,先删除dblink,在创建dblink
|
||||||
|
String deleteSql = "DROP PUBLIC DATABASE LINK " + linkName;
|
||||||
|
// 删除 dblink
|
||||||
|
if (OracleConnector.execOracleSQL(conn, deleteSql,
|
||||||
|
Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName())) {
|
||||||
|
// OracleConnector.execOracleSQL(conn, sql,
|
||||||
|
// Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
|
||||||
|
if (!OracleConnector.execOracleSQL(conn, sql,
|
||||||
|
Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName())) {
|
||||||
|
OracleConnector.execUpdateOracleSQL(conn, sql,
|
||||||
|
Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Configs.CONSOLE_LOGGER.error("删除已有的DBLink失败,无法创建新的DBLink!");
|
||||||
|
FileOperateHelper.fileWrite(Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName() + ".log",
|
||||||
|
"删除已有的DBLink失败,无法创建新的DBLink!" + "\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// 否则,创建dblink
|
||||||
|
// OracleConnector.execOracleSQL(conn, sql,
|
||||||
|
// Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
|
||||||
|
if (!OracleConnector.execOracleSQL(conn, sql, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName())) {
|
||||||
|
OracleConnector.execUpdateOracleSQL(conn, sql,
|
||||||
|
Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @Title: exportData @Description:数据导出 @param @param conn
|
||||||
|
* 需要导出的数据汇总库连接 @param @param dataInfoEntities 需要导出的数据列表 @return
|
||||||
|
* Result<String> 返回类型 @throws
|
||||||
|
*/
|
||||||
|
public String exportData(GatherOracleInfo gatherOracleInfo, List<DataInfoEntity> dataInfoEntities,
|
||||||
|
List<ExportDataTypeEnum> typeListEnum) {
|
||||||
|
|
||||||
|
// 文件名称组合
|
||||||
|
String exportFileName = Constant.EXPORT_DATA + Constant.LOG_FILE_NAME_SEPERATOR + DateHandle.getNowSecond();
|
||||||
|
String logFileName = Configs.EXPORT_DATA_LOG_LOCALTION + exportFileName + ".log";
|
||||||
|
FileOperateHelper.fileReWrite(logFileName, "准备开始数据导出\r\n");
|
||||||
|
|
||||||
|
// 目前暂时不提供此功能
|
||||||
|
if (typeListEnum.contains(ExportDataTypeEnum.ORIGIN_DATA)) {
|
||||||
|
FileOperateHelper.fileWrite(logFileName, "参数错误,暂不支持原始数据导出!\r\n");
|
||||||
|
return ExceptionMsg.PARAMATER_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出数据到dmp文件
|
||||||
|
if (typeListEnum.contains(ExportDataTypeEnum.GATHER_DATA)) {
|
||||||
|
|
||||||
|
String loginUserName = gatherOracleInfo.getUser();
|
||||||
|
String loginPassword = gatherOracleInfo.getPassword();
|
||||||
|
String connParam = gatherOracleInfo.getIp() + ":" + gatherOracleInfo.getPort() + "/"
|
||||||
|
+ gatherOracleInfo.getDatabaseName();
|
||||||
|
|
||||||
|
// 查询所有用户名
|
||||||
|
// String queryAllUsersCmd="select username from dba_users;";
|
||||||
|
// ResultSet resultSet= OracleConnector.execSqlGetResult(connParam,
|
||||||
|
// loginUserName, loginPassword, queryAllUsersCmd);
|
||||||
|
|
||||||
|
// 组合导出语句中的用户名列表
|
||||||
|
String exportGatherUserNamesForm = "";
|
||||||
|
for (DataInfoEntity dataInfoEntity : dataInfoEntities) {
|
||||||
|
|
||||||
|
String gatherUserName = Constant.GATHER_ORACLE_USERNAME_PREFIX + dataInfoEntity.getRegionalismCode()
|
||||||
|
+ Constant.ONLINE_SEPERATOR + dataInfoEntity.getSystemCode() + Constant.ONLINE_SEPERATOR
|
||||||
|
+ dataInfoEntity.getDataVersion() + gatherOracleInfo.getSuffix();
|
||||||
|
exportGatherUserNamesForm += gatherUserName + ",";
|
||||||
|
}
|
||||||
|
// 去掉最后一个多余的逗号
|
||||||
|
exportGatherUserNamesForm = exportGatherUserNamesForm.substring(0, exportGatherUserNamesForm.length() - 1);
|
||||||
|
|
||||||
|
// 组合导出命令
|
||||||
|
String exportDataCmd = "exp " + loginUserName + "/" + loginPassword + "@" + connParam + " file="
|
||||||
|
+ Configs.EXPORT_DATA_LOCALTION + exportFileName + ".dmp owner=" + exportGatherUserNamesForm;
|
||||||
|
|
||||||
|
FileOperateHelper.fileWrite(logFileName, "准备dmp文件导出!\r\n执行导出命令:" + exportDataCmd + "\r\n");
|
||||||
|
int executeCmdResult = RunCommand.runCommandWaitNoOverflow(exportDataCmd, logFileName);
|
||||||
|
if (executeCmdResult == 1) {
|
||||||
|
FileOperateHelper.fileWrite(logFileName, "dmp文件导出正常结束!\r\n");
|
||||||
|
} else {
|
||||||
|
FileOperateHelper.fileWrite(logFileName, "dmp文件导出异常结束!\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 标准表抽取脚本导出
|
||||||
|
if (typeListEnum.contains(ExportDataTypeEnum.EXTRACT_STANDARD_TABLE_SCRIPT)) {
|
||||||
|
String originSqlPath = Configs.EXPORT_DATA_ORIGIN_SQL_SCRIPT;
|
||||||
|
|
||||||
|
// 拷贝所有的原始数据脚本到导出位置
|
||||||
|
for (DataInfoEntity dataInfoEntity : dataInfoEntities) {
|
||||||
|
String folderName = dataInfoEntity.getRegionalismCode() + Constant.FILE_NAME_SEPARATOR
|
||||||
|
+ dataInfoEntity.getSystemCode() + Constant.FILE_NAME_SEPARATOR
|
||||||
|
+ dataInfoEntity.getDataVersion();
|
||||||
|
String destPath = StringHandle.joinPath(originSqlPath, folderName);
|
||||||
|
String sourcePath = StringHandle.joinPath(dataInfoEntity.getDataPath(), "*.sql");
|
||||||
|
|
||||||
|
FileOperateHelper.fileWrite(logFileName, "准备拷贝原始数据中的脚本文件!\r\n");
|
||||||
|
FileOperateHelper.fileWrite(logFileName, "执行文件复制命令cp -rp " + sourcePath + " " + destPath);
|
||||||
|
Result<Boolean> copySqlScriptRes = FileOperateHelper.folderCopy(sourcePath, destPath);
|
||||||
|
if (copySqlScriptRes.getData().equals(false)) {
|
||||||
|
FileOperateHelper.fileWrite(logFileName,
|
||||||
|
"原始脚本数据拷贝出错!\r\n" + copySqlScriptRes.getCode() + ":" + copySqlScriptRes.getMsg() + "\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
originSqlPath = Configs.EXPORT_DATA_PLATFORM_SQL_SCRIPT;
|
||||||
|
|
||||||
|
// 拷贝汇总平台保存的脚本到导出位置
|
||||||
|
for (DataInfoEntity dataInfoEntity : dataInfoEntities) {
|
||||||
|
String folderName = dataInfoEntity.getRegionalismCode() + Constant.FILE_NAME_SEPARATOR
|
||||||
|
+ dataInfoEntity.getSystemCode() + Constant.FILE_NAME_SEPARATOR
|
||||||
|
+ dataInfoEntity.getDataVersion();
|
||||||
|
String destPath = StringHandle.joinPath(originSqlPath, folderName);
|
||||||
|
String sourcePath = StringHandle.joinPathFromList(
|
||||||
|
Arrays.asList(Configs.SQL_SCRIPT_PATH_STANDARD, dataInfoEntity.getRegionalismCode(),
|
||||||
|
"*" + Constant.FILE_NAME_SEPARATOR + dataInfoEntity.getSystemCode() + ".sql"));
|
||||||
|
FileOperateHelper.fileWrite(logFileName, "准备拷贝汇总平台中数据的脚本文件!\r\n");
|
||||||
|
FileOperateHelper.fileWrite(logFileName, "执行文件复制命令cp -rp " + sourcePath + " " + destPath + "\r\n");
|
||||||
|
Result<Boolean> copySqlScriptRes = FileOperateHelper.folderCopy(sourcePath, destPath);
|
||||||
|
if (copySqlScriptRes.getData().equals(false)) {
|
||||||
|
FileOperateHelper.fileWrite(logFileName, "汇总平台脚本数据拷贝出错!\r\n" + copySqlScriptRes.getCode() + ":"
|
||||||
|
+ copySqlScriptRes.getMsg() + "\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FileOperateHelper.fileWrite(logFileName, "数据导出结束!\r\n");
|
||||||
|
return ExceptionMsg.SUCCESS;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createExec(Connection conn, OracleConnectorParams oc, GatherOracleInfo totalOracle) {
|
||||||
|
String execCmd = "CREATE TABLE U_BZBJY.KZXZB(XZQHDM Varchar(255),XZQHMC Varchar(255),YSND Varchar(255),ZBCODE Varchar(255),ZB_ID Varchar(255),ZB_NO Varchar(255),"
|
||||||
|
+ "ZBDJLXCODE Varchar(255),ZBDJLXNAME Varchar(255),ZBLXNAME Varchar(255),DOCNO Varchar(255),ZBSM Varchar(255),ZBFWDATE Varchar(255),ZBYSLXCODE Varchar(255),"
|
||||||
|
+ "ZBYSLXNAME Varchar(255),ZBYSLYNAME Varchar(255),YSDWCODE Varchar(255),YSDWNAME Varchar(255),GNFLCODE Varchar(255),GNFLNAME Varchar(255),JJFLCODE Varchar(255),"
|
||||||
|
+ "JJFLNAME Varchar(255),ZBGLCSNAME Varchar(255),SZGLCODE Varchar(255),SZGLNAME Varchar(255),XMCODE Varchar(255),XMNAME Varchar(255),GZBZ Varchar(255),"
|
||||||
|
+ "JJBZ Varchar(255),CGBZ Varchar(255),ZFFSCODE Varchar(255),ZFFSNAME Varchar(255),JZZFBZ Varchar(255),ZBJE Numeric(18,2),ZBTJJE Numeric(18,2),ZBDJJE Numeric(18,2),"
|
||||||
|
+ "ZBKYJE Numeric(18,2),ZYZFBZ Varchar(255),BZ Varchar(255))";
|
||||||
|
|
||||||
|
try {
|
||||||
|
OracleConnector.execOracleSQL(conn, execCmd, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(Custom4exception.threadVolume_Oracle_Except, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String generateExreactStandardTablesUser(OracleConnectorParams oc, GatherOracleInfo totalOracle) {
|
||||||
|
String exreactStandardTablesUser = Constant.GATHER_ORACLE_USERNAME_PREFIX + oc.getName().replaceAll("-", "_")
|
||||||
|
+ totalOracle.getSuffix();
|
||||||
|
return exreactStandardTablesUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String addQuotationMarkToTableName(String sql) {
|
||||||
|
if (!sql.contains("@")) {
|
||||||
|
return sql;
|
||||||
|
}
|
||||||
|
int endPosition = sql.indexOf("@");
|
||||||
|
int startposition = endPosition;
|
||||||
|
for (int i = endPosition - 1; i >= 0; i--) {
|
||||||
|
char tmp = sql.charAt(i);
|
||||||
|
// 是点或者空格,则表名称结束
|
||||||
|
if (tmp == '.' || tmp == ' ') {
|
||||||
|
startposition = i + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (startposition == endPosition) {
|
||||||
|
return sql;
|
||||||
|
}
|
||||||
|
String addSql = sql.substring(0, startposition) + "\"" + sql.substring(startposition, endPosition) + "\""
|
||||||
|
+ sql.substring(endPosition);
|
||||||
|
return addSql;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -10,8 +10,8 @@ import javax.annotation.Resource;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.platform.dao.IRegionalismCodeDao;
|
import com.platform.dao.RegionalismCodeDao;
|
||||||
import com.platform.dao.ISystemCodeDao;
|
import com.platform.dao.SystemCodeDao;
|
||||||
import com.platform.entities.RegionalismEntity;
|
import com.platform.entities.RegionalismEntity;
|
||||||
import com.platform.entities.SystemEntity;
|
import com.platform.entities.SystemEntity;
|
||||||
import com.platform.service.ICodeService;
|
import com.platform.service.ICodeService;
|
||||||
|
|
@ -29,10 +29,10 @@ public class CodeServiceImpl implements ICodeService {
|
||||||
public final static Logger log = Logger.getLogger(CodeServiceImpl.class);
|
public final static Logger log = Logger.getLogger(CodeServiceImpl.class);
|
||||||
|
|
||||||
@Resource(name = "systemCodeDao")
|
@Resource(name = "systemCodeDao")
|
||||||
private ISystemCodeDao systemCodeDao;
|
private SystemCodeDao systemCodeDao;
|
||||||
|
|
||||||
@Resource(name = "regionalismCodeDao")
|
@Resource(name = "regionalismCodeDao")
|
||||||
private IRegionalismCodeDao regionalismCodeDao;
|
private RegionalismCodeDao regionalismCodeDao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SystemEntity> findSystem(SystemEntity sys) throws Exception {
|
public List<SystemEntity> findSystem(SystemEntity sys) throws Exception {
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,10 @@ package com.platform.service.impl;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
|
@ -22,16 +24,18 @@ import com.platform.form.PagerOptions;
|
||||||
import com.platform.http.gfs.RemoveData;
|
import com.platform.http.gfs.RemoveData;
|
||||||
import com.platform.service.DataInfoService;
|
import com.platform.service.DataInfoService;
|
||||||
import com.platform.utils.Configs;
|
import com.platform.utils.Configs;
|
||||||
|
import com.platform.utils.ExceptionMsg;
|
||||||
|
import com.platform.utils.Result;
|
||||||
|
|
||||||
@Service(value = "dataInfoService")
|
@Service(value = "dataInfoService")
|
||||||
public class DataInfoServiceImp implements DataInfoService {
|
public class DataInfoServiceImp implements DataInfoService {
|
||||||
|
|
||||||
/** log4j */
|
/** log4j */
|
||||||
public static Logger log = Configs.DAILY_ROLLING_LOGGER;
|
public static Logger log = Configs.DAILY_ROLLING_LOGGER;
|
||||||
|
|
||||||
@Resource(name = "dataInfoDao")
|
@Resource(name = "dataInfoDao")
|
||||||
private DataInfoDao dfdDao;
|
private DataInfoDao dfdDao;
|
||||||
|
|
||||||
private RemoveData removedata = new RemoveData();
|
private RemoveData removedata = new RemoveData();
|
||||||
|
|
||||||
public void setDfdDao(DataInfoDao dfdDao) {
|
public void setDfdDao(DataInfoDao dfdDao) {
|
||||||
|
|
@ -39,28 +43,54 @@ public class DataInfoServiceImp implements DataInfoService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ModelMap getPagerTableData(PagerOptions pagerOptions) throws Exception{
|
public Result<List<DataInfoEntity>> getAllData(Boolean isUnique) throws Exception {
|
||||||
|
Result<List<DataInfoEntity>> result = new Result<>();
|
||||||
|
List<DataInfoEntity> dataList = null;
|
||||||
|
try {
|
||||||
|
dataList = dfdDao.findAll();
|
||||||
|
} catch (Exception e) {
|
||||||
|
result.setCode(ExceptionMsg.EXCEPTION_CODE);
|
||||||
|
result.setMsg(ExceptionMsg.DATABASE_ERROR);
|
||||||
|
result.setStatus(false);
|
||||||
|
}
|
||||||
|
Set<String> dataPathSet = new HashSet<>();
|
||||||
|
List<DataInfoEntity> newDataList = new ArrayList<DataInfoEntity>();
|
||||||
|
for (DataInfoEntity oneData : dataList) {
|
||||||
|
String dataPath = oneData.getDataPath().substring(oneData.getVolumePath().length());
|
||||||
|
if (!dataPathSet.contains(dataPath)) {
|
||||||
|
newDataList.add(oneData);
|
||||||
|
dataPathSet.add(dataPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
result.setMsg(ExceptionMsg.SUCCESS);
|
||||||
|
result.setData(newDataList);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ModelMap getPagerTableData(PagerOptions pagerOptions) throws Exception {
|
||||||
ModelMap modelMap = new ModelMap();
|
ModelMap modelMap = new ModelMap();
|
||||||
String querystr = pagerOptions.getKeyQuery();
|
String querystr = pagerOptions.getKeyQuery();
|
||||||
String[] querys = null;
|
String[] querys = null;
|
||||||
List<String> removelist = new ArrayList<String>();
|
List<String> removelist = new ArrayList<String>();
|
||||||
List<String> alllist = new ArrayList<String>();
|
List<String> alllist = new ArrayList<String>();
|
||||||
List<String> list = new ArrayList<String>();
|
List<String> list = new ArrayList<String>();
|
||||||
//如果有查询数据库类型的
|
// 如果有查询数据库类型的
|
||||||
//去掉版本字段
|
// 去掉版本字段
|
||||||
Pattern pattern = Pattern.compile("^版本\\d+");
|
Pattern pattern = Pattern.compile("^版本\\d+");
|
||||||
if (null != querystr && !"".equals(querystr)) {
|
if (null != querystr && !"".equals(querystr)) {
|
||||||
if (querystr.toLowerCase().contains("oracle")) {
|
if (querystr.toLowerCase().contains("oracle")) {
|
||||||
pagerOptions.setDataBaseType("ORACLE");
|
pagerOptions.setDataBaseType("ORACLE");
|
||||||
querystr = querystr.toUpperCase().replaceAll("ORACLE", "");
|
querystr = querystr.toUpperCase().replaceAll("ORACLE", "");
|
||||||
}else if(querystr.toLowerCase().contains("sql server")){
|
} else if (querystr.toLowerCase().contains("sql server")) {
|
||||||
pagerOptions.setDataBaseType("SQL SERVER");
|
pagerOptions.setDataBaseType("SQL SERVER");
|
||||||
querystr = querystr.toUpperCase().replaceAll("SQL SERVER", "");
|
querystr = querystr.toUpperCase().replaceAll("SQL SERVER", "");
|
||||||
}
|
}
|
||||||
querys = querystr.trim().split(" ");
|
querys = querystr.trim().split(" ");
|
||||||
list = Arrays.asList(querys);
|
list = Arrays.asList(querys);
|
||||||
}
|
}
|
||||||
//遍历 list
|
// 遍历 list
|
||||||
for (String ss : list) {
|
for (String ss : list) {
|
||||||
ss = ss.trim();
|
ss = ss.trim();
|
||||||
if (!"".equals(ss)) {
|
if (!"".equals(ss)) {
|
||||||
|
|
@ -88,11 +118,11 @@ public class DataInfoServiceImp implements DataInfoService {
|
||||||
if (arrays.size() > 0) {
|
if (arrays.size() > 0) {
|
||||||
pagerOptions.setArray(arrays);
|
pagerOptions.setArray(arrays);
|
||||||
}
|
}
|
||||||
if (null !=pagerOptions.getSubmittedBatch() && !"".equals(pagerOptions.getSubmittedBatch()) ) {
|
if (null != pagerOptions.getSubmittedBatch() && !"".equals(pagerOptions.getSubmittedBatch())) {
|
||||||
pagerOptions.setSubmittedBatch("批次"+pagerOptions.getSubmittedBatch());
|
pagerOptions.setSubmittedBatch("批次" + pagerOptions.getSubmittedBatch());
|
||||||
}
|
}
|
||||||
List<DataInfoEntity> result = null;
|
List<DataInfoEntity> result = null;
|
||||||
try{
|
try {
|
||||||
result = dfdDao.getLimitedDataInfoByPage(pagerOptions);
|
result = dfdDao.getLimitedDataInfoByPage(pagerOptions);
|
||||||
if ("1".equals(pagerOptions.getMark())) {
|
if ("1".equals(pagerOptions.getMark())) {
|
||||||
List<Integer> ids = new ArrayList<Integer>();
|
List<Integer> ids = new ArrayList<Integer>();
|
||||||
|
|
@ -106,15 +136,15 @@ public class DataInfoServiceImp implements DataInfoService {
|
||||||
srcIds.put(dataInfoEntity.getSrcId(), null);
|
srcIds.put(dataInfoEntity.getSrcId(), null);
|
||||||
}
|
}
|
||||||
for (DataInfoEntity dataInfoEntity : result) {
|
for (DataInfoEntity dataInfoEntity : result) {
|
||||||
//存在 对应 的热区数据
|
// 存在 对应 的热区数据
|
||||||
if (srcIds.keySet().contains(dataInfoEntity.getId())) {
|
if (srcIds.keySet().contains(dataInfoEntity.getId())) {
|
||||||
dataInfoEntity.setExistHotData(1);
|
dataInfoEntity.setExistHotData(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}catch(Exception e){
|
} catch (Exception e) {
|
||||||
log.error(e);
|
log.error(e);
|
||||||
}
|
}
|
||||||
modelMap.addAttribute("page", pagerOptions);
|
modelMap.addAttribute("page", pagerOptions);
|
||||||
|
|
@ -122,12 +152,12 @@ public class DataInfoServiceImp implements DataInfoService {
|
||||||
modelMap.addAttribute("length", pagerOptions.getTotleSize());
|
modelMap.addAttribute("length", pagerOptions.getTotleSize());
|
||||||
return modelMap;
|
return modelMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteData(String[] id) throws Exception {
|
public void deleteData(String[] id) throws Exception {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
List<Integer> ids = new ArrayList<Integer>();
|
List<Integer> ids = new ArrayList<Integer>();
|
||||||
for(String idx: id){
|
for (String idx : id) {
|
||||||
ids.add(Integer.parseInt(idx));
|
ids.add(Integer.parseInt(idx));
|
||||||
}
|
}
|
||||||
deleteData(ids);
|
deleteData(ids);
|
||||||
|
|
@ -136,12 +166,11 @@ public class DataInfoServiceImp implements DataInfoService {
|
||||||
@Override
|
@Override
|
||||||
public void deleteData(List<Integer> ids) throws Exception {
|
public void deleteData(List<Integer> ids) throws Exception {
|
||||||
if (ids.size() > 0) {
|
if (ids.size() > 0) {
|
||||||
//数据在不在?
|
// 数据在不在?
|
||||||
List<String> paths = dfdDao.getIdIsExist(ids);
|
List<String> paths = dfdDao.getIdIsExist(ids);
|
||||||
if(paths.size()>0){
|
if (paths.size() > 0) {
|
||||||
//TODO 删除文件操作
|
// TODO 删除文件操作
|
||||||
Pattern pattern = Pattern
|
Pattern pattern = Pattern.compile("\\/$");
|
||||||
.compile("\\/$");
|
|
||||||
for (int i = 0; i < paths.size(); i++) {
|
for (int i = 0; i < paths.size(); i++) {
|
||||||
String folderPath = paths.get(i);
|
String folderPath = paths.get(i);
|
||||||
Matcher matcher = pattern.matcher(folderPath);
|
Matcher matcher = pattern.matcher(folderPath);
|
||||||
|
|
@ -149,20 +178,19 @@ public class DataInfoServiceImp implements DataInfoService {
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
tailPath = matcher.group();
|
tailPath = matcher.group();
|
||||||
}
|
}
|
||||||
folderPath = folderPath.substring(0, folderPath.length()-tailPath.length());
|
folderPath = folderPath.substring(0, folderPath.length() - tailPath.length());
|
||||||
int res = removedata.deleteFolder(folderPath);
|
int res = removedata.deleteFolder(folderPath);
|
||||||
if (res != 1) {
|
if (res != 1) {
|
||||||
log.error( folderPath+ " 删除失败!\n");
|
log.error(folderPath + " 删除失败!\n");
|
||||||
}
|
} else {
|
||||||
else {
|
log.info(folderPath + " 删除成功!\n");
|
||||||
log.info( folderPath+ " 删除成功!\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//删除数据库记录
|
// 删除数据库记录
|
||||||
dfdDao.removes(ids);
|
dfdDao.removes(ids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -176,4 +204,5 @@ public class DataInfoServiceImp implements DataInfoService {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,43 @@
|
||||||
package com.platform.service.impl;
|
package com.platform.service.impl;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.base.MyException;
|
||||||
|
import com.platform.dao.DataInfoDao;
|
||||||
import com.platform.dao.GatherOracleDao;
|
import com.platform.dao.GatherOracleDao;
|
||||||
|
import com.platform.dao.RegionalismCodeDao;
|
||||||
|
import com.platform.dao.SystemCodeDao;
|
||||||
|
import com.platform.dao.VolumeDao;
|
||||||
|
import com.platform.entities.DataInfoEntity;
|
||||||
import com.platform.entities.GatherOracleInfo;
|
import com.platform.entities.GatherOracleInfo;
|
||||||
|
import com.platform.entities.RegionalismEntity;
|
||||||
|
import com.platform.entities.VolumeInitEntity;
|
||||||
|
import com.platform.enums.DataCheckoutStatusEnum;
|
||||||
|
import com.platform.enums.DataStatusEnum;
|
||||||
|
import com.platform.enums.EncodeTypeEnum;
|
||||||
|
import com.platform.enums.ExportDataTypeEnum;
|
||||||
|
import com.platform.enums.GatherOracleStatusEnum;
|
||||||
|
import com.platform.enums.GatherOracleTypeEnum;
|
||||||
|
import com.platform.enums.VolumeMarkEnum;
|
||||||
|
import com.platform.oracle.OracleConnector;
|
||||||
import com.platform.service.IGatherOracleService;
|
import com.platform.service.IGatherOracleService;
|
||||||
|
import com.platform.service.OracleHelper;
|
||||||
|
import com.platform.utils.Configs;
|
||||||
|
import com.platform.utils.Constant;
|
||||||
|
import com.platform.utils.DateForm;
|
||||||
|
import com.platform.utils.ExceptionMsg;
|
||||||
|
import com.platform.utils.FileOperateHelper;
|
||||||
|
import com.platform.utils.Result;
|
||||||
|
import com.platform.utils.StringHandle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* oracle数据总库 管理
|
* oracle数据总库 管理
|
||||||
|
|
@ -18,7 +45,7 @@ import com.platform.service.IGatherOracleService;
|
||||||
* @author chen
|
* @author chen
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Service(value = "mySqlService")
|
@Service(value = "gatherOracleService")
|
||||||
public class GatherOracleServiceImpl implements IGatherOracleService {
|
public class GatherOracleServiceImpl implements IGatherOracleService {
|
||||||
|
|
||||||
public final static Logger log = Logger.getLogger(GatherOracleServiceImpl.class);
|
public final static Logger log = Logger.getLogger(GatherOracleServiceImpl.class);
|
||||||
|
|
@ -29,6 +56,18 @@ public class GatherOracleServiceImpl implements IGatherOracleService {
|
||||||
@Resource(name = "gatherOracleDao")
|
@Resource(name = "gatherOracleDao")
|
||||||
private GatherOracleDao gatherOracleDao;
|
private GatherOracleDao gatherOracleDao;
|
||||||
|
|
||||||
|
@Resource(name = "dataInfoDao")
|
||||||
|
private DataInfoDao dataInfoDao;
|
||||||
|
|
||||||
|
@Resource(name = "volumeDao")
|
||||||
|
private VolumeDao volumeDao;
|
||||||
|
|
||||||
|
@Resource(name = "systemCodeDao")
|
||||||
|
private SystemCodeDao systemCodeDao;
|
||||||
|
|
||||||
|
@Resource(name = "regionalismCodeDao")
|
||||||
|
private RegionalismCodeDao regionalismCodeDao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<GatherOracleInfo> findAllOracle() throws Exception {
|
public List<GatherOracleInfo> findAllOracle() throws Exception {
|
||||||
List<GatherOracleInfo> result = gatherOracleDao.selectAllOracle();
|
List<GatherOracleInfo> result = gatherOracleDao.selectAllOracle();
|
||||||
|
|
@ -36,53 +75,69 @@ public class GatherOracleServiceImpl implements IGatherOracleService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int deleteOracle(int id) throws Exception {
|
public int deleteOracle(int id) throws Exception {
|
||||||
|
|
||||||
int result = 0;
|
int result = 0;
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
// 删除汇总的库--逻辑删除
|
GatherOracleInfo gatherOracleInfo = gatherOracleDao.selectOracleById(id);
|
||||||
// GatherOracleInfo oracle = new GatherOracleInfo();
|
|
||||||
// oracle.setId(id);
|
// 不删除系统名称中的汇总库名称,因为数据并没有删除,而且不删除没有影响
|
||||||
// oracle.setRemove("1");
|
/*if (gatherOracleInfo != null) {
|
||||||
// result = gatherOracleDao.updateOracleById(oracle );
|
systemCodeDao.deleteBySystemName(gatherOracleInfo.getName());
|
||||||
|
}*/
|
||||||
result = gatherOracleDao.deleteOracleById(id);
|
result = gatherOracleDao.deleteOracleById(id);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int insertOracle(GatherOracleInfo oracle) throws Exception {
|
public int insertOracle(GatherOracleInfo oracle) throws Exception {
|
||||||
// 连接oracle,
|
|
||||||
|
// 连接oracle
|
||||||
|
int status = 0;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
// 1 代表 是标准库抽取
|
|
||||||
if ("1".equals(oracle.getType())) {
|
if (OracleConnector.canConnect(
|
||||||
GatherOracleInfo ora = new GatherOracleInfo();
|
"jdbc:oracle:thin:@" + oracle.getIp() + ":" + oracle.getPort() + ":" + oracle.getDatabaseName(),
|
||||||
ora.setType("0");
|
oracle.getUser(), oracle.getPassword())) {
|
||||||
gatherOracleDao.updateAllOracle(ora);
|
status = 1;
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
result = gatherOracleDao.insertOracle(oracle);
|
oracle.setStatus(status);
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e);
|
// 检测汇总库名称是否存在
|
||||||
|
List<GatherOracleInfo> gatherOracleInfos = gatherOracleDao.selectAllOracle();
|
||||||
|
for (GatherOracleInfo one : gatherOracleInfos) {
|
||||||
|
if (oracle.getName().equals(one.getName())) {
|
||||||
|
log.error(ExceptionMsg.GATHER_ORACLE_ALREADY_EXISTED);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result = gatherOracleDao.insertOracle(oracle);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int updateOracle(GatherOracleInfo oracle) throws Exception {
|
public int updateOracle(GatherOracleInfo oracle) throws Exception {
|
||||||
int status = 1;
|
int status = 0;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
Connection conn = null /*OracleConnector.ConnectionBuilder("jdbc:oracle:thin:@" + oracle.getIp() + ":" + oracle.getPort() + ":"
|
|
||||||
+ oracle.getDatabaseName(), oracle.getUser(), oracle.getPassword())*/;
|
if (OracleConnector.canConnect(
|
||||||
if (null == conn) {
|
"jdbc:oracle:thin:@" + oracle.getIp() + ":" + oracle.getPort() + ":" + oracle.getDatabaseName(),
|
||||||
status = 0;
|
oracle.getUser(), oracle.getPassword())) {
|
||||||
|
status = 1;
|
||||||
}
|
}
|
||||||
oracle.setStatus(status);
|
oracle.setStatus(status);
|
||||||
|
|
||||||
|
// 如果设置该汇总库为标准表汇总库,则更新其他汇总库的类型为非标准表汇总库
|
||||||
|
if (GatherOracleTypeEnum.YES.getValue().equals(oracle.getType())) {
|
||||||
|
GatherOracleInfo ora = new GatherOracleInfo();
|
||||||
|
ora.setType(GatherOracleTypeEnum.NO.getValue());
|
||||||
|
gatherOracleDao.updateAllOracleExceptId(ora);
|
||||||
|
}
|
||||||
|
|
||||||
if (oracle.getId() > 0) {
|
if (oracle.getId() > 0) {
|
||||||
if ("1".equals(oracle.getType())) {
|
|
||||||
GatherOracleInfo ora = new GatherOracleInfo();
|
|
||||||
ora.setType("0");
|
|
||||||
gatherOracleDao.updateAllOracleExceptId(ora);
|
|
||||||
}
|
|
||||||
result = gatherOracleDao.updateOracleById(oracle);
|
result = gatherOracleDao.updateOracleById(oracle);
|
||||||
} else {
|
} else {
|
||||||
result = insertOracle(oracle);
|
result = insertOracle(oracle);
|
||||||
|
|
@ -90,4 +145,193 @@ public class GatherOracleServiceImpl implements IGatherOracleService {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (非 Javadoc)
|
||||||
|
* <p>Title: createGatherDatabase</p>
|
||||||
|
* <p>Description: </p>
|
||||||
|
* @param oracle
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
* @see com.platform.service.IGatherOracleService#createGatherDatabase(com.platform.entities.GatherOracleInfo)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.REQUIRED)
|
||||||
|
public Result<DataInfoEntity> createGatherDatabase(GatherOracleInfo oracle) throws Exception {
|
||||||
|
Result<DataInfoEntity> result = new Result<DataInfoEntity>();
|
||||||
|
|
||||||
|
DataInfoEntity dataInfoEntity = initDataInfoEntity(oracle);
|
||||||
|
|
||||||
|
// 查找数据是否已经存在
|
||||||
|
DataInfoEntity originData = dataInfoDao.findByDataPath(dataInfoEntity.getDataPath());
|
||||||
|
if (originData != null) {
|
||||||
|
result.setData(null);
|
||||||
|
result.setStatus(false);
|
||||||
|
result.setMsg(ExceptionMsg.CREATE_GATHER_DATABASE_ERROR + ExceptionMsg.DATABASE_EXISTS);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
String origin_path = dataInfoEntity.getCharset().equals(EncodeTypeEnum.UTF8.getValue())
|
||||||
|
? Configs.ORIGIN_DATABASE_UTF8 : Configs.ORIGIN_DATABASE_GBK;
|
||||||
|
Result<Boolean> copyFolderRes = FileOperateHelper.folderCopy(origin_path, dataInfoEntity.getDataPath());
|
||||||
|
if (copyFolderRes.getData() == false) {
|
||||||
|
result.setData(null);
|
||||||
|
result.setStatus(false);
|
||||||
|
result.setMsg(copyFolderRes.getMsg());
|
||||||
|
return result;
|
||||||
|
// throw new MyException(copyFolderRes.getMsg());
|
||||||
|
}
|
||||||
|
|
||||||
|
int count = dataInfoDao.save(dataInfoEntity);
|
||||||
|
if (count == 0) {
|
||||||
|
// 事物回滚
|
||||||
|
throw new MyException(ExceptionMsg.DATABASE_ERROR);
|
||||||
|
}
|
||||||
|
result.setData(dataInfoEntity);
|
||||||
|
result.setMsg(ExceptionMsg.SUCCESS);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<String> oracleDataExport(List<Integer> idList, List<ExportDataTypeEnum> typeListEnum,
|
||||||
|
List<Integer> gatherOracleList) throws Exception {
|
||||||
|
Result<String> result = new Result<String>();
|
||||||
|
|
||||||
|
// 查询选择的所有数据
|
||||||
|
List<DataInfoEntity> dataInfoEntities = dataInfoDao.findByIds(idList);
|
||||||
|
|
||||||
|
// 数据不存在
|
||||||
|
if (dataInfoEntities == null || dataInfoEntities.isEmpty()) {
|
||||||
|
log.error(ExceptionMsg.DATABASE_NOT_EXISTS + " " + idList + " 没有找到数据!");
|
||||||
|
result.setStatus(false);
|
||||||
|
result.setMsg(ExceptionMsg.DATABASE_NOT_EXISTS);
|
||||||
|
result.setData(null);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
GatherOracleInfo gatherOracleInfo = null;
|
||||||
|
if (typeListEnum.contains(ExportDataTypeEnum.GATHER_DATA)) {
|
||||||
|
|
||||||
|
Integer selectedGatherOracleId = gatherOracleList.get(0);
|
||||||
|
gatherOracleInfo = gatherOracleDao.selectOracleById(selectedGatherOracleId);
|
||||||
|
|
||||||
|
gatherOracleInfo = gatherOracleDao.selectOracleById(selectedGatherOracleId);
|
||||||
|
// 汇总库不存在
|
||||||
|
if (gatherOracleInfo == null) {
|
||||||
|
log.error(ExceptionMsg.GATHER_ORACLE_NOT_EXISTED + ": " + selectedGatherOracleId + " 找不到对应的汇总库!");
|
||||||
|
result.setStatus(false);
|
||||||
|
result.setMsg(ExceptionMsg.GATHER_ORACLE_NOT_EXISTED);
|
||||||
|
result.setData(null);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 汇总库不能连接
|
||||||
|
if (gatherOracleInfo.getStatus() == GatherOracleStatusEnum.STOPPED.getStatus()) {
|
||||||
|
log.error(ExceptionMsg.GATHER_ORACLE_NOT_CONNECT + ": " + gatherOracleInfo.getId() + " 汇总库不能连接!");
|
||||||
|
result.setStatus(false);
|
||||||
|
result.setMsg(ExceptionMsg.GATHER_ORACLE_NOT_CONNECT);
|
||||||
|
result.setData(null);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeListEnum.contains(ExportDataTypeEnum.ORIGIN_DATA)) {
|
||||||
|
// 目前暂时不提供此功能
|
||||||
|
result.setStatus(false);
|
||||||
|
result.setMsg(ExceptionMsg.PARAMATER_ERROR);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开启导出进程
|
||||||
|
final GatherOracleInfo finalGatherOracleInfo = gatherOracleInfo;
|
||||||
|
Constant.DATA_EXPORT_THREAD_POOL.execute(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
new OracleHelper().exportData(finalGatherOracleInfo, dataInfoEntities, typeListEnum);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
result.setStatus(true);
|
||||||
|
result.setMsg(ExceptionMsg.SUCCESS);
|
||||||
|
result.setData(ExceptionMsg.SUCCESS);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化一个DataInfoEntity对象
|
||||||
|
*
|
||||||
|
* @param oracle
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
* @see [类、类#方法、类#成员]
|
||||||
|
*/
|
||||||
|
private DataInfoEntity initDataInfoEntity(GatherOracleInfo oracle) throws Exception {
|
||||||
|
List<RegionalismEntity> regionalismEntities = regionalismCodeDao
|
||||||
|
.findExistRegionalism(new ArrayList<String>(Arrays.asList(Configs.GATHER_DATABASE_AREA_CODE)));
|
||||||
|
|
||||||
|
if (regionalismEntities == null || regionalismEntities.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
DataInfoEntity dataInfoEntity = new DataInfoEntity();
|
||||||
|
|
||||||
|
// 寻找当前的热区volume,设置为数据所在volume
|
||||||
|
List<VolumeInitEntity> volumeInitEntities = volumeDao.findAll();
|
||||||
|
if (volumeInitEntities == null || volumeInitEntities.isEmpty()) {
|
||||||
|
throw new MyException(ExceptionMsg.ONLINE_VOLUME_PATH_IS_NULL);
|
||||||
|
}
|
||||||
|
for (VolumeInitEntity oneVolume : volumeInitEntities) {
|
||||||
|
if (VolumeMarkEnum.ONLINE.getMark().equals(oneVolume.getMark())) {
|
||||||
|
dataInfoEntity.setVolumePath(oneVolume.getPath());
|
||||||
|
dataInfoEntity.setVolumeIp(oneVolume.getIp());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 没找到热区,则抛出异常
|
||||||
|
if (dataInfoEntity.getVolumePath() == null) {
|
||||||
|
throw new MyException(ExceptionMsg.ONLINE_VOLUME_PATH_IS_NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
RegionalismEntity regionalismEntity = regionalismEntities.get(0);
|
||||||
|
dataInfoEntity.setRegionalismCode(regionalismEntity.getCode());
|
||||||
|
dataInfoEntity.setSystemName(oracle.getSystemName());
|
||||||
|
|
||||||
|
// 插入汇总库名称到系统名称表中,并获取系统编码
|
||||||
|
Integer systemCode = systemCodeDao.findBySystemName(dataInfoEntity.getSystemName());
|
||||||
|
if (systemCode == null || systemCode == 0) {
|
||||||
|
systemCodeDao.insert(dataInfoEntity.getSystemName());
|
||||||
|
systemCode = systemCodeDao.findBySystemName(dataInfoEntity.getSystemName());
|
||||||
|
if (systemCode == null || systemCode == 0) {
|
||||||
|
throw new MyException(ExceptionMsg.DATABASE_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dataInfoEntity.setSystemCode(systemCode);
|
||||||
|
dataInfoEntity.setCityName(regionalismEntity.getCityName());
|
||||||
|
dataInfoEntity.setDistrictName(regionalismEntity.getDistrictName());
|
||||||
|
dataInfoEntity.setDataVersion(Configs.GATHER_DATABASE_DATA_VERSION);
|
||||||
|
dataInfoEntity.setSubmittedBatch(Configs.GATHER_DATABASE_BATCH);
|
||||||
|
|
||||||
|
dataInfoEntity.setDataType(Configs.GATHER_DATABASE_DATA_TYPE);
|
||||||
|
dataInfoEntity.setCharset(oracle.getEncoding());
|
||||||
|
|
||||||
|
dataInfoEntity.setCollectingTime(DateForm.getNowToDay());
|
||||||
|
// dataInfoEntity.setCollectorName(oracle.getContact());
|
||||||
|
dataInfoEntity.setCollectorName(Constant.GATHER_DATABASE_SYSTEM_NAME);
|
||||||
|
dataInfoEntity.setCollectorContacts(oracle.getPhone());
|
||||||
|
dataInfoEntity.setStartYear(StringHandle.getTimeFirstSegment(oracle.getStartTime()));
|
||||||
|
dataInfoEntity.setStartMonth(StringHandle.getTimeSecondSegment(oracle.getStartTime()));
|
||||||
|
dataInfoEntity.setEndYear(StringHandle.getTimeFirstSegment(oracle.getEndTime()));
|
||||||
|
dataInfoEntity.setEndMonth(StringHandle.getTimeSecondSegment(oracle.getEndTime()));
|
||||||
|
dataInfoEntity.setYear(dataInfoEntity.getStartYear() + Constant.SHORT_LINE + dataInfoEntity.getEndYear());
|
||||||
|
dataInfoEntity.setDataVersion(oracle.getDataVersion());
|
||||||
|
dataInfoEntity.setDataBaseType(Constant.ORACLE);
|
||||||
|
// 根据数据信息生成数据路径
|
||||||
|
dataInfoEntity.generateDataPath();
|
||||||
|
|
||||||
|
// 以下几个和未写明的都取默认值
|
||||||
|
dataInfoEntity.setCheckoutFlag(DataCheckoutStatusEnum.NO.getValue());
|
||||||
|
dataInfoEntity.setPayResult(DataCheckoutStatusEnum.NO.getValue());
|
||||||
|
dataInfoEntity.setExecResult(DataCheckoutStatusEnum.NO.getValue());
|
||||||
|
dataInfoEntity.setExtractStatus(DataStatusEnum.NOT_CHECKOUT.getCode());
|
||||||
|
|
||||||
|
return dataInfoEntity;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,74 @@
|
||||||
package com.platform.service.impl;
|
package com.platform.service.impl;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.platform.service.ILogRead;
|
import com.platform.service.ILogRead;
|
||||||
import com.platform.utils.Configs;
|
import com.platform.utils.Configs;
|
||||||
|
import com.platform.utils.Constant;
|
||||||
|
import com.platform.utils.ExceptionMsg;
|
||||||
import com.platform.utils.FileOperateHelper;
|
import com.platform.utils.FileOperateHelper;
|
||||||
|
import com.platform.utils.StringHandle;
|
||||||
|
|
||||||
@Service(value = "logReadService")
|
@Service(value = "logReadService")
|
||||||
public class LogReadServiceImpl implements ILogRead {
|
public class LogReadServiceImpl implements ILogRead {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String readLog(String filename) throws Exception {
|
public String readLog(String filename) throws Exception {
|
||||||
String result = FileOperateHelper.fileReader(Configs.EXTRACT_LOG_LOCALTION + filename+".log");
|
String result = FileOperateHelper.fileReader(Configs.EXTRACT_LOG_LOCALTION + filename + ".log");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String readStandardLog(String filename) throws Exception {
|
public String readStandardLog(String filename) throws Exception {
|
||||||
String result = FileOperateHelper.fileReader(Configs.EXTRACT_STANDARD_LOG_LOCALTION + "CQ" + filename.replace("-", "_")+".log");
|
String result = FileOperateHelper
|
||||||
|
.fileReader(Configs.EXTRACT_STANDARD_LOG_LOCALTION + "CQ" + filename.replace("-", "_") + ".log");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String readExportDataLog() throws Exception {
|
||||||
|
File logFilePath = new File(Configs.EXPORT_DATA_LOG_LOCALTION);
|
||||||
|
if (!logFilePath.isDirectory()) {
|
||||||
|
log.error(Configs.EXPORT_DATA_LOG_LOCALTION + " 不存在或者不是文件夹!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String[] logFileNames = logFilePath.list();
|
||||||
|
|
||||||
|
// 寻找时间最近的日志
|
||||||
|
String newLogFileName = "";
|
||||||
|
long newTimeSecond = 0L;
|
||||||
|
for (String logFileName : logFileNames) {
|
||||||
|
if (logFileName.endsWith(Constant.LOG_FILE_NAME_POSTFIX)
|
||||||
|
&& logFileName.contains(Constant.LOG_FILE_NAME_SEPERATOR)) {
|
||||||
|
String[] logFileNameSplit = logFileName.split(Constant.LOG_FILE_NAME_SEPERATOR);
|
||||||
|
if (logFileNameSplit.length != 2) {
|
||||||
|
log.error(logFileName + " 不合法!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Long timeSecond = Long.parseLong(logFileNameSplit[1].substring(0,
|
||||||
|
logFileNameSplit[1].indexOf(Constant.LOG_FILE_NAME_POSTFIX)));
|
||||||
|
if (timeSecond > newTimeSecond) {
|
||||||
|
newTimeSecond = timeSecond;
|
||||||
|
newLogFileName = logFileName;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(logFileName + " 不合法!");
|
||||||
|
log.error(ExceptionMsg.exceptionStackToStr(e));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (newLogFileName == "") {
|
||||||
|
log.error(" 找不到合法日志文件!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String result = FileOperateHelper
|
||||||
|
.fileReader(StringHandle.joinPath(Configs.EXPORT_DATA_LOG_LOCALTION, newLogFileName));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,14 @@ import com.platform.entities.VolumeInitEntity;
|
||||||
import com.platform.glusterfs.ShowData;
|
import com.platform.glusterfs.ShowData;
|
||||||
import com.platform.http.gfs.RemoveData;
|
import com.platform.http.gfs.RemoveData;
|
||||||
import com.platform.service.IMoveDataService;
|
import com.platform.service.IMoveDataService;
|
||||||
|
import com.platform.utils.Constant;
|
||||||
import com.platform.utils.DateForm;
|
import com.platform.utils.DateForm;
|
||||||
|
import com.platform.utils.StringHandle;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Service(value = "moveDataService")
|
@Service(value = "moveDataService")
|
||||||
public class MoveDataServiceImpl implements IMoveDataService {
|
public class MoveDataServiceImpl implements IMoveDataService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日志
|
* 日志
|
||||||
*/
|
*/
|
||||||
|
|
@ -36,7 +38,7 @@ public class MoveDataServiceImpl implements IMoveDataService {
|
||||||
|
|
||||||
@Resource(name = "dataInfoDao")
|
@Resource(name = "dataInfoDao")
|
||||||
private DataInfoDao dataInfoDao;
|
private DataInfoDao dataInfoDao;
|
||||||
|
|
||||||
@Resource(name = "volumeDao")
|
@Resource(name = "volumeDao")
|
||||||
private VolumeDao volumeDao;
|
private VolumeDao volumeDao;
|
||||||
|
|
||||||
|
|
@ -45,7 +47,7 @@ public class MoveDataServiceImpl implements IMoveDataService {
|
||||||
/**
|
/**
|
||||||
* MD5校验
|
* MD5校验
|
||||||
*/
|
*/
|
||||||
// CheckoutMD5 check = new CheckoutMD5();
|
// CheckoutMD5 check = new CheckoutMD5();
|
||||||
|
|
||||||
@Resource(name = "dataInfoMoveTmpDao")
|
@Resource(name = "dataInfoMoveTmpDao")
|
||||||
private DataInfoMoveTmpDao dataInfoMoveTmpDao;
|
private DataInfoMoveTmpDao dataInfoMoveTmpDao;
|
||||||
|
|
@ -56,31 +58,31 @@ public class MoveDataServiceImpl implements IMoveDataService {
|
||||||
ShowData show = new ShowData();
|
ShowData show = new ShowData();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveData(List<DataInfoEntity> data, FolderNode node)
|
public boolean moveData(List<DataInfoEntity> data, FolderNode node) throws Exception {
|
||||||
throws Exception {
|
|
||||||
boolean isSuccess = false;
|
boolean isSuccess = false;
|
||||||
if (null ==node.getName() ||"".equals(node.getName())) {
|
if (null == node.getName() || "".equals(node.getName())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (null ==node.getPath() ||"".equals(node.getPath())) {
|
if (null == node.getPath() || "".equals(node.getPath())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
List<VolumeInitEntity> listVolume = volumeDao.findAll();
|
List<VolumeInitEntity> listVolume = volumeDao.findAll();
|
||||||
if (null == listVolume || listVolume.size() == 0) {
|
if (null == listVolume || listVolume.size() == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String tailPath = "";
|
// node.getPath() 表示选择的volume的路径
|
||||||
|
String destVolumePath = node.getPath();
|
||||||
|
|
||||||
if (null != data) {
|
if (null != data) {
|
||||||
// XXX/320198_16/1,or XXX/320122KFQ_15/1 ---> /320198_16/1, or
|
|
||||||
// /320122KFQ_15/1
|
|
||||||
List<DataInfoEntityMoveTmp> exist = dataInfoMoveTmpDao.findAll();
|
List<DataInfoEntityMoveTmp> exist = dataInfoMoveTmpDao.findAll();
|
||||||
List<String> existIds = new ArrayList<String>();
|
List<String> existIds = new ArrayList<String>();
|
||||||
List<Integer> fkIds = new ArrayList<Integer>();
|
List<Integer> fkIds = new ArrayList<Integer>();
|
||||||
|
|
||||||
if (null != exist) {
|
if (null != exist) {
|
||||||
for (DataInfoEntityMoveTmp dataInfoEntityMoveTmp : exist) {
|
for (DataInfoEntityMoveTmp dataInfoEntityMoveTmp : exist) {
|
||||||
if ("0".equals(dataInfoEntityMoveTmp.getCompleteStatus())
|
if ("0".equals(dataInfoEntityMoveTmp.getCompleteStatus())
|
||||||
|| "1".equals(dataInfoEntityMoveTmp
|
|| "1".equals(dataInfoEntityMoveTmp.getCompleteStatus())) {
|
||||||
.getCompleteStatus())) {
|
|
||||||
if (null != dataInfoEntityMoveTmp.getDataPath()) {
|
if (null != dataInfoEntityMoveTmp.getDataPath()) {
|
||||||
existIds.add(dataInfoEntityMoveTmp.getDataPath());
|
existIds.add(dataInfoEntityMoveTmp.getDataPath());
|
||||||
}
|
}
|
||||||
|
|
@ -88,19 +90,16 @@ public class MoveDataServiceImpl implements IMoveDataService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Pattern pattern = Pattern
|
Pattern pattern = Pattern.compile("\\/\\d+[a-z]*[A-Z]*_\\d+\\/\\d*\\/*$");
|
||||||
.compile("\\/\\d+[a-z]*[A-Z]*_\\d+\\/\\d*\\/*$");
|
|
||||||
// 末尾 含有 /
|
// 末尾 含有 /
|
||||||
Pattern pattern2 = Pattern.compile("\\/$");
|
Pattern pattern2 = Pattern.compile("\\/$");
|
||||||
String dstPath = node.getPath();
|
|
||||||
Matcher matcher2 = pattern2.matcher(dstPath);
|
|
||||||
// 去掉 最后 的 / 符合
|
|
||||||
if (matcher2.find()) {
|
|
||||||
dstPath = dstPath.substring(0, dstPath.length() - 1);
|
|
||||||
}
|
|
||||||
List<DataInfoEntityMoveTmp> moveList = new ArrayList<DataInfoEntityMoveTmp>();
|
List<DataInfoEntityMoveTmp> moveList = new ArrayList<DataInfoEntityMoveTmp>();
|
||||||
for (DataInfoEntity dataInfoEntity : data) {
|
for (DataInfoEntity dataInfoEntity : data) {
|
||||||
//(根据迁移路径判断)存在迁移过的数据,不允许迁移,先必须删除记录
|
int newDataVersion = getDestDataVersion(dataInfoEntity, destVolumePath);
|
||||||
|
String newDataPath = StringHandle.joinPath(destVolumePath,
|
||||||
|
dataInfoEntity.generateNoVolumePathDataPathFromVersion(newDataVersion));
|
||||||
|
// (根据迁移路径判断)存在迁移过的数据,不允许迁移,先必须删除记录
|
||||||
if (existIds.contains(dataInfoEntity.getDataPath())) {
|
if (existIds.contains(dataInfoEntity.getDataPath())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -113,63 +112,54 @@ public class MoveDataServiceImpl implements IMoveDataService {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 迁移数据的位置在原数据路径或者原数据父目录及其上,不允许迁移
|
// 迁移数据的位置在原数据路径或者原数据父目录及其上,不允许迁移
|
||||||
if (dataInfoEntity.getDataPath().contains(node.getPath())) {
|
if (dataInfoEntity.getDataPath().contains(newDataPath)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// TODO 正则:取出 data 的后面 的 路径,eg: XXX/320198_16/1,or
|
/*// TODO 正则:取出 data 的后面 的 路径,eg: XXX/320198_16/1,or
|
||||||
// XXX/320122KFQ_15/1)
|
// XXX/320122KFQ_15/1)
|
||||||
Matcher matcher = pattern.matcher(dataInfoEntity.getDataPath());
|
Matcher matcher = pattern.matcher(dataInfoEntity.getDataPath());
|
||||||
// tailPath 第一个字符是 / 符号取尾:"\\/\\d+[a-z]*[A-Z]*_\\d+\\/\\d*\\/*$"
|
// tailPath 第一个字符是 / 符号取尾:"\\/\\d+[a-z]*[A-Z]*_\\d+\\/\\d*\\/*$"
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
tailPath = matcher.group();
|
tailPath = matcher.group();
|
||||||
}
|
}
|
||||||
String finalDestPath = dstPath + tailPath;
|
String finalDestPath = newDataPath + tailPath;
|
||||||
Matcher matchertmp2 = pattern2.matcher(finalDestPath);
|
Matcher matchertmp2 = pattern2.matcher(finalDestPath);
|
||||||
// 去掉 最后 的 / 符合
|
// 去掉 最后 的 / 符合
|
||||||
if (!matchertmp2.find()) {
|
if (!matchertmp2.find()) {
|
||||||
finalDestPath = finalDestPath + "/";
|
finalDestPath = finalDestPath + "/";
|
||||||
}
|
}*/
|
||||||
DataInfoEntityMoveTmp dataMove = new DataInfoEntityMoveTmp();
|
DataInfoEntityMoveTmp dataMove = new DataInfoEntityMoveTmp();
|
||||||
dataMove.setSystemCode(dataInfoEntity.getSystemCode());
|
dataMove.setSystemCode(dataInfoEntity.getSystemCode());
|
||||||
dataMove.setRegionalismCode(dataInfoEntity.getRegionalismCode());
|
dataMove.setRegionalismCode(dataInfoEntity.getRegionalismCode());
|
||||||
dataMove.setDstPath(finalDestPath);
|
dataMove.setDstPath(newDataPath);
|
||||||
dataMove.setLastTime(DateForm.date2StringBysecond(new Date()));
|
dataMove.setLastTime(DateForm.date2StringBysecond(new Date()));
|
||||||
dataMove.setFkid(dataInfoEntity.getId());
|
dataMove.setFkid(dataInfoEntity.getId());
|
||||||
// 末尾 含有 /
|
// 末尾 含有 /
|
||||||
Matcher matcher3 = pattern2.matcher(node.getPath());
|
// Matcher matcher3 = pattern2.matcher(newDataPath);
|
||||||
// 加上最后 的 / 符合
|
// 加上最后 的 / 符合
|
||||||
String volumePath = "";
|
|
||||||
if (!matcher3.find()) {
|
/*if (!matcher3.find()) {
|
||||||
volumePath = node.getPath()+"/";
|
volumePath = newDataPath + "/";
|
||||||
}
|
} else {
|
||||||
else {
|
volumePath = newDataPath;
|
||||||
volumePath = node.getPath();
|
}*/
|
||||||
}
|
|
||||||
String path = "";
|
// 寻找目的volume的ip
|
||||||
String ip = "";
|
String ip = "";
|
||||||
for ( VolumeInitEntity ve : listVolume) {
|
for (VolumeInitEntity oneVolume : listVolume) {
|
||||||
String tmpPath = ve.getPath();
|
// volumePath : 迁移目的 volume
|
||||||
// volumePath : 迁移目的 volume
|
if (oneVolume.getPath().equals(destVolumePath))
|
||||||
if (volumePath.contains(tmpPath)) {
|
ip = oneVolume.getIp();
|
||||||
if (tmpPath.length() > path.length()) {
|
|
||||||
path = tmpPath;
|
|
||||||
ip = ve.getIp();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (path.length() == 0) {
|
|
||||||
dataMove.setDstVolumePath("nopath");
|
|
||||||
dataMove.setDstVolumeIp("noIP");
|
|
||||||
}else {
|
|
||||||
dataMove.setDstVolumePath(path);
|
|
||||||
dataMove.setDstVolumeIp(ip);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dataMove.setDstVolumePath(destVolumePath);
|
||||||
|
dataMove.setDstVolumeIp(ip);
|
||||||
dataMove.setCompleteStatus("0");
|
dataMove.setCompleteStatus("0");
|
||||||
//只 允许 冷区的数据迁移 mark=1表示冷区
|
// 只 允许 冷区的数据迁移 mark=1表示冷区
|
||||||
// if ("1".equals(dataInfoEntity.getMark())) {
|
// if ("1".equals(dataInfoEntity.getMark())) {
|
||||||
// dataMove.setAddData("1");
|
// dataMove.setAddData("1");
|
||||||
moveList.add(dataMove);
|
moveList.add(dataMove);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
if (moveList.size() > 0) {
|
if (moveList.size() > 0) {
|
||||||
dataInfoMoveTmpDao.insertBatch(moveList);
|
dataInfoMoveTmpDao.insertBatch(moveList);
|
||||||
|
|
@ -179,6 +169,35 @@ public class MoveDataServiceImpl implements IMoveDataService {
|
||||||
return isSuccess;
|
return isSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取迁移数据的目的版本号 <功能详细描述>
|
||||||
|
*
|
||||||
|
* @param allDatas
|
||||||
|
* @param data
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
* @see [类、类#方法、类#成员]
|
||||||
|
*/
|
||||||
|
private int getDestDataVersion(DataInfoEntity data, String destVolumePath) throws Exception {
|
||||||
|
List<DataInfoEntity> allDatas = dataInfoDao.findAll();
|
||||||
|
if (allDatas == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int maxVersion = 0;
|
||||||
|
String data_key = data.getRegionalismCode() + Constant.ONLINE_SEPERATOR + data.getSystemCode();
|
||||||
|
for (DataInfoEntity oneData : allDatas) {
|
||||||
|
// 寻找所有数据中在目的集群中的数据的最高版本号
|
||||||
|
String oneDataKey = oneData.getRegionalismCode() + Constant.ONLINE_SEPERATOR + oneData.getSystemCode();
|
||||||
|
if (oneDataKey.equals(data_key) && oneData.getVolumePath().equals(destVolumePath)) {
|
||||||
|
if (oneData.getDataVersion() > maxVersion) {
|
||||||
|
maxVersion = oneData.getDataVersion();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return maxVersion + 1;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DataInfoEntityMoveTmp> findAll() throws Exception {
|
public List<DataInfoEntityMoveTmp> findAll() throws Exception {
|
||||||
List<DataInfoEntityMoveTmp> result = new ArrayList<DataInfoEntityMoveTmp>();
|
List<DataInfoEntityMoveTmp> result = new ArrayList<DataInfoEntityMoveTmp>();
|
||||||
|
|
@ -187,11 +206,11 @@ public class MoveDataServiceImpl implements IMoveDataService {
|
||||||
for (DataInfoEntityMoveTmp tmpentity : tmp) {
|
for (DataInfoEntityMoveTmp tmpentity : tmp) {
|
||||||
if (null != tmpentity.getSubmittedBatch() || null != tmpentity.getSystemName()) {
|
if (null != tmpentity.getSubmittedBatch() || null != tmpentity.getSystemName()) {
|
||||||
result.add(tmpentity);
|
result.add(tmpentity);
|
||||||
}else {
|
} else {
|
||||||
this.delete(tmpentity);
|
this.delete(tmpentity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e);
|
log.error(e);
|
||||||
}
|
}
|
||||||
|
|
@ -208,22 +227,22 @@ public class MoveDataServiceImpl implements IMoveDataService {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
int result = 0;
|
int result = 0;
|
||||||
//迁移失败
|
// 迁移失败
|
||||||
if ("3".equals(dataMove.getCompleteStatus())) {
|
if ("3".equals(dataMove.getCompleteStatus())) {
|
||||||
int code = removeservice.deleteFolder(dataMove.getDstPath());
|
int code = removeservice.deleteFolder(dataMove.getDstPath());
|
||||||
if (code == -100) {
|
if (code == -100) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//是正则迁移时:
|
// 是正则迁移时:
|
||||||
if ("1".equals(dataMove.getCompleteStatus())) {
|
if ("1".equals(dataMove.getCompleteStatus())) {
|
||||||
if(1 != removeservice.abortcopyFolder(dataMove.getDataPath(), makeDstPath(dataMove.getDstPath()))){
|
if (1 != removeservice.abortcopyFolder(dataMove.getDataPath(), makeDstPath(dataMove.getDstPath()))) {
|
||||||
try{
|
try {
|
||||||
removeservice.deleteFolder(dataMove.getDstPath());
|
removeservice.deleteFolder(dataMove.getDstPath());
|
||||||
}catch(Exception e){
|
} catch (Exception e) {
|
||||||
log.error(e);
|
log.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -250,19 +269,21 @@ public class MoveDataServiceImpl implements IMoveDataService {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 去掉 最后 的 数字 +/
|
/**
|
||||||
|
* 去掉 最后 的 数字 +/
|
||||||
|
*
|
||||||
* @param dstPath
|
* @param dstPath
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String makeDstPath(String dstPath) {
|
private String makeDstPath(String dstPath) {
|
||||||
// 末尾 含有 数字 + /
|
// 末尾 含有 数字 + /
|
||||||
Pattern pattern2 = Pattern.compile("\\d+\\/$");
|
Pattern pattern2 = Pattern.compile("\\d+\\/$");
|
||||||
Matcher matcher2 = pattern2.matcher(dstPath);
|
Matcher matcher2 = pattern2.matcher(dstPath);
|
||||||
//去掉 最后 的 数字 +/ 符合
|
// 去掉 最后 的 数字 +/ 符合
|
||||||
if (matcher2.find()) {
|
if (matcher2.find()) {
|
||||||
String removeStr = matcher2.group();
|
String removeStr = matcher2.group();
|
||||||
removeStr.length();
|
removeStr.length();
|
||||||
dstPath = dstPath.substring(0, dstPath.length()-removeStr.length());
|
dstPath = dstPath.substring(0, dstPath.length() - removeStr.length());
|
||||||
}
|
}
|
||||||
return dstPath;
|
return dstPath;
|
||||||
}
|
}
|
||||||
|
|
@ -279,23 +300,23 @@ public class MoveDataServiceImpl implements IMoveDataService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
int result = 0;
|
int result = 0;
|
||||||
for (DataInfoEntityMoveTmp dataMove : dellist) {
|
for (DataInfoEntityMoveTmp dataMove : dellist) {
|
||||||
//迁移失败
|
// 迁移失败
|
||||||
if ("3".equals(dataMove.getCompleteStatus())) {
|
if ("3".equals(dataMove.getCompleteStatus())) {
|
||||||
int code = removeservice.deleteFolder(dataMove.getDstPath());
|
int code = removeservice.deleteFolder(dataMove.getDstPath());
|
||||||
if (code == -100) {
|
if (code == -100) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//是正则迁移时:
|
// 是正则迁移时:
|
||||||
if ("1".equals(dataMove.getCompleteStatus())) {
|
if ("1".equals(dataMove.getCompleteStatus())) {
|
||||||
if(1 != removeservice.abortcopyFolder(dataMove.getDataPath(), makeDstPath(dataMove.getDstPath()))){
|
if (1 != removeservice.abortcopyFolder(dataMove.getDataPath(), makeDstPath(dataMove.getDstPath()))) {
|
||||||
try{
|
try {
|
||||||
removeservice.deleteFolder(dataMove.getDstPath());
|
removeservice.deleteFolder(dataMove.getDstPath());
|
||||||
}catch(Exception e){
|
} catch (Exception e) {
|
||||||
log.error(e);
|
log.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,12 @@ import com.platform.entities.OracleConnectorParams;
|
||||||
import com.platform.kubernetes.SimpleKubeClient;
|
import com.platform.kubernetes.SimpleKubeClient;
|
||||||
import com.platform.oracle.OracleConnector;
|
import com.platform.oracle.OracleConnector;
|
||||||
import com.platform.service.IOracleExtractService;
|
import com.platform.service.IOracleExtractService;
|
||||||
import com.platform.service.OracleExtractHelper;
|
import com.platform.service.OracleHelper;
|
||||||
import com.platform.utils.CacheSetCantDelete;
|
import com.platform.utils.CacheSetCantDelete;
|
||||||
import com.platform.utils.Configs;
|
import com.platform.utils.Configs;
|
||||||
import com.platform.utils.Constant;
|
import com.platform.utils.Constant;
|
||||||
import com.platform.utils.DateForm;
|
import com.platform.utils.DateForm;
|
||||||
|
import com.platform.utils.ExceptionMsg;
|
||||||
import com.platform.utils.FileOperateHelper;
|
import com.platform.utils.FileOperateHelper;
|
||||||
|
|
||||||
@Service(value = "OracleExtract")
|
@Service(value = "OracleExtract")
|
||||||
|
|
@ -32,8 +33,7 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
||||||
/**
|
/**
|
||||||
* 日志
|
* 日志
|
||||||
*/
|
*/
|
||||||
public final static Logger log = Logger
|
public final static Logger log = Logger.getLogger(OracleExtractServiceImpl.class);
|
||||||
.getLogger(OracleExtractServiceImpl.class);
|
|
||||||
|
|
||||||
@Resource(name = "dataInfoDao")
|
@Resource(name = "dataInfoDao")
|
||||||
private DataInfoDao dataInfoDao;
|
private DataInfoDao dataInfoDao;
|
||||||
|
|
@ -45,7 +45,7 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
||||||
/**
|
/**
|
||||||
* 抽取
|
* 抽取
|
||||||
*/
|
*/
|
||||||
private OracleExtractHelper oracleExtract = new OracleExtractHelper();
|
private OracleHelper oracleExtract = new OracleHelper();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据库连接实现类
|
* 数据库连接实现类
|
||||||
|
|
@ -53,8 +53,7 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
||||||
private OracleConnector connect = new OracleConnector();
|
private OracleConnector connect = new OracleConnector();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean extractOracle(String name,
|
public boolean extractOracle(String name, List<OracleConnectorParams> datainfos, GatherOracleInfo oracleModel)
|
||||||
List<OracleConnectorParams> datainfos, GatherOracleInfo oracleModel)
|
|
||||||
throws Exception {
|
throws Exception {
|
||||||
boolean isSuccess = false;
|
boolean isSuccess = false;
|
||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
|
|
@ -67,14 +66,11 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
conn = OracleConnector.connectionBuilder(
|
conn = OracleConnector.connectionBuilder(
|
||||||
"jdbc:oracle:thin:@" + oracleModel.getIp() + ":"
|
"jdbc:oracle:thin:@" + oracleModel.getIp() + ":" + oracleModel.getPort() + ":"
|
||||||
+ oracleModel.getPort() + ":"
|
|
||||||
+ oracleModel.getDatabaseName(),
|
+ oracleModel.getDatabaseName(),
|
||||||
oracleModel.getUser(), oracleModel.getPassword(),
|
oracleModel.getUser(), oracleModel.getPassword(), datainfos.get(0));
|
||||||
datainfos.get(0));
|
|
||||||
if (null == conn) {
|
if (null == conn) {
|
||||||
FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION
|
FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION + datainfos.get(0).getName() + ".log",
|
||||||
+ datainfos.get(0).getName() + ".log",
|
|
||||||
"创建oracle连接失败: [" + conn + "]\r\n");
|
"创建oracle连接失败: [" + conn + "]\r\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -82,29 +78,17 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
||||||
String replicasName = collectOracle.getName();
|
String replicasName = collectOracle.getName();
|
||||||
DataInfoEntity data = new DataInfoEntity();
|
DataInfoEntity data = new DataInfoEntity();
|
||||||
try {
|
try {
|
||||||
if (null != collectOracle.getDataId()
|
if (null != collectOracle.getDataId() && !"".equals(collectOracle.getDataId())) {
|
||||||
&& !"".equals(collectOracle.getDataId())) {
|
|
||||||
data.setId(Integer.valueOf(collectOracle.getDataId()));
|
data.setId(Integer.valueOf(collectOracle.getDataId()));
|
||||||
data.setExtractStatus(1);
|
data.setExtractStatus(1);
|
||||||
dataInfoDao.updateExtract(data);
|
dataInfoDao.updateExtract(data);
|
||||||
collectOracle.setName("J"
|
collectOracle.setName("J" + collectOracle.getName().replace("-", "_"));
|
||||||
+ collectOracle.getName().replace("-", "_"));
|
String cmd = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS + " label --overwrite rc "
|
||||||
String cmd = "kubectl --server "
|
+ replicasName + " isExtract=1";
|
||||||
+ Configs.KUBE_MASTER_ADDRESS
|
|
||||||
+ " label --overwrite rc " + replicasName
|
|
||||||
+ " isExtract=1";
|
|
||||||
// sql日志记录时间:
|
// sql日志记录时间:
|
||||||
FileOperateHelper
|
FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION + collectOracle.getName() + ".log",
|
||||||
.fileWrite(
|
"\r\n 开始汇总 \r\n" + DateForm.date2StringBysecond(new Date()) + "\r\n");
|
||||||
Configs.EXTRACT_LOG_LOCALTION
|
List<String> rList = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
|
||||||
+ collectOracle.getName()
|
|
||||||
+ ".log",
|
|
||||||
"\r\n 开始汇总 \r\n"
|
|
||||||
+ DateForm
|
|
||||||
.date2StringBysecond(new Date())
|
|
||||||
+ "\r\n");
|
|
||||||
List<String> rList = Constant.ganymedSSH
|
|
||||||
.execCmdWaitAcquiescent(cmd);
|
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
for (String string : rList)
|
for (String string : rList)
|
||||||
sb.append(string).append("\n");
|
sb.append(string).append("\n");
|
||||||
|
|
@ -113,18 +97,14 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
||||||
// "isExtract", "1");
|
// "isExtract", "1");
|
||||||
// //更新oracle汇总状态,0标示为未汇总,1标示汇总中,2标示汇总完成
|
// //更新oracle汇总状态,0标示为未汇总,1标示汇总中,2标示汇总完成
|
||||||
oracleExtract.createDBLink(conn, collectOracle); // 创建dblink
|
oracleExtract.createDBLink(conn, collectOracle); // 创建dblink
|
||||||
oracleExtract.createTableSpace(conn, collectOracle,
|
oracleExtract.createTableSpace(conn, collectOracle, oracleModel); // 创建表空间
|
||||||
oracleModel); // 创建表空间
|
oracleExtract.createUser(conn, collectOracle, oracleModel);// 创建用户并授权
|
||||||
oracleExtract.createUser(conn, collectOracle,
|
oracleExtract.extractColleDB(conn, collectOracle, oracleModel);// 执行抽取
|
||||||
oracleModel);// 创建用户并授权
|
|
||||||
oracleExtract.extractColleDB(conn, collectOracle,
|
|
||||||
oracleModel);// 执行抽取
|
|
||||||
// client.updateOrAddReplicasLabelById(collectOracle.getName(),
|
// client.updateOrAddReplicasLabelById(collectOracle.getName(),
|
||||||
// "isExtract", "2");
|
// "isExtract", "2");
|
||||||
// //更新oracle汇总状态,0标示为未汇总,1标示汇总中,2标示汇总完成
|
// //更新oracle汇总状态,0标示为未汇总,1标示汇总中,2标示汇总完成
|
||||||
cmd = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS
|
cmd = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS + " label --overwrite rc "
|
||||||
+ " label --overwrite rc " + replicasName
|
+ replicasName + " isExtract=2";
|
||||||
+ " isExtract=2";
|
|
||||||
rList = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
|
rList = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
|
||||||
sb = new StringBuffer();
|
sb = new StringBuffer();
|
||||||
for (String string : rList)
|
for (String string : rList)
|
||||||
|
|
@ -132,14 +112,12 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
||||||
Configs.CONSOLE_LOGGER.info(sb.toString());
|
Configs.CONSOLE_LOGGER.info(sb.toString());
|
||||||
data.setExtractStatus(2);
|
data.setExtractStatus(2);
|
||||||
dataInfoDao.updateExtract(data);
|
dataInfoDao.updateExtract(data);
|
||||||
DataInfoEntity tmpdata = dataInfoDao.findById(data
|
DataInfoEntity tmpdata = dataInfoDao.findById(data.getId());
|
||||||
.getId());
|
|
||||||
data.setId(tmpdata.getSrcId());
|
data.setId(tmpdata.getSrcId());
|
||||||
dataInfoDao.updateExtract(data);
|
dataInfoDao.updateExtract(data);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String cmd = "kubectl label --overwrite rc " + replicasName
|
String cmd = "kubectl label --overwrite rc " + replicasName + " isExtract=0";
|
||||||
+ " isExtract=0";
|
|
||||||
Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
|
Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
|
||||||
data.setExtractStatus(0);
|
data.setExtractStatus(0);
|
||||||
dataInfoDao.updateExtract(data);
|
dataInfoDao.updateExtract(data);
|
||||||
|
|
@ -149,33 +127,26 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
||||||
log.error(Custom4exception.OracleSQL_Except, e);
|
log.error(Custom4exception.OracleSQL_Except, e);
|
||||||
} finally {
|
} finally {
|
||||||
// 去掉保存的当前数据id,
|
// 去掉保存的当前数据id,
|
||||||
CacheSetCantDelete.removeExtractId(collectOracle
|
CacheSetCantDelete.removeExtractId(collectOracle.getDataId());
|
||||||
.getDataId());
|
|
||||||
String msg = "汇总结束";
|
String msg = "汇总结束";
|
||||||
if (2 != data.getExtractStatus()) {
|
if (2 != data.getExtractStatus()) {
|
||||||
msg += " 汇总有异常!状态重置为待汇总 ";
|
msg += " 汇总有异常!状态重置为待汇总 ";
|
||||||
data.setExtractStatus(0);
|
data.setExtractStatus(0);
|
||||||
dataInfoDao.updateExtract(data);
|
dataInfoDao.updateExtract(data);
|
||||||
DataInfoEntity tmpdata = dataInfoDao.findById(data
|
DataInfoEntity tmpdata = dataInfoDao.findById(data.getId());
|
||||||
.getId());
|
|
||||||
data.setId(tmpdata.getSrcId());
|
data.setId(tmpdata.getSrcId());
|
||||||
dataInfoDao.updateExtract(data);
|
dataInfoDao.updateExtract(data);
|
||||||
}
|
}
|
||||||
// sql日志记录时间:
|
// sql日志记录时间:
|
||||||
FileOperateHelper.fileWrite(
|
FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION + collectOracle.getName() + ".log",
|
||||||
Configs.EXTRACT_LOG_LOCALTION
|
"\r\n " + msg + " >>>>>>> " + DateForm.date2StringBysecond(new Date()) + "\r\n\r\n\n");
|
||||||
+ collectOracle.getName() + ".log",
|
|
||||||
"\r\n " + msg + " >>>>>>> "
|
|
||||||
+ DateForm.date2StringBysecond(new Date())
|
|
||||||
+ "\r\n\r\n\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isSuccess = true;
|
isSuccess = true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
new CustomException(Custom4exception.OracleSQL_Except, e);
|
new CustomException(Custom4exception.OracleSQL_Except, e);
|
||||||
}
|
} finally {
|
||||||
finally{
|
if (conn != null) {
|
||||||
if(conn != null){
|
|
||||||
try {
|
try {
|
||||||
conn.close();
|
conn.close();
|
||||||
} catch (SQLException e2) {
|
} catch (SQLException e2) {
|
||||||
|
|
@ -188,21 +159,19 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isConnectTotalOracle(GatherOracleInfo oracleModel)
|
public boolean isConnectTotalOracle(GatherOracleInfo oracleModel) throws Exception {
|
||||||
throws Exception {
|
|
||||||
boolean isConnect = false;
|
boolean isConnect = false;
|
||||||
Exception excep = null;
|
Exception excep = null;
|
||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
try {
|
try {
|
||||||
conn = OracleConnector.connectionBuilder(
|
conn = OracleConnector
|
||||||
"jdbc:oracle:thin:@" + oracleModel.getIp() + ":"
|
.connectionBuilder(
|
||||||
+ oracleModel.getPort() + ":"
|
"jdbc:oracle:thin:@" + oracleModel.getIp() + ":" + oracleModel.getPort() + ":"
|
||||||
+ oracleModel.getDatabaseName(), oracleModel.getUser(),
|
+ oracleModel.getDatabaseName(),
|
||||||
oracleModel.getPassword(), null);
|
oracleModel.getUser(), oracleModel.getPassword(), null);
|
||||||
if (null == conn) {
|
if (null == conn) {
|
||||||
isConnect = false;
|
isConnect = false;
|
||||||
throw new CustomException(Custom4exception.connect_Oracle_Except,
|
throw new CustomException(Custom4exception.connect_Oracle_Except, null, oracleModel);
|
||||||
null, oracleModel);
|
|
||||||
// FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION
|
// FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION
|
||||||
// + dataInfolist.get(0).getName(), "创建oracle连接失败: [" + conn +
|
// + dataInfolist.get(0).getName(), "创建oracle连接失败: [" + conn +
|
||||||
// "]\r\n");
|
// "]\r\n");
|
||||||
|
|
@ -211,9 +180,8 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
excep = e;
|
excep = e;
|
||||||
}
|
} finally {
|
||||||
finally{
|
if (conn != null) {
|
||||||
if(conn != null){
|
|
||||||
try {
|
try {
|
||||||
conn.close();// 关闭连接
|
conn.close();// 关闭连接
|
||||||
} catch (Exception e2) {
|
} catch (Exception e2) {
|
||||||
|
|
@ -228,8 +196,7 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean extractStandardTable(String name,
|
public boolean extractStandardTable(String name, List<OracleConnectorParams> dataInfolist,
|
||||||
List<OracleConnectorParams> dataInfolist,
|
|
||||||
GatherOracleInfo oracleConnect) {
|
GatherOracleInfo oracleConnect) {
|
||||||
boolean isSuccess = false;
|
boolean isSuccess = false;
|
||||||
// map转 bean(汇总库信息-带tableName的)
|
// map转 bean(汇总库信息-带tableName的)
|
||||||
|
|
@ -242,42 +209,32 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
try {
|
try {
|
||||||
conn = OracleConnector.connectionBuilder(
|
conn = OracleConnector.connectionBuilder(
|
||||||
"jdbc:oracle:thin:@" + oracleModel.getIp() + ":"
|
"jdbc:oracle:thin:@" + oracleModel.getIp() + ":" + oracleModel.getPort() + ":"
|
||||||
+ oracleModel.getPort() + ":"
|
+ oracleModel.getDatabaseName(),
|
||||||
+ oracleModel.getDatabaseName(), oracleModel.getUser(),
|
oracleModel.getUser(), oracleModel.getPassword(), dataInfolist.get(0));
|
||||||
oracleModel.getPassword(), dataInfolist.get(0));
|
|
||||||
if (null == conn) {
|
if (null == conn) {
|
||||||
FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION
|
FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION + dataInfolist.get(0).getName() + ".log",
|
||||||
+ dataInfolist.get(0).getName() + ".log", "创建oracle连接失败: ["
|
"创建oracle连接失败: [" + conn + "]\r\n");
|
||||||
+ conn + "]\r\n");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (OracleConnectorParams collectOracle : datainfos) {
|
for (OracleConnectorParams collectOracle : datainfos) {
|
||||||
String replicasName = collectOracle.getName();
|
String replicasName = collectOracle.getName();
|
||||||
DataInfoEntity data = new DataInfoEntity();
|
DataInfoEntity data = new DataInfoEntity();
|
||||||
try {
|
try {
|
||||||
if (null != collectOracle.getDataId()
|
if (null != collectOracle.getDataId() && !"".equals(collectOracle.getDataId())) {
|
||||||
&& !"".equals(collectOracle.getDataId())) {
|
|
||||||
data.setId(Integer.valueOf(collectOracle.getDataId()));
|
data.setId(Integer.valueOf(collectOracle.getDataId()));
|
||||||
// 设置为 标准表 抽取中
|
// 设置为 标准表 抽取中
|
||||||
data.setCheckoutFlag(Constant.CHECKOUTFLAG_SIX);
|
data.setCheckoutFlag(Constant.CHECKOUTFLAG_SIX);
|
||||||
data.setStandardExtractStatus("1");
|
data.setStandardExtractStatus("1");
|
||||||
dataInfoDao.update(data);
|
dataInfoDao.update(data);
|
||||||
collectOracle.setName("CQ"
|
collectOracle.setName("CQ" + collectOracle.getName().replace("-", "_"));
|
||||||
+ collectOracle.getName().replace("-", "_"));
|
String cmd = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS + " annotate --overwrite rc "
|
||||||
String cmd = "kubectl --server "
|
+ replicasName + " standardExtractStatus=1";
|
||||||
+ Configs.KUBE_MASTER_ADDRESS
|
|
||||||
+ " annotate --overwrite rc " + replicasName
|
|
||||||
+ " standardExtractStatus=1";
|
|
||||||
// sql日志记录时间:
|
// sql日志记录时间:
|
||||||
FileOperateHelper.fileWrite(
|
FileOperateHelper.fileWrite(
|
||||||
Configs.EXTRACT_STANDARD_LOG_LOCALTION
|
Configs.EXTRACT_STANDARD_LOG_LOCALTION + collectOracle.getName() + ".log",
|
||||||
+ collectOracle.getName() + ".log",
|
"\r\n 开始抽取标准表 \r\n " + DateForm.date2StringBysecond(new Date()) + "\n\r\n");
|
||||||
"\r\n 开始抽取标准表 \r\n "
|
List<String> rList = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
|
||||||
+ DateForm.date2StringBysecond(new Date())
|
|
||||||
+ "\n\r\n");
|
|
||||||
List<String> rList = Constant.ganymedSSH
|
|
||||||
.execCmdWaitAcquiescent(cmd);
|
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
for (String string : rList)
|
for (String string : rList)
|
||||||
sb.append(string).append("\n");
|
sb.append(string).append("\n");
|
||||||
|
|
@ -286,23 +243,30 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
||||||
// "isExtract", "1");
|
// "isExtract", "1");
|
||||||
// //更新oracle汇总状态,0标示为未汇总,1标示汇总中,2标示汇总完成
|
// //更新oracle汇总状态,0标示为未汇总,1标示汇总中,2标示汇总完成
|
||||||
oracleExtract.createStandardDBLink(conn, collectOracle); // 创建dblink
|
oracleExtract.createStandardDBLink(conn, collectOracle); // 创建dblink
|
||||||
oracleExtract.createStardardTableSpace(conn, collectOracle,
|
oracleExtract.createStardardTableSpace(conn, collectOracle, oracleModel); // 创建表空间
|
||||||
oracleModel); // 创建表空间
|
oracleExtract.createUser(conn, collectOracle, oracleModel);// 创建
|
||||||
oracleExtract.createOnlyUser(conn, collectOracle,
|
// 抽取标准表的
|
||||||
oracleModel);// 创建 抽取标准表的 用户并授权
|
// 用户并授权
|
||||||
DataInfoEntity tmpdata = dataInfoDao.findById(data.getId());
|
DataInfoEntity tmpdata = dataInfoDao.findById(data.getId());
|
||||||
|
log.info("查询dataInfo,通过id="+data.getId()+" 结果: "+tmpdata);
|
||||||
if (null != tmpdata) {
|
if (null != tmpdata) {
|
||||||
if (Constant.CHECKOUT_STATUS_THREE.equals(tmpdata
|
log.info("tmpdata.getPayResultLast(): "+tmpdata.getPayResultLast());
|
||||||
.getPayResultLast())
|
// 刚上传的数据必须要在信息系统中先进行校验,才能进行标准表的抽取
|
||||||
|| Constant.CHECKOUT_STATUS_FIVE.equals(tmpdata
|
//TODO 暂不校验
|
||||||
.getPayResultLast())) {
|
if ( true || Constant.CHECKOUT_STATUS_THREE.equals(tmpdata.getPayResultLast())
|
||||||
|
|| Constant.CHECKOUT_STATUS_FIVE.equals(tmpdata.getPayResultLast())
|
||||||
|
|| Constant.CHECKOUT_STATUS_SEVEN.equals(tmpdata.getPayResultLast())) {
|
||||||
|
// 刚上传的数据payResultLast默认为0,以payResult即checkout_pay字段表示是否校验过支付标准表
|
||||||
|
// if
|
||||||
|
// (DataCheckoutStatusEnum.YES.getValue().equals(tmpdata.getPayResult()))
|
||||||
|
// {
|
||||||
// 抽取中
|
// 抽取中
|
||||||
data.setPayResultLast(Constant.CHECKOUT_STATUS_SIX);
|
data.setPayResultLast(Constant.CHECKOUT_STATUS_SIX);
|
||||||
dataInfoDao.update(data);
|
dataInfoDao.update(data);
|
||||||
boolean isExtrac = true;
|
boolean isExtrac = true;
|
||||||
try {
|
try {
|
||||||
oracleExtract.extractStandardPayTable(conn,
|
log.info("开始执行抽取");
|
||||||
collectOracle, oracleModel);// 执行抽取
|
oracleExtract.extractStandardPayTable(conn, collectOracle, oracleModel);// 执行抽取
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 改回 校验存在的状态
|
// 改回 校验存在的状态
|
||||||
data.setPayResultLast(Constant.CHECKOUT_STATUS_THREE);
|
data.setPayResultLast(Constant.CHECKOUT_STATUS_THREE);
|
||||||
|
|
@ -315,17 +279,21 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
||||||
dataInfoDao.update(data);
|
dataInfoDao.update(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Constant.CHECKOUT_STATUS_THREE.equals(tmpdata
|
// 刚上传的数据必须要在信息系统中先进行校验,才能进行标准表的抽取
|
||||||
.getExecResultLast())
|
if (true || Constant.CHECKOUT_STATUS_THREE.equals(tmpdata.getExecResultLast())
|
||||||
|| Constant.CHECKOUT_STATUS_FIVE.equals(tmpdata
|
|| Constant.CHECKOUT_STATUS_FIVE.equals(tmpdata.getExecResultLast())
|
||||||
.getExecResultLast())) {
|
|| Constant.CHECKOUT_STATUS_SEVEN.equals(tmpdata.getExecResultLast())) {
|
||||||
|
|
||||||
|
// 刚上传的数据execResultLast默认为0,以execResult即checkout_indicate字段表示是否校验过执行标准表
|
||||||
|
// if
|
||||||
|
// (DataCheckoutStatusEnum.YES.getValue().equals(tmpdata.getExecResult()))
|
||||||
|
// {
|
||||||
// 抽取中
|
// 抽取中
|
||||||
data.setExecResultLast(Constant.CHECKOUT_STATUS_SIX);
|
data.setExecResultLast(Constant.CHECKOUT_STATUS_SIX);
|
||||||
dataInfoDao.update(data);
|
dataInfoDao.update(data);
|
||||||
boolean isExtrac = true;
|
boolean isExtrac = true;
|
||||||
try {
|
try {
|
||||||
oracleExtract.extractStandardExecTable(conn,
|
oracleExtract.extractStandardExecTable(conn, collectOracle, oracleModel);// 执行抽取
|
||||||
collectOracle, oracleModel);// 执行抽取
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 改回 校验存在的状态
|
// 改回 校验存在的状态
|
||||||
data.setExecResultLast(Constant.CHECKOUT_STATUS_THREE);
|
data.setExecResultLast(Constant.CHECKOUT_STATUS_THREE);
|
||||||
|
|
@ -337,12 +305,13 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
||||||
dataInfoDao.update(data);
|
dataInfoDao.update(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// client.updateOrAddReplicasLabelById(collectOracle.getName(),
|
|
||||||
// "isExtract", "2");
|
// 抽取其他标准表
|
||||||
// //更新oracle汇总状态,0标示为未汇总,1标示汇总中,2标示汇总完成
|
oracleExtract.extractOtherStandardTable(conn, collectOracle, oracleModel);
|
||||||
cmd = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS
|
|
||||||
+ " annotate --overwrite rc " + replicasName
|
// 更新oracle汇总状态,0标示为未汇总,1标示汇总中,2标示汇总完成
|
||||||
+ " standardExtractStatus=2";
|
cmd = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS + " annotate --overwrite rc "
|
||||||
|
+ replicasName + " standardExtractStatus=2";
|
||||||
rList = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
|
rList = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
|
||||||
sb = new StringBuffer();
|
sb = new StringBuffer();
|
||||||
for (String string : rList)
|
for (String string : rList)
|
||||||
|
|
@ -351,17 +320,15 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
||||||
data.setCheckoutFlag(Constant.CHECKOUTFLAG_SEVEN);
|
data.setCheckoutFlag(Constant.CHECKOUTFLAG_SEVEN);
|
||||||
data.setStandardExtractStatus("2");
|
data.setStandardExtractStatus("2");
|
||||||
dataInfoDao.update(data);
|
dataInfoDao.update(data);
|
||||||
DataInfoEntity tmpSrcData = dataInfoDao.findById(data
|
DataInfoEntity tmpSrcData = dataInfoDao.findById(data.getId());
|
||||||
.getId());
|
|
||||||
data.setId(tmpSrcData.getSrcId());
|
data.setId(tmpSrcData.getSrcId());
|
||||||
dataInfoDao.update(data);
|
dataInfoDao.update(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
log.error(ExceptionMsg.exceptionStackToStr(e));
|
||||||
String cmd = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS
|
String cmd = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS + " annotate --overwrite rc "
|
||||||
+ " annotate --overwrite rc " + replicasName
|
+ replicasName + " standardExtractStatus=0";
|
||||||
+ " standardExtractStatus=0";
|
|
||||||
Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
|
Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
|
||||||
data.setStandardExtractStatus("0");
|
data.setStandardExtractStatus("0");
|
||||||
dataInfoDao.update(data);
|
dataInfoDao.update(data);
|
||||||
|
|
@ -384,19 +351,15 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
||||||
// sql日志记录时间:
|
// sql日志记录时间:
|
||||||
// sql日志记录时间:
|
// sql日志记录时间:
|
||||||
FileOperateHelper.fileWrite(
|
FileOperateHelper.fileWrite(
|
||||||
Configs.EXTRACT_STANDARD_LOG_LOCALTION
|
Configs.EXTRACT_STANDARD_LOG_LOCALTION + collectOracle.getName() + ".log",
|
||||||
+ collectOracle.getName() + ".log",
|
" " + msg + " >>>>> " + DateForm.date2StringBysecond(new Date()) + "\r\n\r\n\n");
|
||||||
" " + msg + " >>>>> "
|
|
||||||
+ DateForm.date2StringBysecond(new Date())
|
|
||||||
+ "\r\n\r\n\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO: handle exception
|
log.error(ExceptionMsg.exceptionStackToStr(e));
|
||||||
}
|
} finally {
|
||||||
finally{
|
if (conn != null) {
|
||||||
if(conn != null){
|
|
||||||
try {
|
try {
|
||||||
conn.close();// 关闭连接
|
conn.close();// 关闭连接
|
||||||
} catch (Exception e2) {
|
} catch (Exception e2) {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -18,9 +17,9 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.platform.dao.IRegionalismCodeDao;
|
|
||||||
import com.platform.dao.ISystemCodeDao;
|
|
||||||
import com.platform.dao.PreDataInfoDao;
|
import com.platform.dao.PreDataInfoDao;
|
||||||
|
import com.platform.dao.RegionalismCodeDao;
|
||||||
|
import com.platform.dao.SystemCodeDao;
|
||||||
import com.platform.entities.PreDataInfo;
|
import com.platform.entities.PreDataInfo;
|
||||||
import com.platform.entities.RegionalismEntity;
|
import com.platform.entities.RegionalismEntity;
|
||||||
import com.platform.entities.SystemEntity;
|
import com.platform.entities.SystemEntity;
|
||||||
|
|
@ -34,24 +33,23 @@ import com.platform.utils.excelUtils.ExcelOperation;
|
||||||
|
|
||||||
@Service(value = "preDataInfoService")
|
@Service(value = "preDataInfoService")
|
||||||
public class PreDataInfoServiceImpl implements IPreDataInfoService {
|
public class PreDataInfoServiceImpl implements IPreDataInfoService {
|
||||||
|
|
||||||
public final static Logger log = Configs.DAILY_ROLLING_LOGGER.getLogger(PreDataInfoServiceImpl.class);
|
public final static Logger log = Configs.DAILY_ROLLING_LOGGER.getLogger(PreDataInfoServiceImpl.class);
|
||||||
|
|
||||||
@Resource(name = "preDataInfoDao")
|
@Resource(name = "preDataInfoDao")
|
||||||
private PreDataInfoDao preDataInfoDao;
|
private PreDataInfoDao preDataInfoDao;
|
||||||
|
|
||||||
@Resource(name = "systemCodeDao")
|
@Resource(name = "systemCodeDao")
|
||||||
private ISystemCodeDao systemCodeDao;
|
private SystemCodeDao systemCodeDao;
|
||||||
|
|
||||||
@Resource(name = "regionalismCodeDao")
|
@Resource(name = "regionalismCodeDao")
|
||||||
private IRegionalismCodeDao regionalismCodeDao;
|
private RegionalismCodeDao regionalismCodeDao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PreDataInfo> findAll() throws Exception {
|
public List<PreDataInfo> findAll() throws Exception {
|
||||||
List<PreDataInfo> result = preDataInfoDao.findAll();
|
List<PreDataInfo> result = preDataInfoDao.findAll();
|
||||||
Map<String, String> sqlFilePathsStandard = new HashMap<String, String>();
|
Map<String, String> sqlFilePathsStandard = new HashMap<String, String>();
|
||||||
sqlFilePathsStandard = getAllFile(sqlFilePathsStandard,
|
sqlFilePathsStandard = getAllFile(sqlFilePathsStandard, Configs.SQL_SCRIPT_PATH_STANDARD);
|
||||||
Configs.SQL_SCRIPT_PATH_STANDARD);
|
|
||||||
setScript(result, sqlFilePathsStandard);
|
setScript(result, sqlFilePathsStandard);
|
||||||
for (PreDataInfo preDataInfo : result) {
|
for (PreDataInfo preDataInfo : result) {
|
||||||
preDataInfo.reSetWorkRange(new ArrayList<String>());
|
preDataInfo.reSetWorkRange(new ArrayList<String>());
|
||||||
|
|
@ -75,28 +73,28 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
|
||||||
List<HashMap<String, Object>> rowErr = new ArrayList<HashMap<String, Object>>();
|
List<HashMap<String, Object>> rowErr = new ArrayList<HashMap<String, Object>>();
|
||||||
// 待增加的
|
// 待增加的
|
||||||
List<PreDataInfo> all2Insert = new ArrayList<PreDataInfo>();
|
List<PreDataInfo> all2Insert = new ArrayList<PreDataInfo>();
|
||||||
//excel读出的 所有
|
// excel读出的 所有
|
||||||
List<PreDataInfo> all = new ArrayList<PreDataInfo>();
|
List<PreDataInfo> all = new ArrayList<PreDataInfo>();
|
||||||
//excel读出的 所有修改操作的数据
|
// excel读出的 所有修改操作的数据
|
||||||
List<PreDataInfo> list4Update = new ArrayList<PreDataInfo>();
|
List<PreDataInfo> list4Update = new ArrayList<PreDataInfo>();
|
||||||
//excel读出的 所有新增地区操作的数据
|
// excel读出的 所有新增地区操作的数据
|
||||||
List<PreDataInfo> list4AddArea = new ArrayList<PreDataInfo>();
|
List<PreDataInfo> list4AddArea = new ArrayList<PreDataInfo>();
|
||||||
//excel读出的 所有新增系统操作的数据
|
// excel读出的 所有新增系统操作的数据
|
||||||
List<PreDataInfo> list4AddSystem = new ArrayList<PreDataInfo>();
|
List<PreDataInfo> list4AddSystem = new ArrayList<PreDataInfo>();
|
||||||
for (String filePath : paths) {
|
for (String filePath : paths) {
|
||||||
// file.temp 文件存在? 存在则删除 file,且读入 file.temp
|
// file.temp 文件存在? 存在则删除 file,且读入 file.temp
|
||||||
//读取完后删除源文件(不管是否成功导入)
|
// 读取完后删除源文件(不管是否成功导入)
|
||||||
XSSFWorkbook workbook = null;
|
XSSFWorkbook workbook = null;
|
||||||
File tmpf = new File(filePath + ".temp");
|
File tmpf = new File(filePath + ".temp");
|
||||||
File f = new File(filePath);
|
File file = new File(filePath);
|
||||||
String errMsg= "读取失败,请使用标准的excel模板,编辑后再导入";
|
String errMsg = "读取失败,请使用标准的excel模板,编辑后再导入";
|
||||||
// file.temp 文件存在
|
// file.temp 文件存在
|
||||||
if (tmpf.exists()) {
|
if (tmpf.exists()) {
|
||||||
//删除 file
|
// 删除 file
|
||||||
try {
|
try {
|
||||||
workbook = new XSSFWorkbook(tmpf);
|
workbook = new XSSFWorkbook(tmpf);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("["+filePath+ errMsg);
|
log.error("[" + filePath + errMsg);
|
||||||
log.error(e);
|
log.error(e);
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
map.put("name", tmpf.getName());
|
map.put("name", tmpf.getName());
|
||||||
|
|
@ -104,45 +102,47 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
|
||||||
errFile.add((HashMap<String, Object>) map);
|
errFile.add((HashMap<String, Object>) map);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
if (!file.exists()) {
|
||||||
if (!f.exists()) {
|
|
||||||
log.error(filePath + ",文件 不存在!");
|
log.error(filePath + ",文件 不存在!");
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
map.put("name", f.getName());
|
map.put("name", file.getName());
|
||||||
map.put("value", "文件 不存在!");
|
map.put("value", "文件 不存在!");
|
||||||
errFile.add((HashMap<String, Object>) map);
|
errFile.add((HashMap<String, Object>) map);
|
||||||
continue;
|
continue;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
try {
|
try {
|
||||||
workbook = new XSSFWorkbook(f);
|
workbook = new XSSFWorkbook(file);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("["+filePath+errMsg);
|
log.error("[" + filePath + errMsg);
|
||||||
log.error(e);
|
log.error(e);
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
map.put("name", f.getName());
|
map.put("name", file.getName());
|
||||||
map.put("value", errMsg);
|
map.put("value", errMsg);
|
||||||
errFile.add((HashMap<String, Object>) map);
|
errFile.add((HashMap<String, Object>) map);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Excel导入
|
// Excel导入
|
||||||
try {
|
try {
|
||||||
PreDataInfo pre = new PreDataInfo();
|
PreDataInfo pre = new PreDataInfo();
|
||||||
//excel数据 --> java bean
|
// excel数据 --> java bean
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<PreDataInfo> subPreData = ExcelOperation.readExcel4Update(workbook, Constant.EXCEL_TEMPLATE_INIT_ROW, 0, "["+f.getName()+"] ", rowErr,pre, "id", "dataId", "workRange","sysCode","updateTime","userTablespaceStatus", "checkoutIndicateStatus", "checkoutPayStatus", "userTablespacePath", "checkoutIndicatePath", "checkoutPayPath", "sqlList", "dataVersion", "collectingTime", "collUpdate");
|
List<PreDataInfo> subPreData = ExcelOperation.readExcel4Update(workbook,
|
||||||
|
Constant.EXCEL_TEMPLATE_INIT_ROW, 0, "[" + file.getName() + "] ", rowErr, pre, "id", "dataId",
|
||||||
|
"workRange", "sysCode", "updateTime", "userTablespaceStatus", "checkoutIndicateStatus",
|
||||||
|
"checkoutPayStatus", "userTablespacePath", "checkoutIndicatePath", "checkoutPayPath", "sqlList",
|
||||||
|
"dataVersion", "collectingTime", "collUpdate");
|
||||||
if (null != subPreData && subPreData.size() > 0) {
|
if (null != subPreData && subPreData.size() > 0) {
|
||||||
// 是否是 同一个县区的 系统--是则 加入
|
// 是否是 同一个县区的 系统--是则 加入
|
||||||
boolean isSameArea = true;
|
boolean isSameArea = true;
|
||||||
String areaCode = subPreData.get(0).getAreaCode();
|
String areaCode = subPreData.get(0).getAreaCode();
|
||||||
for (PreDataInfo preDataInfo : subPreData) {
|
for (PreDataInfo preDataInfo : subPreData) {
|
||||||
if (!areaCode.equals(preDataInfo.getAreaCode())) {
|
if (!areaCode.equals(preDataInfo.getAreaCode())) {
|
||||||
// TODO 不是同一个地区: isSameArea = false;
|
// TODO 不是同一个地区: isSameArea = false;
|
||||||
// isSameArea = false;
|
// isSameArea = false;
|
||||||
// errArea.add(areaCode);
|
// errArea.add(areaCode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -154,19 +154,19 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e);
|
log.error(e);
|
||||||
}
|
}
|
||||||
// finally{
|
// finally{
|
||||||
// if (null != workbook) {
|
// if (null != workbook) {
|
||||||
// workbook.close();
|
// workbook.close();
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
//根据 操作 类别 分类(修改, 新增行政区划,新增信息系统)
|
// 根据 操作 类别 分类(修改, 新增行政区划,新增信息系统)
|
||||||
if (all.size() > 0) {
|
if (all.size() > 0) {
|
||||||
for (PreDataInfo preDataInfo : all) {
|
for (PreDataInfo preDataInfo : all) {
|
||||||
String sysName = preDataInfo.getSysName();
|
String sysName = preDataInfo.getSysName();
|
||||||
boolean iserr = false;
|
boolean iserr = false;
|
||||||
if (null == sysName ) {
|
if (null == sysName) {
|
||||||
iserr = true;
|
iserr = true;
|
||||||
}
|
}
|
||||||
if (sysName.contains("\\")) {
|
if (sysName.contains("\\")) {
|
||||||
|
|
@ -199,37 +199,37 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
|
||||||
if (iserr) {
|
if (iserr) {
|
||||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||||
map.put("value", "系统名称不能使用?*\":<>|/\\");
|
map.put("value", "系统名称不能使用?*\":<>|/\\");
|
||||||
map.put("name", preDataInfo.getCityName()+"-"+preDataInfo.getDistrictName()+"-"+preDataInfo.getSysName());
|
map.put("name", preDataInfo.getCityName() + "-" + preDataInfo.getDistrictName() + "-"
|
||||||
|
+ preDataInfo.getSysName());
|
||||||
rowErr.add(map);
|
rowErr.add(map);
|
||||||
}
|
}
|
||||||
String updateType = preDataInfo.getIsupdate();
|
String updateType = preDataInfo.getIsupdate();
|
||||||
switch (updateType)
|
switch (updateType) {
|
||||||
{
|
case Constant.preDataInfo_add_system:
|
||||||
case Constant.preDataInfo_add_system:
|
list4AddSystem.add(preDataInfo);
|
||||||
list4AddSystem.add(preDataInfo);
|
break;
|
||||||
break;
|
|
||||||
|
case Constant.preDataInfo_add_area:
|
||||||
case Constant.preDataInfo_add_area:
|
list4AddArea.add(preDataInfo);
|
||||||
list4AddArea.add(preDataInfo);
|
break;
|
||||||
break;
|
|
||||||
|
case Constant.preDataInfo_update:
|
||||||
case Constant.preDataInfo_update:
|
list4Update.add(preDataInfo);
|
||||||
list4Update.add(preDataInfo);
|
break;
|
||||||
break;
|
|
||||||
|
default:
|
||||||
default:
|
break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查 地区 是否没有-(没有则添加新地区):
|
// 查 地区 是否没有-(没有则添加新地区):
|
||||||
if (list4AddArea.size() > 0) {
|
if (list4AddArea.size() > 0) {
|
||||||
this.addArea(list4AddArea, rowErr);
|
this.addArea(list4AddArea, rowErr);
|
||||||
}
|
}
|
||||||
if (errFile.size() > 0) {
|
if (errFile.size() > 0) {
|
||||||
rowErr.addAll(errFile);
|
rowErr.addAll(errFile);
|
||||||
// errmap.put("err",errFile);
|
// errmap.put("err",errFile);
|
||||||
}
|
}
|
||||||
if (rowErr.size() > 0) {
|
if (rowErr.size() > 0) {
|
||||||
errmap.put("err", rowErr);
|
errmap.put("err", rowErr);
|
||||||
|
|
@ -241,27 +241,27 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
|
||||||
errmap.put("system", list4AddSystem.size());
|
errmap.put("system", list4AddSystem.size());
|
||||||
errmap.put("area", list4AddArea.size());
|
errmap.put("area", list4AddArea.size());
|
||||||
errmap.put("update", list4Update.size());
|
errmap.put("update", list4Update.size());
|
||||||
|
|
||||||
//在 pre_data_info表中 新增 操作为(新增行政区划)的系统 -- start
|
// 在 pre_data_info表中 新增 操作为(新增行政区划)的系统 -- start
|
||||||
List<PreDataInfo> allAreaInsert = new ArrayList<PreDataInfo>();
|
List<PreDataInfo> allAreaInsert = new ArrayList<PreDataInfo>();
|
||||||
List<String> sysNamesArea = new ArrayList<String>();
|
List<String> sysNamesArea = new ArrayList<String>();
|
||||||
for (PreDataInfo preDataInfo : list4AddArea) {
|
for (PreDataInfo preDataInfo : list4AddArea) {
|
||||||
sysNamesArea.add(preDataInfo.getSysName());
|
sysNamesArea.add(preDataInfo.getSysName());
|
||||||
}
|
}
|
||||||
//查询系统的code。
|
// 查询系统的code。
|
||||||
List<SystemEntity> listSystem = new ArrayList<SystemEntity>();
|
List<SystemEntity> listSystem = new ArrayList<SystemEntity>();
|
||||||
Map<String, Integer> syscodeMap = new HashMap<String, Integer>();
|
Map<String, Integer> syscodeMap = new HashMap<String, Integer>();
|
||||||
// 去掉 已经导入的系统。。(例如 excel反复导入)
|
// 去掉 已经导入的系统。。(例如 excel反复导入)
|
||||||
//在 pre_data_info表中 新增 操作为(新增行政区划)的系统
|
// 在 pre_data_info表中 新增 操作为(新增行政区划)的系统
|
||||||
allAreaInsert = this.removeRepeat(list4AddArea);
|
allAreaInsert = this.removeRepeat(list4AddArea);
|
||||||
if (allAreaInsert.size() > 0) {
|
if (allAreaInsert.size() > 0) {
|
||||||
list4AddSystem.addAll(allAreaInsert);
|
list4AddSystem.addAll(allAreaInsert);
|
||||||
}
|
}
|
||||||
// 查系统 是否没有-(没有则在 pre_data_info添加新系统):
|
// 查系统 是否没有-(没有则在 pre_data_info添加新系统):
|
||||||
if (list4AddSystem.size() > 0) {
|
if (list4AddSystem.size() > 0) {
|
||||||
//新增系统
|
// 新增系统
|
||||||
this.AddSystem(list4AddSystem);
|
this.AddSystem(list4AddSystem);
|
||||||
List<String> sysNames = new ArrayList<String>();
|
List<String> sysNames = new ArrayList<String>();
|
||||||
for (PreDataInfo preDataInfo : list4AddSystem) {
|
for (PreDataInfo preDataInfo : list4AddSystem) {
|
||||||
sysNames.add(preDataInfo.getSysName());
|
sysNames.add(preDataInfo.getSysName());
|
||||||
}
|
}
|
||||||
|
|
@ -273,42 +273,42 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
|
||||||
for (SystemEntity systemEntity : listSystem) {
|
for (SystemEntity systemEntity : listSystem) {
|
||||||
syscodeMap.put(systemEntity.getSystemName(), systemEntity.getCode());
|
syscodeMap.put(systemEntity.getSystemName(), systemEntity.getCode());
|
||||||
}
|
}
|
||||||
for ( PreDataInfo systemEntity : list4AddSystem) {
|
for (PreDataInfo systemEntity : list4AddSystem) {
|
||||||
PreDataInfo systemFull = new PreDataInfo();
|
PreDataInfo systemFull = new PreDataInfo();
|
||||||
BeanCopy.copyBean(systemEntity, systemFull);
|
BeanCopy.copyBean(systemEntity, systemFull);
|
||||||
if (syscodeMap.containsKey(systemFull.getSysName())) {
|
if (syscodeMap.containsKey(systemFull.getSysName())) {
|
||||||
systemFull.setSysCode(syscodeMap.get(systemFull.getSysName()));
|
systemFull.setSysCode(syscodeMap.get(systemFull.getSysName()));
|
||||||
systemFull.setUpdateTime(DateForm.date2StringBysecond(new Date()));
|
systemFull.setUpdateTime(DateForm.date2StringBysecond(new Date()));
|
||||||
all2Insert.add(systemFull);
|
all2Insert.add(systemFull);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||||
map.put("value", "无此系统,请新增");
|
map.put("value", "无此系统,请新增");
|
||||||
map.put("name", systemEntity.getCityName()+"-"+systemEntity.getDistrictName()+"-"+systemEntity.getSysName());
|
map.put("name", systemEntity.getCityName() + "-" + systemEntity.getDistrictName() + "-"
|
||||||
|
+ systemEntity.getSysName());
|
||||||
rowErr.add(map);
|
rowErr.add(map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//去掉 已经导入的系统。。(例如 excel反复导入)
|
// 去掉 已经导入的系统。。(例如 excel反复导入)
|
||||||
//在 pre_data_info表中 新增 操作为(新增信息系统)的系统
|
// 在 pre_data_info表中 新增 操作为(新增信息系统)的系统
|
||||||
all2Insert = this.removeRepeat(all2Insert);
|
all2Insert = this.removeRepeat(all2Insert);
|
||||||
if (all2Insert.size() > 0) {
|
if (all2Insert.size() > 0) {
|
||||||
insertBatch(all2Insert,rowErr);
|
insertBatch(all2Insert, rowErr);
|
||||||
if (rowErr.size() > 0) {
|
if (rowErr.size() > 0) {
|
||||||
errmap.put("err",rowErr);
|
errmap.put("err", rowErr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//在 pre_data_info表中 新增 操作为(新增行政区划)的系统 -- end
|
// 在 pre_data_info表中 新增 操作为(新增行政区划)的系统 -- end
|
||||||
//在 pre_data_info表中 更新 操作为 (修改) 的系统
|
// 在 pre_data_info表中 更新 操作为 (修改) 的系统
|
||||||
if (list4Update.size() > 0) {
|
if (list4Update.size() > 0) {
|
||||||
// 待修改的
|
// 待修改的
|
||||||
List<PreDataInfo> allUpdate = new ArrayList<PreDataInfo>();
|
List<PreDataInfo> allUpdate = new ArrayList<PreDataInfo>();
|
||||||
// 查询系统 code
|
// 查询系统 code
|
||||||
for (PreDataInfo preDataInfo : list4Update) {
|
for (PreDataInfo preDataInfo : list4Update) {
|
||||||
sysNamesArea.add(preDataInfo.getSysName());
|
sysNamesArea.add(preDataInfo.getSysName());
|
||||||
}
|
}
|
||||||
//查询系统的code。
|
// 查询系统的code。
|
||||||
List<SystemEntity> listSystem4Update = new ArrayList<SystemEntity>();
|
List<SystemEntity> listSystem4Update = new ArrayList<SystemEntity>();
|
||||||
if (sysNamesArea.size() > 0) {
|
if (sysNamesArea.size() > 0) {
|
||||||
listSystem4Update = systemCodeDao.findByName(sysNamesArea);
|
listSystem4Update = systemCodeDao.findByName(sysNamesArea);
|
||||||
|
|
@ -323,72 +323,77 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
|
||||||
UpdateFull.setSysCode(syscodeMap.get(UpdateFull.getSysName()));
|
UpdateFull.setSysCode(syscodeMap.get(UpdateFull.getSysName()));
|
||||||
UpdateFull.setUpdateTime(DateForm.date2StringBysecond(new Date()));
|
UpdateFull.setUpdateTime(DateForm.date2StringBysecond(new Date()));
|
||||||
allUpdate.add(UpdateFull);
|
allUpdate.add(UpdateFull);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||||
map.put("value", "无此系统,请新增");
|
map.put("value", "无此系统,请新增");
|
||||||
map.put("name", preUpdate.getCityName()+"-"+preUpdate.getDistrictName()+"-"+preUpdate.getSysName());
|
map.put("name",
|
||||||
|
preUpdate.getCityName() + "-" + preUpdate.getDistrictName() + "-" + preUpdate.getSysName());
|
||||||
rowErr.add(map);
|
rowErr.add(map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 更新
|
// 更新
|
||||||
for (PreDataInfo preEntity : allUpdate) {
|
for (PreDataInfo preEntity : allUpdate) {
|
||||||
try{
|
try {
|
||||||
preDataInfoDao.update(preEntity);
|
preDataInfoDao.update(preEntity);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch(Exception e){
|
|
||||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||||
map.put("value", "请检查是否有填写错误,比如:错别字、超出范围等");
|
map.put("value", "请检查是否有填写错误,比如:错别字、超出范围等");
|
||||||
map.put("name", preEntity.getAreaCode()+"-"+preEntity.getCityName()+"-"+preEntity.getDistrictName()+"-"+preEntity.getSysName());
|
map.put("name", preEntity.getAreaCode() + "-" + preEntity.getCityName() + "-"
|
||||||
log.error(preEntity.getAreaCode()+"-"+preEntity.getCityName()+"-"+preEntity.getDistrictName()+"-"+preEntity.getSysName());
|
+ preEntity.getDistrictName() + "-" + preEntity.getSysName());
|
||||||
|
log.error(preEntity.getAreaCode() + "-" + preEntity.getCityName() + "-"
|
||||||
|
+ preEntity.getDistrictName() + "-" + preEntity.getSysName());
|
||||||
rowErr.add(map);
|
rowErr.add(map);
|
||||||
log.error(e);
|
log.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rowErr.size() > 0 && !errmap.keySet().contains("err")) {
|
if (rowErr.size() > 0 && !errmap.keySet().contains("err")) {
|
||||||
errmap.put("err",rowErr);
|
errmap.put("err", rowErr);
|
||||||
}
|
}
|
||||||
return errmap;
|
return errmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, List> exportExcel(String path) throws Exception {
|
|
||||||
Map<String, List> map = new HashMap<String, List>();
|
|
||||||
List<String> errList = new ArrayList<String>();
|
|
||||||
List<PreDataInfo> list = findAll();
|
|
||||||
ClassPathResource res = new ClassPathResource(Constant.SYSTEM_INFO_EXCEL_TEMPLATE_FIEL_PATH);
|
|
||||||
//此处 耗时太久:(原因:excel 2007 以后采用的方式不同造成的建议升级 到 poi 3.15以上)
|
|
||||||
XSSFWorkbook workbook = null;
|
|
||||||
XSSFWorkbook result = null;
|
|
||||||
try {
|
|
||||||
workbook = new XSSFWorkbook(res.getInputStream());
|
|
||||||
result = ExcelOperation.writeExcelTemplate(workbook, Constant.EXCEL_TEMPLATE_INIT_ROW, 0, 25, list, "id", "dataId", "workRange","sysCode","updateTime","userTablespaceStatus", "checkoutIndicateStatus", "checkoutPayStatus", "userTablespacePath", "checkoutIndicatePath", "checkoutPayPath", "sqlList", "dataVersion", "collectingTime", "collUpdate");
|
|
||||||
} catch (Exception e) {
|
|
||||||
errList.add(e.getMessage());
|
|
||||||
}
|
|
||||||
//不能进行close,
|
|
||||||
FileOutputStream fileOut = null;
|
|
||||||
try {
|
|
||||||
File f = new File(path);
|
|
||||||
f.createNewFile();
|
|
||||||
fileOut = new FileOutputStream(f);
|
|
||||||
result.write(fileOut);
|
|
||||||
} catch (IOException e) {
|
|
||||||
errList.add(e.getMessage());
|
|
||||||
}
|
|
||||||
finally{
|
|
||||||
if (null != fileOut) {
|
|
||||||
fileOut.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (errList.size() > 0) {
|
|
||||||
map.put("err", errList);
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 给system_info增加新系统
|
@Override
|
||||||
|
public Map<String, List> exportExcel(String path) throws Exception {
|
||||||
|
Map<String, List> map = new HashMap<String, List>();
|
||||||
|
List<String> errList = new ArrayList<String>();
|
||||||
|
List<PreDataInfo> list = findAll();
|
||||||
|
ClassPathResource res = new ClassPathResource(Constant.SYSTEM_INFO_EXCEL_TEMPLATE_FIEL_PATH);
|
||||||
|
// 此处 耗时太久:(原因:excel 2007 以后采用的方式不同造成的建议升级 到 poi 3.15以上)
|
||||||
|
XSSFWorkbook workbook = null;
|
||||||
|
XSSFWorkbook result = null;
|
||||||
|
try {
|
||||||
|
workbook = new XSSFWorkbook(res.getInputStream());
|
||||||
|
result = ExcelOperation.writeExcelTemplate(workbook, Constant.EXCEL_TEMPLATE_INIT_ROW, 0, 25, list, "id",
|
||||||
|
"dataId", "workRange", "sysCode", "updateTime", "userTablespaceStatus", "checkoutIndicateStatus",
|
||||||
|
"checkoutPayStatus", "userTablespacePath", "checkoutIndicatePath", "checkoutPayPath", "sqlList",
|
||||||
|
"dataVersion", "collectingTime", "collUpdate");
|
||||||
|
} catch (Exception e) {
|
||||||
|
errList.add(e.getMessage());
|
||||||
|
}
|
||||||
|
// 不能进行close,
|
||||||
|
FileOutputStream fileOut = null;
|
||||||
|
try {
|
||||||
|
File f = new File(path);
|
||||||
|
f.createNewFile();
|
||||||
|
fileOut = new FileOutputStream(f);
|
||||||
|
result.write(fileOut);
|
||||||
|
} catch (IOException e) {
|
||||||
|
errList.add(e.getMessage());
|
||||||
|
} finally {
|
||||||
|
if (null != fileOut) {
|
||||||
|
fileOut.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (errList.size() > 0) {
|
||||||
|
map.put("err", errList);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给system_info增加新系统
|
||||||
|
*
|
||||||
* @param list4AddSystem
|
* @param list4AddSystem
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
|
@ -396,22 +401,22 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
|
||||||
private int AddSystem(List<PreDataInfo> list4AddSystem) throws Exception {
|
private int AddSystem(List<PreDataInfo> list4AddSystem) throws Exception {
|
||||||
int insertNum = 0;
|
int insertNum = 0;
|
||||||
// 查系统 是否没有-(没有则添加新系统):
|
// 查系统 是否没有-(没有则添加新系统):
|
||||||
List<String> sysNames = new ArrayList<String>();
|
List<String> sysNames = new ArrayList<String>();
|
||||||
for (PreDataInfo preDataInfo : list4AddSystem) {
|
for (PreDataInfo preDataInfo : list4AddSystem) {
|
||||||
sysNames.add(preDataInfo.getSysName());
|
sysNames.add(preDataInfo.getSysName());
|
||||||
}
|
}
|
||||||
// 判断-是否存在该系统
|
// 判断-是否存在该系统
|
||||||
if (sysNames.size() > 0) {
|
if (sysNames.size() > 0) {
|
||||||
//数据库 已存在的 系统
|
// 数据库 已存在的 系统
|
||||||
List<SystemEntity> listSystem = systemCodeDao.findByName(sysNames);
|
List<SystemEntity> listSystem = systemCodeDao.findByName(sysNames);
|
||||||
List<String> existSysNames = new ArrayList<String>();
|
List<String> existSysNames = new ArrayList<String>();
|
||||||
if (null != listSystem) {
|
if (null != listSystem) {
|
||||||
for ( SystemEntity systemEntity : listSystem) {
|
for (SystemEntity systemEntity : listSystem) {
|
||||||
existSysNames.add(systemEntity.getSystemName());
|
existSysNames.add(systemEntity.getSystemName());
|
||||||
}
|
}
|
||||||
sysNames.removeAll(existSysNames);
|
sysNames.removeAll(existSysNames);
|
||||||
}
|
}
|
||||||
////数据库 不存在的 系统-(添加新系统)
|
//// 数据库 不存在的 系统-(添加新系统)
|
||||||
if (sysNames.size() > 0) {
|
if (sysNames.size() > 0) {
|
||||||
systemCodeDao.insertBatch(sysNames);
|
systemCodeDao.insertBatch(sysNames);
|
||||||
insertNum = sysNames.size();
|
insertNum = sysNames.size();
|
||||||
|
|
@ -419,16 +424,19 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
|
||||||
}
|
}
|
||||||
return insertNum;
|
return insertNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 新增地区
|
/**
|
||||||
* @param list4AddArea 待新增地区的列表
|
* 新增地区
|
||||||
|
*
|
||||||
|
* @param list4AddArea
|
||||||
|
* 待新增地区的列表
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private int addArea(List<PreDataInfo> list4AddArea, List<HashMap<String, Object>> err)throws Exception {
|
private int addArea(List<PreDataInfo> list4AddArea, List<HashMap<String, Object>> err) throws Exception {
|
||||||
int insertNum = 0;
|
int insertNum = 0;
|
||||||
List<String> areacodeList = new ArrayList<String>();
|
List<String> areacodeList = new ArrayList<String>();
|
||||||
Map<String,RegionalismEntity> areaMap = new HashMap<String, RegionalismEntity>();
|
Map<String, RegionalismEntity> areaMap = new HashMap<String, RegionalismEntity>();
|
||||||
for (PreDataInfo preDataInfo : list4AddArea) {
|
for (PreDataInfo preDataInfo : list4AddArea) {
|
||||||
// areacodeList 存放 地区code
|
// areacodeList 存放 地区code
|
||||||
areacodeList.add(preDataInfo.getAreaCode().toLowerCase());
|
areacodeList.add(preDataInfo.getAreaCode().toLowerCase());
|
||||||
|
|
@ -441,20 +449,21 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
|
||||||
List<RegionalismEntity> existEntity = regionalismCodeDao.findExistRegionalism(areacodeList);
|
List<RegionalismEntity> existEntity = regionalismCodeDao.findExistRegionalism(areacodeList);
|
||||||
for (RegionalismEntity regionalismEntity : existEntity) {
|
for (RegionalismEntity regionalismEntity : existEntity) {
|
||||||
insertNum = -1;
|
insertNum = -1;
|
||||||
//去掉重复的地区
|
// 去掉重复的地区
|
||||||
areaMap.remove(regionalismEntity.getCode());
|
areaMap.remove(regionalismEntity.getCode());
|
||||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||||
map.put("value", "新增的地区已存在");
|
map.put("value", "新增的地区已存在");
|
||||||
map.put("name", regionalismEntity.getCode()+"-"+regionalismEntity.getCityName()+"-"+regionalismEntity.getDistrictName());
|
map.put("name", regionalismEntity.getCode() + "-" + regionalismEntity.getCityName() + "-"
|
||||||
|
+ regionalismEntity.getDistrictName());
|
||||||
err.add(map);
|
err.add(map);
|
||||||
}
|
}
|
||||||
if(-1 == insertNum){
|
if (-1 == insertNum) {
|
||||||
return insertNum;
|
return insertNum;
|
||||||
}
|
}
|
||||||
//新增 地区
|
// 新增 地区
|
||||||
if (areaMap.size() > 0) {
|
if (areaMap.size() > 0) {
|
||||||
List<RegionalismEntity> insert2Regionalism = new ArrayList<RegionalismEntity>();
|
List<RegionalismEntity> insert2Regionalism = new ArrayList<RegionalismEntity>();
|
||||||
for ( String key : areaMap.keySet()) {
|
for (String key : areaMap.keySet()) {
|
||||||
insert2Regionalism.add(areaMap.get(key));
|
insert2Regionalism.add(areaMap.get(key));
|
||||||
}
|
}
|
||||||
if (insert2Regionalism.size() > 0) {
|
if (insert2Regionalism.size() > 0) {
|
||||||
|
|
@ -468,12 +477,12 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
|
||||||
}
|
}
|
||||||
return insertNum;
|
return insertNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 遍历文件
|
* 遍历文件
|
||||||
*
|
*
|
||||||
* @param ps must not null
|
* @param ps
|
||||||
|
* must not null
|
||||||
* @param path
|
* @param path
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -494,46 +503,47 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
|
||||||
return ps;
|
return ps;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 设置脚本信息
|
/**
|
||||||
|
* 设置脚本信息
|
||||||
|
*
|
||||||
* @param systemDataInfo
|
* @param systemDataInfo
|
||||||
* @param sqlFilePathsStandard
|
* @param sqlFilePathsStandard
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private List<PreDataInfo> setScript(List<PreDataInfo> systemDataInfo,
|
private List<PreDataInfo> setScript(List<PreDataInfo> systemDataInfo, Map<String, String> sqlFilePathsStandard) {
|
||||||
Map<String, String> sqlFilePathsStandard) {
|
|
||||||
List<PreDataInfo> fileEntitys = new ArrayList<PreDataInfo>();
|
List<PreDataInfo> fileEntitys = new ArrayList<PreDataInfo>();
|
||||||
for (PreDataInfo preDataInfo : systemDataInfo) {
|
for (PreDataInfo preDataInfo : systemDataInfo) {
|
||||||
// 归档表空间脚本的位置-
|
// 归档表空间脚本的位置-
|
||||||
String TablePathStandard = getFilePath("UserTablespace_",
|
String TablePathStandard = getFilePath("UserTablespace_", sqlFilePathsStandard, preDataInfo, ".sql");
|
||||||
sqlFilePathsStandard, preDataInfo, ".sql");
|
|
||||||
if (null != TablePathStandard && !"".equals(TablePathStandard)) {
|
if (null != TablePathStandard && !"".equals(TablePathStandard)) {
|
||||||
preDataInfo.setUserTablespaceStatus("是");
|
preDataInfo.setUserTablespaceStatus("是");
|
||||||
preDataInfo.setUserTablespacePath("UserTablespace_"+preDataInfo.getAreaCode()+"_" + preDataInfo.getSysCode()+ ".sql");
|
preDataInfo.setUserTablespacePath(
|
||||||
|
"UserTablespace_" + preDataInfo.getAreaCode() + "_" + preDataInfo.getSysCode() + ".sql");
|
||||||
}
|
}
|
||||||
// 归档预算 脚本的位置-
|
// 归档预算 脚本的位置-
|
||||||
String indicatePathStandard = getFilePath("Checkout_Indicate_",
|
String indicatePathStandard = getFilePath("Checkout_Indicate_", sqlFilePathsStandard, preDataInfo, ".sql");
|
||||||
sqlFilePathsStandard, preDataInfo, ".sql");
|
|
||||||
if (null != indicatePathStandard && !"".equals(indicatePathStandard)) {
|
if (null != indicatePathStandard && !"".equals(indicatePathStandard)) {
|
||||||
preDataInfo.setCheckoutIndicateStatus("是");
|
preDataInfo.setCheckoutIndicateStatus("是");
|
||||||
preDataInfo.setCheckoutIndicatePath("Checkout_Indicate_"+preDataInfo.getAreaCode()+"_" + preDataInfo.getSysCode()+ ".sql");
|
preDataInfo.setCheckoutIndicatePath(
|
||||||
|
"Checkout_Indicate_" + preDataInfo.getAreaCode() + "_" + preDataInfo.getSysCode() + ".sql");
|
||||||
}
|
}
|
||||||
// 归档表空间脚本的位置-
|
// 归档表空间脚本的位置-
|
||||||
String payPathStandard = getFilePath("Checkout_Pay_",
|
String payPathStandard = getFilePath("Checkout_Pay_", sqlFilePathsStandard, preDataInfo, ".sql");
|
||||||
sqlFilePathsStandard, preDataInfo, ".sql");
|
|
||||||
if (null != payPathStandard && !"".equals(payPathStandard)) {
|
if (null != payPathStandard && !"".equals(payPathStandard)) {
|
||||||
preDataInfo.setCheckoutPayStatus("是");
|
preDataInfo.setCheckoutPayStatus("是");
|
||||||
preDataInfo.setCheckoutPayPath("Checkout_Pay_"+preDataInfo.getAreaCode()+"_" + preDataInfo.getSysCode()+ ".sql");
|
preDataInfo.setCheckoutPayPath(
|
||||||
|
"Checkout_Pay_" + preDataInfo.getAreaCode() + "_" + preDataInfo.getSysCode() + ".sql");
|
||||||
}
|
}
|
||||||
// 设置 状态
|
// 设置 状态
|
||||||
String type = preDataInfo.getDataBaseType().toUpperCase();
|
String type = preDataInfo.getDataBaseType().toUpperCase();
|
||||||
if (!"ORACLE".equals(type)) {
|
if (!"ORACLE".equals(type)) {
|
||||||
preDataInfo.setUserTablespaceStatus("-");
|
preDataInfo.setUserTablespaceStatus("-");
|
||||||
}
|
}
|
||||||
fileEntitys.add(preDataInfo);
|
fileEntitys.add(preDataInfo);
|
||||||
}
|
}
|
||||||
return fileEntitys;
|
return fileEntitys;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查找文件
|
* 查找文件
|
||||||
*
|
*
|
||||||
|
|
@ -543,11 +553,9 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
|
||||||
* @param affix
|
* @param affix
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String getFilePath(String prefix, Map<String, String> map,
|
private String getFilePath(String prefix, Map<String, String> map, PreDataInfo pre, String affix) {
|
||||||
PreDataInfo pre, String affix) {
|
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
sb.append(prefix).append(pre.getAreaCode()).append("_")
|
sb.append(prefix).append(pre.getAreaCode()).append("_").append(pre.getSysCode()).append(affix);
|
||||||
.append(pre.getSysCode()).append(affix);
|
|
||||||
String fileName = sb.toString().toLowerCase();
|
String fileName = sb.toString().toLowerCase();
|
||||||
if (!map.containsKey(fileName)) {
|
if (!map.containsKey(fileName)) {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -556,26 +564,28 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
|
||||||
String pathStandard = map.get(fileName);
|
String pathStandard = map.get(fileName);
|
||||||
return pathStandard;
|
return pathStandard;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 新增系统时,去掉系统已存在的 新增操作里的
|
/**
|
||||||
|
* 新增系统时,去掉系统已存在的 新增操作里的
|
||||||
|
*
|
||||||
* @param allAreaInsert
|
* @param allAreaInsert
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private List<PreDataInfo> removeRepeat(List<PreDataInfo> allAreaInsert) throws Exception {
|
private List<PreDataInfo> removeRepeat(List<PreDataInfo> allAreaInsert) throws Exception {
|
||||||
Map<String, PreDataInfo> excelAdd = new HashMap<String, PreDataInfo>();
|
Map<String, PreDataInfo> excelAdd = new HashMap<String, PreDataInfo>();
|
||||||
List<PreDataInfo> allResult = new ArrayList<PreDataInfo>();
|
List<PreDataInfo> allResult = new ArrayList<PreDataInfo>();
|
||||||
//系统已存在的 系统
|
// 系统已存在的 系统
|
||||||
List<PreDataInfo> sysInDataBase = preDataInfoDao.findAll();
|
List<PreDataInfo> sysInDataBase = preDataInfoDao.findAll();
|
||||||
Map<String, String> sysInDataBaseMap = new HashMap<String, String>();
|
Map<String, String> sysInDataBaseMap = new HashMap<String, String>();
|
||||||
for (PreDataInfo preDataInfo : sysInDataBase) {
|
for (PreDataInfo preDataInfo : sysInDataBase) {
|
||||||
sysInDataBaseMap.put(preDataInfo.getAreaCode()+"_"+preDataInfo.getSysName().trim(), null);
|
sysInDataBaseMap.put(preDataInfo.getAreaCode() + "_" + preDataInfo.getSysName(), null);
|
||||||
}
|
}
|
||||||
//本次新增的系统
|
// 本次新增的系统
|
||||||
for (PreDataInfo pre : allAreaInsert) {
|
for (PreDataInfo pre : allAreaInsert) {
|
||||||
if (null == pre.getSysName() || "".equals(pre.getSysName())) {
|
if (null == pre.getSysName() || "".equals(pre.getSysName())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
excelAdd.put(pre.getAreaCode()+"_"+pre.getSysName().trim(), pre);
|
excelAdd.put(pre.getAreaCode() + "_" + pre.getSysName().trim(), pre);
|
||||||
}
|
}
|
||||||
Set<String> keys = excelAdd.keySet();
|
Set<String> keys = excelAdd.keySet();
|
||||||
if (null != keys) {
|
if (null != keys) {
|
||||||
|
|
@ -587,15 +597,18 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
|
||||||
}
|
}
|
||||||
return allResult;
|
return allResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 批量插入--一次限定多少个(将allAreaInsert 分成 设定大小的 集合) 比如 allAreaInsert 有 100个, 按照 11个为一个集合分,可分成 10个集合
|
/**
|
||||||
* @param allAreaInsert
|
* 批量插入--一次限定多少个(将allAreaInsert 分成 设定大小的 集合) 比如 allAreaInsert 有 100个, 按照
|
||||||
* @param rowErr
|
* 11个为一个集合分,可分成 10个集合
|
||||||
|
*
|
||||||
|
* @param allAreaInsert
|
||||||
|
* @param rowErr
|
||||||
*/
|
*/
|
||||||
private void insertBatch(List<PreDataInfo> allAreaInsert, List<HashMap<String, Object>> rowErr) {
|
private void insertBatch(List<PreDataInfo> allAreaInsert, List<HashMap<String, Object>> rowErr) {
|
||||||
if (allAreaInsert.size() > 0) {
|
if (allAreaInsert.size() > 0) {
|
||||||
int listSize = allAreaInsert.size();
|
int listSize = allAreaInsert.size();
|
||||||
int loopSize = listSize/Configs.NUM_ONE_IMPORT_EXCEL;
|
int loopSize = listSize / Configs.NUM_ONE_IMPORT_EXCEL;
|
||||||
if (loopSize * Configs.NUM_ONE_IMPORT_EXCEL != listSize) {
|
if (loopSize * Configs.NUM_ONE_IMPORT_EXCEL != listSize) {
|
||||||
loopSize++;
|
loopSize++;
|
||||||
}
|
}
|
||||||
|
|
@ -604,7 +617,7 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
|
||||||
list[i] = new ArrayList<PreDataInfo>();
|
list[i] = new ArrayList<PreDataInfo>();
|
||||||
}
|
}
|
||||||
for (int i = 0; i < listSize; i++) {
|
for (int i = 0; i < listSize; i++) {
|
||||||
list[i/Configs.NUM_ONE_IMPORT_EXCEL].add(allAreaInsert.get(i));
|
list[i / Configs.NUM_ONE_IMPORT_EXCEL].add(allAreaInsert.get(i));
|
||||||
}
|
}
|
||||||
for (List<PreDataInfo> arrayList : list) {
|
for (List<PreDataInfo> arrayList : list) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -613,8 +626,10 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
|
||||||
for (PreDataInfo preDataInfo : arrayList) {
|
for (PreDataInfo preDataInfo : arrayList) {
|
||||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||||
map.put("value", "请检查是否有填写错误,比如:错别字、超出范围等");
|
map.put("value", "请检查是否有填写错误,比如:错别字、超出范围等");
|
||||||
map.put("name", preDataInfo.getAreaCode()+"-"+preDataInfo.getCityName()+"-"+preDataInfo.getDistrictName()+"-"+preDataInfo.getSysName());
|
map.put("name", preDataInfo.getAreaCode() + "-" + preDataInfo.getCityName() + "-"
|
||||||
log.error(preDataInfo.getAreaCode()+"-"+preDataInfo.getCityName()+"-"+preDataInfo.getDistrictName()+"-"+preDataInfo.getSysName());
|
+ preDataInfo.getDistrictName() + "-" + preDataInfo.getSysName());
|
||||||
|
log.error(preDataInfo.getAreaCode() + "-" + preDataInfo.getCityName() + "-"
|
||||||
|
+ preDataInfo.getDistrictName() + "-" + preDataInfo.getSysName());
|
||||||
rowErr.add(map);
|
rowErr.add(map);
|
||||||
}
|
}
|
||||||
log.error(e);
|
log.error(e);
|
||||||
|
|
@ -622,5 +637,5 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@ public class VolumeServiceImpl implements IVolumeService {
|
||||||
|
|
||||||
@Resource(name = "volumeDao")
|
@Resource(name = "volumeDao")
|
||||||
private VolumeDao volumeDao;
|
private VolumeDao volumeDao;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int save(VolumeDataEntity entity) throws Exception {
|
public int save(VolumeDataEntity entity) throws Exception {
|
||||||
int rest = 1;
|
int rest = 1;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
package com.platform.service.thread;
|
package com.platform.service.thread;
|
||||||
|
|
||||||
import io.fabric8.kubernetes.api.model.Pod;
|
|
||||||
import io.fabric8.kubernetes.api.model.ReplicationController;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
@ -18,8 +15,12 @@ import com.platform.oracle.OracleConnector;
|
||||||
import com.platform.utils.CacheOracleCheckoutEntity;
|
import com.platform.utils.CacheOracleCheckoutEntity;
|
||||||
import com.platform.utils.Configs;
|
import com.platform.utils.Configs;
|
||||||
import com.platform.utils.Constant;
|
import com.platform.utils.Constant;
|
||||||
|
import com.platform.utils.ExceptionMsg;
|
||||||
import com.platform.utils.FileOperateHelper;
|
import com.platform.utils.FileOperateHelper;
|
||||||
|
|
||||||
|
import io.fabric8.kubernetes.api.model.Pod;
|
||||||
|
import io.fabric8.kubernetes.api.model.ReplicationController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验oracle标准表是否存在
|
* 校验oracle标准表是否存在
|
||||||
*
|
*
|
||||||
|
|
@ -28,8 +29,7 @@ import com.platform.utils.FileOperateHelper;
|
||||||
*/
|
*/
|
||||||
public class ThreadCheckoutStandardOracle extends Thread {
|
public class ThreadCheckoutStandardOracle extends Thread {
|
||||||
|
|
||||||
public final static Logger log = Configs.CONSOLE_LOGGER
|
public final static Logger log = Configs.CONSOLE_LOGGER.getLogger(ThreadCheckoutStandardOracle.class);
|
||||||
.getLogger(ThreadCheckoutStandardOracle.class);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* kuber 客户端
|
* kuber 客户端
|
||||||
|
|
@ -58,8 +58,7 @@ public class ThreadCheckoutStandardOracle extends Thread {
|
||||||
for (int i = 0; i < 11; i++) {
|
for (int i = 0; i < 11; i++) {
|
||||||
try {
|
try {
|
||||||
// 数据的 keys (=kuber的应用名称 taskName)
|
// 数据的 keys (=kuber的应用名称 taskName)
|
||||||
Set<String> taskNames = CacheOracleCheckoutEntity
|
Set<String> taskNames = CacheOracleCheckoutEntity.getCheckKeys();
|
||||||
.getCheckKeys();
|
|
||||||
int lengs = taskNames.size();
|
int lengs = taskNames.size();
|
||||||
if (lengs == 0) {
|
if (lengs == 0) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -75,8 +74,7 @@ public class ThreadCheckoutStandardOracle extends Thread {
|
||||||
// 获得 kuber的 pod
|
// 获得 kuber的 pod
|
||||||
Pod tmpPod = filterPod(key);
|
Pod tmpPod = filterPod(key);
|
||||||
if (null == tmpPod) {
|
if (null == tmpPod) {
|
||||||
log.info("replicationController标签: " + key
|
log.info("replicationController标签: " + key + " 的 pod 节点不存在!");
|
||||||
+ " 的 pod 节点不存在!");
|
|
||||||
if (i > 5) {
|
if (i > 5) {
|
||||||
CacheOracleCheckoutEntity.checkRemove(key);
|
CacheOracleCheckoutEntity.checkRemove(key);
|
||||||
}
|
}
|
||||||
|
|
@ -87,35 +85,26 @@ public class ThreadCheckoutStandardOracle extends Thread {
|
||||||
|
|
||||||
if (i == 10) {
|
if (i == 10) {
|
||||||
|
|
||||||
String cmd = "kubectl --server "
|
String cmd = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS + " label --overwrite rc " + key
|
||||||
+ Configs.KUBE_MASTER_ADDRESS
|
+ " status=1";
|
||||||
+ " label --overwrite rc " + key + " status=1";
|
|
||||||
|
|
||||||
List<String> rList = Constant.ganymedSSH
|
List<String> rList = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
|
||||||
.execCmdWaitAcquiescent(cmd);
|
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
for (String str : rList)
|
for (String str : rList)
|
||||||
sb.append(str).append("\n");
|
sb.append(str).append("\n");
|
||||||
log.info("更新replicationController标签: " + key
|
log.info("更新replicationController标签: " + key + "\t[标签更新为: 失败]");
|
||||||
+ "\t[标签更新为: 失败]");
|
|
||||||
log.info(sb.toString());
|
log.info(sb.toString());
|
||||||
|
|
||||||
|
String cmd2 = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS + " annotate --overwrite rc "
|
||||||
String cmd2 = "kubectl --server "
|
+ key + " checkoutFlag=0";
|
||||||
+ Configs.KUBE_MASTER_ADDRESS
|
List<String> rList2 = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd2);
|
||||||
+ " annotate --overwrite rc " + key
|
|
||||||
+ " checkoutFlag=0";
|
|
||||||
List<String> rList2 = Constant.ganymedSSH
|
|
||||||
.execCmdWaitAcquiescent(cmd2);
|
|
||||||
StringBuffer sb2 = new StringBuffer();
|
StringBuffer sb2 = new StringBuffer();
|
||||||
for (String str : rList2)
|
for (String str : rList2)
|
||||||
sb2.append(str).append("\n");
|
sb2.append(str).append("\n");
|
||||||
log.info("更新replicationController标签: " + key
|
log.info("更新replicationController标签: " + key + "\t[标签更新为: 未校验]");
|
||||||
+ "\t[标签更新为: 未校验]");
|
|
||||||
log.info(sb2.toString());
|
log.info(sb2.toString());
|
||||||
// 当前key标签对应的 数据服务的记录
|
// 当前key标签对应的 数据服务的记录
|
||||||
CheckoutEntity tmp = CacheOracleCheckoutEntity
|
CheckoutEntity tmp = CacheOracleCheckoutEntity.getCheck(key);
|
||||||
.getCheck(key);
|
|
||||||
tmp.setCheckoutFlag(Constant.CHECKOUTFLAG_ZERO);
|
tmp.setCheckoutFlag(Constant.CHECKOUTFLAG_ZERO);
|
||||||
tmp.setPayResultLast(Constant.CHECKOUT_STATUS_ZERO);
|
tmp.setPayResultLast(Constant.CHECKOUT_STATUS_ZERO);
|
||||||
tmp.setExecResultLast(Constant.CHECKOUT_STATUS_ZERO);
|
tmp.setExecResultLast(Constant.CHECKOUT_STATUS_ZERO);
|
||||||
|
|
@ -147,11 +136,9 @@ public class ThreadCheckoutStandardOracle extends Thread {
|
||||||
*/
|
*/
|
||||||
private Pod filterPod(String taskName) {
|
private Pod filterPod(String taskName) {
|
||||||
Pod pod = null;
|
Pod pod = null;
|
||||||
ReplicationController replicationController = client
|
ReplicationController replicationController = client.getReplicationController(taskName);
|
||||||
.getReplicationController(taskName);
|
|
||||||
if (null != replicationController) {
|
if (null != replicationController) {
|
||||||
List<Pod> filterPods = client
|
List<Pod> filterPods = client.getPodsForApplicaList(replicationController);
|
||||||
.getPodsForApplicaList(replicationController);
|
|
||||||
if (filterPods != null && filterPods.size() > 0) {
|
if (filterPods != null && filterPods.size() > 0) {
|
||||||
pod = filterPods.get(0);
|
pod = filterPods.get(0);
|
||||||
}
|
}
|
||||||
|
|
@ -170,20 +157,16 @@ public class ThreadCheckoutStandardOracle extends Thread {
|
||||||
String ip = client.getPodHostIp(pod);
|
String ip = client.getPodHostIp(pod);
|
||||||
int port = client.getPodContainerport(pod);
|
int port = client.getPodContainerport(pod);
|
||||||
if (ip != null && port != 0) {
|
if (ip != null && port != 0) {
|
||||||
String url = "jdbc:oracle:thin:@" + ip + ":" + port + ":"
|
String url = "jdbc:oracle:thin:@" + ip + ":" + port + ":" + Configs.ORACLE_ORCL;
|
||||||
+ Configs.ORACLE_ORCL;
|
|
||||||
boolean flag = OracleConnector.canConnect(url, // 连接结果返回参数,true标示连接成功,false标示连接失败
|
boolean flag = OracleConnector.canConnect(url, // 连接结果返回参数,true标示连接成功,false标示连接失败
|
||||||
Configs.ORACLE_USER, Configs.ORACLE_PSW);
|
Configs.ORACLE_USER, Configs.ORACLE_PSW);
|
||||||
log.info("url:" + url + ",user:" + Configs.ORACLE_USER
|
log.info("url:" + url + ",user:" + Configs.ORACLE_USER + ",password:" + Configs.ORACLE_PSW);
|
||||||
+ ",password:" + Configs.ORACLE_PSW);
|
|
||||||
String message = "失败";
|
String message = "失败";
|
||||||
|
|
||||||
|
String cmd3 = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS + " annotate --overwrite rc " + key
|
||||||
|
+ " checkoutFlag=0";
|
||||||
|
|
||||||
String cmd3 = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS
|
List<String> rList3 = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd3);
|
||||||
+ " annotate --overwrite rc " + key + " checkoutFlag=0";
|
|
||||||
|
|
||||||
List<String> rList3 = Constant.ganymedSSH
|
|
||||||
.execCmdWaitAcquiescent(cmd3);
|
|
||||||
StringBuffer sb3 = new StringBuffer();
|
StringBuffer sb3 = new StringBuffer();
|
||||||
for (String str : rList3)
|
for (String str : rList3)
|
||||||
sb3.append(str).append("\n");
|
sb3.append(str).append("\n");
|
||||||
|
|
@ -192,87 +175,61 @@ public class ThreadCheckoutStandardOracle extends Thread {
|
||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
|
|
||||||
String cmd = "kubectl --server "
|
String cmd = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS + " label --overwrite rc " + key
|
||||||
+ Configs.KUBE_MASTER_ADDRESS
|
+ " status=2";
|
||||||
+ " label --overwrite rc " + key + " status=2";
|
|
||||||
|
|
||||||
// 设置服务为 成功
|
// 设置服务为 成功
|
||||||
List<String> rList = Constant.ganymedSSH
|
List<String> rList = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
|
||||||
.execCmdWaitAcquiescent(cmd);
|
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
for (String str : rList)
|
for (String str : rList)
|
||||||
sb.append(str).append("\n");
|
sb.append(str).append("\n");
|
||||||
log.info(sb.toString());
|
log.info(sb.toString());
|
||||||
message = "成功";
|
message = "成功";
|
||||||
log.info("更新replicationController标签: " + key
|
log.info("更新replicationController标签: " + key + "\t[标签更新为: 成功]");
|
||||||
+ "\t[标签更新为: 成功]");
|
|
||||||
// 校验标签
|
// 校验标签
|
||||||
|
|
||||||
String cmd2 = "kubectl --server "
|
String cmd2 = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS + " annotate --overwrite rc " + key
|
||||||
+ Configs.KUBE_MASTER_ADDRESS
|
|
||||||
+ " annotate --overwrite rc " + key
|
|
||||||
+ " checkoutFlag=2";
|
+ " checkoutFlag=2";
|
||||||
List<String> rList2 = Constant.ganymedSSH
|
List<String> rList2 = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd2);
|
||||||
.execCmdWaitAcquiescent(cmd2);
|
|
||||||
StringBuffer sb2 = new StringBuffer();
|
StringBuffer sb2 = new StringBuffer();
|
||||||
for (String str : rList2)
|
for (String str : rList2)
|
||||||
sb2.append(str).append("\n");
|
sb2.append(str).append("\n");
|
||||||
log.info(sb2.toString());
|
log.info(sb2.toString());
|
||||||
log.info("更新replicationController标签: " + key
|
log.info("更新replicationController标签: " + key + "\t[标签更新为: 校验中]");
|
||||||
+ "\t[标签更新为: 校验中]");
|
|
||||||
// 获得当前 服务对应的 数据
|
// 获得当前 服务对应的 数据
|
||||||
CheckoutEntity tmp = CacheOracleCheckoutEntity
|
CheckoutEntity tmp = CacheOracleCheckoutEntity.getCheck(key);
|
||||||
.getCheck(key);
|
|
||||||
if (null != tmp) {
|
if (null != tmp) {
|
||||||
CacheOracleCheckoutEntity.putExtract(key, tmp);
|
CacheOracleCheckoutEntity.putExtract(key, tmp);
|
||||||
}
|
}
|
||||||
// 查询 对应的 2 个标准表
|
// 查询 对应的 2 个标准表
|
||||||
OracleConnectorParams oc = new OracleConnectorParams();
|
OracleConnectorParams oc = new OracleConnectorParams();
|
||||||
String logName = tmp.getAreaCode().toLowerCase() + "_"
|
String logName = tmp.getAreaCode().toLowerCase() + "_" + tmp.getSysCode() + "_"
|
||||||
+ tmp.getSysCode() + "_" + tmp.getDataVersion();
|
+ tmp.getDataVersion();
|
||||||
oc.setName(logName);
|
oc.setName(logName);
|
||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
try {
|
try {
|
||||||
conn = OracleConnector.connectionBuilder(
|
conn = OracleConnector.connectionBuilder(url, Configs.ORACLE_USER, Configs.ORACLE_PSW, oc);
|
||||||
url, Configs.ORACLE_USER, Configs.ORACLE_PSW,
|
|
||||||
oc);
|
|
||||||
// 支付--校验
|
// 支付--校验
|
||||||
if (!Constant.CHECKOUT_STATUS_ONE.equals(tmp
|
if (!Constant.CHECKOUT_STATUS_ONE.equals(tmp.getPayResultLast())) {
|
||||||
.getPayResultLast())) {
|
|
||||||
String paySql = "select * from dba_tables where owner = '"
|
String paySql = "select * from dba_tables where owner = '"
|
||||||
+ Configs.COLLECT_STANDARD_TABLE_USER
|
+ Configs.COLLECT_STANDARD_TABLE_USER.toUpperCase() + "' and table_name = '"
|
||||||
.toUpperCase()
|
+ Configs.COLLECT_PAY_TABLE.toUpperCase() + "'";
|
||||||
+ "' and table_name = '"
|
if (OracleConnector.execUpdateOracleSQL(conn, paySql,
|
||||||
+ Configs.COLLECT_PAY_TABLE.toUpperCase()
|
FileOperateHelper.addLastSeparator(Configs.EXTRACT_STANDARD_LOG_LOCALTION) + logName
|
||||||
+ "'";
|
+ "jy.log")) {
|
||||||
if (OracleConnector
|
|
||||||
.execUpdateOracleSQL(
|
|
||||||
conn,
|
|
||||||
paySql,
|
|
||||||
FileOperateHelper
|
|
||||||
.addLastSeparator(Configs.EXTRACT_STANDARD_LOG_LOCALTION)
|
|
||||||
+ logName + "jy.log")) {
|
|
||||||
tmp.setPayResultLast(Constant.CHECKOUT_STATUS_THREE);
|
tmp.setPayResultLast(Constant.CHECKOUT_STATUS_THREE);
|
||||||
} else {
|
} else {
|
||||||
tmp.setPayResultLast(Constant.CHECKOUT_STATUS_FOUR);
|
tmp.setPayResultLast(Constant.CHECKOUT_STATUS_FOUR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 可执行-- 校验
|
// 可执行-- 校验
|
||||||
if (!Constant.CHECKOUT_STATUS_ONE.equals(tmp
|
if (!Constant.CHECKOUT_STATUS_ONE.equals(tmp.getExecResultLast())) {
|
||||||
.getExecResultLast())) {
|
|
||||||
String execSql = "select * from dba_tables where owner = '"
|
String execSql = "select * from dba_tables where owner = '"
|
||||||
+ Configs.COLLECT_STANDARD_TABLE_USER
|
+ Configs.COLLECT_STANDARD_TABLE_USER.toUpperCase() + "' and table_name = '"
|
||||||
.toUpperCase()
|
+ Configs.COLLECT_EXEC_TABLE.toUpperCase() + "'";
|
||||||
+ "' and table_name = '"
|
if (OracleConnector.execUpdateOracleSQL(conn, execSql,
|
||||||
+ Configs.COLLECT_EXEC_TABLE.toUpperCase()
|
FileOperateHelper.addLastSeparator(Configs.EXTRACT_STANDARD_LOG_LOCALTION) + logName
|
||||||
+ "'";
|
+ "jy.log")) {
|
||||||
if (OracleConnector
|
|
||||||
.execUpdateOracleSQL(
|
|
||||||
conn,
|
|
||||||
execSql,
|
|
||||||
FileOperateHelper
|
|
||||||
.addLastSeparator(Configs.EXTRACT_STANDARD_LOG_LOCALTION)
|
|
||||||
+ logName + "jy.log")) {
|
|
||||||
tmp.setExecResultLast(Constant.CHECKOUT_STATUS_THREE);
|
tmp.setExecResultLast(Constant.CHECKOUT_STATUS_THREE);
|
||||||
} else {
|
} else {
|
||||||
tmp.setExecResultLast(Constant.CHECKOUT_STATUS_FOUR);
|
tmp.setExecResultLast(Constant.CHECKOUT_STATUS_FOUR);
|
||||||
|
|
@ -283,30 +240,25 @@ public class ThreadCheckoutStandardOracle extends Thread {
|
||||||
updateDataInfo(tmp);
|
updateDataInfo(tmp);
|
||||||
// 将 CacheOracleCheckoutEntity checkMap中的 数据
|
// 将 CacheOracleCheckoutEntity checkMap中的 数据
|
||||||
// 放入extractMap中
|
// 放入extractMap中
|
||||||
/* CacheOracleCheckoutEntity.putExtract(key, */CacheOracleCheckoutEntity
|
/* CacheOracleCheckoutEntity.putExtract(key, */
|
||||||
.checkRemove(key)/* ) */;
|
CacheOracleCheckoutEntity.checkRemove(key);
|
||||||
// 更新kuber状态
|
// 更新kuber状态
|
||||||
|
|
||||||
cmd2 = "kubectl --server "
|
cmd2 = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS + " annotate --overwrite rc " + key
|
||||||
+ Configs.KUBE_MASTER_ADDRESS
|
|
||||||
+ " annotate --overwrite rc " + key
|
|
||||||
+ " checkoutFlag=1";
|
+ " checkoutFlag=1";
|
||||||
// client.updateOrAddReplicasLabelById(taskNSyame,
|
// client.updateOrAddReplicasLabelById(taskNSyame,
|
||||||
// "status", "2");
|
// "status", "2");
|
||||||
rList = Constant.ganymedSSH
|
rList = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd2);
|
||||||
.execCmdWaitAcquiescent(cmd2);
|
|
||||||
sb = new StringBuffer();
|
sb = new StringBuffer();
|
||||||
for (String str : rList)
|
for (String str : rList)
|
||||||
sb.append(str).append("\n");
|
sb.append(str).append("\n");
|
||||||
log.info(sb.toString());
|
log.info(sb.toString());
|
||||||
message = "成功";
|
message = "成功";
|
||||||
log.info("更新replicationController标签: " + key
|
log.info("更新replicationController标签: " + key + "\t[标签更新为: 已校验]");
|
||||||
+ "\t[标签更新为: 已校验]");
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e);
|
log.error(ExceptionMsg.exceptionStackToStr(e));
|
||||||
}
|
} finally {
|
||||||
finally{
|
if (conn != null) {
|
||||||
if(conn != null){
|
|
||||||
try {
|
try {
|
||||||
conn.close();// 关闭连接
|
conn.close();// 关闭连接
|
||||||
} catch (Exception e2) {
|
} catch (Exception e2) {
|
||||||
|
|
@ -337,8 +289,7 @@ public class ThreadCheckoutStandardOracle extends Thread {
|
||||||
data.setExecResultLast(checkoutEntity.getExecResultLast());
|
data.setExecResultLast(checkoutEntity.getExecResultLast());
|
||||||
data.setCheckoutFlag(checkoutEntity.getCheckoutFlag());
|
data.setCheckoutFlag(checkoutEntity.getCheckoutFlag());
|
||||||
dataInfoDao.update(data);
|
dataInfoDao.update(data);
|
||||||
DataInfoEntity tmpdata = dataInfoDao.findById(checkoutEntity
|
DataInfoEntity tmpdata = dataInfoDao.findById(checkoutEntity.getDataId());
|
||||||
.getDataId());
|
|
||||||
data.setId(tmpdata.getSrcId());
|
data.setId(tmpdata.getSrcId());
|
||||||
dataInfoDao.update(data);
|
dataInfoDao.update(data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package com.platform.service.thread;
|
||||||
import com.base.Custom4exception;
|
import com.base.Custom4exception;
|
||||||
import com.base.CustomException;
|
import com.base.CustomException;
|
||||||
import com.platform.entities.OracleConnectorParams;
|
import com.platform.entities.OracleConnectorParams;
|
||||||
import com.platform.form.oracleForm;
|
import com.platform.form.OracleForm;
|
||||||
import com.platform.service.IOracleExtractService;
|
import com.platform.service.IOracleExtractService;
|
||||||
import com.platform.utils.CacheSetCantDelete;
|
import com.platform.utils.CacheSetCantDelete;
|
||||||
|
|
||||||
|
|
@ -15,13 +15,13 @@ public class ThreadExtractOracle extends Thread {
|
||||||
|
|
||||||
private IOracleExtractService OracleExtract;
|
private IOracleExtractService OracleExtract;
|
||||||
|
|
||||||
private oracleForm form;
|
private OracleForm form;
|
||||||
|
|
||||||
/** oracle汇总库抽取
|
/** oracle汇总库抽取
|
||||||
* @param form
|
* @param form
|
||||||
* @param OracleExtract
|
* @param OracleExtract
|
||||||
*/
|
*/
|
||||||
public ThreadExtractOracle(oracleForm form, IOracleExtractService OracleExtract) {
|
public ThreadExtractOracle(OracleForm form, IOracleExtractService OracleExtract) {
|
||||||
this.setDaemon(true);
|
this.setDaemon(true);
|
||||||
this.OracleExtract = OracleExtract;
|
this.OracleExtract = OracleExtract;
|
||||||
this.form = form;
|
this.form = form;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.base.Custom4exception;
|
import com.base.Custom4exception;
|
||||||
import com.platform.entities.OracleConnectorParams;
|
import com.platform.entities.OracleConnectorParams;
|
||||||
import com.platform.form.oracleForm;
|
import com.platform.form.OracleForm;
|
||||||
import com.platform.service.IOracleExtractService;
|
import com.platform.service.IOracleExtractService;
|
||||||
import com.platform.service.impl.CheckoutServiceImpl;
|
import com.platform.service.impl.CheckoutServiceImpl;
|
||||||
import com.platform.utils.CacheSetCantDelete;
|
import com.platform.utils.CacheSetCantDelete;
|
||||||
|
|
@ -25,13 +25,13 @@ public class ThreadExtractStandardOracle extends Thread {
|
||||||
*/
|
*/
|
||||||
private IOracleExtractService OracleExtract;
|
private IOracleExtractService OracleExtract;
|
||||||
|
|
||||||
private oracleForm form;
|
private OracleForm form;
|
||||||
|
|
||||||
/** oracle汇总库抽取
|
/** oracle汇总库抽取
|
||||||
* @param form
|
* @param form
|
||||||
* @param OracleExtract
|
* @param OracleExtract
|
||||||
*/
|
*/
|
||||||
public ThreadExtractStandardOracle(oracleForm form, IOracleExtractService OracleExtract) {
|
public ThreadExtractStandardOracle(OracleForm form, IOracleExtractService OracleExtract) {
|
||||||
this.setDaemon(true);
|
this.setDaemon(true);
|
||||||
this.OracleExtract = OracleExtract;
|
this.OracleExtract = OracleExtract;
|
||||||
this.form = form;
|
this.form = form;
|
||||||
|
|
@ -40,7 +40,7 @@ public class ThreadExtractStandardOracle extends Thread {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (null != form.getInneed()) {
|
if (null != form.getInneed()) {
|
||||||
//保存 正zai抽取标准表的数据id
|
//保存 正在抽取标准表的数据id
|
||||||
for (OracleConnectorParams element : form.getInneed()) {
|
for (OracleConnectorParams element : form.getInneed()) {
|
||||||
CacheSetCantDelete.addStandardId(element.getDataId());
|
CacheSetCantDelete.addStandardId(element.getDataId());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import com.platform.entities.DataInfoEntity;
|
||||||
import com.platform.entities.GatherOracleInfo;
|
import com.platform.entities.GatherOracleInfo;
|
||||||
import com.platform.entities.OracleConnectorParams;
|
import com.platform.entities.OracleConnectorParams;
|
||||||
import com.platform.oracle.OracleConnector;
|
import com.platform.oracle.OracleConnector;
|
||||||
import com.platform.service.OracleExtractHelper;
|
import com.platform.service.OracleHelper;
|
||||||
import com.platform.utils.CacheSetCantDelete;
|
import com.platform.utils.CacheSetCantDelete;
|
||||||
import com.platform.utils.Configs;
|
import com.platform.utils.Configs;
|
||||||
import com.platform.utils.Constant;
|
import com.platform.utils.Constant;
|
||||||
|
|
@ -39,7 +39,7 @@ public class ThreadExtractStandardSqlServer extends Thread{
|
||||||
/**
|
/**
|
||||||
* 抽取
|
* 抽取
|
||||||
*/
|
*/
|
||||||
private OracleExtractHelper oracleExtract = new OracleExtractHelper();
|
private OracleHelper oracleExtract = new OracleHelper();
|
||||||
|
|
||||||
/** 汇总库 */
|
/** 汇总库 */
|
||||||
private GatherOracleInfo oracleConnect;
|
private GatherOracleInfo oracleConnect;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package com.platform.service.thread;
|
||||||
|
|
||||||
import com.base.Custom4exception;
|
import com.base.Custom4exception;
|
||||||
import com.base.CustomException;
|
import com.base.CustomException;
|
||||||
import com.platform.form.oracleForm;
|
import com.platform.form.OracleForm;
|
||||||
import com.platform.service.IOracleExtractService;
|
import com.platform.service.IOracleExtractService;
|
||||||
|
|
||||||
/** 测试是否能获得oracle连接
|
/** 测试是否能获得oracle连接
|
||||||
|
|
@ -17,13 +17,13 @@ public class ThreadGainOracleConnect extends Thread {
|
||||||
|
|
||||||
private IOracleExtractService OracleExtract;
|
private IOracleExtractService OracleExtract;
|
||||||
|
|
||||||
private oracleForm form;
|
private OracleForm form;
|
||||||
|
|
||||||
/** 测试是否能获得oracle连接
|
/** 测试是否能获得oracle连接
|
||||||
* @param form
|
* @param form
|
||||||
* @param OracleExtract
|
* @param OracleExtract
|
||||||
*/
|
*/
|
||||||
public ThreadGainOracleConnect(oracleForm form, IOracleExtractService OracleExtract) {
|
public ThreadGainOracleConnect(OracleForm form, IOracleExtractService OracleExtract) {
|
||||||
this.form = form;
|
this.form = form;
|
||||||
this.OracleExtract= OracleExtract;
|
this.OracleExtract= OracleExtract;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,9 @@ import javax.annotation.Resource;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.base.MyException;
|
||||||
import com.base.TaskOperateData;
|
import com.base.TaskOperateData;
|
||||||
import com.platform.dao.DataInfoDao;
|
import com.platform.dao.DataInfoDao;
|
||||||
import com.platform.dao.DataInfoMoveTmpDao;
|
import com.platform.dao.DataInfoMoveTmpDao;
|
||||||
|
|
@ -22,58 +24,64 @@ import com.platform.entities.DataInfoEntity;
|
||||||
import com.platform.entities.DataInfoEntityMoveTmp;
|
import com.platform.entities.DataInfoEntityMoveTmp;
|
||||||
import com.platform.entities.VolumeInitEntity;
|
import com.platform.entities.VolumeInitEntity;
|
||||||
import com.platform.glusterfs.CheckoutMD5;
|
import com.platform.glusterfs.CheckoutMD5;
|
||||||
import com.platform.http.gfs.CopyData;
|
|
||||||
import com.platform.glusterfs.ShowData;
|
import com.platform.glusterfs.ShowData;
|
||||||
|
import com.platform.http.gfs.CopyData;
|
||||||
import com.platform.utils.Bean2MapUtils;
|
import com.platform.utils.Bean2MapUtils;
|
||||||
|
import com.platform.utils.Configs;
|
||||||
import com.platform.utils.Constant;
|
import com.platform.utils.Constant;
|
||||||
import com.platform.utils.DateForm;
|
import com.platform.utils.DateForm;
|
||||||
|
import com.platform.utils.ExceptionMsg;
|
||||||
import com.platform.utils.FileOperateHelper;
|
import com.platform.utils.FileOperateHelper;
|
||||||
|
import com.platform.utils.RunCommand;
|
||||||
|
import com.platform.utils.StringHandle;
|
||||||
|
|
||||||
/** 数据迁移---(该类不用了,丢弃)
|
/**
|
||||||
|
*
|
||||||
* @author chen
|
* @author chen
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class ThreadMoveData{
|
public class ThreadMoveData {
|
||||||
|
|
||||||
public final static Logger log = Logger.getLogger(ThreadMoveData.class);
|
public final static Logger log = Logger.getLogger(ThreadMoveData.class);
|
||||||
|
|
||||||
@Resource(name = "dataInfoDao")
|
@Resource(name = "dataInfoDao")
|
||||||
private DataInfoDao dataInfoDao;
|
private DataInfoDao dataInfoDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 迁移
|
* 迁移
|
||||||
*/
|
*/
|
||||||
CopyData copy = new CopyData();
|
CopyData copy = new CopyData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MD5校验
|
* MD5校验
|
||||||
*/
|
*/
|
||||||
CheckoutMD5 check = new CheckoutMD5();
|
CheckoutMD5 check = new CheckoutMD5();
|
||||||
|
|
||||||
@Resource(name = "dataInfoMoveTmpDao")
|
@Resource(name = "dataInfoMoveTmpDao")
|
||||||
private DataInfoMoveTmpDao dataInfoMoveTmpDao;
|
private DataInfoMoveTmpDao dataInfoMoveTmpDao;
|
||||||
|
|
||||||
@Resource(name = "volumeDao")
|
@Resource(name = "volumeDao")
|
||||||
private VolumeDao volumeDao;
|
private VolumeDao volumeDao;
|
||||||
|
|
||||||
|
private Map<String, String> volumeMap = new HashMap<String, String>();
|
||||||
/**
|
/**
|
||||||
* 查看数据
|
* 查看数据
|
||||||
*/
|
*/
|
||||||
ShowData show = new ShowData();
|
ShowData show = new ShowData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* : 实时更新数据库--根据查询到的 迁移的数据
|
* : 实时更新数据库--根据查询到的 迁移的数据
|
||||||
*/
|
*/
|
||||||
public ThreadMoveData() {
|
public ThreadMoveData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
//迁移数据 -- 2016-11-30后 使用
|
// 迁移数据 -- 2016-11-30后 使用
|
||||||
@Scheduled(fixedDelay = 5000)
|
@Scheduled(fixedDelay = 3000)
|
||||||
public void moveDataByWebGfs(){
|
public void moveDataByWebGfs() {
|
||||||
synchronized(this){
|
// log.info("----迁移任务轮询-----");
|
||||||
|
synchronized (ThreadMoveData.class) {
|
||||||
List<DataInfoEntityMoveTmp> result = new ArrayList<DataInfoEntityMoveTmp>();
|
List<DataInfoEntityMoveTmp> result = new ArrayList<DataInfoEntityMoveTmp>();
|
||||||
Map<String, String> volumeMap = new HashMap<String, String>();
|
|
||||||
try {
|
try {
|
||||||
List<VolumeInitEntity> volumeList = volumeDao.findAll();
|
List<VolumeInitEntity> volumeList = volumeDao.findAll();
|
||||||
for (VolumeInitEntity volumeInitEntity : volumeList) {
|
for (VolumeInitEntity volumeInitEntity : volumeList) {
|
||||||
|
|
@ -88,191 +96,14 @@ public class ThreadMoveData{
|
||||||
log.error(e);
|
log.error(e);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
List<DataInfoEntityMoveTmp> insertData = this.doMoveService(result);
|
doMoveService(result);
|
||||||
if (insertData.size() > 0) {
|
|
||||||
for (DataInfoEntityMoveTmp dataInfoEntityMoveTmp : insertData) {
|
|
||||||
this.makeDataInfo(dataInfoEntityMoveTmp, volumeMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e);
|
log.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//5秒 //2016-11-30后 不使用
|
|
||||||
// @Scheduled(fixedDelay = 5000)
|
|
||||||
public void doSomething() {
|
|
||||||
|
|
||||||
try {
|
@Transactional
|
||||||
List<DataInfoEntityMoveTmp> result = null;
|
|
||||||
//查询 表 move_data_tmp
|
|
||||||
result = dataInfoMoveTmpDao.findAll();
|
|
||||||
if (null != result) {
|
|
||||||
//gfs 获取size,
|
|
||||||
int rsize = result.size();
|
|
||||||
boolean isNoMove = true;
|
|
||||||
//该循环必须 循环每个,不能有 break;
|
|
||||||
// rate:大小:假的,待换成真实比例
|
|
||||||
double realRate = 0.00;
|
|
||||||
int moveFileCurrNum = 0;
|
|
||||||
for (int i = 0; i < rsize; i++) {
|
|
||||||
DataInfoEntityMoveTmp dataMove = result.get(i);
|
|
||||||
//如果拷贝进度超过20分钟未进行-- 判断为 迁移失败。
|
|
||||||
// "1" :正在上传,0:等待 迁移, 2:成功 3:失败
|
|
||||||
long srcSizeTemp = 0;
|
|
||||||
long dstSize = 0;
|
|
||||||
if ("1".equals(dataMove.getCompleteStatus())) {
|
|
||||||
long nowTime = new Date().getTime();
|
|
||||||
long timelong = nowTime - DateForm.string2DateBysecond(dataMove.getLastTime()).getTime();
|
|
||||||
if (timelong > 1000*60*20) {
|
|
||||||
doMd5(srcSizeTemp, dstSize, dataMove);
|
|
||||||
}
|
|
||||||
//正在上传的个数。
|
|
||||||
moveFileCurrNum++;
|
|
||||||
if (moveFileCurrNum >= Constant.moveFileMaxNum) {
|
|
||||||
isNoMove = false;
|
|
||||||
}
|
|
||||||
// 查询大小:。//gfs 获取size,
|
|
||||||
srcSizeTemp = show.getFolderSize(dataMove.getDataPath());
|
|
||||||
long srcSize = (long) (srcSizeTemp * 0.998);
|
|
||||||
dstSize = show.getFolderSize(dataMove.getDstPath());
|
|
||||||
boolean isExist = false;
|
|
||||||
if (srcSize < 0) {
|
|
||||||
log.error(dataMove.getDataPath() + " : 路径不存在! ");
|
|
||||||
isExist = true;
|
|
||||||
}
|
|
||||||
if (dstSize < 0) {
|
|
||||||
log.error(dataMove.getDstPath() + " : 路径不存在! ");
|
|
||||||
isExist = true;
|
|
||||||
}
|
|
||||||
if (isExist) {
|
|
||||||
// 3:表示 迁移失败
|
|
||||||
dataMove.setLastTime(DateForm.date2StringBysecond(new Date()));
|
|
||||||
dataMove.setCompleteStatus("3");
|
|
||||||
dataInfoMoveTmpDao.update(dataMove);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (srcSize > 0 && dstSize > 0) {
|
|
||||||
realRate = (dstSize*100 / srcSize );
|
|
||||||
}
|
|
||||||
if (srcSize == dstSize || realRate > 100) {
|
|
||||||
realRate = 100;
|
|
||||||
}
|
|
||||||
if (realRate > dataMove.getRate()) {
|
|
||||||
dataMove.setLastTime(DateForm.date2StringBysecond(new Date()));
|
|
||||||
dataMove.setRate((int) realRate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if("1".equals(dataMove.getCompleteStatus()) && dataMove.getRate() > 0){
|
|
||||||
//传输完毕:进行校验
|
|
||||||
if (realRate >= 100) {
|
|
||||||
//TODO
|
|
||||||
doMd5(srcSizeTemp, dstSize, dataMove);
|
|
||||||
dataMove.setLastTime(DateForm.date2StringBysecond(new Date()));
|
|
||||||
}
|
|
||||||
dataInfoMoveTmpDao.update(dataMove);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//循环 完了, 确定没有上传的 ,没有正在上传的
|
|
||||||
if (isNoMove) {
|
|
||||||
//查询 表 move_data_tmp
|
|
||||||
result = dataInfoMoveTmpDao.findAll();
|
|
||||||
if (null != result) {
|
|
||||||
|
|
||||||
int tmpsize = result.size();
|
|
||||||
// 上传下一个后
|
|
||||||
for (int i = 0; i < tmpsize; i++) {
|
|
||||||
DataInfoEntityMoveTmp next2move = result.get(i);
|
|
||||||
//如果是 待 迁移状态的
|
|
||||||
if ("0".equals(next2move.getCompleteStatus())) {
|
|
||||||
//待迁移的数据 -- 开始迁移
|
|
||||||
// 末尾 含有 /
|
|
||||||
Pattern pattern2 = Pattern.compile("\\d+\\/$");
|
|
||||||
String dstPath = next2move.getDstPath();
|
|
||||||
Matcher matcher2 = pattern2.matcher(dstPath);
|
|
||||||
//去掉 最后 的 数字 +/ 符合
|
|
||||||
if (matcher2.find()) {
|
|
||||||
String removeStr = matcher2.group();
|
|
||||||
dstPath = dstPath.replace(removeStr, "");
|
|
||||||
}
|
|
||||||
//数据迁移。
|
|
||||||
copy.copyFolder(next2move.getDataPath(), dstPath);
|
|
||||||
// "1" :正在上传,0:等待 迁移, 2:成功 3:失败
|
|
||||||
next2move.setCompleteStatus("1");
|
|
||||||
next2move.setLastTime(DateForm.date2StringBysecond(new Date()));
|
|
||||||
//更新sql
|
|
||||||
dataInfoMoveTmpDao.update(next2move);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Thread.sleep(Constant.update_dataInfo_sleep_time);
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.err.println(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/** md5校验
|
|
||||||
* @param srcSizeTemp
|
|
||||||
* @param dstSize
|
|
||||||
* @param dataMove
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
private void doMd5(long srcSizeTemp, long dstSize, DataInfoEntityMoveTmp dataMove) throws Exception {
|
|
||||||
|
|
||||||
int difSize = (int) (srcSizeTemp-dstSize);
|
|
||||||
if (difSize < 1) {
|
|
||||||
difSize = 1;
|
|
||||||
}
|
|
||||||
Thread.sleep(10*difSize);
|
|
||||||
//TODO 查看当前拷贝目录进程是否结束?
|
|
||||||
// 进行MD5校验
|
|
||||||
int resl = check.checkoutMD5Folder(dataMove.getDataPath(), dataMove.getDstPath());
|
|
||||||
// 校验成功--则增加数据库记录
|
|
||||||
if(resl == 1){
|
|
||||||
try{
|
|
||||||
// 判断 迁移数据的status是否改为 2
|
|
||||||
DataInfoEntityMoveTmp movetmp = dataInfoMoveTmpDao.findById(dataMove.getId());
|
|
||||||
if(null != movetmp){
|
|
||||||
if (!"2".equals(movetmp.getCompleteStatus())) {
|
|
||||||
//校验成功--修改 数据库记录--
|
|
||||||
dataMove.setCompleteStatus("2");
|
|
||||||
dataMove.setLastTime(DateForm.date2StringBysecond(new Date()));
|
|
||||||
dataInfoMoveTmpDao.update(dataMove);
|
|
||||||
//TODO 新增 一条数据-到-dataInfo
|
|
||||||
DataInfoEntity data = (DataInfoEntity) Bean2MapUtils.convertMap(
|
|
||||||
DataInfoEntity.class, Bean2MapUtils.convertBean(dataMove));
|
|
||||||
data.setDataPath(dataMove.getDstPath());
|
|
||||||
data.setVolumeIp(dataMove.getDstVolumeIp());
|
|
||||||
data.setVolumePath(dataMove.getDstVolumePath());
|
|
||||||
data.setVolumeIp(dataMove.getVolumeIp());
|
|
||||||
data.setPayResult(dataMove.getPayResult());
|
|
||||||
data.setExecResult(dataMove.getExecResult());
|
|
||||||
data.setId(0);
|
|
||||||
dataInfoDao.save(data);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
dataMove.setCompleteStatus("2");
|
|
||||||
dataMove.setLastTime(DateForm.date2StringBysecond(new Date()));
|
|
||||||
dataInfoMoveTmpDao.update(dataMove);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}catch(Exception e){
|
|
||||||
log.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// 3:表示 迁移失败
|
|
||||||
dataMove.setLastTime(DateForm.date2StringBysecond(new Date()));
|
|
||||||
dataMove.setCompleteStatus("3");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<DataInfoEntityMoveTmp> doMoveService(List<DataInfoEntityMoveTmp> result) throws Exception {
|
private List<DataInfoEntityMoveTmp> doMoveService(List<DataInfoEntityMoveTmp> result) throws Exception {
|
||||||
List<DataInfoEntityMoveTmp> data4Insert = new ArrayList<DataInfoEntityMoveTmp>();
|
List<DataInfoEntityMoveTmp> data4Insert = new ArrayList<DataInfoEntityMoveTmp>();
|
||||||
List<DataInfoEntityMoveTmp>[] subMove = new ArrayList[4];
|
List<DataInfoEntityMoveTmp>[] subMove = new ArrayList[4];
|
||||||
|
|
@ -280,106 +111,47 @@ public class ThreadMoveData{
|
||||||
subMove[i] = new ArrayList<DataInfoEntityMoveTmp>();
|
subMove[i] = new ArrayList<DataInfoEntityMoveTmp>();
|
||||||
}
|
}
|
||||||
Map<String, TaskOperateData> taskMap = new HashMap<String, TaskOperateData>();
|
Map<String, TaskOperateData> taskMap = new HashMap<String, TaskOperateData>();
|
||||||
for ( DataInfoEntityMoveTmp moveE : result) {
|
for (DataInfoEntityMoveTmp moveE : result) {
|
||||||
switch (moveE.getCompleteStatus()) {
|
switch (moveE.getCompleteStatus()) {
|
||||||
//待迁移
|
// 待迁移
|
||||||
case "0":
|
case "0":
|
||||||
subMove[0].add(moveE);
|
subMove[0].add(moveE);
|
||||||
break;
|
break;
|
||||||
//正在迁移
|
// 正在迁移
|
||||||
case "1":
|
case "1":
|
||||||
subMove[1].add(moveE);
|
subMove[1].add(moveE);
|
||||||
break;
|
break;
|
||||||
//迁移完成的
|
// 迁移完成的
|
||||||
case "2":
|
case "2":
|
||||||
subMove[2].add(moveE);
|
subMove[2].add(moveE);
|
||||||
break;
|
break;
|
||||||
//迁移失败
|
// 迁移失败
|
||||||
case "3":
|
case "3":
|
||||||
subMove[3].add(moveE);
|
subMove[3].add(moveE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//迁移失败---不处理 status = -1:表示迁移完成,校验失败,-2:表示迁移失败 -3:表示删除失败
|
|
||||||
|
// 待迁移 status = 0:准备迁移(则开始迁移)
|
||||||
//迁移完成的--不处理 status = 3:表示校验成功,
|
if (subMove[0].size() > 0) {
|
||||||
|
// 正在迁移的 数量
|
||||||
//正则迁移 status = 1:表示正在迁移(如果 web gfs 迁移成功 则 增加一条记录)
|
|
||||||
if(subMove[1].size() > 0){
|
|
||||||
//请求进度
|
|
||||||
List<TaskOperateData> list = new ArrayList<TaskOperateData>();
|
|
||||||
try {
|
|
||||||
list = copy.operationTask();
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("copy.operationTask()");
|
|
||||||
log.error(e);
|
|
||||||
}
|
|
||||||
for (TaskOperateData taskOperateData : list) {
|
|
||||||
taskMap.put(FileOperateHelper.addLastLinuxSeparator(taskOperateData.getSourcePath())
|
|
||||||
+ "-" + FileOperateHelper.addLastLinuxSeparator(taskOperateData.getDestPath()),
|
|
||||||
taskOperateData);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (DataInfoEntityMoveTmp moveE : subMove[1]) {
|
|
||||||
TaskOperateData taskOne = taskMap.get(FileOperateHelper.addLastLinuxSeparator(moveE.getDataPath())
|
|
||||||
+"-"+FileOperateHelper.addLastLinuxSeparator(makeDstPath(moveE.getDstPath())));
|
|
||||||
if (null == taskOne) {
|
|
||||||
long nowTime = new Date().getTime();
|
|
||||||
long timelong = nowTime - DateForm.string2DateBysecond(moveE.getLastTime()).getTime();
|
|
||||||
if (timelong > 1000*60*20) {
|
|
||||||
try {
|
|
||||||
moveE.setCompleteStatus("3");
|
|
||||||
dataInfoMoveTmpDao.update(moveE);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int rate = taskOne.getProgress();
|
|
||||||
if (rate >= 100) {
|
|
||||||
rate = 99;
|
|
||||||
}
|
|
||||||
moveE.setRate(rate);
|
|
||||||
moveE.setLastTime(DateForm.date2StringBysecond(new Date()));
|
|
||||||
if (3 == taskOne.getStatus()) {
|
|
||||||
moveE.setRate(100);
|
|
||||||
//成功---创建数据(改为 记录 到 data4Insert 中 )
|
|
||||||
// makeDataInfo(moveE);
|
|
||||||
data4Insert.add(moveE);
|
|
||||||
}else if(taskOne.getStatus() < 0){
|
|
||||||
moveE.setRate(taskOne.getProgress());
|
|
||||||
//失败
|
|
||||||
moveE.setCompleteStatus("3");
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
dataInfoMoveTmpDao.update(moveE);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//待迁移 status = 0:准备迁移(则开始迁移)
|
|
||||||
if(subMove[0].size() > 0){
|
|
||||||
//正则迁移的 数量
|
|
||||||
int curMoveNum = subMove[1].size();
|
int curMoveNum = subMove[1].size();
|
||||||
for ( DataInfoEntityMoveTmp moveE : subMove[0]) {
|
for (DataInfoEntityMoveTmp moveE : subMove[0]) {
|
||||||
if(curMoveNum < Constant.moveFileMaxNum){
|
if (curMoveNum < Constant.moveFileMaxNum) {
|
||||||
moveE.setLastTime(DateForm.date2StringBysecond(new Date()));
|
moveE.setLastTime(DateForm.date2StringBysecond(new Date()));
|
||||||
//请求迁移
|
// 请求迁移
|
||||||
curMoveNum++;
|
curMoveNum++;
|
||||||
//TODO 判断 moveE.getDataPath()的空间大小 和 makeDstPath(moveE.getDstPath())的大小
|
// TODO 判断 moveE.getDataPath()的空间大小 和
|
||||||
//迁移
|
// makeDstPath(moveE.getDstPath())的大小
|
||||||
|
// 迁移
|
||||||
try {
|
try {
|
||||||
int copyResult = copy.copyFolder(moveE.getDataPath(), makeDstPath(moveE.getDstPath()));
|
int copyResult = copy.copyFolder(moveE.getDataPath(), moveE.getDstPath());
|
||||||
log.info("httpclient copyFolder result: "+copyResult);
|
log.info("httpclient copyFolder result: " + copyResult);
|
||||||
if(1== copyResult){
|
if (1 == copyResult) {
|
||||||
moveE.setCompleteStatus("1");
|
moveE.setCompleteStatus("1");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
moveE.setCompleteStatus("3");
|
moveE.setCompleteStatus("3");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
@ -394,41 +166,111 @@ public class ThreadMoveData{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 迁移失败---不处理 status = -1:表示迁移完成,校验失败,-2:表示迁移失败 -3:表示删除失败
|
||||||
|
|
||||||
|
// 迁移完成的--不处理 status = 3:表示校验成功,
|
||||||
|
|
||||||
|
// 正则迁移 status = 1:表示正在迁移(如果 web gfs 迁移成功 则 增加一条记录)
|
||||||
|
if (subMove[1].size() > 0) {
|
||||||
|
// 请求进度
|
||||||
|
List<TaskOperateData> list = new ArrayList<TaskOperateData>();
|
||||||
|
try {
|
||||||
|
list = copy.operationTask();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("copy.operationTask", e);
|
||||||
|
}
|
||||||
|
for (TaskOperateData taskOperateData : list) {
|
||||||
|
String key = FileOperateHelper.addLastLinuxSeparator(taskOperateData.getSourcePath()) + "-"
|
||||||
|
+ FileOperateHelper.addLastLinuxSeparator(taskOperateData.getDestPath());
|
||||||
|
taskMap.put(key, taskOperateData);
|
||||||
|
/*if (taskMap.get(key) == null) {
|
||||||
|
taskMap.put(key, taskOperateData);
|
||||||
|
} else {
|
||||||
|
// 只存储时间最近的,即正在进行的
|
||||||
|
if (taskMap.get(key).getStartTime().compareTo(taskOperateData.getStartTime()) < 0) {
|
||||||
|
taskMap.put(key, taskOperateData);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
for (DataInfoEntityMoveTmp moveE : subMove[1]) {
|
||||||
|
TaskOperateData taskOne = taskMap.get(FileOperateHelper.addLastLinuxSeparator(moveE.getDataPath()) + "-"
|
||||||
|
+ FileOperateHelper.addLastLinuxSeparator(moveE.getDstPath()));
|
||||||
|
if (null == taskOne) {
|
||||||
|
long nowTime = new Date().getTime();
|
||||||
|
long timelong = nowTime - DateForm.string2DateBysecond(moveE.getLastTime()).getTime();
|
||||||
|
if (timelong > 1000 * 60 * 20) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
log.info("copy task timeout id:"+ moveE.getId() + " path: "+moveE.getDstPath());
|
||||||
|
moveE.setCompleteStatus("3");
|
||||||
|
dataInfoMoveTmpDao.update(moveE);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int rate = taskOne.getProgress();
|
||||||
|
if (rate >= 100) {
|
||||||
|
rate = 99;
|
||||||
|
}
|
||||||
|
moveE.setRate(rate);
|
||||||
|
moveE.setLastTime(DateForm.date2StringBysecond(new Date()));
|
||||||
|
int status = taskOne.getStatus();
|
||||||
|
if (3 == status) {
|
||||||
|
// 成功---创建数据(改为 记录 到 data4Insert 中 )
|
||||||
|
log.info("gfs copy folder success id: "+moveE.getId());
|
||||||
|
moveE.setRate(100);
|
||||||
|
makeDataInfo(moveE);
|
||||||
|
// data4Insert.add(moveE);
|
||||||
|
} else if (status < 0) {
|
||||||
|
moveE.setRate(taskOne.getProgress());
|
||||||
|
// 失败
|
||||||
|
moveE.setCompleteStatus("3");
|
||||||
|
|
||||||
|
log.info("gfs copy folder error id: "+moveE.getId()+" status: "+status);
|
||||||
|
}
|
||||||
|
dataInfoMoveTmpDao.update(moveE);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return data4Insert;
|
return data4Insert;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int makeDataInfo(DataInfoEntityMoveTmp dataMove, Map<String, String> volumeMap){
|
private int makeDataInfo(DataInfoEntityMoveTmp dataMove) {
|
||||||
try{
|
try {
|
||||||
// 判断 迁移数据的status是否改为 2
|
// 判断 迁移数据的status是否改为 2
|
||||||
DataInfoEntityMoveTmp movetmp = dataInfoMoveTmpDao.findById(dataMove.getId());
|
DataInfoEntityMoveTmp movetmp = dataInfoMoveTmpDao.findById(dataMove.getId());
|
||||||
if(null != movetmp){
|
if (null != movetmp) {
|
||||||
if (!"2".equals(movetmp.getCompleteStatus())) {
|
if (!"2".equals(movetmp.getCompleteStatus())) {
|
||||||
//校验成功--修改 数据库记录--
|
// 校验成功--修改 数据库记录--
|
||||||
dataMove.setCompleteStatus("2");
|
dataMove.setCompleteStatus("2");
|
||||||
dataMove.setLastTime(DateForm.date2StringBysecond(new Date()));
|
dataMove.setLastTime(DateForm.date2StringBysecond(new Date()));
|
||||||
dataInfoMoveTmpDao.update(dataMove);
|
// dataInfoMoveTmpDao.update(dataMove);
|
||||||
//TODO 新增 一条数据-到-dataInfo
|
// TODO 新增 一条数据-到-dataInfo
|
||||||
DataInfoEntity data = (DataInfoEntity) Bean2MapUtils.convertMap(
|
DataInfoEntity data = (DataInfoEntity) Bean2MapUtils.convertMap(DataInfoEntity.class,
|
||||||
DataInfoEntity.class, Bean2MapUtils.convertBean(dataMove));
|
Bean2MapUtils.convertBean(dataMove));
|
||||||
data.setDataPath(dataMove.getDstPath());
|
data.setDataPath(dataMove.getDstPath());
|
||||||
|
data.setDataVersion(data.getDataVersionFromDataPath());
|
||||||
if (null == dataMove.getDstVolumeIp()) {
|
if (null == dataMove.getDstVolumeIp()) {
|
||||||
data.setVolumeIp("localhost");
|
data.setVolumeIp("localhost");
|
||||||
}else {
|
} else {
|
||||||
data.setVolumeIp(dataMove.getDstVolumeIp());
|
data.setVolumeIp(dataMove.getDstVolumeIp());
|
||||||
}
|
}
|
||||||
// volume路径,,没有传入
|
// volume路径,,没有传入
|
||||||
if (null == dataMove.getDstVolumePath()) {
|
if (null == dataMove.getDstVolumePath()) {
|
||||||
data.setVolumePath(dataMove.getDstPath());
|
data.setVolumePath(dataMove.getDstPath());
|
||||||
}else {
|
} else {
|
||||||
data.setVolumePath(dataMove.getDstVolumePath());
|
data.setVolumePath(dataMove.getDstVolumePath());
|
||||||
String mark = volumeMap.get(dataMove.getDstVolumePath());
|
String mark = volumeMap.get(dataMove.getDstVolumePath());
|
||||||
// hot :0
|
// hot :0
|
||||||
if("0".equals(mark)){
|
if ("0".equals(mark)) {
|
||||||
if (movetmp.getFkid() > 0) {
|
if (movetmp.getFkid() > 0) {
|
||||||
data.setSrcId(movetmp.getFkid());
|
data.setSrcId(movetmp.getFkid());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
data.setSrcId(dataMove.getFkid());
|
data.setSrcId(dataMove.getFkid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -436,40 +278,53 @@ public class ThreadMoveData{
|
||||||
data.setPayResult(dataMove.getPayResult());
|
data.setPayResult(dataMove.getPayResult());
|
||||||
data.setExecResult(dataMove.getExecResult());
|
data.setExecResult(dataMove.getExecResult());
|
||||||
data.setId(0);
|
data.setId(0);
|
||||||
try {
|
|
||||||
if (dataInfoDao.countByDataPath(data) == 0) {
|
if (dataInfoDao.countByDataPath(data) == 0) {
|
||||||
dataInfoDao.save(data);
|
dataInfoDao.save(data);
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e);
|
|
||||||
dataMove.setCompleteStatus("1");
|
|
||||||
dataInfoMoveTmpDao.update(dataMove);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}else {
|
log.info("save datainfo success, id="+dataMove.getId());
|
||||||
|
}
|
||||||
|
} /*else {
|
||||||
dataInfoMoveTmpDao.update(dataMove);
|
dataInfoMoveTmpDao.update(dataMove);
|
||||||
}
|
}*/
|
||||||
}catch(Exception e){
|
} catch (Exception e) {
|
||||||
log.error(e);
|
log.error(ExceptionMsg.exceptionStackToStr(e));
|
||||||
|
dataMove.setCompleteStatus("3");
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 去掉 最后 的 数字 +/
|
/**
|
||||||
|
|
||||||
|
* 去掉 最后 的 数字 +/
|
||||||
|
*
|
||||||
* @param dstPath
|
* @param dstPath
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String makeDstPath(String dstPath) {
|
private String makeDstPath(String dstPath) {
|
||||||
// 末尾 含有 数字 + /
|
// 末尾 含有 数字 + /
|
||||||
Pattern pattern2 = Pattern.compile("\\d+\\/$");
|
Pattern pattern2 = Pattern.compile("\\d+\\/$");
|
||||||
Matcher matcher2 = pattern2.matcher(dstPath);
|
Matcher matcher2 = pattern2.matcher(dstPath);
|
||||||
//去掉 最后 的 数字 +/ 符合
|
// 去掉 最后 的 数字 +/ 符合
|
||||||
if (matcher2.find()) {
|
if (matcher2.find()) {
|
||||||
String removeStr = matcher2.group();
|
String removeStr = matcher2.group();
|
||||||
removeStr.length();
|
removeStr.length();
|
||||||
dstPath = dstPath.substring(0, dstPath.length()-removeStr.length());
|
dstPath = dstPath.substring(0, dstPath.length() - removeStr.length());
|
||||||
}
|
}
|
||||||
return dstPath;
|
return dstPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 为路径添加/*,以不创建源文件夹的方式迁移
|
||||||
|
*
|
||||||
|
* @param path
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String addAllSubDataPath(String path) {
|
||||||
|
if (path.endsWith(Constant.LINUX_FILE_SEPERATOR)) {
|
||||||
|
return path + "*";
|
||||||
|
}
|
||||||
|
return path + "/*";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,132 +2,221 @@ package com.platform.utils;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/** 配置启动 变量
|
/**
|
||||||
|
* 配置启动 变量
|
||||||
|
*
|
||||||
* @author chen
|
* @author chen
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Configs {
|
public class Configs {
|
||||||
|
|
||||||
/** 全局自定义异常--编码 */
|
/** 全局自定义异常--编码 */
|
||||||
public static final String GLOBAL_EXP_CUSTOM = "3001001001";
|
public static final String GLOBAL_EXP_CUSTOM = "3001001001";
|
||||||
|
|
||||||
/** 全局非自定义异常--编码 */
|
/** 全局非自定义异常--编码 */
|
||||||
public static final String GLOBAL_EXP_NOT_CUSTOM = "3001001002";
|
public static final String GLOBAL_EXP_NOT_CUSTOM = "3001001002";
|
||||||
|
|
||||||
public static final String CONFIG_LOCALTION = "WebContent/WEB-INF/config/config.properties";
|
public static final String CONFIG_LOCALTION = "WebContent/WEB-INF/config/config.properties";
|
||||||
|
|
||||||
public static final Logger CONSOLE_LOGGER = Logger.getLogger("console");
|
public static final Logger CONSOLE_LOGGER = Logger.getLogger("console");
|
||||||
|
|
||||||
public static final Logger DAILY_ROLLING_LOGGER = Logger
|
public static final Logger DAILY_ROLLING_LOGGER = Logger.getLogger("dailyRollingFile");
|
||||||
.getLogger("dailyRollingFile");
|
|
||||||
|
|
||||||
public static final Logger DAILY_LOGGER = Logger.getLogger("railyFile");
|
public static final Logger DAILY_LOGGER = Logger.getLogger("railyFile");
|
||||||
|
|
||||||
public static final Logger LOGGER = Logger.getLogger(Configs.class);
|
public static final Logger LOGGER = Logger.getLogger(Configs.class);
|
||||||
|
|
||||||
public static String KUBE_MASTER_URL = "http://192.168.0.110:8080/"; // kubernetes集群的maser
|
public static String KUBE_MASTER_URL = "http://192.168.0.110:8080/"; // kubernetes集群的maser
|
||||||
// URl
|
// URl
|
||||||
|
public static String OPERATE_SYSTEM = "1";
|
||||||
public static String KUBE_MASTER_ADDRESS="127.0.0.1:8080";
|
public static String KUBE_MASTER_ADDRESS = "127.0.0.1:8080";
|
||||||
|
|
||||||
|
|
||||||
public static int ORACLE_DEFAULT_PORT = 1521; // oracle的默认端口号
|
public static int ORACLE_DEFAULT_PORT = 1521; // oracle的默认端口号
|
||||||
|
|
||||||
public static String COLLECT_USER_NAME = "system"; //采集统一的登入用户名
|
public static String COLLECT_USER_NAME = "system"; // 采集统一的登入用户名
|
||||||
|
|
||||||
public static String COLLECT_PASSWORD = "oracle"; //采集统一的登入密码
|
public static String COLLECT_PASSWORD = "oracle"; // 采集统一的登入密码
|
||||||
|
|
||||||
|
public static String COLLECT_SERVICE_NAME = "orcl"; // 采集库统一的服务名
|
||||||
|
|
||||||
|
public static String GATHER_PORT = "1521"; // 汇总库的端口号
|
||||||
|
|
||||||
|
public static String GATHER_USER_NAME = "system"; // 汇总库的登入用户名
|
||||||
|
|
||||||
|
public static String GATHER_USER_PASSWORD = "1"; // 汇总库的登入密码
|
||||||
|
|
||||||
public static String COLLECT_SERVICE_NAME = "orcl"; //采集库统一的服务名
|
|
||||||
|
|
||||||
public static String GATHER_PORT ="1521"; //汇总库的端口号
|
|
||||||
|
|
||||||
public static String GATHER_USER_NAME = "system"; //汇总库的登入用户名
|
|
||||||
|
|
||||||
public static String GATHER_USER_PASSWORD = "1"; //汇总库的登入密码
|
|
||||||
|
|
||||||
/** 抽取标准表 的 标准表所在 用户 */
|
/** 抽取标准表 的 标准表所在 用户 */
|
||||||
public static String GATHER_STANDARD_USER_NAME = "u_bzbjy";
|
public static String GATHER_STANDARD_USER_NAME = "";
|
||||||
|
|
||||||
/** 可执行表名 */
|
/** 可执行表名 */
|
||||||
public static String GATHER_STANDARD_EXEC_TABLE_NAME = "kzxzb";
|
public static String GATHER_STANDARD_EXEC_TABLE_NAME = "";
|
||||||
|
|
||||||
/** 可支付表名 */
|
/** 可支付表名 */
|
||||||
public static String GATHER_STANDARD_PAY_TABLE_NAME = "zfxxb";
|
public static String GATHER_STANDARD_PAY_TABLE_NAME = "";
|
||||||
|
|
||||||
public static String GATHER_SERVICE_NAME = "orcl"; //汇总库的服务名
|
/**
|
||||||
|
* 其他标准表表名称
|
||||||
public static String TABLE_SUFFIX = "_20152016"; //汇总库汇总表的后缀名
|
*/
|
||||||
|
public static String OTHER_STANDARD_TABLES = "";
|
||||||
public static String EXTRACT_LOG_LOCALTION = "D:\\log"; //数据汇总日志保存位置
|
|
||||||
|
public static String GATHER_SERVICE_NAME = "orcl"; // 汇总库的服务名
|
||||||
public static String EXTRACT_STANDARD_LOG_LOCALTION = "D:\\log2"; //数据抽取日志保存位置
|
|
||||||
|
public static String TABLE_SUFFIX = ""; // 汇总库汇总表的后缀名
|
||||||
public static String GATHER_TABLESPACE_NAME=""; //表空间名
|
|
||||||
|
public static String EXTRACT_LOG_LOCALTION = ""; // 数据汇总日志保存位置
|
||||||
public static String GATHER_TABLESPACE_PATH=""; //表空间路径
|
|
||||||
|
public static String EXTRACT_STANDARD_LOG_LOCALTION = ""; // 数据抽取日志保存位置
|
||||||
public static String GATHER_TABLE_PASSWORD="1"; //登入密码
|
|
||||||
|
public static String EXPORT_DATA_LOG_LOCALTION = ""; // 数据导出日志保存位置
|
||||||
//数据根目录
|
|
||||||
public static String DATA_PATH="";
|
public static String EXPORT_DATA_LOCALTION = ""; // 数据导出日志保存位置
|
||||||
|
|
||||||
|
public static String EXPORT_DATA_LOG_NAME = "export_data"; // 数据导出日志名称
|
||||||
|
|
||||||
|
public static String GATHER_TABLESPACE_NAME = ""; // 表空间名
|
||||||
|
|
||||||
|
public static String GATHER_TABLESPACE_PATH = ""; // 表空间路径
|
||||||
|
|
||||||
|
public static String GATHER_TABLE_PASSWORD = "1"; // 登入密码
|
||||||
|
|
||||||
|
// 数据根目录
|
||||||
|
public static String DATA_PATH = "";
|
||||||
|
|
||||||
/** excel上传路径 */
|
/** excel上传路径 */
|
||||||
public static String FILE_UPLOAD_PATH="";
|
public static String FILE_UPLOAD_PATH = "";
|
||||||
|
|
||||||
/** excel下载路经 */
|
/** excel下载路经 */
|
||||||
public static String FILE_DOWNLOAD_PATH="";
|
public static String FILE_DOWNLOAD_PATH = "";
|
||||||
|
|
||||||
/** 包下载路径 */
|
/** 包下载路径 */
|
||||||
public static String PACKAGE_DOWNLOAD_PATH="";
|
public static String PACKAGE_DOWNLOAD_PATH = "";
|
||||||
|
|
||||||
/** 下载包名 */
|
/** 下载包名 */
|
||||||
public static String PACKAGE_NAME="";
|
public static String PACKAGE_NAME = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最新脚本的位置
|
* 最新脚本的位置
|
||||||
*/
|
*/
|
||||||
public static String SQL_SCRIPT_PATH_LAST="D:\\test\\sql_script_last\\";
|
public static String SQL_SCRIPT_PATH_LAST = "";
|
||||||
/** 归档脚本的位置 */
|
/** 归档脚本的位置 */
|
||||||
public static String SQL_SCRIPT_PATH_STANDARD="D:\\test\\sql_script_standard\\";
|
public static String SQL_SCRIPT_PATH_STANDARD = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出数据原始库sql脚本
|
||||||
|
*/
|
||||||
|
public static String EXPORT_DATA_ORIGIN_SQL_SCRIPT = "origin_sql_script";
|
||||||
|
/**
|
||||||
|
* 导出数据汇总平台sql脚本
|
||||||
|
*/
|
||||||
|
public static String EXPORT_DATA_PLATFORM_SQL_SCRIPT = "platform_sql_script";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 多少 个月前的数据
|
* 多少 个月前的数据
|
||||||
*/
|
*/
|
||||||
public static int dataBefore = 6;
|
public static int dataBefore = 6;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* excel导入一次批量导入5个
|
* excel导入一次批量导入5个
|
||||||
*/
|
*/
|
||||||
public static int NUM_ONE_IMPORT_EXCEL = 5;
|
public static int NUM_ONE_IMPORT_EXCEL = 5;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* docker启动的 oracle服务 的 实例名称
|
* docker启动的 oracle服务 的 实例名称
|
||||||
*/
|
*/
|
||||||
public static String ORACLE_ORCL = "orcl";
|
public static String ORACLE_ORCL = "orcl";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* docker启动的 oracle服务 的 实例登陆用户名
|
* docker启动的 oracle服务 的 实例登陆用户名
|
||||||
*/
|
*/
|
||||||
public static String ORACLE_USER = "system";
|
public static String ORACLE_USER = "system";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* docker启动的 oracle服务 的 实例登陆密码
|
* docker启动的 oracle服务 的 实例登陆密码
|
||||||
*/
|
*/
|
||||||
public static String ORACLE_PSW = "oracle";
|
public static String ORACLE_PSW = "oracle";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 采集库中的 标准表所在 的 用户
|
* 采集库中的 标准表所在 的 用户
|
||||||
*/
|
*/
|
||||||
public static String COLLECT_STANDARD_TABLE_USER = "u_bzbjy";
|
public static String COLLECT_STANDARD_TABLE_USER = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 可执行的 标准表的 名
|
* 可执行的 标准表的 名
|
||||||
*/
|
*/
|
||||||
public static String COLLECT_EXEC_TABLE = "kzxzb";
|
public static String COLLECT_EXEC_TABLE = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付的 标准表的 名
|
* 支付的 标准表的 名
|
||||||
*/
|
*/
|
||||||
public static String COLLECT_PAY_TABLE = "zfxxb";
|
public static String COLLECT_PAY_TABLE = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原始数据目录
|
||||||
|
*/
|
||||||
|
public static String ORIGIN_DATABASE_UTF8 = "";
|
||||||
|
public static String ORIGIN_DATABASE_GBK = "";
|
||||||
|
|
||||||
|
// 汇总库数据信息
|
||||||
|
/**
|
||||||
|
* oracle内置用户列表,英文逗号分割,并且加单引号
|
||||||
|
*/
|
||||||
|
public static String SYSTEM_USERS = "'SCOTT'";
|
||||||
|
/**
|
||||||
|
* 汇总库地区编码
|
||||||
|
*/
|
||||||
|
public static String GATHER_DATABASE_AREA_CODE = "100000";
|
||||||
|
/**
|
||||||
|
* 汇总库系统名称
|
||||||
|
*/
|
||||||
|
public static String GATHER_DATABASE_SYSTEM_NAME = "汇总库";
|
||||||
|
/**
|
||||||
|
* 数据类型(财政、社保等,默认为汇总库)
|
||||||
|
*/
|
||||||
|
public static String GATHER_DATABASE_DATA_TYPE = "汇总库";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前数据批次(A、B)
|
||||||
|
*/
|
||||||
|
public static String GATHER_DATABASE_BATCH = "批次A";
|
||||||
|
/**
|
||||||
|
* 汇总库创建人姓名
|
||||||
|
*/
|
||||||
|
public static String GATHER_DATABASE_CREATOR_NAME = "管理员";
|
||||||
|
/**
|
||||||
|
* 汇总库创建人联系方式
|
||||||
|
*/
|
||||||
|
public static String GATHER_DATABASE_CREATOR_PHONE = "132123245687";
|
||||||
|
/**
|
||||||
|
* 数据库编码类型(UTF8,GBK)
|
||||||
|
*/
|
||||||
|
public static String GATHER_DATABASE_ENCODEING = "UTF8";
|
||||||
|
/**
|
||||||
|
* 数据库类型(ORACLE)
|
||||||
|
*/
|
||||||
|
public static String GATHER_DATABASE_TYPE = "ORACLE";
|
||||||
|
/**
|
||||||
|
* 当前数据开始年度
|
||||||
|
*/
|
||||||
|
public static String GATHER_DATABASE_START_YEAR = "2017";
|
||||||
|
/**
|
||||||
|
* 当前数据结束年度
|
||||||
|
*/
|
||||||
|
public static String GATHER_DATABASE_END_YEAR = "2017";
|
||||||
|
/**
|
||||||
|
* 当前数据开始月份
|
||||||
|
*/
|
||||||
|
public static String GATHER_DATABASE_START_MONTH = "1";
|
||||||
|
/**
|
||||||
|
* 当前数据结束月份
|
||||||
|
*/
|
||||||
|
public static String GATHER_DATABASE_END_MONTH = "12";
|
||||||
|
/**
|
||||||
|
* 数据版本
|
||||||
|
*/
|
||||||
|
public static int GATHER_DATABASE_DATA_VERSION = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表空间大小
|
||||||
|
*/
|
||||||
|
public static String TABLES_SPACE_SIZE = "50M";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
package com.platform.utils;
|
package com.platform.utils;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.servlet.ServletContextEvent;
|
import javax.servlet.ServletContextEvent;
|
||||||
|
|
@ -9,9 +7,6 @@ import javax.servlet.ServletContextListener;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.base.MyException;
|
|
||||||
import com.mysql.jdbc.log.Log;
|
|
||||||
import com.platform.controller.ExcelController;
|
|
||||||
import com.platform.http.HttpClientConstant;
|
import com.platform.http.HttpClientConstant;
|
||||||
import com.platform.utils.excelUtils.ExcelOperation;
|
import com.platform.utils.excelUtils.ExcelOperation;
|
||||||
|
|
||||||
|
|
@ -44,6 +39,7 @@ public class ConfigsLoader implements ServletContextListener {
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
Properties properties = cReader.getProperties();
|
Properties properties = cReader.getProperties();
|
||||||
|
Configs.OPERATE_SYSTEM = properties.getProperty("operate-system");
|
||||||
Configs.KUBE_MASTER_URL = properties.getProperty("kubeMasterUrl");
|
Configs.KUBE_MASTER_URL = properties.getProperty("kubeMasterUrl");
|
||||||
Configs.COLLECT_USER_NAME = properties.getProperty("collect-user-name");
|
Configs.COLLECT_USER_NAME = properties.getProperty("collect-user-name");
|
||||||
Configs.COLLECT_PASSWORD = properties.getProperty("collect-password");
|
Configs.COLLECT_PASSWORD = properties.getProperty("collect-password");
|
||||||
|
|
@ -61,17 +57,47 @@ public class ConfigsLoader implements ServletContextListener {
|
||||||
Configs.KUBE_MASTER_ADDRESS = properties.getProperty("kubeMasterAddress");
|
Configs.KUBE_MASTER_ADDRESS = properties.getProperty("kubeMasterAddress");
|
||||||
Configs.GATHER_TABLE_PASSWORD = properties.getProperty("gather-table-user-password");
|
Configs.GATHER_TABLE_PASSWORD = properties.getProperty("gather-table-user-password");
|
||||||
Configs.PACKAGE_NAME = properties.getProperty("package_name");
|
Configs.PACKAGE_NAME = properties.getProperty("package_name");
|
||||||
|
Configs.OTHER_STANDARD_TABLES = properties.getProperty("other_standard_tables");
|
||||||
|
|
||||||
|
// 项目数据根路径
|
||||||
|
Configs.DATA_PATH = properties.getProperty("data_path");
|
||||||
|
|
||||||
|
Configs.ORIGIN_DATABASE_UTF8 = Configs.DATA_PATH + properties.getProperty("origin_database_utf8");
|
||||||
|
Configs.ORIGIN_DATABASE_GBK = Configs.DATA_PATH + properties.getProperty("origin_database_gbk");
|
||||||
|
|
||||||
Configs.DATA_PATH =properties.getProperty("data_path");
|
|
||||||
Configs.EXTRACT_LOG_LOCALTION = Configs.DATA_PATH + properties.getProperty("extract-log-localtion");
|
Configs.EXTRACT_LOG_LOCALTION = Configs.DATA_PATH + properties.getProperty("extract-log-localtion");
|
||||||
if (!FileOperateHelper.ifNotExistMkdir(Configs.EXTRACT_LOG_LOCALTION)) {
|
if (!FileOperateHelper.ifNotExistMkdir(Configs.EXTRACT_LOG_LOCALTION)) {
|
||||||
log.error(Configs.EXTRACT_LOG_LOCALTION + "创建失败");
|
log.error(Configs.EXTRACT_LOG_LOCALTION + "创建失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Configs.EXPORT_DATA_LOCALTION = Configs.DATA_PATH + properties.getProperty("export-data-localtion");
|
||||||
|
if (!FileOperateHelper.ifNotExistMkdir(Configs.EXPORT_DATA_LOCALTION)) {
|
||||||
|
log.error(Configs.EXPORT_DATA_LOCALTION + "创建失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
Configs.EXPORT_DATA_ORIGIN_SQL_SCRIPT = Configs.EXPORT_DATA_LOCALTION
|
||||||
|
+ properties.getProperty("export_data_origin_sql_script");
|
||||||
|
if (!FileOperateHelper.ifNotExistMkdir(Configs.EXPORT_DATA_ORIGIN_SQL_SCRIPT)) {
|
||||||
|
log.error(Configs.EXPORT_DATA_ORIGIN_SQL_SCRIPT + "创建失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
Configs.EXPORT_DATA_PLATFORM_SQL_SCRIPT = Configs.EXPORT_DATA_LOCALTION
|
||||||
|
+ properties.getProperty("export_data_platform_sql_script");
|
||||||
|
if (!FileOperateHelper.ifNotExistMkdir(Configs.EXPORT_DATA_PLATFORM_SQL_SCRIPT)) {
|
||||||
|
log.error(Configs.EXPORT_DATA_PLATFORM_SQL_SCRIPT + "创建失败");
|
||||||
|
}
|
||||||
|
|
||||||
Configs.EXTRACT_STANDARD_LOG_LOCALTION = Configs.DATA_PATH
|
Configs.EXTRACT_STANDARD_LOG_LOCALTION = Configs.DATA_PATH
|
||||||
+ properties.getProperty("extract-standard-log-localtion");
|
+ properties.getProperty("extract-standard-log-localtion");
|
||||||
if (!FileOperateHelper.ifNotExistMkdir(Configs.EXTRACT_STANDARD_LOG_LOCALTION)) {
|
if (!FileOperateHelper.ifNotExistMkdir(Configs.EXTRACT_STANDARD_LOG_LOCALTION)) {
|
||||||
log.error(Configs.EXTRACT_STANDARD_LOG_LOCALTION + "创建失败");
|
log.error(Configs.EXTRACT_STANDARD_LOG_LOCALTION + "创建失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Configs.EXPORT_DATA_LOG_LOCALTION = Configs.DATA_PATH + properties.getProperty("export-data-log-localtion");
|
||||||
|
if (!FileOperateHelper.ifNotExistMkdir(Configs.EXPORT_DATA_LOG_LOCALTION)) {
|
||||||
|
log.error(Configs.EXPORT_DATA_LOG_LOCALTION + "创建失败");
|
||||||
|
}
|
||||||
|
|
||||||
Configs.FILE_UPLOAD_PATH = Configs.DATA_PATH + properties.getProperty("file_upload_path");
|
Configs.FILE_UPLOAD_PATH = Configs.DATA_PATH + properties.getProperty("file_upload_path");
|
||||||
if (!FileOperateHelper.ifNotExistMkdir(Configs.FILE_UPLOAD_PATH)) {
|
if (!FileOperateHelper.ifNotExistMkdir(Configs.FILE_UPLOAD_PATH)) {
|
||||||
log.error(Configs.FILE_UPLOAD_PATH + "创建失败");
|
log.error(Configs.FILE_UPLOAD_PATH + "创建失败");
|
||||||
|
|
@ -100,9 +126,15 @@ public class ConfigsLoader implements ServletContextListener {
|
||||||
Configs.ORACLE_ORCL = properties.getProperty("oracle-orcl");
|
Configs.ORACLE_ORCL = properties.getProperty("oracle-orcl");
|
||||||
Configs.ORACLE_USER = properties.getProperty("oracle-user");
|
Configs.ORACLE_USER = properties.getProperty("oracle-user");
|
||||||
Configs.ORACLE_PSW = properties.getProperty("oracle-psw");
|
Configs.ORACLE_PSW = properties.getProperty("oracle-psw");
|
||||||
|
|
||||||
Configs.COLLECT_STANDARD_TABLE_USER = properties.getProperty("collect-user-table");
|
Configs.COLLECT_STANDARD_TABLE_USER = properties.getProperty("collect-user-table");
|
||||||
Configs.COLLECT_EXEC_TABLE = properties.getProperty("collect-exec-table");
|
Configs.COLLECT_EXEC_TABLE = properties.getProperty("collect-exec-table");
|
||||||
Configs.COLLECT_PAY_TABLE = properties.getProperty("collect-pay-table");
|
Configs.COLLECT_PAY_TABLE = properties.getProperty("collect-pay-table");
|
||||||
|
|
||||||
|
Configs.GATHER_STANDARD_USER_NAME = Configs.COLLECT_STANDARD_TABLE_USER;
|
||||||
|
Configs.GATHER_STANDARD_EXEC_TABLE_NAME = Configs.COLLECT_EXEC_TABLE;
|
||||||
|
Configs.GATHER_STANDARD_PAY_TABLE_NAME = Configs.COLLECT_PAY_TABLE;
|
||||||
|
|
||||||
HttpClientConstant.URL_IP_PORT = properties.getProperty("HttpClientConstant_URL_IP_PORT").trim();
|
HttpClientConstant.URL_IP_PORT = properties.getProperty("HttpClientConstant_URL_IP_PORT").trim();
|
||||||
Constant.moveFileMaxNum = Integer.valueOf(properties.getProperty("moveFileMaxNum").trim());
|
Constant.moveFileMaxNum = Integer.valueOf(properties.getProperty("moveFileMaxNum").trim());
|
||||||
Constant.hostIp = properties.getProperty("gfs_control_ip").trim();
|
Constant.hostIp = properties.getProperty("gfs_control_ip").trim();
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,19 @@
|
||||||
|
|
||||||
package com.platform.utils;
|
package com.platform.utils;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
/** 常量
|
/**
|
||||||
|
* 常量
|
||||||
|
*
|
||||||
* @author chen
|
* @author chen
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Constant {
|
public class Constant {
|
||||||
public static String rootUser = "root";
|
public static String rootUser = "root";
|
||||||
public static String rootPasswd = "root";
|
public static String rootPasswd = "root";
|
||||||
// public static String hostIp = "192.168.191.23";
|
// public static String hostIp = "192.168.191.23";
|
||||||
public static String hostIp = "";
|
public static String hostIp = "";
|
||||||
public static int port = 22;
|
public static int port = 22;
|
||||||
public static String glusterPeerStatus = "gluster peer status";
|
public static String glusterPeerStatus = "gluster peer status";
|
||||||
|
|
@ -27,14 +31,17 @@ public class Constant {
|
||||||
public static String noSuchFile = "No such file or directory";
|
public static String noSuchFile = "No such file or directory";
|
||||||
public static GanymedSSH ganymedSSH = null;
|
public static GanymedSSH ganymedSSH = null;
|
||||||
public static String fileGetTreeData = "WebContent\\WEB-INF\\config\\getTreedata.sh";
|
public static String fileGetTreeData = "WebContent\\WEB-INF\\config\\getTreedata.sh";
|
||||||
public static String AutoMountfile="/gfsAutoMount/AutoRun.sh";
|
public static String AutoMountfile = "/gfsAutoMount/AutoRun.sh";
|
||||||
public static String MountRecord="/gfsAutoMount/mountPoint.record";
|
public static String MountRecord = "/gfsAutoMount/mountPoint.record";
|
||||||
public static String strGetTreeData = "function ergodic(){\n "
|
public static String strGetTreeData = "function ergodic(){\n "
|
||||||
+ "for file in \\`ls \\$1\\`\n do\n if [ \"\\$file\" != \"app\" -a -d \\$1\\\"/\\\"\\$file ]\n "
|
+ "for file in \\`ls \\$1\\`\n do\n if [ \"\\$file\" != \"app\" -a -d \\$1\\\"/\\\"\\$file ]\n "
|
||||||
+ "then\n ergodic \\$1\"/\"\\$file\n else\n local path=\\$1\"/\"\\$file\n "
|
+ "then\n ergodic \\$1\"/\"\\$file\n else\n local path=\\$1\"/\"\\$file\n "
|
||||||
+ "echo \\$path \n fi\n done\n}\n\nIFS=\\$\\'\\n\\' "
|
+ "echo \\$path \n fi\n done\n}\n\nIFS=\\$\\'\\n\\' "
|
||||||
+ "#这个必须要,否则会在文件名中有空格时出错\nINIT_PATH=\".\";\nergodic \\$1\n";
|
+ "#这个必须要,否则会在文件名中有空格时出错\nINIT_PATH=\".\";\nergodic \\$1\n";
|
||||||
|
|
||||||
|
public final static String NO_SUCH_FILE_OR_DIRECTORY = "No such file or directory";
|
||||||
|
public final static String LIST_TO_STRING_SEPARATOR = "\n";
|
||||||
|
public final static String FILE_NAME_SEPARATOR = "_";
|
||||||
/**
|
/**
|
||||||
* 迁移数据时,并发迁移数量
|
* 迁移数据时,并发迁移数量
|
||||||
*/
|
*/
|
||||||
|
|
@ -43,110 +50,136 @@ public class Constant {
|
||||||
/**
|
/**
|
||||||
* volume 获取的线程休眠时间
|
* volume 获取的线程休眠时间
|
||||||
*/
|
*/
|
||||||
public final static int get_volume_sleep_time = 3*60000;
|
public final static int get_volume_sleep_time = 3 * 60000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据迁移 获取的线程休眠时间
|
* 数据迁移 获取的线程休眠时间
|
||||||
*/
|
*/
|
||||||
public final static int update_dataInfo_sleep_time = 1500;
|
public final static int update_dataInfo_sleep_time = 1500;
|
||||||
|
|
||||||
/** 国际话配置文件文件-i18n.properties */
|
/** 国际话配置文件文件-i18n.properties */
|
||||||
public final static String I18N_PROPERTIES_FIEL_PATH = "/com/base/i18n.properties";
|
public final static String I18N_PROPERTIES_FIEL_PATH = "/com/base/i18n.properties";
|
||||||
|
|
||||||
/** 信息系统excel导出模板 */
|
/** 信息系统excel导出模板 */
|
||||||
public final static String SYSTEM_INFO_EXCEL_TEMPLATE_FIEL_PATH = "/com/base/system_templates.xlsx";
|
public final static String SYSTEM_INFO_EXCEL_TEMPLATE_FIEL_PATH = "/com/base/system_templates.xlsx";
|
||||||
|
|
||||||
/** WritefileThread-线程睡眠时间--3000 */
|
/** WritefileThread-线程睡眠时间--3000 */
|
||||||
public final static long THREAD_SLEEP_WRITEFILETHREAD = 3000;
|
public final static long THREAD_SLEEP_WRITEFILETHREAD = 3000;
|
||||||
|
|
||||||
/** CustomException记录报异常的对象的对象个数--10 */
|
/** CustomException记录报异常的对象的对象个数--10 */
|
||||||
public final static int CustomException_log_object_size = 10;
|
public final static int CustomException_log_object_size = 10;
|
||||||
|
|
||||||
/** excel模板真实数据的起始行数 */
|
/** excel模板真实数据的起始行数 */
|
||||||
public final static int EXCEL_TEMPLATE_INIT_ROW = 8;
|
public final static int EXCEL_TEMPLATE_INIT_ROW = 8;
|
||||||
|
|
||||||
/** excel模板的 总列 数 */
|
/** excel模板的 总列 数 */
|
||||||
public final static int EXCEL_TEMPLATE_TOTAL_COL = 25;
|
public final static int EXCEL_TEMPLATE_TOTAL_COL = 25;
|
||||||
|
|
||||||
/** excel导入-修改preDataInfo信息 */
|
/** excel导入-修改preDataInfo信息 */
|
||||||
public final static String preDataInfo_update = "修改";
|
public final static String preDataInfo_update = "修改";
|
||||||
|
|
||||||
/** excel导入-新增行政区划-preDataInfo信息 */
|
/** excel导入-新增行政区划-preDataInfo信息 */
|
||||||
public final static String preDataInfo_add_area = "新增行政区划";
|
public final static String preDataInfo_add_area = "新增行政区划";
|
||||||
|
|
||||||
/** excel导入-新增信息系统-preDataInfo信息 */
|
/** excel导入-新增信息系统-preDataInfo信息 */
|
||||||
public final static String preDataInfo_add_system = "新增信息系统";
|
public final static String preDataInfo_add_system = "新增信息系统";
|
||||||
|
|
||||||
/** cfg文件的名称 */
|
/** cfg文件的名称 */
|
||||||
public final static String cfgFileName = "system_name_sys_code.cfg";
|
public final static String cfgFileName = "system_name_sys_code.cfg";
|
||||||
|
|
||||||
/** 表空间用户名 */
|
/** 表空间用户名 */
|
||||||
public final static String UserTablespace = "usertablespace_";
|
public final static String UserTablespace = "usertablespace_";
|
||||||
|
|
||||||
/** 可执行校验脚本 */
|
/** 可执行校验脚本 */
|
||||||
public final static String Checkout_Indicate = "checkout_indicate_";
|
public final static String Checkout_Indicate = "checkout_indicate_";
|
||||||
|
|
||||||
/** 支付的验证脚本 */
|
/** 支付的验证脚本 */
|
||||||
public final static String Checkout_Pay = "checkout_pay_";
|
public final static String Checkout_Pay = "checkout_pay_";
|
||||||
|
|
||||||
/** sqlserver:支付脚本 */
|
/** sqlserver:支付脚本 */
|
||||||
public final static String standard_indicate = "standard_indicate_";
|
public final static String standard_indicate = "standard_indicate_";
|
||||||
|
|
||||||
/** sqlserver:支付脚本 */
|
/** sqlserver:支付脚本 */
|
||||||
public final static String standard_pay = "standard_pay_";
|
public final static String standard_pay = "standard_pay_";
|
||||||
|
|
||||||
//校验 CHECKOUT_STATUS 0:未校验,1:不需校验,2:正在校验,3:校验成功,4:校验失败,5:待抽取,6:正在抽取,7:抽取完成
|
/** 数据导出日志文件名称 */
|
||||||
/** 校验状态-0 */
|
public final static String EXPORT_DATA = "export_data";
|
||||||
|
|
||||||
|
// 校验 CHECKOUT_STATUS 0:未校验,1:不需校验,2:正在校验,3:校验成功,4:校验失败,5:待抽取,6:正在抽取,7:抽取完成
|
||||||
|
/** 校验状态-0 */
|
||||||
public final static String CHECKOUT_STATUS_ZERO = "0";
|
public final static String CHECKOUT_STATUS_ZERO = "0";
|
||||||
|
|
||||||
/** 校验状态-1 */
|
/** 校验状态-1 */
|
||||||
public final static String CHECKOUT_STATUS_ONE = "1";
|
public final static String CHECKOUT_STATUS_ONE = "1";
|
||||||
|
|
||||||
/** 校验状态-2 */
|
/** 校验状态-2 */
|
||||||
public final static String CHECKOUT_STATUS_TWO = "2";
|
public final static String CHECKOUT_STATUS_TWO = "2";
|
||||||
|
|
||||||
/** 校验状态-3 */
|
/** 校验状态-3 */
|
||||||
public final static String CHECKOUT_STATUS_THREE = "3";
|
public final static String CHECKOUT_STATUS_THREE = "3";
|
||||||
|
|
||||||
/** 校验状态-4 */
|
/** 校验状态-4 */
|
||||||
public final static String CHECKOUT_STATUS_FOUR = "4";
|
public final static String CHECKOUT_STATUS_FOUR = "4";
|
||||||
|
|
||||||
/** 校验状态-5 */
|
/** 校验状态-5 */
|
||||||
public final static String CHECKOUT_STATUS_FIVE = "5";
|
public final static String CHECKOUT_STATUS_FIVE = "5";
|
||||||
|
|
||||||
/** 校验状态-6 */
|
/** 校验状态-6 */
|
||||||
public final static String CHECKOUT_STATUS_SIX = "6";
|
public final static String CHECKOUT_STATUS_SIX = "6";
|
||||||
|
|
||||||
/** 校验状态-7 */
|
/** 校验状态-7 */
|
||||||
public final static String CHECKOUT_STATUS_SEVEN = "7";
|
public final static String CHECKOUT_STATUS_SEVEN = "7";
|
||||||
|
|
||||||
//校验标识 CHECKOUTFLAG 校验标识符,0未校验,1已校验,2:正在校验,6正在抽取,7抽取完成
|
// 校验标识 CHECKOUTFLAG 校验标识符,0未校验,1已校验,2:正在校验,6正在抽取,7抽取完成
|
||||||
/** 校验标识-0 */
|
/** 校验标识-0 */
|
||||||
public final static String CHECKOUTFLAG_ZERO = "0";
|
public final static String CHECKOUTFLAG_ZERO = "0";
|
||||||
|
|
||||||
/** 校验标识-1 */
|
/** 校验标识-1 */
|
||||||
public final static String CHECKOUTFLAG_ONE = "1";
|
public final static String CHECKOUTFLAG_ONE = "1";
|
||||||
|
|
||||||
/** 校验标识-2 */
|
/** 校验标识-2 */
|
||||||
public final static String CHECKOUTFLAG_TWO = "2";
|
public final static String CHECKOUTFLAG_TWO = "2";
|
||||||
|
|
||||||
/** 校验标识-6 */
|
/** 校验标识-6 */
|
||||||
public final static String CHECKOUTFLAG_SIX = "6";
|
public final static String CHECKOUTFLAG_SIX = "6";
|
||||||
|
|
||||||
/** 校验标识-7 */
|
/** 校验标识-7 */
|
||||||
public final static String CHECKOUTFLAG_SEVEN = "7";
|
public final static String CHECKOUTFLAG_SEVEN = "7";
|
||||||
|
|
||||||
// 汇总库的 类型 ORACLE_EXTRACT_TYPE 0:总库汇总 1:抽取标准表汇总
|
// 汇总库的 类型 ORACLE_EXTRACT_TYPE 0:总库汇总 1:抽取标准表汇总
|
||||||
/** 类型-0 汇总 */
|
/** 类型-0 汇总 */
|
||||||
public final static String ORACLE_EXTRACT_TYPE_ZERO = "0";
|
public final static String ORACLE_EXTRACT_TYPE_ZERO = "0";
|
||||||
|
|
||||||
/** 类型-1 抽取 */
|
/** 类型-1 抽取 */
|
||||||
public final static String ORACLE_EXTRACT_TYPE_ONE = "1";
|
public final static String ORACLE_EXTRACT_TYPE_ONE = "1";
|
||||||
|
|
||||||
/** 校验结果 是 */
|
/** 校验结果 是 */
|
||||||
public final static String ORACLE_CHECK_REULT_ZERO = "是";
|
public final static String ORACLE_CHECK_REULT_ZERO = "是";
|
||||||
|
|
||||||
/** 校验结果 否 */
|
/** 校验结果 否 */
|
||||||
public final static String ORACLE_CHECK_REULT_ONE = "否";
|
public final static String ORACLE_CHECK_REULT_ONE = "否";
|
||||||
|
|
||||||
|
public final static String BATCH = "批次";
|
||||||
|
public final static String BATCH_A = "批次A";
|
||||||
|
public final static String BATCH_B = "批次B";
|
||||||
|
public final static String A = "A";
|
||||||
|
public final static String B = "B";
|
||||||
|
/**
|
||||||
|
* 汇总库用户名前缀
|
||||||
|
*/
|
||||||
|
public final static String GATHER_ORACLE_USERNAME_PREFIX = "J";
|
||||||
|
|
||||||
|
public final static String LINUX_FILE_SEPERATOR = "/";
|
||||||
|
|
||||||
|
public final static String ONLINE_SEPERATOR = "_";
|
||||||
|
public final static String SHORT_LINE = "-";
|
||||||
|
public final static String LOG_FILE_NAME_SEPERATOR = "@";
|
||||||
|
public final static String LOG_FILE_NAME_POSTFIX = ".log";
|
||||||
|
public final static String ORACLE = "ORACLE";
|
||||||
|
public final static String COMMA = ",";
|
||||||
|
public final static String GATHER_DATABASE_SYSTEM_NAME = "汇总库";
|
||||||
|
public static final String GATHER_USER_PREFIX = "J";
|
||||||
|
public static final Integer DATA_EXPORT_THREAD_MAX_COUNT = 1;
|
||||||
|
public static final Integer DATA_EXPORT_THREAD_COUNT = 0;
|
||||||
|
public static ExecutorService DATA_EXPORT_THREAD_POOL = Executors.newFixedThreadPool(DATA_EXPORT_THREAD_MAX_COUNT);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,10 @@ public class DateForm {
|
||||||
|
|
||||||
private static ThreadLocal<DateFormat> threadLocal_day = new ThreadLocal<DateFormat>();
|
private static ThreadLocal<DateFormat> threadLocal_day = new ThreadLocal<DateFormat>();
|
||||||
|
|
||||||
|
public static String getNowToDay(){
|
||||||
|
SimpleDateFormat df = new SimpleDateFormat(data_format_day);//设置日期格式
|
||||||
|
return df.format(new Date());// new Date()为获取当前系统时间
|
||||||
|
}
|
||||||
public static String date2StringBysecond(Date date) {
|
public static String date2StringBysecond(Date date) {
|
||||||
if (date == null) {
|
if (date == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,22 @@
|
||||||
package com.platform.utils;
|
package com.platform.utils;
|
||||||
import java.util.Date;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
public class DateHandle {
|
public class DateHandle {
|
||||||
public static String getNow() {
|
|
||||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//è®¾ç½®æ—¥æœŸæ ¼å¼<EFBFBD>
|
public static String getNowSecond() {
|
||||||
return df.format(new Date());// new Date()为获å<EFBFBD>–当å‰<EFBFBD>系统时é—?
|
|
||||||
}
|
return new Date().getTime() + "";// new Date()为获取当前系统时<EFBFBD>?
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getNow() {
|
||||||
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// 设置日期格式
|
||||||
|
return df.format(new Date());// new Date()为获取当前系统时<EFBFBD>?
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getNowDate() {
|
||||||
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");// 设置日期格式
|
||||||
|
return df.format(new Date());// new Date()为获取当前系统时<EFBFBD>?
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名 : ExceptionMsg.java 版权 : <版权/公司名> 描述 : <描述>
|
||||||
|
*
|
||||||
|
* @author liliy 版本 : <版本> 修改时间: 2018年1月19日 修改内容: <修改内容>
|
||||||
|
*/
|
||||||
|
package com.platform.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <一句话功能简述> <功能详细描述>
|
||||||
|
*
|
||||||
|
* @author liliy
|
||||||
|
* @version [版本号,2018年1月19日]
|
||||||
|
* @see [相关类/方法]
|
||||||
|
* @since [产品/模块版本]
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ExceptionMsg {
|
||||||
|
public static String SUCCESS = "成功!";
|
||||||
|
public static String UNKNOW_ERROR = "未知错误!";
|
||||||
|
public static String PARAMATER_ERROR = "参数错误!";
|
||||||
|
public static String ONLINE_VOLUME_PATH_IS_NULL = "热区不存在或者热区挂载目录不存在!";
|
||||||
|
public static String CREATE_PATH_FAIL = "创建文件夹失败!";
|
||||||
|
public static String SOURCE_FILE_NOT_EXIST = "源文件不存在!";
|
||||||
|
public static String DATABASE_ERROR = "数据库操作异常!";
|
||||||
|
public static String GATHER_ORACLE_ALREADY_EXISTED = "汇总库已经存在!";
|
||||||
|
public static String GATHER_ORACLE_NOT_EXISTED = "汇总库不存在!";
|
||||||
|
public static String GATHER_ORACLE_NOT_CONNECT = "汇总库不能连接!";
|
||||||
|
public static String CREATE_GATHER_DATABASE_ERROR = "创建汇总库失败!";
|
||||||
|
public static String DATABASE_EXISTS = "数据已经存在!";
|
||||||
|
public static String DATABASE_NOT_EXISTS = "数据不存在!";
|
||||||
|
public static String ALREADY_EXPORTING = "已经正在到处中,不予许导出!";
|
||||||
|
public static int EXCEPTION_CODE = -1;
|
||||||
|
|
||||||
|
public static String exceptionStackToStr(Exception exception) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
StackTraceElement[] stackTraceElements = exception.getStackTrace();
|
||||||
|
for (StackTraceElement oneElement : stackTraceElements) {
|
||||||
|
stringBuffer.append(oneElement + "\r\n");
|
||||||
|
}
|
||||||
|
return stringBuffer.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,14 +1,21 @@
|
||||||
package com.platform.utils;
|
package com.platform.utils;
|
||||||
|
|
||||||
|
import java.io.BufferedInputStream;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.apache.poi.poifs.property.Parent;
|
|
||||||
|
import com.platform.glusterfs.ShowData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件读写操作帮助类
|
* 文件读写操作帮助类
|
||||||
|
|
@ -18,7 +25,7 @@ import org.apache.poi.poifs.property.Parent;
|
||||||
*/
|
*/
|
||||||
public class FileOperateHelper {
|
public class FileOperateHelper {
|
||||||
|
|
||||||
private static Logger log = Configs.CONSOLE_LOGGER.getLogger(FileOperateHelper.class);
|
private static Logger log = Logger.getLogger(FileOperateHelper.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 以追加的方式将信息写入文件
|
* 以追加的方式将信息写入文件
|
||||||
|
|
@ -43,9 +50,10 @@ public class FileOperateHelper {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
sb.append(message);
|
sb.append(message);
|
||||||
out.write(sb.toString().getBytes("utf-8"));
|
out.write(sb.toString().getBytes("utf-8"));
|
||||||
|
log.info(sb.toString());
|
||||||
out.close();
|
out.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
log.error(ExceptionMsg.exceptionStackToStr(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -68,6 +76,7 @@ public class FileOperateHelper {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
sb.append(message);
|
sb.append(message);
|
||||||
out.write(sb.toString().getBytes("utf-8"));
|
out.write(sb.toString().getBytes("utf-8"));
|
||||||
|
log.info(sb.toString());
|
||||||
out.close();
|
out.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
log.error(e);
|
||||||
|
|
@ -101,6 +110,7 @@ public class FileOperateHelper {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
sb.append(message);
|
sb.append(message);
|
||||||
out.write(sb.toString().getBytes("GBK"));
|
out.write(sb.toString().getBytes("GBK"));
|
||||||
|
log.info(sb.toString().getBytes("GBK"));
|
||||||
out.close();
|
out.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
log.error(e);
|
||||||
|
|
@ -185,6 +195,81 @@ public class FileOperateHelper {
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @Title: toByteArray @Description: 二进制读取文件返回byte[] @param @param
|
||||||
|
* filename @param @return @param @throws IOException 设定文件 @return
|
||||||
|
* byte[] 返回类型 @throws
|
||||||
|
*/
|
||||||
|
public static byte[] readFiletoByteArray(String fileName) throws IOException {
|
||||||
|
|
||||||
|
File f = new File(fileName);
|
||||||
|
if (!f.exists()) {
|
||||||
|
throw new FileNotFoundException(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
ByteArrayOutputStream bos = new ByteArrayOutputStream((int) f.length());
|
||||||
|
BufferedInputStream in = null;
|
||||||
|
try {
|
||||||
|
in = new BufferedInputStream(new FileInputStream(f));
|
||||||
|
int buf_size = 1024;
|
||||||
|
byte[] buffer = new byte[buf_size];
|
||||||
|
int len = 0;
|
||||||
|
while (-1 != (len = in.read(buffer, 0, buf_size))) {
|
||||||
|
bos.write(buffer, 0, len);
|
||||||
|
}
|
||||||
|
log.info(fileName + " 文件读取成功!");
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error(ExceptionMsg.exceptionStackToStr(e));
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
in.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error(ExceptionMsg.exceptionStackToStr(e));
|
||||||
|
}
|
||||||
|
bos.close();
|
||||||
|
}
|
||||||
|
return bos.toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @Title: outputStreadRead @Description: 字节流写入文件 @param @param
|
||||||
|
* fileName @param @param data 设定文件 @return void 返回类型 @throws
|
||||||
|
*/
|
||||||
|
public static void writeStreadRead(String fileName, byte[] data) {
|
||||||
|
// 创建字节流对象
|
||||||
|
OutputStream stream = null;
|
||||||
|
try {
|
||||||
|
// 实例化对象
|
||||||
|
stream = new FileOutputStream(fileName);
|
||||||
|
// 要写入的字符串数据
|
||||||
|
String string = "OutputStreamp测试写入数据";
|
||||||
|
// 将字符串数据转换为字节数组
|
||||||
|
byte[] bytes = data;
|
||||||
|
// 将字节数组写入到文件
|
||||||
|
stream.write(bytes);
|
||||||
|
// 清空缓冲区,将写入的数据保存
|
||||||
|
stream.flush();
|
||||||
|
// 写入成功后的提示语
|
||||||
|
log.info(fileName + " 文件写入成功!");
|
||||||
|
|
||||||
|
// 抛出异常
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error(ExceptionMsg.exceptionStackToStr(e));
|
||||||
|
} finally {
|
||||||
|
// 如果stream被实例化
|
||||||
|
if (stream != null) {
|
||||||
|
try {
|
||||||
|
// 关闭字节流
|
||||||
|
stream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error(ExceptionMsg.exceptionStackToStr(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static String addLastSeparator(String path) {
|
public static String addLastSeparator(String path) {
|
||||||
// 去掉 File.separator
|
// 去掉 File.separator
|
||||||
path = removeLastSeparator(path);
|
path = removeLastSeparator(path);
|
||||||
|
|
@ -287,4 +372,90 @@ public class FileOperateHelper {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 复制文件,支持通配符 code=-1 创建目的文件夹失败; -2 源文件为空; -3 未知的拷贝错误
|
||||||
|
*
|
||||||
|
* @param sourcePath
|
||||||
|
* @param destPath
|
||||||
|
* @return
|
||||||
|
* @see [类、类#方法、类#成员]
|
||||||
|
*/
|
||||||
|
public static Result<Boolean> fileCopy(String sourceFileName, String destFolderName) {
|
||||||
|
|
||||||
|
Result<Boolean> result = new Result<Boolean>();
|
||||||
|
|
||||||
|
String command = "cp -rp " + sourceFileName + " " + destFolderName;
|
||||||
|
List<String> execRes = Constant.ganymedSSH.execCmdWaitAcquiescent(command);
|
||||||
|
|
||||||
|
if (execRes == null) {
|
||||||
|
result.setData(false);
|
||||||
|
result.setMsg(ExceptionMsg.UNKNOW_ERROR);
|
||||||
|
result.setCode(-3);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (execRes.isEmpty() || execRes.get(0).equals("")) {
|
||||||
|
result.setData(true);
|
||||||
|
result.setCode(1);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (execRes.get(0).contains(Constant.NO_SUCH_FILE_OR_DIRECTORY)) {
|
||||||
|
result.setData(false);
|
||||||
|
result.setMsg(execRes.get(0));
|
||||||
|
result.setCode(-3);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
result.setData(false);
|
||||||
|
result.setMsg(StringHandle.listToString(execRes, Constant.LIST_TO_STRING_SEPARATOR));
|
||||||
|
result.setCode(-3);
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复制文件夹 code=-1 创建目的文件夹失败; -2 源文件夹为空; -3 未知的拷贝错误
|
||||||
|
*
|
||||||
|
* @param sourcePath
|
||||||
|
* @param destPath
|
||||||
|
* @return
|
||||||
|
* @see [类、类#方法、类#成员]
|
||||||
|
*/
|
||||||
|
public static Result<Boolean> folderCopy(String sourceFolderName, String destFolderName) {
|
||||||
|
|
||||||
|
Result<Boolean> result = new Result<Boolean>();
|
||||||
|
String createFolderCmd = "mkdir -p " + destFolderName;
|
||||||
|
List<String> createFolderRes = Constant.ganymedSSH.execCmdWaitAcquiescent(createFolderCmd);
|
||||||
|
|
||||||
|
if (!createFolderRes.isEmpty()) {
|
||||||
|
result.setData(false);
|
||||||
|
result.setMsg(ExceptionMsg.CREATE_PATH_FAIL);
|
||||||
|
result.setCode(-1);
|
||||||
|
log.error("创建文件夹失败!" + destFolderName);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowData showData = new ShowData();
|
||||||
|
Map<String, String> reStrings = showData.showFolderData(sourceFolderName);
|
||||||
|
if (reStrings == null) {
|
||||||
|
result.setData(false);
|
||||||
|
result.setMsg(ExceptionMsg.SOURCE_FILE_NOT_EXIST);
|
||||||
|
result.setCode(-2);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
String command = "cp -rp " + sourceFolderName + " " + destFolderName;
|
||||||
|
List<String> execRes = Constant.ganymedSSH.execCmdWaitAcquiescent(command);
|
||||||
|
if (!execRes.isEmpty()) {
|
||||||
|
result.setData(false);
|
||||||
|
result.setMsg(execRes.get(0));
|
||||||
|
result.setCode(-3);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result.setData(true);
|
||||||
|
result.setCode(1);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,7 @@
|
||||||
|
|
||||||
package com.platform.utils;
|
package com.platform.utils;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.*;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -17,9 +14,6 @@ import ch.ethz.ssh2.Connection;
|
||||||
import ch.ethz.ssh2.Session;
|
import ch.ethz.ssh2.Session;
|
||||||
import ch.ethz.ssh2.StreamGobbler;
|
import ch.ethz.ssh2.StreamGobbler;
|
||||||
|
|
||||||
import ch.ethz.ssh2.*;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class GanymedSSH {
|
public class GanymedSSH {
|
||||||
public static Logger log = Logger.getLogger(GanymedSSH.class);
|
public static Logger log = Logger.getLogger(GanymedSSH.class);
|
||||||
|
|
@ -48,6 +42,8 @@ public class GanymedSSH {
|
||||||
public static Connection getOpenedConnection(String host, String username, String password, int port)
|
public static Connection getOpenedConnection(String host, String username, String password, int port)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
|
log.info("connect server: "+host+" port: "+port+" username: "+username+" password: "+password);
|
||||||
|
|
||||||
Connection conns = new Connection(host, port);
|
Connection conns = new Connection(host, port);
|
||||||
conns.connect(); // make sure the connection is opened
|
conns.connect(); // make sure the connection is opened
|
||||||
boolean isAuthenticated = conns.authenticateWithPassword(username, password);
|
boolean isAuthenticated = conns.authenticateWithPassword(username, password);
|
||||||
|
|
@ -57,10 +53,7 @@ public class GanymedSSH {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void execCmdNoWaitAcquiescent(String cmd) {
|
public void execCmdNoWaitAcquiescent(String cmd) {
|
||||||
// String host=Constant.hostIp;
|
log.info("["+conn+"]execute cmd: " +cmd );
|
||||||
// String username=Constant.rootUser;
|
|
||||||
// String password=Constant.rootPasswd;
|
|
||||||
// int port=Constant.port;
|
|
||||||
|
|
||||||
Session sess = null;
|
Session sess = null;
|
||||||
try {
|
try {
|
||||||
|
|
@ -105,10 +98,7 @@ public class GanymedSSH {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> execCmdWaitAcquiescent(String cmd) {
|
public List<String> execCmdWaitAcquiescent(String cmd) {
|
||||||
// String host=Constant.hostIp;
|
log.info("["+conn+"]execute cmd: " +cmd );
|
||||||
// String username=Constant.rootUser;
|
|
||||||
// String password=Constant.rootPasswd;
|
|
||||||
// int port=Constant.port;
|
|
||||||
List<String> reStrings = new ArrayList<String>();
|
List<String> reStrings = new ArrayList<String>();
|
||||||
|
|
||||||
Session sess = null;
|
Session sess = null;
|
||||||
|
|
@ -157,6 +147,8 @@ public class GanymedSSH {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.info("output: " +reStrings );
|
||||||
return reStrings;
|
return reStrings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -288,7 +280,13 @@ public class GanymedSSH {
|
||||||
return str_size;
|
return str_size;
|
||||||
}
|
}
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
PropertyConfigurator.configure("log4j.properties");
|
// PropertyConfigurator.configure("log4j.properties");
|
||||||
|
|
||||||
|
File srcDir = new File("/tmp");
|
||||||
|
File[] files = srcDir.listFiles();
|
||||||
|
for (File file : files) {
|
||||||
|
System.out.println(file.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,81 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名 : OracleSqlHandle.java
|
||||||
|
* 版权 : <版权/公司名>
|
||||||
|
* 描述 : <描述>
|
||||||
|
* @author liliy
|
||||||
|
* 版本 : <版本>
|
||||||
|
* 修改时间: 2018年1月25日
|
||||||
|
* 修改内容: <修改内容>
|
||||||
|
*/
|
||||||
|
package com.platform.utils;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import com.base.Custom4exception;
|
||||||
|
import com.base.CustomException;
|
||||||
|
import com.platform.entities.OracleConnectorParams;
|
||||||
|
import com.platform.oracle.OracleConnector;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行oracle相关的sql语句
|
||||||
|
* <功能详细描述>
|
||||||
|
* @author liliy
|
||||||
|
* @version [版本号,2018年1月25日]
|
||||||
|
* @see [相关类/方法]
|
||||||
|
* @since [产品/模块版本]
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class OracleSqlHandle {
|
||||||
|
|
||||||
|
public static Logger log = Logger
|
||||||
|
.getLogger(OracleConnector.class);
|
||||||
|
private String url;
|
||||||
|
// private String
|
||||||
|
private String user;
|
||||||
|
private String password;
|
||||||
|
private String driver="oracle.jdbc.OracleDriver";
|
||||||
|
// 创建一个数据库连接
|
||||||
|
Connection connection = null;
|
||||||
|
// 创建预编译语句对象,一般都是用这个而不用Statement
|
||||||
|
PreparedStatement pstm = null;
|
||||||
|
// 创建一个结果集对象
|
||||||
|
ResultSet rs = null;
|
||||||
|
public OracleSqlHandle() {
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
Class.forName("oracle.jdbc.driver.OracleDriver");
|
||||||
|
log.info("Oracle驱动加载成功");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
log.error(Custom4exception.OracleSQL_Except, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Connection getConnection(String url,
|
||||||
|
String user, String password, OracleConnectorParams oc)
|
||||||
|
throws CustomException {
|
||||||
|
Connection conn = null;
|
||||||
|
try {
|
||||||
|
conn = DriverManager.getConnection(url, user, password);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Configs.CONSOLE_LOGGER.info("创建oracle连接失败: [" + e.getMessage()
|
||||||
|
+ "]");
|
||||||
|
if (null != oc) {
|
||||||
|
FileOperateHelper.fileWrite(
|
||||||
|
Configs.EXTRACT_LOG_LOCALTION + oc.getName() + ".log",
|
||||||
|
"创建oracle连接失败: [" + e.getMessage() + "]\r\n");
|
||||||
|
}
|
||||||
|
throw new CustomException(Custom4exception.OracleSQL_Except, e);
|
||||||
|
}
|
||||||
|
return conn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,87 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名 : Result.java 版权 : <版权/公司名> 描述 : <描述>
|
||||||
|
*
|
||||||
|
* @author liliy 版本 : <版本> 修改时间: 2018年1月19日 修改内容: <修改内容>
|
||||||
|
*/
|
||||||
|
package com.platform.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口返回值定义 <功能详细描述>
|
||||||
|
*
|
||||||
|
* @author liliy
|
||||||
|
* @version [版本号,2018年1月19日]
|
||||||
|
* @see [相关类/方法]
|
||||||
|
* @since [产品/模块版本]
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Result<Data> {
|
||||||
|
// 接口调用状态
|
||||||
|
private Boolean status = true;
|
||||||
|
//接口返回代码
|
||||||
|
private int code=0;
|
||||||
|
// 接口返回信息
|
||||||
|
private String msg = "";
|
||||||
|
// 接口返回值
|
||||||
|
private Data data = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the status
|
||||||
|
*/
|
||||||
|
public Boolean getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param status
|
||||||
|
* the status to set
|
||||||
|
*/
|
||||||
|
public void setStatus(Boolean status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the msg
|
||||||
|
*/
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param msg
|
||||||
|
* the msg to set
|
||||||
|
*/
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the data
|
||||||
|
*/
|
||||||
|
public Data getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param data
|
||||||
|
* the data to set
|
||||||
|
*/
|
||||||
|
public void setData(Data data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the code
|
||||||
|
*/
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param code the code to set
|
||||||
|
*/
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,19 +1,31 @@
|
||||||
package com.platform.utils;
|
package com.platform.utils;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.log4j.*;
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import com.platform.enums.OperatingSystemEnum;
|
||||||
|
|
||||||
public class RunCommand {
|
public class RunCommand {
|
||||||
|
|
||||||
|
|
||||||
public static Logger log = Logger.getLogger(RunCommand.class);
|
public static Logger log = Logger.getLogger(RunCommand.class);
|
||||||
|
|
||||||
public List<String> runCommandWait(String command) {
|
public static List<String> runCommandWait(String command) {
|
||||||
List<String> reStrings = null;
|
List<String> reStrings = null;
|
||||||
String cmds[] = { "/bin/bash", "-c", command };
|
String systemShell = "";
|
||||||
|
String systemShellArg = "";
|
||||||
|
if (Configs.OPERATE_SYSTEM.equals(OperatingSystemEnum.LINUX.getValue())) {
|
||||||
|
systemShell = "/bin/sh";
|
||||||
|
systemShellArg = "-c";
|
||||||
|
} else if (Configs.OPERATE_SYSTEM.equals(OperatingSystemEnum.WINDOWS.getValue())) {
|
||||||
|
systemShell = "cmd";
|
||||||
|
systemShellArg = "/c";
|
||||||
|
}
|
||||||
|
String[] cmds = { systemShell, systemShellArg, command };
|
||||||
try {
|
try {
|
||||||
Process ps = Runtime.getRuntime().exec(cmds);
|
Process ps = Runtime.getRuntime().exec(cmds);
|
||||||
ps.waitFor();
|
ps.waitFor();
|
||||||
|
|
@ -22,28 +34,106 @@ public class RunCommand {
|
||||||
String line;
|
String line;
|
||||||
while ((line = br.readLine()) != null) {
|
while ((line = br.readLine()) != null) {
|
||||||
reStrings.add(line);
|
reStrings.add(line);
|
||||||
// System.out.println(line);
|
log.info(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
br = new BufferedReader(new InputStreamReader(ps.getErrorStream()));
|
br = new BufferedReader(new InputStreamReader(ps.getErrorStream()));
|
||||||
reStrings = new ArrayList<String>();
|
reStrings = new ArrayList<String>();
|
||||||
|
|
||||||
while ((line = br.readLine()) != null) {
|
while ((line = br.readLine()) != null) {
|
||||||
reStrings.add(line);
|
reStrings.add(line);
|
||||||
// System.out.println(line);
|
// System.out.println(line);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
log.error("0001 runCommandWait is error");
|
log.error(ExceptionMsg.exceptionStackToStr(e));
|
||||||
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
return reStrings;
|
return reStrings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int runCommand(String command) {
|
public static int runCommandWaitNoOverflow(String command, String logFileName) {
|
||||||
List<String> reStrings = null;
|
|
||||||
String cmds[] = { "/bin/bash", "-c", command };
|
String systemShell = "";
|
||||||
|
String systemShellArg = "";
|
||||||
|
if (Configs.OPERATE_SYSTEM.equals(OperatingSystemEnum.LINUX.getValue())) {
|
||||||
|
systemShell = "/bin/sh";
|
||||||
|
systemShellArg = "-c";
|
||||||
|
} else if (Configs.OPERATE_SYSTEM.equals(OperatingSystemEnum.WINDOWS.getValue())) {
|
||||||
|
systemShell = "/bin/bash";
|
||||||
|
systemShellArg = "/c";
|
||||||
|
}
|
||||||
|
String[] cmds = { systemShell, systemShellArg, command };
|
||||||
|
try {
|
||||||
|
Process ps = Runtime.getRuntime().exec(cmds);
|
||||||
|
|
||||||
|
// 处理InputStream的线程
|
||||||
|
new Thread() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
BufferedReader in = new BufferedReader(new InputStreamReader(ps.getInputStream()));
|
||||||
|
String line = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
while ((line = in.readLine()) != null) {
|
||||||
|
FileOperateHelper.fileWrite(logFileName, line + "\r\n");
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
in.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error(ExceptionMsg.exceptionStackToStr(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
|
||||||
|
// 处理ErrorStream的线程
|
||||||
|
new Thread() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
BufferedReader err = new BufferedReader(new InputStreamReader(ps.getErrorStream()));
|
||||||
|
String line = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
while ((line = err.readLine()) != null) {
|
||||||
|
FileOperateHelper.fileWrite(logFileName, line + "\r\n");
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
err.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error(ExceptionMsg.exceptionStackToStr(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
ps.waitFor();
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
log.error("runCommand execute " + command + " is error");
|
||||||
|
log.error(ExceptionMsg.exceptionStackToStr(e));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int runCommand(String command) {
|
||||||
|
|
||||||
|
String systemShell = "";
|
||||||
|
String systemShellArg = "";
|
||||||
|
if (Configs.OPERATE_SYSTEM.equals(OperatingSystemEnum.LINUX.getValue())) {
|
||||||
|
systemShell = "/bin/sh";
|
||||||
|
systemShellArg = "-c";
|
||||||
|
} else if (Configs.OPERATE_SYSTEM.equals(OperatingSystemEnum.WINDOWS.getValue())) {
|
||||||
|
systemShell = "/bin/bash";
|
||||||
|
systemShellArg = "/c";
|
||||||
|
}
|
||||||
|
String[] cmds = { systemShell, systemShellArg, command };
|
||||||
try {
|
try {
|
||||||
Process ps = Runtime.getRuntime().exec(cmds);
|
Process ps = Runtime.getRuntime().exec(cmds);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
@ -56,5 +146,4 @@ public class RunCommand {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,86 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名 : StringHandle.java 版权 : <版权/公司名> 描述 : <描述>
|
||||||
|
*
|
||||||
|
* @author liliy 版本 : <版本> 修改时间: 2018年1月20日 修改内容: <修改内容>
|
||||||
|
*/
|
||||||
|
package com.platform.utils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <一句话功能简述> <功能详细描述>
|
||||||
|
*
|
||||||
|
* @author liliy
|
||||||
|
* @version [版本号,2018年1月20日]
|
||||||
|
* @see [相关类/方法]
|
||||||
|
* @since [产品/模块版本]
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class StringHandle {
|
||||||
|
public static String joinPath(String path1, String path2) {
|
||||||
|
if (path1.endsWith(Constant.LINUX_FILE_SEPERATOR)) {
|
||||||
|
path1 = path1.substring(0, path1.length() - 1);
|
||||||
|
}
|
||||||
|
if (path2.startsWith(Constant.LINUX_FILE_SEPERATOR)) {
|
||||||
|
path2 = path2.substring(1, path2.length());
|
||||||
|
}
|
||||||
|
return path1 + Constant.LINUX_FILE_SEPERATOR + path2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String joinPathFromList(List<String> paths) {
|
||||||
|
String resPath = Constant.LINUX_FILE_SEPERATOR;
|
||||||
|
|
||||||
|
for (String path : paths) {
|
||||||
|
if (path.startsWith(Constant.LINUX_FILE_SEPERATOR)) {
|
||||||
|
path = path.substring(1, path.length());
|
||||||
|
}
|
||||||
|
if (path.endsWith(Constant.LINUX_FILE_SEPERATOR)) {
|
||||||
|
path = path.substring(0, path.length() - 1);
|
||||||
|
}
|
||||||
|
resPath += path + Constant.LINUX_FILE_SEPERATOR;
|
||||||
|
}
|
||||||
|
resPath = resPath.substring(0, resPath.length() - 1);
|
||||||
|
return resPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getTimeFirstSegment(String time) {
|
||||||
|
if (time.contains(Constant.LINUX_FILE_SEPERATOR)) {
|
||||||
|
return time.split(Constant.LINUX_FILE_SEPERATOR)[0];
|
||||||
|
} else if (time.contains("-")) {
|
||||||
|
return time.split("-")[0];
|
||||||
|
} else {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getTimeSecondSegment(String time) {
|
||||||
|
if (time.contains(Constant.LINUX_FILE_SEPERATOR)) {
|
||||||
|
return time.split(Constant.LINUX_FILE_SEPERATOR)[1];
|
||||||
|
} else if (time.contains("-")) {
|
||||||
|
return time.split("-")[1];
|
||||||
|
} else {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 将list中的内容拼接成string <功能详细描述>
|
||||||
|
*
|
||||||
|
* @param list
|
||||||
|
* @return
|
||||||
|
* @see [类、类#方法、类#成员]
|
||||||
|
*/
|
||||||
|
public static String listToString(List list, String separator) {
|
||||||
|
StringBuilder res = new StringBuilder();
|
||||||
|
if (list == null || list.isEmpty()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
for (Object one : list) {
|
||||||
|
res.append(one.toString()).append(separator);
|
||||||
|
}
|
||||||
|
return res.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -14,13 +14,14 @@ public class ZipCompressUtils {
|
||||||
private static Logger logger = Logger.getLogger(ZipCompressUtils.class);
|
private static Logger logger = Logger.getLogger(ZipCompressUtils.class);
|
||||||
|
|
||||||
public static void zip(File inputFile, String zipFileName) {
|
public static void zip(File inputFile, String zipFileName) {
|
||||||
|
|
||||||
Properties pro = System.getProperties();
|
Properties pro = System.getProperties();
|
||||||
String osName = pro.getProperty("os.name");
|
String osName = pro.getProperty("os.name");
|
||||||
if(osName.contains("Linux")||osName.contains("linux")){
|
if (osName.contains("Linux") || osName.contains("linux")) {
|
||||||
ProcessMyUtil.execCmdWaitAcquiescent("zip -r "+ FileOperateHelper.addLastSeparator(Configs.PACKAGE_DOWNLOAD_PATH) +"package.zip " + FileOperateHelper.addLastSeparator(Configs.PACKAGE_DOWNLOAD_PATH) + Configs.PACKAGE_NAME);
|
String zipCmd = "zip -r " + FileOperateHelper.addLastSeparator(Configs.PACKAGE_DOWNLOAD_PATH)
|
||||||
}
|
+ "package.zip " + inputFile;
|
||||||
else if (osName.contains("Windows") || osName.contains("windows")) {
|
RunCommand.runCommandWait(zipCmd);
|
||||||
|
} else if (osName.contains("Windows") || osName.contains("windows")) {
|
||||||
// windows下压缩:
|
// windows下压缩:
|
||||||
try {
|
try {
|
||||||
// 解决中文文件夹名乱码的问题
|
// 解决中文文件夹名乱码的问题
|
||||||
|
|
@ -33,12 +34,10 @@ public class ZipCompressUtils {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e);
|
logger.error(e);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
logger.error(" The current system is not supported \r\n");
|
logger.error(" The current system is not supported \r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void zip(ZipOutputStream zos, File file, String base) {
|
private static void zip(ZipOutputStream zos, File file, String base) {
|
||||||
|
|
@ -68,8 +67,7 @@ public class ZipCompressUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void writeFile(ZipOutputStream zos, File file)
|
private static void writeFile(ZipOutputStream zos, File file) throws IOException {
|
||||||
throws IOException {
|
|
||||||
logger.info("开始压缩" + file.getName());
|
logger.info("开始压缩" + file.getName());
|
||||||
FileInputStream fis = new FileInputStream(file);
|
FileInputStream fis = new FileInputStream(file);
|
||||||
int len;
|
int len;
|
||||||
|
|
|
||||||
|
|
@ -1,38 +1,61 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件名 : TestDataInfoMoveTmpDao.java
|
* 文件名 : TestDataInfoMoveTmpDao.java 版权 : <版权/公司名> 描述 : <描述>
|
||||||
* 版权 : <版权/公司名>
|
*
|
||||||
* 描述 : <描述>
|
* @author liliy 版本 : <版本> 修改时间: 2017年12月20日 修改内容: <修改内容>
|
||||||
* @author liliy
|
|
||||||
* 版本 : <版本>
|
|
||||||
* 修改时间: 2017年12月20日
|
|
||||||
* 修改内容: <修改内容>
|
|
||||||
*/
|
*/
|
||||||
package com.platform.dao;
|
package com.platform.dao;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Test;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import com.platform.test.SMBasedTest;
|
import com.platform.entities.DataInfoEntityMoveTmp;
|
||||||
|
import com.platform.test.BaseTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <一句话功能简述>
|
* <一句话功能简述> <功能详细描述>
|
||||||
* <功能详细描述>
|
*
|
||||||
* @author liliy
|
* @author liliy
|
||||||
* @version [版本号,2017年12月20日]
|
* @version [版本号,2017年12月20日]
|
||||||
* @see [相关类/方法]
|
* @see [相关类/方法]
|
||||||
* @since [产品/模块版本]
|
* @since [产品/模块版本]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class TestDataInfoMoveTmpDao extends SMBasedTest {
|
public class TestDataInfoMoveTmpDao extends BaseTest {
|
||||||
|
@Autowired
|
||||||
private DataInfoMoveTmpDao dataInfoMoveTmpDao;
|
private DataInfoMoveTmpDao dataInfoMoveTmpDao;
|
||||||
|
|
||||||
@Before
|
// @Before
|
||||||
public void before() {
|
// public void before() {
|
||||||
dataInfoMoveTmpDao = (DataInfoMoveTmpDao) this.applicationContext.getBean("dataInfoMoveTmpDao");
|
// dataInfoMoveTmpDao = (DataInfoMoveTmpDao)
|
||||||
|
// this.applicationContext.getBean("dataInfoMoveTmpDao");
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdate() {
|
||||||
|
DataInfoEntityMoveTmp dataInfoEntityMoveTmp = new DataInfoEntityMoveTmp();
|
||||||
|
dataInfoEntityMoveTmp.setId(12);
|
||||||
|
dataInfoEntityMoveTmp.setCompleteStatus("1");
|
||||||
|
try {
|
||||||
|
int count = dataInfoMoveTmpDao.update(dataInfoEntityMoveTmp);
|
||||||
|
System.out.println(count);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInsertBatch() {
|
// @Test
|
||||||
// dataInfoMoveTmpDao.insertBatch();
|
public void testFindById() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
DataInfoEntityMoveTmp dataInfoMoveTmp = dataInfoMoveTmpDao.findById(12);
|
||||||
|
System.out.println(dataInfoMoveTmp.getCompleteStatus());
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import com.platform.dao.EncodeInfoDao;
|
|
||||||
import com.platform.entities.EncodedInfoEntity;
|
import com.platform.entities.EncodedInfoEntity;
|
||||||
import com.platform.test.SMBasedTest;
|
import com.platform.test.SMBasedTest;
|
||||||
|
|
||||||
|
|
@ -17,47 +15,42 @@ public class TestEncodeInfoDao extends SMBasedTest {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void initBeforeFunction() {
|
public void initBeforeFunction() {
|
||||||
eiDao = (EncodeInfoDao) this.applicationContext
|
eiDao = (EncodeInfoDao) this.applicationContext.getBean("encodeInfoDao");
|
||||||
.getBean("encodeInfoDao");
|
|
||||||
testTableName = "system_info";
|
testTableName = "system_info";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
// @Test
|
||||||
public void testGetAllEntityInfo() {
|
public void testGetAllEntityInfo() {
|
||||||
List<EncodedInfoEntity> allEntities = eiDao
|
List<EncodedInfoEntity> allEntities = eiDao.getAllEntityInfo(testTableName);
|
||||||
.getAllEntityInfo(testTableName);
|
|
||||||
System.out.println(allEntities);
|
System.out.println(allEntities);
|
||||||
Assert.assertTrue(allEntities.size() > 0);
|
Assert.assertTrue(allEntities.size() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
// @Test
|
||||||
public void testGetEncodeNameByCode() {
|
public void testGetEncodeNameByCode() {
|
||||||
String result = eiDao.getEncodeNameByCode("1", testTableName);
|
String result = eiDao.getEncodeNameByCode("1", testTableName);
|
||||||
Assert.assertTrue(result.equals("预算执行系统"));
|
Assert.assertTrue(result.equals("预算执行系统"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
// @Test
|
||||||
public void testGetEncodeCodeByName() {
|
public void testGetEncodeCodeByName() {
|
||||||
List<String> result = eiDao
|
List<String> result = eiDao.getEncodeCodeByName("预算执行系统", testTableName);
|
||||||
.getEncodeCodeByName("预算执行系统", testTableName);
|
|
||||||
Assert.assertTrue(result.size() > 0);
|
Assert.assertTrue(result.size() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
// @Test
|
||||||
public void testUpdateEncodeNameByCode() {
|
public void testUpdateEncodeNameByCode() {
|
||||||
int result = eiDao
|
int result = eiDao.updateEncodeNameByCode("3", "财政一体化平台", testTableName);
|
||||||
.updateEncodeNameByCode("3", "财政一体化平台", testTableName);
|
|
||||||
Assert.assertTrue(result > 0);
|
Assert.assertTrue(result > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
// @Test
|
||||||
public void testInsertEncodeEntity() {
|
public void testInsertEncodeEntity() {
|
||||||
int result = eiDao.insertEncodeEntity(new EncodedInfoEntity("非税收入系统",
|
int result = eiDao.insertEncodeEntity(new EncodedInfoEntity("非税收入系统", "4"), testTableName);
|
||||||
"4"), testTableName);
|
|
||||||
Assert.assertTrue(result == 1);
|
Assert.assertTrue(result == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
// @Test
|
||||||
public void testDeleteEncodeByCode() {
|
public void testDeleteEncodeByCode() {
|
||||||
int result = eiDao.deleteEncodeByCode("5", testTableName);
|
int result = eiDao.deleteEncodeByCode("5", testTableName);
|
||||||
Assert.assertTrue(result >= 1);
|
Assert.assertTrue(result >= 1);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.platform.dao;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.platform.test.SMBasedTest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* <一句话功能简述> <功能详细描述>
|
||||||
|
*
|
||||||
|
* @author liliy
|
||||||
|
* @version [版本号,2018年1月21日]
|
||||||
|
* @see [相关类/方法]
|
||||||
|
* @since [产品/模块版本]
|
||||||
|
*/
|
||||||
|
public class TestSystemCodeDao extends SMBasedTest {
|
||||||
|
|
||||||
|
private SystemCodeDao systemCodeDao;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void initBeforeFunction() {
|
||||||
|
systemCodeDao = (SystemCodeDao) this.applicationContext.getBean("systemCodeDao");
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Test
|
||||||
|
public void testInsert() throws Exception {
|
||||||
|
String testSystemName = "测试";
|
||||||
|
System.out.println(systemCodeDao.insert(testSystemName));
|
||||||
|
System.out.println(systemCodeDao.deleteBySystemName(testSystemName));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFindAllSystem() throws Exception {
|
||||||
|
System.out.println(systemCodeDao.findAllSystem());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
package com.platform.dao;
|
|
||||||
|
|
||||||
import org.junit.Before;
|
|
||||||
|
|
||||||
import com.platform.dao.DataInfoDao;
|
|
||||||
import com.platform.test.SMBasedTest;
|
|
||||||
|
|
||||||
public class TestSystemInfoDao extends SMBasedTest {
|
|
||||||
private DataInfoDao dfDao;
|
|
||||||
|
|
||||||
@Before
|
|
||||||
public void initBeforeFunction() {
|
|
||||||
dfDao = (DataInfoDao) this.applicationContext.getBean("dataInfoDao");
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Test @Test
|
|
||||||
public void test() {
|
|
||||||
//System.out.println(dfDao.getCount());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名 : BaseTest.java 版权 : <版权/公司名> 描述 : <描述>
|
||||||
|
*
|
||||||
|
* @author liliy 版本 : <版本> 修改时间: 2018年4月19日 修改内容: <修改内容>
|
||||||
|
*/
|
||||||
|
package com.platform.test;
|
||||||
|
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <一句话功能简述>
|
||||||
|
*
|
||||||
|
* @author liliy
|
||||||
|
* @version [版本号,2018年4月19日]
|
||||||
|
* @see [相关类/方法]
|
||||||
|
* @since [产品/模块版本]
|
||||||
|
*/
|
||||||
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
|
@ContextConfiguration(locations = { "classpath:spring-applicationContext.xml",
|
||||||
|
"classpath:springmvc-applicationContext.xml", "classpath:mybatis-applicationConfig.xml" })
|
||||||
|
public class BaseTest {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -4,6 +4,8 @@ import java.util.Date;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.platform.entities.DataInfoEntity;
|
||||||
|
|
||||||
public class StringIntegerTest {
|
public class StringIntegerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -19,23 +21,28 @@ public class StringIntegerTest {
|
||||||
r = b & b1;
|
r = b & b1;
|
||||||
}
|
}
|
||||||
System.out.println(r);
|
System.out.println(r);
|
||||||
System.out.println("1: "+(new Date().getTime() - f.getTime()));
|
System.out.println("1: " + (new Date().getTime() - f.getTime()));
|
||||||
|
|
||||||
String c = "1";
|
String c = "1";
|
||||||
Date f3 = new Date();
|
Date f3 = new Date();
|
||||||
String d = "";
|
String d = "";
|
||||||
for (int i = 0; i < 1000000; i++) {
|
for (int i = 0; i < 1000000; i++) {
|
||||||
if (a.equals(a1)){
|
if (a.equals(a1)) {
|
||||||
if (a.equals(c)) {
|
if (a.equals(c)) {
|
||||||
d= "1";
|
d = "1";
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
a = a1;
|
a = a1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println(d);
|
System.out.println(d);
|
||||||
System.out.println("2: "+(new Date().getTime() - f3.getTime()));
|
System.out.println("2: " + (new Date().getTime() - f3.getTime()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetDataVersionFromDataPath() {
|
||||||
|
DataInfoEntity dataInfoEntity = new DataInfoEntity();
|
||||||
|
dataInfoEntity.setDataPath("/mnt/gfs/test1/2018/A/320900_8/2");
|
||||||
|
System.out.println(dataInfoEntity.getDataVersionFromDataPath());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,36 +1,50 @@
|
||||||
package com.platform.test;
|
package com.platform.test;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import com.platform.utils.Configs;
|
|
||||||
import com.platform.utils.DateForm;
|
import com.platform.utils.DateForm;
|
||||||
import com.platform.utils.FileOperateHelper;
|
import com.platform.utils.FileOperateHelper;
|
||||||
|
|
||||||
public class TestWriteFile {
|
public class TestWriteFile {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) throws IOException {
|
||||||
FileOperateHelper
|
byte[] data = FileOperateHelper
|
||||||
.fileWrite(
|
.readFiletoByteArray("D:\\aggregation-platform_data_path\\excel_export_dir\\export.xls");
|
||||||
Configs.EXTRACT_LOG_LOCALTION +"\\test.log",
|
for (int i = 0; i < data.length; i++) {
|
||||||
"Hello! \r\n");
|
System.out.print(data[i] + "\t");
|
||||||
System.out.println("Hello!");
|
}
|
||||||
|
System.out.println("");
|
||||||
|
FileOperateHelper.writeStreadRead("D:\\aggregation-platform_data_path\\excel_export_dir\\export2.xls", data);
|
||||||
|
|
||||||
|
data = FileOperateHelper
|
||||||
|
.readFiletoByteArray("D:\\aggregation-platform_data_path\\excel_export_dir\\export2.xls");
|
||||||
|
for (int i = 0; i < data.length; i++) {
|
||||||
|
System.out.print(data[i] + "\t");
|
||||||
|
}
|
||||||
|
// FileOperateHelper
|
||||||
|
// .fileWrite(
|
||||||
|
// "/aggregation-platform_data_path/excel_export_dir/export.xls",
|
||||||
|
// "Hello! \r\n");
|
||||||
|
// System.out.println("Hello!");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void TestCalendar(){
|
public void TestCalendar() {
|
||||||
Calendar c2 = Calendar.getInstance();
|
Calendar c2 = Calendar.getInstance();
|
||||||
String time = DateForm.date2StringByDay(c2.getTime());
|
String time = DateForm.date2StringByDay(c2.getTime());
|
||||||
System.out.println(time);
|
System.out.println(time);
|
||||||
System.out.println("----"+c2.get(Calendar.MONTH));
|
System.out.println("----" + c2.get(Calendar.MONTH));
|
||||||
c2.set(Calendar.MONTH, getMonBeforeHalfYear(c2.get(Calendar.MONTH)));
|
c2.set(Calendar.MONTH, getMonBeforeHalfYear(c2.get(Calendar.MONTH)));
|
||||||
time = DateForm.date2StringByDay(c2.getTime());
|
time = DateForm.date2StringByDay(c2.getTime());
|
||||||
System.out.println(time);
|
System.out.println(time);
|
||||||
System.out.println("----"+c2.get(Calendar.MONTH));
|
System.out.println("----" + c2.get(Calendar.MONTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getMonBeforeHalfYear(int num){
|
private int getMonBeforeHalfYear(int num) {
|
||||||
num -= 6;
|
num -= 6;
|
||||||
if (num <= 0) {
|
if (num <= 0) {
|
||||||
num = num + 12;
|
num = num + 12;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,133 @@
|
||||||
|
#强烈建议数据的存储目录按如下目录结构 根目录/年度/批次/地区编码_系统编码_版本
|
||||||
|
|
||||||
|
#操作系统识别,linux为0,windows为1
|
||||||
|
operate-system=1
|
||||||
|
|
||||||
|
#=============================================================================================================
|
||||||
|
# MySQL
|
||||||
|
#=============================================================================================================
|
||||||
|
# 驱动程序
|
||||||
|
jdbc.mysql.driver=com.mysql.jdbc.Driver
|
||||||
|
# 连接url
|
||||||
|
|
||||||
|
jdbc.mysql.url=jdbc:mysql://192.168.191.120:3306/ftpdata?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&autoReconnect=true&failOverReadOnly=false
|
||||||
|
|
||||||
|
# 用户名
|
||||||
|
jdbc.mysql.username=root
|
||||||
|
# 密码
|
||||||
|
jdbc.mysql.password=root
|
||||||
|
|
||||||
|
#=============================================================================================================
|
||||||
|
# Oracle 连接配置
|
||||||
|
#=============================================================================================================
|
||||||
|
# hui用户名
|
||||||
|
gather-user-name=system
|
||||||
|
gather-standard-user-name=u_bzbjy
|
||||||
|
gather-standard-exec-table-name=kzxzb
|
||||||
|
gather-standard-pay-table-name=zfxxb
|
||||||
|
# 密码
|
||||||
|
gather-user-password=oracle
|
||||||
|
|
||||||
|
#
|
||||||
|
gather-port=1521
|
||||||
|
#
|
||||||
|
gather-service-name=orcl
|
||||||
|
|
||||||
|
#
|
||||||
|
#==============================================================================================================
|
||||||
|
table-suffix=_20152016
|
||||||
|
|
||||||
|
gather-tablespace-name=TS_TTSSS
|
||||||
|
|
||||||
|
#dbf file's path must exist
|
||||||
|
gather-tablespace-path=/opt/oracle/app/oradata/orcl/
|
||||||
|
# user's password must exist
|
||||||
|
gather-table-user-password=user
|
||||||
|
|
||||||
|
#kuber's url must exist
|
||||||
|
kubeMasterUrl=http://192.168.191.120:8080/
|
||||||
|
|
||||||
|
kubeMasterAddress=192.168.191.120:8080
|
||||||
|
|
||||||
|
collect-user-name=system
|
||||||
|
collect-password=oracle
|
||||||
|
collect-service-name=orcl
|
||||||
|
# standard table :
|
||||||
|
# eg:sql -> select count(*) from u_bzbjy.kzxzb; select count(*) from u_bzbjy.zfxxb;
|
||||||
|
collect-user-table=U_BZBJY
|
||||||
|
collect-exec-table=KZXZB
|
||||||
|
collect-pay-table=ZFXXB
|
||||||
|
# 其他的标准表名称,用逗号分隔
|
||||||
|
other_standard_tables=ZYSKJ
|
||||||
|
#gfs cluster master IP
|
||||||
|
gfs_control_ip=192.168.191.120
|
||||||
|
#gfs web password of root
|
||||||
|
gfs_control_rootPassWd=root
|
||||||
|
#url of gfs web
|
||||||
|
HttpClientConstant_URL_IP_PORT=http://192.168.191.120:9002/glusterfs_restful/
|
||||||
|
#data between 6 month ago and now
|
||||||
|
dataBefore=6
|
||||||
|
#move a data once
|
||||||
|
moveFileMaxNum=1
|
||||||
|
#import 5 rows of Excel once
|
||||||
|
numOneImportExcel=5
|
||||||
|
oracle-orcl=orcl
|
||||||
|
oracle-user=system
|
||||||
|
oracle-psw=oracle
|
||||||
|
|
||||||
|
# linux path
|
||||||
|
#=============================================================================================================
|
||||||
|
|
||||||
|
#系统数据目录根路径
|
||||||
|
data_path=/aggregation-platform_data_path/
|
||||||
|
|
||||||
|
# extract's log file location
|
||||||
|
extract-log-localtion=extract_log/
|
||||||
|
# standard extract's log file location
|
||||||
|
extract-standard-log-localtion=extract_standard_log/
|
||||||
|
|
||||||
|
#数据导出路径
|
||||||
|
export-data-localtion=export-data-localtion/
|
||||||
|
|
||||||
|
#数据导出日志路径
|
||||||
|
export-data-log-localtion=export-data-log-localtion/
|
||||||
|
# 导出数据原始库sql脚本
|
||||||
|
export_data_origin_sql_script = origin_sql_script/
|
||||||
|
# 导出数据汇总平台sql脚本
|
||||||
|
export_data_platform_sql_script = platform_sql_script/
|
||||||
|
#import excel file's location
|
||||||
|
file_upload_path=excel_import_dir/
|
||||||
|
|
||||||
|
#信息系统excel导出文件
|
||||||
|
file_download_path=excel_export_dir/export.xls
|
||||||
|
#file package download's location
|
||||||
|
package_download_path=package_download_path/
|
||||||
|
|
||||||
|
package_name=package.zip
|
||||||
|
#location of sql script lastest
|
||||||
|
sql_script_path_last=sql_last/
|
||||||
|
#location of sql script standard
|
||||||
|
sql_script_path_standard=sql_standard/
|
||||||
|
|
||||||
|
#oracle原始数据目录
|
||||||
|
origin_database_utf8=origin_database/UTF8/app/
|
||||||
|
origin_database_gbk=origin_database/gbk/app/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#=============================================================================================================
|
||||||
|
# 数据库公共配置
|
||||||
|
#=============================================================================================================
|
||||||
|
jdbc.initialSize=5
|
||||||
|
jdbc.minIdle=5
|
||||||
|
jdbc.maxIdle=20
|
||||||
|
jdbc.maxActive=100
|
||||||
|
jdbc.maxWait=100000
|
||||||
|
jdbc.defaultAutoCommit=false
|
||||||
|
jdbc.removeAbandoned=true
|
||||||
|
jdbc.removeAbandonedTimeout=600
|
||||||
|
jdbc.testWhileIdle=true
|
||||||
|
jdbc.timeBetweenEvictionRunsMillis=60000
|
||||||
|
jdbc.numTestsPerEvictionRun=20
|
||||||
|
jdbc.minEvictableIdleTimeMillis=300000
|
||||||
|
#==============================================================================================================
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE configuration PUBLIC
|
||||||
|
"-//mybatis.org//DTD Config 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||||
|
<configuration>
|
||||||
|
<typeAliases>
|
||||||
|
<typeAlias alias="String" type="java.lang.String" />
|
||||||
|
<typeAlias alias="EncodedInfoEntity" type="com.platform.entities.EncodedInfoEntity" />
|
||||||
|
<typeAlias alias="DataInfoEntity" type="com.platform.entities.DataInfoEntity" />
|
||||||
|
<typeAlias alias="PagerOptions" type="com.platform.form.PagerOptions" />
|
||||||
|
<typeAlias alias="GatherOracleInfo" type="com.platform.entities.GatherOracleInfo" />
|
||||||
|
<typeAlias alias="DataInfoEntityMoveTmp"
|
||||||
|
type="com.platform.entities.DataInfoEntityMoveTmp" />
|
||||||
|
<typeAlias alias="SystemEntity" type="com.platform.entities.SystemEntity" />
|
||||||
|
<typeAlias alias="RegionalismEntity" type="com.platform.entities.RegionalismEntity" />
|
||||||
|
<typeAlias alias="OracleForm" type="com.platform.form.OracleForm" />
|
||||||
|
</typeAliases>
|
||||||
|
|
||||||
|
<plugins>
|
||||||
|
<plugin interceptor="com.platform.utils.page.PageInterceptor">
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
|
||||||
|
|
||||||
|
</configuration>
|
||||||
|
|
@ -1,64 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
|
|
||||||
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
|
|
||||||
xmlns:context="http://www.springframework.org/schema/context"
|
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
|
||||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
|
||||||
http://www.springframework.org/schema/tx
|
|
||||||
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
|
|
||||||
http://www.springframework.org/schema/aop
|
|
||||||
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
|
|
||||||
http://www.springframework.org/schema/context
|
|
||||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
|
|
||||||
<!-- 读取db.properties中的属性值 -->
|
|
||||||
<bean
|
|
||||||
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
|
||||||
<property name="location" value="/WebContent/WEB-INF/config/config.properties"></property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<!-- 连接MySQL数据库 -->
|
|
||||||
<bean id="mySQLDataSource"
|
|
||||||
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
|
|
||||||
<property name="driverClassName" value="${jdbc.mysql.driver}" />
|
|
||||||
<property name="url" value="${jdbc.mysql.url}" />
|
|
||||||
<property name="username" value="${jdbc.mysql.username}" />
|
|
||||||
<property name="password" value="${jdbc.mysql.password}" />
|
|
||||||
</bean>
|
|
||||||
<bean id="mySQLSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
|
||||||
<property name="configLocation" value="/WebContent/WEB-INF/config/mybatis-applicationConfig.xml" />
|
|
||||||
<property name="dataSource" ref="mySQLDataSource" />
|
|
||||||
</bean>
|
|
||||||
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
|
|
||||||
<property name="basePackage" value="com.platform.dao" />
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<!-- 配置声明式事物 -->
|
|
||||||
<bean id="mySQLTxManager"
|
|
||||||
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
|
||||||
<property name="dataSource" ref="mySQLDataSource" />
|
|
||||||
</bean>
|
|
||||||
<tx:advice id="txAdvice" transaction-manager="mySQLTxManager">
|
|
||||||
<tx:attributes>
|
|
||||||
<tx:method name="delete*" propagation="REQUIRED" />
|
|
||||||
<tx:method name="insert*" propagation="REQUIRED" />
|
|
||||||
<tx:method name="update*" propagation="REQUIRED" />
|
|
||||||
<tx:method name="get*" read-only="true" />
|
|
||||||
<tx:method name="select*" read-only="true" />
|
|
||||||
</tx:attributes>
|
|
||||||
</tx:advice>
|
|
||||||
<aop:config>
|
|
||||||
<aop:pointcut expression="execution(* com.platform.service.*.*(..))"
|
|
||||||
id="pointcut" />
|
|
||||||
<aop:advisor advice-ref="txAdvice" pointcut-ref="pointcut" />
|
|
||||||
</aop:config>
|
|
||||||
<bean id="user" class="com.platform.test.User">
|
|
||||||
<property name="name" value="伍名" />
|
|
||||||
<property name="id" value="1" />
|
|
||||||
<property name="sex" value="男" />
|
|
||||||
</bean>
|
|
||||||
<context:component-scan base-package="com.platform.*">
|
|
||||||
<context:exclude-filter type="annotation"
|
|
||||||
expression="org.springframework.stereotype.Controller" />
|
|
||||||
</context:component-scan>
|
|
||||||
</beans>
|
|
||||||
|
|
@ -0,0 +1,125 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
|
||||||
|
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
|
||||||
|
xmlns:context="http://www.springframework.org/schema/context"
|
||||||
|
xmlns:task="http://www.springframework.org/schema/task"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||||
|
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||||
|
http://www.springframework.org/schema/tx
|
||||||
|
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
|
||||||
|
http://www.springframework.org/schema/aop
|
||||||
|
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
|
||||||
|
http://www.springframework.org/schema/context
|
||||||
|
http://www.springframework.org/schema/context/spring-context-3.0.xsd
|
||||||
|
http://www.springframework.org/schema/websocket
|
||||||
|
http://www.springframework.org/schema/websocket/spring-websocket.xsd
|
||||||
|
http://www.springframework.org/schema/beans
|
||||||
|
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
|
http://www.springframework.org/schema/task
|
||||||
|
http://www.springframework.org/schema/task/spring-task-3.0.xsd">
|
||||||
|
|
||||||
|
<!-- 读取db.properties中的属性值 -->
|
||||||
|
|
||||||
|
<bean
|
||||||
|
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||||||
|
<property name="location" value="classpath:config.properties"></property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="messageCodeResolver"
|
||||||
|
class="org.springframework.validation.DefaultMessageCodesResolver">
|
||||||
|
<property name="prefix" value="validation."></property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- 连接MySQL数据库 -->
|
||||||
|
<bean id="mySQLDataSource"
|
||||||
|
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
|
||||||
|
<property name="driverClassName" value="${jdbc.mysql.driver}" />
|
||||||
|
<property name="url" value="${jdbc.mysql.url}" />
|
||||||
|
<property name="username" value="${jdbc.mysql.username}" />
|
||||||
|
<property name="password" value="${jdbc.mysql.password}" />
|
||||||
|
</bean>
|
||||||
|
<!-- <bean id="mySQLSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
||||||
|
<property name="configLocation" value="WEB-INF/config/mybatis-applicationConfig.xml"
|
||||||
|
/> <property name="dataSource" ref="mySQLDataSource" /> </bean> -->
|
||||||
|
<bean id="mySQLSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
||||||
|
<property name="configLocation" value="classpath:mybatis-applicationConfig.xml" />
|
||||||
|
<property name="dataSource" ref="mySQLDataSource" />
|
||||||
|
<property name="mapperLocations">
|
||||||
|
<list>
|
||||||
|
<value>classpath:com/dao/mapper/*.xml</value>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- mapper扫描器 -->
|
||||||
|
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
|
||||||
|
<!-- 扫描包路径,如果需要扫描多个包,中间使用半角逗号隔开 -->
|
||||||
|
<property name="basePackage" value="com.platform.dao"></property>
|
||||||
|
<property name="sqlSessionFactoryBeanName" value="mySQLSessionFactory" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- 配置声明式事物 事物管理器 -->
|
||||||
|
<!-- 配置声明式事物 -->
|
||||||
|
<bean id="mySQLTxManager"
|
||||||
|
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||||
|
<property name="dataSource" ref="mySQLDataSource" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 使用注解事务,需要添加Transactional注解属性 -->
|
||||||
|
<bean id="transactionManager"
|
||||||
|
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||||
|
<property name="dataSource" ref="mySQLDataSource" />
|
||||||
|
</bean>
|
||||||
|
<tx:annotation-driven transaction-manager="transactionManager" />
|
||||||
|
|
||||||
|
<tx:advice id="txAdvice" transaction-manager="mySQLTxManager">
|
||||||
|
<tx:attributes>
|
||||||
|
<tx:method name="delete*" propagation="REQUIRED" />
|
||||||
|
<tx:method name="insert*" propagation="REQUIRED" />
|
||||||
|
<tx:method name="update*" propagation="REQUIRED" />
|
||||||
|
<tx:method name="select*" read-only="true" />
|
||||||
|
</tx:attributes>
|
||||||
|
</tx:advice>
|
||||||
|
<aop:config>
|
||||||
|
<aop:pointcut expression="execution(* com.platform.service.*.*(..))"
|
||||||
|
id="pointcut" />
|
||||||
|
<aop:advisor advice-ref="txAdvice" pointcut-ref="pointcut" />
|
||||||
|
</aop:config>
|
||||||
|
|
||||||
|
<!-- 连接oracle数据库 -->
|
||||||
|
<!-- <bean id="oracleDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"
|
||||||
|
destroy-method="close"> <property name="driverClassName" value="${jdbc.oracle.driver}"
|
||||||
|
/> <property name="url" value="${jdbc.oracle.url}" /> <property name="username"
|
||||||
|
value="${jdbc.oracle.username}" /> <property name="password" value="${jdbc.oracle.password}"
|
||||||
|
/> <property name="initialSize" value="${jdbc.initialSize}" /> <property
|
||||||
|
name="minIdle" value="${jdbc.minIdle}" /> <property name="maxIdle" value="${jdbc.maxIdle}"
|
||||||
|
/> <property name="maxActive" value="${jdbc.maxActive}" /> <property name="maxWait"
|
||||||
|
value="${jdbc.maxWait}" /> <property name="defaultAutoCommit" value="${jdbc.defaultAutoCommit}"
|
||||||
|
/> <property name="removeAbandoned" value="${jdbc.removeAbandoned}" /> <property
|
||||||
|
name="removeAbandonedTimeout" value="${jdbc.removeAbandonedTimeout}" /> <property
|
||||||
|
name="testWhileIdle" value="${jdbc.testWhileIdle}" /> <property name="timeBetweenEvictionRunsMillis"
|
||||||
|
value="${jdbc.timeBetweenEvictionRunsMillis}" /> <property name="numTestsPerEvictionRun"
|
||||||
|
value="${jdbc.numTestsPerEvictionRun}" /> <property name="minEvictableIdleTimeMillis"
|
||||||
|
value="${jdbc.minEvictableIdleTimeMillis}" /> </bean> -->
|
||||||
|
<context:component-scan base-package="com.platform.*">
|
||||||
|
<context:exclude-filter type="annotation"
|
||||||
|
expression="org.springframework.stereotype.Controller" />
|
||||||
|
</context:component-scan>
|
||||||
|
<!-- Enables the Spring Task @Scheduled programming model -->
|
||||||
|
<task:executor id="executor" pool-size="5" />
|
||||||
|
<task:scheduler id="scheduler" pool-size="10" />
|
||||||
|
<task:annotation-driven executor="executor"
|
||||||
|
scheduler="scheduler" />
|
||||||
|
<bean id="multipartResolver"
|
||||||
|
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
|
||||||
|
<!-- set the max upload size100MB -->
|
||||||
|
<property name="maxUploadSize">
|
||||||
|
<value>104857600</value>
|
||||||
|
</property>
|
||||||
|
<property name="maxInMemorySize">
|
||||||
|
<value>4096</value>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
</beans>
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
|
||||||
|
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx"
|
||||||
|
xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:context="http://www.springframework.org/schema/context"
|
||||||
|
xmlns:websocket="http://www.springframework.org/schema/websocket"
|
||||||
|
xsi:schemaLocation="
|
||||||
|
http://www.springframework.org/schema/context
|
||||||
|
http://www.springframework.org/schema/context/spring-context-4.0.xsd
|
||||||
|
http://www.springframework.org/schema/beans
|
||||||
|
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
|
||||||
|
http://www.springframework.org/schema/jdbc
|
||||||
|
http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd
|
||||||
|
http://www.springframework.org/schema/tx
|
||||||
|
http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
|
||||||
|
http://www.springframework.org/schema/aop
|
||||||
|
http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
|
||||||
|
http://www.springframework.org/schema/mvc
|
||||||
|
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
|
||||||
|
http://www.springframework.org/schema/websocket
|
||||||
|
http://www.springframework.org/schema/websocket/spring-websocket-4.0.xsd"
|
||||||
|
default-autowire="byName">
|
||||||
|
|
||||||
|
<context:component-scan
|
||||||
|
base-package="com.platform.controller,com.platform.test,com.platform.websocket;">
|
||||||
|
<context:include-filter type="annotation"
|
||||||
|
expression="org.springframework.stereotype.Controller" />
|
||||||
|
<context:exclude-filter type="annotation"
|
||||||
|
expression="org.springframework.stereotype.Service" />
|
||||||
|
</context:component-scan>
|
||||||
|
|
||||||
|
<context:annotation-config />
|
||||||
|
|
||||||
|
<mvc:annotation-driven>
|
||||||
|
<mvc:message-converters>
|
||||||
|
<bean id="mappingJacksonHttpMessageConverter"
|
||||||
|
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
|
||||||
|
<property name="supportedMediaTypes">
|
||||||
|
<list>
|
||||||
|
<value>application/json;charset=UTF-8</value>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
</mvc:message-converters>
|
||||||
|
</mvc:annotation-driven>
|
||||||
|
|
||||||
|
<!-- 用于将对象转换为JSON -->
|
||||||
|
<bean id="stringConverter"
|
||||||
|
class="org.springframework.http.converter.StringHttpMessageConverter">
|
||||||
|
<property name="supportedMediaTypes">
|
||||||
|
<list>
|
||||||
|
<value>application/json;charset=UTF-8</value>
|
||||||
|
<value>text/html;charset=UTF-8</value>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
<bean id="jsonConverter"
|
||||||
|
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" />
|
||||||
|
<bean
|
||||||
|
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
|
||||||
|
<property name="messageConverters">
|
||||||
|
<list>
|
||||||
|
<ref bean="stringConverter" />
|
||||||
|
<ref bean="jsonConverter" />
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
</beans>
|
||||||
Loading…
Reference in New Issue