parent
e42e9b9554
commit
4d8078c6c1
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
|
||||
<persistence-unit name="aggregation-platform">
|
||||
</persistence-unit>
|
||||
</persistence>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
|
||||
<persistence-unit name="aggregation-platform">
|
||||
</persistence-unit>
|
||||
</persistence>
|
||||
|
@ -1,42 +1,42 @@
|
||||
<?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.IRegionalismCodeDao">
|
||||
<resultMap id="getEntityByText" type="com.platform.entities.RegionalismEntity">
|
||||
<id property="code" column="code" jdbcType="VARCHAR" />
|
||||
<result property="cityName" column="city_name" jdbcType="VARCHAR" />
|
||||
<result property="districtName" column="district_name" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
code,city_name,district_name
|
||||
</sql>
|
||||
|
||||
<!-- 获取数据全部记录信息 -->
|
||||
<select id="findAllRegionalism" resultMap="getEntityByText">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM regionalism_info
|
||||
order by code
|
||||
</select>
|
||||
|
||||
<select id="findSubRegionalism" parameterType="com.platform.entities.RegionalismEntity" resultMap="getEntityByText">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM regionalism_info
|
||||
<where>
|
||||
<if test="code != null and code != ''">
|
||||
AND code LIKE CONCAT(CONCAT('%', #{code}), '%')
|
||||
</if>
|
||||
<if test="cityName != null and cityName != ''">
|
||||
AND city_name LIKE CONCAT(CONCAT('%', #{cityName}), '%')
|
||||
</if>
|
||||
<if test="districtName != null and districtName != ''">
|
||||
AND district_name LIKE CONCAT(CONCAT('%', #{districtName}), '%')
|
||||
</if>
|
||||
</where>
|
||||
order by code
|
||||
</select>
|
||||
<?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.IRegionalismCodeDao">
|
||||
<resultMap id="getEntityByText" type="com.platform.entities.RegionalismEntity">
|
||||
<id property="code" column="code" jdbcType="VARCHAR" />
|
||||
<result property="cityName" column="city_name" jdbcType="VARCHAR" />
|
||||
<result property="districtName" column="district_name" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
code,city_name,district_name
|
||||
</sql>
|
||||
|
||||
<!-- 获取数据全部记录信息 -->
|
||||
<select id="findAllRegionalism" resultMap="getEntityByText">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM regionalism_info
|
||||
order by code
|
||||
</select>
|
||||
|
||||
<select id="findSubRegionalism" parameterType="com.platform.entities.RegionalismEntity" resultMap="getEntityByText">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM regionalism_info
|
||||
<where>
|
||||
<if test="code != null and code != ''">
|
||||
AND code LIKE CONCAT(CONCAT('%', #{code}), '%')
|
||||
</if>
|
||||
<if test="cityName != null and cityName != ''">
|
||||
AND city_name LIKE CONCAT(CONCAT('%', #{cityName}), '%')
|
||||
</if>
|
||||
<if test="districtName != null and districtName != ''">
|
||||
AND district_name LIKE CONCAT(CONCAT('%', #{districtName}), '%')
|
||||
</if>
|
||||
</where>
|
||||
order by code
|
||||
</select>
|
||||
</mapper>
|
@ -1,42 +1,42 @@
|
||||
<?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="findSubSystem" parameterType="com.platform.entities.SystemEntity" resultMap="getEntityByText">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM system_info
|
||||
<where>
|
||||
<if test="code > 0">
|
||||
AND code = #{code}
|
||||
</if>
|
||||
<if test="cityName != null and cityName != ''">
|
||||
AND city_name LIKE CONCAT(CONCAT('%', #{cityName}), '%')
|
||||
</if>
|
||||
<if test="districtName != null and districtName != ''">
|
||||
AND district_name LIKE CONCAT(CONCAT('%', #{districtName}), '%')
|
||||
</if>
|
||||
</where>
|
||||
order by code
|
||||
</select>
|
||||
|
||||
<?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="findSubSystem" parameterType="com.platform.entities.SystemEntity" resultMap="getEntityByText">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM system_info
|
||||
<where>
|
||||
<if test="code > 0">
|
||||
AND code = #{code}
|
||||
</if>
|
||||
<if test="cityName != null and cityName != ''">
|
||||
AND city_name LIKE CONCAT(CONCAT('%', #{cityName}), '%')
|
||||
</if>
|
||||
<if test="districtName != null and districtName != ''">
|
||||
AND district_name LIKE CONCAT(CONCAT('%', #{districtName}), '%')
|
||||
</if>
|
||||
</where>
|
||||
order by code
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -1,146 +1,146 @@
|
||||
<?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.GatherOracleDao">
|
||||
<resultMap type="com.platform.entities.GatherOracleInfo" id="getEntityBytext">
|
||||
<id property="id" column="id" javaType="int" jdbcType="INTEGER" />
|
||||
<result property="port" column="service_port" javaType="int" jdbcType="INTEGER"/>
|
||||
<result property="ip" column="service_ip" javaType="string" jdbcType="VARCHAR"/>
|
||||
<result property="name" column="service_name" javaType="string" jdbcType="VARCHAR"/>
|
||||
<result property="user" column="service_user" javaType="string" jdbcType="VARCHAR"/>
|
||||
<result property="password" column="service_password" javaType="string" jdbcType="VARCHAR"/>
|
||||
<result property="databaseName" column="service_database" javaType="string" jdbcType="VARCHAR"/>
|
||||
<result property="tableName" column="service_table" javaType="string" jdbcType="VARCHAR"/>
|
||||
<result property="suffix" column="service_suffix" javaType="string" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="service_status" javaType="string" jdbcType="VARCHAR"/>
|
||||
<result property="remove" column="remove" jdbcType="CHAR"/>
|
||||
</resultMap>
|
||||
<sql id="baseOracleInfo">
|
||||
id id, service_port port, service_ip ip, service_name name, service_user user, service_password password, service_database databaseName, service_table tableName, service_suffix suffix, service_status status
|
||||
</sql>
|
||||
|
||||
<select id="selectAllOracle" resultType="com.platform.entities.GatherOracleInfo">
|
||||
SELECT
|
||||
<include refid="baseOracleInfo" />
|
||||
FROM services_info
|
||||
WHERE remove = "0"
|
||||
</select>
|
||||
|
||||
<insert id="insertOracle" parameterType="com.platform.entities.GatherOracleInfo">
|
||||
INSERT INTO
|
||||
services_info(
|
||||
<trim suffixOverrides=",">
|
||||
<if test="port > 0">
|
||||
service_port,
|
||||
</if>
|
||||
<if test="ip != null and ip != ''">
|
||||
service_ip,
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
service_name,
|
||||
</if>
|
||||
<if test="user != null and user != ''">
|
||||
service_user,
|
||||
</if>
|
||||
<if test="password != null and password != ''">
|
||||
service_password,
|
||||
</if>
|
||||
<if test="databaseName != null and databaseName != ''">
|
||||
service_database,
|
||||
</if>
|
||||
<if test="tableName != null and tableName != ''">
|
||||
service_table,
|
||||
</if>
|
||||
<if test="suffix != null and suffix != ''">
|
||||
service_suffix,
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
service_status,
|
||||
</if>
|
||||
</trim>
|
||||
)
|
||||
VALUES(
|
||||
<trim suffixOverrides=",">
|
||||
<if test="port > 0">
|
||||
#{port},
|
||||
</if>
|
||||
<if test="ip != null and ip != ''">
|
||||
#{ip},
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
#{name},
|
||||
</if>
|
||||
<if test="user != null and user != ''">
|
||||
#{user},
|
||||
</if>
|
||||
<if test="password != null and password != ''">
|
||||
#{password},
|
||||
</if>
|
||||
<if test="databaseName != null and databaseName != ''">
|
||||
#{databaseName},
|
||||
</if>
|
||||
<if test="tableName != null and tableName != ''">
|
||||
#{tableName},
|
||||
</if>
|
||||
<if test="suffix != null and suffix != ''">
|
||||
#{suffix},
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
#{status},
|
||||
</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<delete id="deleteOracleById" parameterType="java.lang.Integer">
|
||||
DELETE FROM services_info
|
||||
<where>
|
||||
id =#{id}
|
||||
</where>
|
||||
</delete>
|
||||
|
||||
<update id="updateOracleById" parameterType="com.platform.entities.GatherOracleInfo">
|
||||
UPDATE
|
||||
services_info
|
||||
<set >
|
||||
<trim suffixOverrides=",">
|
||||
<if test="name != null and name != ''">
|
||||
service_name = #{name},
|
||||
</if>
|
||||
<if test="ip != null and ip != ''">
|
||||
service_ip = #{ip},
|
||||
</if>
|
||||
<if test="port > 0">
|
||||
service_port= #{port},
|
||||
</if>
|
||||
<if test="user != null and user != ''">
|
||||
service_user= #{user},
|
||||
</if>
|
||||
<if test="password != null and password != ''">
|
||||
service_password= #{password},
|
||||
</if>
|
||||
<if test="databaseName != null and databaseName != ''">
|
||||
service_database= #{databaseName},
|
||||
</if>
|
||||
<if test="tableName != null and tableName != ''">
|
||||
service_table= #{tableName},
|
||||
</if>
|
||||
<if test="suffix != null and suffix != ''">
|
||||
service_suffix= #{suffix},
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
service_status= #{status},
|
||||
</if>
|
||||
<if test="remove != null and remove != ''">
|
||||
remove= #{remove},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
<where>
|
||||
id = #{id}
|
||||
</where>
|
||||
</update>
|
||||
|
||||
<?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.GatherOracleDao">
|
||||
<resultMap type="com.platform.entities.GatherOracleInfo" id="getEntityBytext">
|
||||
<id property="id" column="id" javaType="int" jdbcType="INTEGER" />
|
||||
<result property="port" column="service_port" javaType="int" jdbcType="INTEGER"/>
|
||||
<result property="ip" column="service_ip" javaType="string" jdbcType="VARCHAR"/>
|
||||
<result property="name" column="service_name" javaType="string" jdbcType="VARCHAR"/>
|
||||
<result property="user" column="service_user" javaType="string" jdbcType="VARCHAR"/>
|
||||
<result property="password" column="service_password" javaType="string" jdbcType="VARCHAR"/>
|
||||
<result property="databaseName" column="service_database" javaType="string" jdbcType="VARCHAR"/>
|
||||
<result property="tableName" column="service_table" javaType="string" jdbcType="VARCHAR"/>
|
||||
<result property="suffix" column="service_suffix" javaType="string" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="service_status" javaType="string" jdbcType="VARCHAR"/>
|
||||
<result property="remove" column="remove" jdbcType="CHAR"/>
|
||||
</resultMap>
|
||||
<sql id="baseOracleInfo">
|
||||
id id, service_port port, service_ip ip, service_name name, service_user user, service_password password, service_database databaseName, service_table tableName, service_suffix suffix, service_status status
|
||||
</sql>
|
||||
|
||||
<select id="selectAllOracle" resultType="com.platform.entities.GatherOracleInfo">
|
||||
SELECT
|
||||
<include refid="baseOracleInfo" />
|
||||
FROM services_info
|
||||
WHERE remove = "0"
|
||||
</select>
|
||||
|
||||
<insert id="insertOracle" parameterType="com.platform.entities.GatherOracleInfo">
|
||||
INSERT INTO
|
||||
services_info(
|
||||
<trim suffixOverrides=",">
|
||||
<if test="port > 0">
|
||||
service_port,
|
||||
</if>
|
||||
<if test="ip != null and ip != ''">
|
||||
service_ip,
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
service_name,
|
||||
</if>
|
||||
<if test="user != null and user != ''">
|
||||
service_user,
|
||||
</if>
|
||||
<if test="password != null and password != ''">
|
||||
service_password,
|
||||
</if>
|
||||
<if test="databaseName != null and databaseName != ''">
|
||||
service_database,
|
||||
</if>
|
||||
<if test="tableName != null and tableName != ''">
|
||||
service_table,
|
||||
</if>
|
||||
<if test="suffix != null and suffix != ''">
|
||||
service_suffix,
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
service_status,
|
||||
</if>
|
||||
</trim>
|
||||
)
|
||||
VALUES(
|
||||
<trim suffixOverrides=",">
|
||||
<if test="port > 0">
|
||||
#{port},
|
||||
</if>
|
||||
<if test="ip != null and ip != ''">
|
||||
#{ip},
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
#{name},
|
||||
</if>
|
||||
<if test="user != null and user != ''">
|
||||
#{user},
|
||||
</if>
|
||||
<if test="password != null and password != ''">
|
||||
#{password},
|
||||
</if>
|
||||
<if test="databaseName != null and databaseName != ''">
|
||||
#{databaseName},
|
||||
</if>
|
||||
<if test="tableName != null and tableName != ''">
|
||||
#{tableName},
|
||||
</if>
|
||||
<if test="suffix != null and suffix != ''">
|
||||
#{suffix},
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
#{status},
|
||||
</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<delete id="deleteOracleById" parameterType="java.lang.Integer">
|
||||
DELETE FROM services_info
|
||||
<where>
|
||||
id =#{id}
|
||||
</where>
|
||||
</delete>
|
||||
|
||||
<update id="updateOracleById" parameterType="com.platform.entities.GatherOracleInfo">
|
||||
UPDATE
|
||||
services_info
|
||||
<set >
|
||||
<trim suffixOverrides=",">
|
||||
<if test="name != null and name != ''">
|
||||
service_name = #{name},
|
||||
</if>
|
||||
<if test="ip != null and ip != ''">
|
||||
service_ip = #{ip},
|
||||
</if>
|
||||
<if test="port > 0">
|
||||
service_port= #{port},
|
||||
</if>
|
||||
<if test="user != null and user != ''">
|
||||
service_user= #{user},
|
||||
</if>
|
||||
<if test="password != null and password != ''">
|
||||
service_password= #{password},
|
||||
</if>
|
||||
<if test="databaseName != null and databaseName != ''">
|
||||
service_database= #{databaseName},
|
||||
</if>
|
||||
<if test="tableName != null and tableName != ''">
|
||||
service_table= #{tableName},
|
||||
</if>
|
||||
<if test="suffix != null and suffix != ''">
|
||||
service_suffix= #{suffix},
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
service_status= #{status},
|
||||
</if>
|
||||
<if test="remove != null and remove != ''">
|
||||
remove= #{remove},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
<where>
|
||||
id = #{id}
|
||||
</where>
|
||||
</update>
|
||||
|
||||
</mapper>
|
@ -1,249 +1,249 @@
|
||||
<?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.DataInfoDao">
|
||||
<resultMap id="getEntityByText" type="com.platform.entities.DataInfoEntity">
|
||||
<id property="id" column="id" javaType="int" jdbcType="INTEGER" />
|
||||
<result property="regionalismCode" column="regionalism_code"
|
||||
javaType="string" jdbcType="VARCHAR" />
|
||||
<result property="cityName" column="city_name" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="districtName" column="district_name"
|
||||
javaType="string" jdbcType="VARCHAR" />
|
||||
<result property="systemCode" column="system_code" javaType="int"
|
||||
jdbcType="INTEGER" />
|
||||
<result property="systemName" column="system_name" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="dataType" column="data_type" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="dataVersion" column="data_version" javaType="int"
|
||||
jdbcType="INTEGER" />
|
||||
<result property="submittedBatch" column="submitted_batch"
|
||||
javaType="string" jdbcType="VARCHAR" />
|
||||
<result property="dataPath" column="data_path" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="charset" column="data_charset" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="collectingTime" column="collection_time"
|
||||
javaType="string" jdbcType="DATE" />
|
||||
<result property="collectorContacts" column="collector_contacts"
|
||||
javaType="string" jdbcType="VARCHAR" />
|
||||
<result property="collectorName" column="collector_name"
|
||||
javaType="string" jdbcType="VARCHAR" />
|
||||
<result property="extractStatus" column="extract_status" jdbcType="INTEGER" />
|
||||
|
||||
<result property="year" column="data_year" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="startYear" column="start_year" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="endYear" column="end_year" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="volumeIp" column="volume_ip" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="volumePath" column="volume_path" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
<sql id="conditionsFilters">
|
||||
<if test="dataType!=null">
|
||||
AND data_details.data_type=#{dataType}
|
||||
</if>
|
||||
<if test="submittedBatch!=null">
|
||||
AND
|
||||
data_details.submitted_batch=#{submittedBatch}
|
||||
</if>
|
||||
<if test="cityName!=null">
|
||||
AND data_details.city_name=#{cityName}
|
||||
</if>
|
||||
<if test="districtName!=null">
|
||||
AND
|
||||
data_details.district_name=#{districtName}
|
||||
</if>
|
||||
<if test="dataVersion !=null">
|
||||
AND data_details.data_version=#{dataVersion}
|
||||
</if>
|
||||
<if test="systemName !=null">
|
||||
AND data_details.system_name=#{systemName}
|
||||
</if>
|
||||
<if test="dataYear !=null">
|
||||
AND data_details.data_year=#{dataYear}
|
||||
</if>
|
||||
<if test="array !=null and array.length > 0">
|
||||
<foreach collection="array" item="item" index="index">
|
||||
AND CONCAT(regionalism_code,system_code,city_name,district_name,system_name) LIKE CONCAT('%',CONCAT(#{item},'%'))
|
||||
</foreach>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<!-- 获取数据符合筛选条件的全部记录信息 -->
|
||||
<select id="getLimitedDataInfoEntities" parameterType="com.platform.entities.PagerOptions"
|
||||
resultMap="getEntityByText">
|
||||
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
|
||||
FROM data_details
|
||||
<where>
|
||||
<include refid="conditionsFilters" />
|
||||
<choose>
|
||||
<when test="offset > 0">
|
||||
and data_details.id>= #{offset}
|
||||
</when>
|
||||
<otherwise>
|
||||
and data_details.id>=0
|
||||
</otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
|
||||
ORDER BY data_details.id
|
||||
<if test="limit > 0">
|
||||
LIMIT #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 获取数据符合筛选条件的总记录条数 -->
|
||||
<select id="getLimitedDataCount" resultType="java.lang.Integer"
|
||||
parameterType="com.platform.entities.PagerOptions">
|
||||
SELECT COUNT(id) FROM data_details
|
||||
<where>
|
||||
<include refid="conditionsFilters" />
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 获取数据查询的起始di -->
|
||||
<select id="getLimitedBeginId" resultType="java.lang.Integer"
|
||||
parameterType="com.platform.entities.PagerOptions">
|
||||
SELECT MAX(idx) FROM (SELECT id idx FROM data_details
|
||||
ORDER BY id LIMIT 0,#{totalLimit}) AS TEMP
|
||||
</select>
|
||||
|
||||
<insert id="save" parameterType="com.platform.entities.DataInfoEntity">
|
||||
INSERT INTO
|
||||
data_info(
|
||||
<trim suffixOverrides=",">
|
||||
<if test="regionalismCode != null and regionalismCode != ''">
|
||||
regionalism_code,
|
||||
</if>
|
||||
<if test="systemCode != null">
|
||||
system_code,
|
||||
</if>
|
||||
<if test="dataType != null and dataType != ''">
|
||||
data_type,
|
||||
</if>
|
||||
<if test="dataVersion != null">
|
||||
data_version,
|
||||
</if>
|
||||
<if test="submittedBatch != null and submittedBatch != ''">
|
||||
submitted_batch,
|
||||
</if>
|
||||
<if test="dataPath != null and dataPath != ''">
|
||||
data_path,
|
||||
</if>
|
||||
<if test="collectingTime != null">
|
||||
collection_time,
|
||||
</if>
|
||||
<if test="collectorName != null and collectorName != ''">
|
||||
collector_name,
|
||||
</if>
|
||||
<if test="collectorContacts != null and collectorContacts != ''">
|
||||
collector_contacts,
|
||||
</if>
|
||||
<if test="charset != null and charset != ''">
|
||||
data_charset,
|
||||
</if>
|
||||
<if test="year != null and year != ''">
|
||||
data_year,
|
||||
</if>
|
||||
<if test="startYear != null and startYear != ''">
|
||||
start_year,
|
||||
</if>
|
||||
<if test="endYear != null and endYear != ''">
|
||||
end_year,
|
||||
</if>
|
||||
<if test="volumeIp != null and volumeIp != ''">
|
||||
volume_ip,
|
||||
</if>
|
||||
<if test="volumePath != null and volumePath != ''">
|
||||
volume_path,
|
||||
</if>
|
||||
<if test="extractStatus > 0">
|
||||
extract_status,
|
||||
</if>
|
||||
</trim>
|
||||
)
|
||||
VALUES(
|
||||
<trim suffixOverrides=",">
|
||||
<if test="regionalismCode != null and regionalismCode != ''">
|
||||
#{regionalismCode},
|
||||
</if>
|
||||
<if test="systemCode != null">
|
||||
#{systemCode},
|
||||
</if>
|
||||
<if test="dataType != null and dataType != ''">
|
||||
#{dataType},
|
||||
</if>
|
||||
<if test="dataVersion != null">
|
||||
#{dataVersion},
|
||||
</if>
|
||||
<if test="submittedBatch != null and submittedBatch != ''">
|
||||
#{submittedBatch},
|
||||
</if>
|
||||
<if test="dataPath != null and dataPath != ''">
|
||||
#{dataPath},
|
||||
</if>
|
||||
<if test="collectingTime != null">
|
||||
#{collectingTime},
|
||||
</if>
|
||||
<if test="collectorName != null and collectorName != ''">
|
||||
#{collectorName},
|
||||
</if>
|
||||
<if test="collectorContacts != null and collectorContacts != ''">
|
||||
#{collectorContacts},
|
||||
</if>
|
||||
<if test="charset != null and charset != ''">
|
||||
#{charset},
|
||||
</if>
|
||||
<if test="year != null and year != ''">
|
||||
#{year},
|
||||
</if>
|
||||
<if test="startYear != null and startYear != ''">
|
||||
#{start_year},
|
||||
</if>
|
||||
<if test="endYear != null and endYear != ''">
|
||||
#{end_year},
|
||||
</if>
|
||||
<if test="volumeIp != null and volumeIp != ''">
|
||||
#{volumeIp},
|
||||
</if>
|
||||
<if test="volumePath != null and volumePath != ''">
|
||||
#{volumePath},
|
||||
</if>
|
||||
<if test="extractStatus > 0">
|
||||
#{extractStatus},
|
||||
</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="getIdIsExist" parameterType="java.util.List" resultType="java.lang.String">
|
||||
select data_path
|
||||
from data_info
|
||||
where id in
|
||||
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and remove ='0'
|
||||
</select>
|
||||
|
||||
<update id="removes" parameterType="java.util.List">
|
||||
UPDATE
|
||||
data_info
|
||||
set remove = '1'
|
||||
where id in
|
||||
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and remove ='0'
|
||||
</update>
|
||||
|
||||
<?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.DataInfoDao">
|
||||
<resultMap id="getEntityByText" type="com.platform.entities.DataInfoEntity">
|
||||
<id property="id" column="id" javaType="int" jdbcType="INTEGER" />
|
||||
<result property="regionalismCode" column="regionalism_code"
|
||||
javaType="string" jdbcType="VARCHAR" />
|
||||
<result property="cityName" column="city_name" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="districtName" column="district_name"
|
||||
javaType="string" jdbcType="VARCHAR" />
|
||||
<result property="systemCode" column="system_code" javaType="int"
|
||||
jdbcType="INTEGER" />
|
||||
<result property="systemName" column="system_name" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="dataType" column="data_type" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="dataVersion" column="data_version" javaType="int"
|
||||
jdbcType="INTEGER" />
|
||||
<result property="submittedBatch" column="submitted_batch"
|
||||
javaType="string" jdbcType="VARCHAR" />
|
||||
<result property="dataPath" column="data_path" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="charset" column="data_charset" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="collectingTime" column="collection_time"
|
||||
javaType="string" jdbcType="DATE" />
|
||||
<result property="collectorContacts" column="collector_contacts"
|
||||
javaType="string" jdbcType="VARCHAR" />
|
||||
<result property="collectorName" column="collector_name"
|
||||
javaType="string" jdbcType="VARCHAR" />
|
||||
<result property="extractStatus" column="extract_status" jdbcType="INTEGER" />
|
||||
|
||||
<result property="year" column="data_year" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="startYear" column="start_year" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="endYear" column="end_year" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="volumeIp" column="volume_ip" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="volumePath" column="volume_path" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
<sql id="conditionsFilters">
|
||||
<if test="dataType!=null">
|
||||
AND data_details.data_type=#{dataType}
|
||||
</if>
|
||||
<if test="submittedBatch!=null">
|
||||
AND
|
||||
data_details.submitted_batch=#{submittedBatch}
|
||||
</if>
|
||||
<if test="cityName!=null">
|
||||
AND data_details.city_name=#{cityName}
|
||||
</if>
|
||||
<if test="districtName!=null">
|
||||
AND
|
||||
data_details.district_name=#{districtName}
|
||||
</if>
|
||||
<if test="dataVersion !=null">
|
||||
AND data_details.data_version=#{dataVersion}
|
||||
</if>
|
||||
<if test="systemName !=null">
|
||||
AND data_details.system_name=#{systemName}
|
||||
</if>
|
||||
<if test="dataYear !=null">
|
||||
AND data_details.data_year=#{dataYear}
|
||||
</if>
|
||||
<if test="array !=null and array.length > 0">
|
||||
<foreach collection="array" item="item" index="index">
|
||||
AND CONCAT(regionalism_code,system_code,city_name,district_name,system_name) LIKE CONCAT('%',CONCAT(#{item},'%'))
|
||||
</foreach>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<!-- 获取数据符合筛选条件的全部记录信息 -->
|
||||
<select id="getLimitedDataInfoEntities" parameterType="com.platform.entities.PagerOptions"
|
||||
resultMap="getEntityByText">
|
||||
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
|
||||
FROM data_details
|
||||
<where>
|
||||
<include refid="conditionsFilters" />
|
||||
<choose>
|
||||
<when test="offset > 0">
|
||||
and data_details.id>= #{offset}
|
||||
</when>
|
||||
<otherwise>
|
||||
and data_details.id>=0
|
||||
</otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
|
||||
ORDER BY data_details.id
|
||||
<if test="limit > 0">
|
||||
LIMIT #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 获取数据符合筛选条件的总记录条数 -->
|
||||
<select id="getLimitedDataCount" resultType="java.lang.Integer"
|
||||
parameterType="com.platform.entities.PagerOptions">
|
||||
SELECT COUNT(id) FROM data_details
|
||||
<where>
|
||||
<include refid="conditionsFilters" />
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 获取数据查询的起始di -->
|
||||
<select id="getLimitedBeginId" resultType="java.lang.Integer"
|
||||
parameterType="com.platform.entities.PagerOptions">
|
||||
SELECT MAX(idx) FROM (SELECT id idx FROM data_details
|
||||
ORDER BY id LIMIT 0,#{totalLimit}) AS TEMP
|
||||
</select>
|
||||
|
||||
<insert id="save" parameterType="com.platform.entities.DataInfoEntity">
|
||||
INSERT INTO
|
||||
data_info(
|
||||
<trim suffixOverrides=",">
|
||||
<if test="regionalismCode != null and regionalismCode != ''">
|
||||
regionalism_code,
|
||||
</if>
|
||||
<if test="systemCode != null">
|
||||
system_code,
|
||||
</if>
|
||||
<if test="dataType != null and dataType != ''">
|
||||
data_type,
|
||||
</if>
|
||||
<if test="dataVersion != null">
|
||||
data_version,
|
||||
</if>
|
||||
<if test="submittedBatch != null and submittedBatch != ''">
|
||||
submitted_batch,
|
||||
</if>
|
||||
<if test="dataPath != null and dataPath != ''">
|
||||
data_path,
|
||||
</if>
|
||||
<if test="collectingTime != null">
|
||||
collection_time,
|
||||
</if>
|
||||
<if test="collectorName != null and collectorName != ''">
|
||||
collector_name,
|
||||
</if>
|
||||
<if test="collectorContacts != null and collectorContacts != ''">
|
||||
collector_contacts,
|
||||
</if>
|
||||
<if test="charset != null and charset != ''">
|
||||
data_charset,
|
||||
</if>
|
||||
<if test="year != null and year != ''">
|
||||
data_year,
|
||||
</if>
|
||||
<if test="startYear != null and startYear != ''">
|
||||
start_year,
|
||||
</if>
|
||||
<if test="endYear != null and endYear != ''">
|
||||
end_year,
|
||||
</if>
|
||||
<if test="volumeIp != null and volumeIp != ''">
|
||||
volume_ip,
|
||||
</if>
|
||||
<if test="volumePath != null and volumePath != ''">
|
||||
volume_path,
|
||||
</if>
|
||||
<if test="extractStatus > 0">
|
||||
extract_status,
|
||||
</if>
|
||||
</trim>
|
||||
)
|
||||
VALUES(
|
||||
<trim suffixOverrides=",">
|
||||
<if test="regionalismCode != null and regionalismCode != ''">
|
||||
#{regionalismCode},
|
||||
</if>
|
||||
<if test="systemCode != null">
|
||||
#{systemCode},
|
||||
</if>
|
||||
<if test="dataType != null and dataType != ''">
|
||||
#{dataType},
|
||||
</if>
|
||||
<if test="dataVersion != null">
|
||||
#{dataVersion},
|
||||
</if>
|
||||
<if test="submittedBatch != null and submittedBatch != ''">
|
||||
#{submittedBatch},
|
||||
</if>
|
||||
<if test="dataPath != null and dataPath != ''">
|
||||
#{dataPath},
|
||||
</if>
|
||||
<if test="collectingTime != null">
|
||||
#{collectingTime},
|
||||
</if>
|
||||
<if test="collectorName != null and collectorName != ''">
|
||||
#{collectorName},
|
||||
</if>
|
||||
<if test="collectorContacts != null and collectorContacts != ''">
|
||||
#{collectorContacts},
|
||||
</if>
|
||||
<if test="charset != null and charset != ''">
|
||||
#{charset},
|
||||
</if>
|
||||
<if test="year != null and year != ''">
|
||||
#{year},
|
||||
</if>
|
||||
<if test="startYear != null and startYear != ''">
|
||||
#{start_year},
|
||||
</if>
|
||||
<if test="endYear != null and endYear != ''">
|
||||
#{end_year},
|
||||
</if>
|
||||
<if test="volumeIp != null and volumeIp != ''">
|
||||
#{volumeIp},
|
||||
</if>
|
||||
<if test="volumePath != null and volumePath != ''">
|
||||
#{volumePath},
|
||||
</if>
|
||||
<if test="extractStatus > 0">
|
||||
#{extractStatus},
|
||||
</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="getIdIsExist" parameterType="java.util.List" resultType="java.lang.String">
|
||||
select data_path
|
||||
from data_info
|
||||
where id in
|
||||
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and remove ='0'
|
||||
</select>
|
||||
|
||||
<update id="removes" parameterType="java.util.List">
|
||||
UPDATE
|
||||
data_info
|
||||
set remove = '1'
|
||||
where id in
|
||||
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and remove ='0'
|
||||
</update>
|
||||
|
||||
</mapper>
|
@ -1,189 +1,189 @@
|
||||
<?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.DataInfoMoveTmpDao">
|
||||
<resultMap id="getEntityByText" type="com.platform.entities.DataInfoEntityMoveTmp">
|
||||
<id property="id" column="id" javaType="int" jdbcType="INTEGER" />
|
||||
<result property="regionalismCode" column="regionalism_code"
|
||||
javaType="string" jdbcType="VARCHAR" />
|
||||
<result property="cityName" column="city_name" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="districtName" column="district_name"
|
||||
javaType="string" jdbcType="VARCHAR" />
|
||||
<result property="systemCode" column="system_code" javaType="int"
|
||||
jdbcType="INTEGER" />
|
||||
<result property="systemName" column="system_name" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="dataType" column="data_type" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="dataVersion" column="data_version" javaType="int"
|
||||
jdbcType="INTEGER" />
|
||||
<result property="submittedBatch" column="submitted_batch"
|
||||
javaType="string" jdbcType="VARCHAR" />
|
||||
<result property="dataPath" column="data_path" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="charset" column="data_charset" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="collectingTime" column="collection_time"
|
||||
javaType="string" jdbcType="DATE" />
|
||||
<result property="collectorContacts" column="collector_contacts"
|
||||
javaType="string" jdbcType="VARCHAR" />
|
||||
<result property="collectorName" column="collector_name"
|
||||
javaType="string" jdbcType="VARCHAR" />
|
||||
<result property="year" column="data_year" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
|
||||
<result property="dstPath" column="dst_path" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="completeStatus" column="complete_status" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="rate" column="rate" javaType="int"
|
||||
jdbcType="INTEGER" />
|
||||
<result property="lastTime" column="lasttime"
|
||||
javaType="string" jdbcType="VARCHAR" />
|
||||
<result property="fkid" column="fkid" javaType="int" jdbcType="INTEGER" />
|
||||
<result property="dstVolumeIp" column="dst_volume_ip" jdbcType="VARCHAR" />
|
||||
<result property="dstVolumePath" column="dst_volume_ip" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
regionalism_code,system_code,dst_path,lasttime,fkid
|
||||
</sql>
|
||||
|
||||
<!-- 获取数据全部记录信息 -->
|
||||
<select id="findAll" resultType="com.platform.entities.DataInfoEntityMoveTmp">
|
||||
SELECT
|
||||
a.id id,a.regionalism_code regionalismCode,a.dst_path dstPath,a.complete_status completeStatus,
|
||||
a.rate rate, a.lasttime lastTime, a.system_code systemCode,a.dst_volume_ip dstVolumeIp,a.dst_volume_path dstVolumePath,
|
||||
b.city_name cityName,b.district_name districtName,b.system_name systemName,b.data_type dataType,
|
||||
b.data_version dataVersion,b.submitted_batch submittedBatch,b.data_path dataPath,b.data_charset charset,
|
||||
b.collection_time collectingTime,b.collector_name collectorName,b.collector_contacts collectorContacts,
|
||||
b.data_year year,b.extract_status extractStatus,b.start_year startYear,b.end_year endYear,
|
||||
b.volume_ip volumeIp,b.volume_path volumePath
|
||||
FROM
|
||||
move_data_tmp a LEFT JOIN data_details b
|
||||
ON a.system_code = b.system_code AND a.regionalism_code = b.regionalism_code AND a.fkid = b.id
|
||||
ORDER BY a.id
|
||||
</select>
|
||||
|
||||
<update id="update" parameterType="com.platform.entities.DataInfoEntityMoveTmp">
|
||||
UPDATE
|
||||
move_data_tmp
|
||||
<set >
|
||||
<trim suffixOverrides=",">
|
||||
<if test="dstPath != null and dstPath != ''">
|
||||
dst_path= #{dstPath},
|
||||
</if>
|
||||
<if test="completeStatus != null and completeStatus != ''">
|
||||
complete_status= #{completeStatus},
|
||||
</if>
|
||||
<if test="rate > 0">
|
||||
rate= #{rate},
|
||||
</if>
|
||||
<if test="lastTime != null and lastTime != ''">
|
||||
lasttime= #{lastTime},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
<where>
|
||||
id = #{id}
|
||||
</where>
|
||||
</update>
|
||||
|
||||
<insert id="save" parameterType="com.platform.entities.DataInfoEntityMoveTmp">
|
||||
INSERT INTO
|
||||
move_data_tmp(
|
||||
<trim suffixOverrides=",">
|
||||
<if test="id > 0">
|
||||
id,
|
||||
</if>
|
||||
<if test="regionalismCode != null and regionalismCode != ''">
|
||||
regionalism_code,
|
||||
</if>
|
||||
<if test="systemCode != null">
|
||||
system_code,
|
||||
</if>
|
||||
<if test="dstPath != null and dstPath != ''">
|
||||
dst_path,
|
||||
</if>
|
||||
<if test="completeStatus != null and completeStatus != ''">
|
||||
complete_status,
|
||||
</if>
|
||||
<if test="rate > 0">
|
||||
rate,
|
||||
</if>
|
||||
<if test="lastTime != null and lastTime != ''">
|
||||
lasttime,
|
||||
</if>
|
||||
<if test="fkid > 0 ">
|
||||
fkid,
|
||||
</if>
|
||||
</trim>
|
||||
)
|
||||
VALUES(
|
||||
<trim suffixOverrides=",">
|
||||
<if test="id > 0">
|
||||
id,
|
||||
</if>
|
||||
<if test="regionalismCode != null and regionalismCode != ''">
|
||||
#{regionalismCode},
|
||||
</if>
|
||||
<if test="systemCode != null and systemCode != ''">
|
||||
#{systemCode},
|
||||
</if>
|
||||
<if test="dstPath != null and dstPath != ''">
|
||||
#{dstPath},
|
||||
</if>
|
||||
<if test="completeStatus != null and completeStatus != ''">
|
||||
#{completeStatus},
|
||||
</if>
|
||||
<if test="rate > 0">
|
||||
#{rate}
|
||||
</if>
|
||||
<if test="lastTime != null and lastTime != ''">
|
||||
#{lastTime},
|
||||
</if>
|
||||
<if test="fkid > 0 ">
|
||||
#{fkid),
|
||||
</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="insertBatch" parameterType="java.util.List">
|
||||
INSERT INTO move_data_tmp ( <include refid="Base_Column_List" /> )
|
||||
VALUES
|
||||
<foreach collection="list" item="item" index="index" separator=",">
|
||||
(#{item.regionalismCode,jdbcType=VARCHAR},#{item.systemCode,jdbcType=INTEGER},#{item.dstPath,jdbcType=VARCHAR},#{item.lastTime,jdbcType=VARCHAR},#{item.fkid})
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<delete id="remove" parameterType="java.lang.Integer">
|
||||
DELETE FROM
|
||||
move_data_tmp
|
||||
WHERE
|
||||
id = #{id}
|
||||
</delete>
|
||||
<!-- 获取数据符合筛选条件的总记录条数 -->
|
||||
<!--
|
||||
<select id="getLimitedDataCount" resultType="java.lang.Integer"
|
||||
parameterType="PagerOptions">
|
||||
SELECT COUNT(id) FROM move_data_tmp
|
||||
<if test="PagerOptions!=null">
|
||||
<where>
|
||||
<include refid="conditionsFilters" />
|
||||
</where>
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
获取数据查询的起始di
|
||||
<select id="getLimitedBeginId" resultType="java.lang.Integer"
|
||||
parameterType="PagerOptions">
|
||||
SELECT MAX(idx) FROM (SELECT id idx FROM move_data_tmp
|
||||
ORDER BY id LIMIT 0,#{PagerOptions.totalLimit}) AS TEMP
|
||||
</select> -->
|
||||
|
||||
<?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.DataInfoMoveTmpDao">
|
||||
<resultMap id="getEntityByText" type="com.platform.entities.DataInfoEntityMoveTmp">
|
||||
<id property="id" column="id" javaType="int" jdbcType="INTEGER" />
|
||||
<result property="regionalismCode" column="regionalism_code"
|
||||
javaType="string" jdbcType="VARCHAR" />
|
||||
<result property="cityName" column="city_name" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="districtName" column="district_name"
|
||||
javaType="string" jdbcType="VARCHAR" />
|
||||
<result property="systemCode" column="system_code" javaType="int"
|
||||
jdbcType="INTEGER" />
|
||||
<result property="systemName" column="system_name" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="dataType" column="data_type" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="dataVersion" column="data_version" javaType="int"
|
||||
jdbcType="INTEGER" />
|
||||
<result property="submittedBatch" column="submitted_batch"
|
||||
javaType="string" jdbcType="VARCHAR" />
|
||||
<result property="dataPath" column="data_path" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="charset" column="data_charset" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="collectingTime" column="collection_time"
|
||||
javaType="string" jdbcType="DATE" />
|
||||
<result property="collectorContacts" column="collector_contacts"
|
||||
javaType="string" jdbcType="VARCHAR" />
|
||||
<result property="collectorName" column="collector_name"
|
||||
javaType="string" jdbcType="VARCHAR" />
|
||||
<result property="year" column="data_year" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
|
||||
<result property="dstPath" column="dst_path" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="completeStatus" column="complete_status" javaType="string"
|
||||
jdbcType="VARCHAR" />
|
||||
<result property="rate" column="rate" javaType="int"
|
||||
jdbcType="INTEGER" />
|
||||
<result property="lastTime" column="lasttime"
|
||||
javaType="string" jdbcType="VARCHAR" />
|
||||
<result property="fkid" column="fkid" javaType="int" jdbcType="INTEGER" />
|
||||
<result property="dstVolumeIp" column="dst_volume_ip" jdbcType="VARCHAR" />
|
||||
<result property="dstVolumePath" column="dst_volume_ip" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
regionalism_code,system_code,dst_path,lasttime,fkid
|
||||
</sql>
|
||||
|
||||
<!-- 获取数据全部记录信息 -->
|
||||
<select id="findAll" resultType="com.platform.entities.DataInfoEntityMoveTmp">
|
||||
SELECT
|
||||
a.id id,a.regionalism_code regionalismCode,a.dst_path dstPath,a.complete_status completeStatus,
|
||||
a.rate rate, a.lasttime lastTime, a.system_code systemCode,a.dst_volume_ip dstVolumeIp,a.dst_volume_path dstVolumePath,
|
||||
b.city_name cityName,b.district_name districtName,b.system_name systemName,b.data_type dataType,
|
||||
b.data_version dataVersion,b.submitted_batch submittedBatch,b.data_path dataPath,b.data_charset charset,
|
||||
b.collection_time collectingTime,b.collector_name collectorName,b.collector_contacts collectorContacts,
|
||||
b.data_year year,b.extract_status extractStatus,b.start_year startYear,b.end_year endYear,
|
||||
b.volume_ip volumeIp,b.volume_path volumePath
|
||||
FROM
|
||||
move_data_tmp a LEFT JOIN data_details b
|
||||
ON a.system_code = b.system_code AND a.regionalism_code = b.regionalism_code AND a.fkid = b.id
|
||||
ORDER BY a.id
|
||||
</select>
|
||||
|
||||
<update id="update" parameterType="com.platform.entities.DataInfoEntityMoveTmp">
|
||||
UPDATE
|
||||
move_data_tmp
|
||||
<set >
|
||||
<trim suffixOverrides=",">
|
||||
<if test="dstPath != null and dstPath != ''">
|
||||
dst_path= #{dstPath},
|
||||
</if>
|
||||
<if test="completeStatus != null and completeStatus != ''">
|
||||
complete_status= #{completeStatus},
|
||||
</if>
|
||||
<if test="rate > 0">
|
||||
rate= #{rate},
|
||||
</if>
|
||||
<if test="lastTime != null and lastTime != ''">
|
||||
lasttime= #{lastTime},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
<where>
|
||||
id = #{id}
|
||||
</where>
|
||||
</update>
|
||||
|
||||
<insert id="save" parameterType="com.platform.entities.DataInfoEntityMoveTmp">
|
||||
INSERT INTO
|
||||
move_data_tmp(
|
||||
<trim suffixOverrides=",">
|
||||
<if test="id > 0">
|
||||
id,
|
||||
</if>
|
||||
<if test="regionalismCode != null and regionalismCode != ''">
|
||||
regionalism_code,
|
||||
</if>
|
||||
<if test="systemCode != null">
|
||||
system_code,
|
||||
</if>
|
||||
<if test="dstPath != null and dstPath != ''">
|
||||
dst_path,
|
||||
</if>
|
||||
<if test="completeStatus != null and completeStatus != ''">
|
||||
complete_status,
|
||||
</if>
|
||||
<if test="rate > 0">
|
||||
rate,
|
||||
</if>
|
||||
<if test="lastTime != null and lastTime != ''">
|
||||
lasttime,
|
||||
</if>
|
||||
<if test="fkid > 0 ">
|
||||
fkid,
|
||||
</if>
|
||||
</trim>
|
||||
)
|
||||
VALUES(
|
||||
<trim suffixOverrides=",">
|
||||
<if test="id > 0">
|
||||
id,
|
||||
</if>
|
||||
<if test="regionalismCode != null and regionalismCode != ''">
|
||||
#{regionalismCode},
|
||||
</if>
|
||||
<if test="systemCode != null and systemCode != ''">
|
||||
#{systemCode},
|
||||
</if>
|
||||
<if test="dstPath != null and dstPath != ''">
|
||||
#{dstPath},
|
||||
</if>
|
||||
<if test="completeStatus != null and completeStatus != ''">
|
||||
#{completeStatus},
|
||||
</if>
|
||||
<if test="rate > 0">
|
||||
#{rate}
|
||||
</if>
|
||||
<if test="lastTime != null and lastTime != ''">
|
||||
#{lastTime},
|
||||
</if>
|
||||
<if test="fkid > 0 ">
|
||||
#{fkid),
|
||||
</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="insertBatch" parameterType="java.util.List">
|
||||
INSERT INTO move_data_tmp ( <include refid="Base_Column_List" /> )
|
||||
VALUES
|
||||
<foreach collection="list" item="item" index="index" separator=",">
|
||||
(#{item.regionalismCode,jdbcType=VARCHAR},#{item.systemCode,jdbcType=INTEGER},#{item.dstPath,jdbcType=VARCHAR},#{item.lastTime,jdbcType=VARCHAR},#{item.fkid})
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<delete id="remove" parameterType="java.lang.Integer">
|
||||
DELETE FROM
|
||||
move_data_tmp
|
||||
WHERE
|
||||
id = #{id}
|
||||
</delete>
|
||||
<!-- 获取数据符合筛选条件的总记录条数 -->
|
||||
<!--
|
||||
<select id="getLimitedDataCount" resultType="java.lang.Integer"
|
||||
parameterType="PagerOptions">
|
||||
SELECT COUNT(id) FROM move_data_tmp
|
||||
<if test="PagerOptions!=null">
|
||||
<where>
|
||||
<include refid="conditionsFilters" />
|
||||
</where>
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
获取数据查询的起始di
|
||||
<select id="getLimitedBeginId" resultType="java.lang.Integer"
|
||||
parameterType="PagerOptions">
|
||||
SELECT MAX(idx) FROM (SELECT id idx FROM move_data_tmp
|
||||
ORDER BY id LIMIT 0,#{PagerOptions.totalLimit}) AS TEMP
|
||||
</select> -->
|
||||
|
||||
</mapper>
|
@ -1,314 +1,332 @@
|
||||
package com.platform.controller;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.base.BaseController;
|
||||
import com.platform.entities.DataInfoEntity;
|
||||
import com.platform.entities.DataInfoEntityMoveTmp;
|
||||
import com.platform.entities.FolderNode;
|
||||
import com.platform.entities.GatherOracleInfo;
|
||||
import com.platform.entities.PagerOptions;
|
||||
import com.platform.entities.VolumeEntity;
|
||||
import com.platform.service.DataInfoService;
|
||||
import com.platform.service.ICodeService;
|
||||
import com.platform.service.IGfsService;
|
||||
import com.platform.service.IMoveDataService;
|
||||
import com.platform.service.IMySqlService;
|
||||
import com.platform.service.IOracleExtractService;
|
||||
import com.platform.service.OracleStatusService;
|
||||
import com.platform.utils.Bean2MapUtils;
|
||||
import com.platform.utils.Configs;
|
||||
import com.platform.utils.UtilsHelper;
|
||||
|
||||
@Controller
|
||||
public class DataModelController extends BaseController{
|
||||
|
||||
public static Logger log = Logger.getLogger(DataModelController.class);
|
||||
|
||||
@Resource(name = "dataInfoService")
|
||||
private DataInfoService dfs;
|
||||
|
||||
@Resource(name = "gfsService")
|
||||
private IGfsService gfsService;
|
||||
|
||||
@Resource(name = "mySqlService")
|
||||
private IMySqlService mySqlService;
|
||||
|
||||
@Resource(name = "OracleExtract")
|
||||
private IOracleExtractService OracleExtract;
|
||||
|
||||
@Resource(name = "moveDataService")
|
||||
private IMoveDataService moveDataService;
|
||||
|
||||
@Resource(name = "codeService")
|
||||
private ICodeService codeService;
|
||||
|
||||
public void setDfsImp(DataInfoService dfs) {
|
||||
this.dfs = dfs;
|
||||
}
|
||||
|
||||
@RequestMapping("/data.json")
|
||||
@ResponseBody
|
||||
public ModelMap getAllDataToJson(HttpServletRequest res,
|
||||
HttpServletResponse req) throws UnsupportedEncodingException {
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
Map<String, String[]> paramMap = res.getParameterMap();
|
||||
Set<String> keySet = paramMap.keySet();
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
StringBuffer sb = new StringBuffer().append("当前的请求参数:{");
|
||||
for (String str : keySet) {
|
||||
String value = paramMap.get(str)[0];
|
||||
if (StringUtils.isNotEmpty(value)) {
|
||||
params.put(str, value);
|
||||
sb.append(str).append(":").append(value).append(",");
|
||||
} else {
|
||||
sb.append(str).append(":").append("null").append(",");
|
||||
}
|
||||
}
|
||||
Configs.CONSOLE_LOGGER.info(sb.deleteCharAt(sb.length() - 1)
|
||||
.append("}").toString());
|
||||
PagerOptions pagerOptions = (PagerOptions) UtilsHelper
|
||||
.newObjAndSetAttrsByClass(PagerOptions.class, params);
|
||||
|
||||
return dfs.getPagerTableData(pagerOptions);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/delete/data", method= RequestMethod.POST)
|
||||
public void deleteData(HttpServletRequest res, HttpServletResponse req) throws Exception {
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
Map<String, String[]> paramMap = res.getParameterMap();
|
||||
String[] data = paramMap.get("data");
|
||||
dfs.deleteData(data);
|
||||
}
|
||||
|
||||
@RequestMapping("/connectOracle")
|
||||
public void connectOracle(HttpServletRequest res, HttpServletResponse req) throws UnsupportedEncodingException {
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
Map<String, String[]> paramMap = res.getParameterMap();
|
||||
String[] oraclesName = paramMap.get("oracleName");
|
||||
if (oraclesName != null)
|
||||
for (String rcName : oraclesName) {
|
||||
Configs.CONSOLE_LOGGER.info("连接成功\t" + rcName);
|
||||
new OracleStatusService().connectToOracle(rcName);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("/cancelOracleConection")
|
||||
public void cancelOracleConnection(HttpServletRequest res,
|
||||
HttpServletResponse req) throws UnsupportedEncodingException {
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
Map<String, String[]> paramMap = res.getParameterMap();
|
||||
String[] oraclesName = paramMap.get("oracleName");
|
||||
String operate = paramMap.get("operation")[0];
|
||||
if (null != oraclesName) {
|
||||
for (String rcName : oraclesName) {
|
||||
Configs.CONSOLE_LOGGER.info("取消连接:\t" + rcName);
|
||||
new OracleStatusService().cancelToOracle(rcName, operate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value="/oracle/{name}/extract", method= RequestMethod.POST)
|
||||
public void oracleExtract(HttpServletRequest res,
|
||||
HttpServletResponse req,@PathVariable String name) throws Exception {
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
System.out.println("------extract-------");
|
||||
System.out.println(name);
|
||||
Map<String, String[]> paramMap = res.getParameterMap();
|
||||
//汇总库 对象信息--带有tableName-
|
||||
String[] nodes = paramMap.get("target");
|
||||
Map map = null;
|
||||
for (String string : nodes) {
|
||||
JSONObject jsonobject = JSONObject.fromObject(string);
|
||||
map = jsonobject;
|
||||
System.out.println(map);
|
||||
}
|
||||
|
||||
// 采集库对象--(多个采集库抽取到1个汇总库的1个tableName下)
|
||||
String[] inneed = paramMap.get("inneed");
|
||||
List<Map<String, String>> colleclist = new ArrayList<Map<String,String>>();
|
||||
for (String string : nodes) {
|
||||
JSONObject jsonobject = JSONObject.fromObject(string);
|
||||
Map inneedMap = jsonobject;
|
||||
colleclist.add(inneedMap);
|
||||
}
|
||||
OracleExtract.extractOracle(name, colleclist, map);
|
||||
|
||||
}
|
||||
// public void oracleExtract(HttpServletRequest res,
|
||||
// HttpServletResponse req, String name, @RequestBody GatherOracleInfo gather, @RequestBody List<OracleConnectorParams> collectOracles)
|
||||
// throws Exception {
|
||||
//// res.setCharacterEncoding("UTF-8");
|
||||
// log.debug("------extract-------");
|
||||
//// Map<String, String[]> paramMap = res.getParameterMap();
|
||||
//// log.debug(paramMap);
|
||||
//// //汇总库 对象信息--带有tableName-
|
||||
//// String[] nodes = paramMap.get("target");
|
||||
//// Map map = null;
|
||||
//// for (String string : nodes) {
|
||||
//// JSONObject jsonobject = JSONObject.fromObject(string);
|
||||
//// map = jsonobject;
|
||||
//// System.out.println(map);
|
||||
//// }
|
||||
////
|
||||
//// // 采集库对象--(多个采集库抽取到1个汇总库的1个tableName下)
|
||||
//// String[] inneed = paramMap.get("inneed");
|
||||
//// List<Map<String, String>> colleclist = new ArrayList<Map<String,String>>();
|
||||
//// for (String string : nodes) {
|
||||
//// JSONObject jsonobject = JSONObject.fromObject(string);
|
||||
//// Map inneedMap = jsonobject;
|
||||
//// colleclist.add(inneedMap);
|
||||
//// }
|
||||
// OracleExtract.extractOracle(name, collectOracles, gather);
|
||||
// }
|
||||
|
||||
@RequestMapping(value="/volume/list", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public List<VolumeEntity> volumeList() throws Exception {
|
||||
log.debug("-----/volume/list------");
|
||||
List<VolumeEntity> result = gfsService.getAllVolumes();
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/volume/{name}/move", method= RequestMethod.POST)
|
||||
public void volumeMove(HttpServletRequest res, HttpServletResponse req,@PathVariable String name,
|
||||
FolderNode selectNode, DataInfoEntity selectItems) throws Exception {
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
System.out.println("get Request");
|
||||
Map<String, String[]> paramMap = res.getParameterMap();
|
||||
// System.out.println(paramMap);
|
||||
String[] nodes = paramMap.get("selectNode");
|
||||
Map map = null;
|
||||
for (String string : nodes) {
|
||||
System.out.println(string);
|
||||
JSONObject jsonobject = JSONObject.fromObject(string);
|
||||
map = jsonobject;
|
||||
}
|
||||
String dstVolume = (String) map.get("volume");
|
||||
|
||||
List<String> listItemPath = new ArrayList<String>();
|
||||
String[] items = paramMap.get("selectItems");
|
||||
System.out.println("selectItems");
|
||||
List<DataInfoEntity> datas = new ArrayList<DataInfoEntity>();
|
||||
List<String> srcVolumes = new ArrayList<String>();
|
||||
for (String string : items) {
|
||||
System.out.println(string);
|
||||
JSONObject jsobj = JSONObject.fromObject(string);
|
||||
Map itemmap = jsobj;
|
||||
DataInfoEntity data = (DataInfoEntity) Bean2MapUtils.convertMap(DataInfoEntity.class, itemmap);
|
||||
datas.add(data);
|
||||
}
|
||||
System.out.println("------/volume/{name}/move--------");
|
||||
if (datas.size() >0) {
|
||||
moveDataService.moveData(datas, (String)map.get("path"));
|
||||
}
|
||||
}
|
||||
// public Object volumeMove(HttpServletRequest res, HttpServletResponse req, String name,
|
||||
// @RequestBody FolderNode selectNode, @RequestBody List<DataInfoEntity> selectItems) throws Exception {
|
||||
// log.debug("-----/volume/{name}/move------");
|
||||
//// Map<String, String[]> paramMap = res.getParameterMap();
|
||||
//// System.out.println(paramMap);
|
||||
// Map<String, String[]> paramMap = res.getParameterMap();
|
||||
// log.debug(paramMap);
|
||||
// //汇总库 对象信息--带有tableName-
|
||||
// String[] nodes = (String[]) paramMap.get("selectNode");
|
||||
// Map map = null;
|
||||
// JSONObject jsonobject = JSONObject.fromObject(string);
|
||||
// map = jsonobject;
|
||||
//
|
||||
//
|
||||
// log.debug(selectItems);
|
||||
// log.debug(selectNode);
|
||||
// boolean result = false ;
|
||||
// if (selectItems.size() >0) {
|
||||
// result = moveDataService.moveData(selectItems, selectNode.getPath());
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
|
||||
@RequestMapping(value="/oracle/list", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public List<GatherOracleInfo> oracleList() throws Exception {
|
||||
log.debug("----------getOracleInfo-----------------------");
|
||||
List<GatherOracleInfo> result = mySqlService.findAllMySql();
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/oracle/{id}/delete", method= RequestMethod.POST)
|
||||
public void oracleDelete(@PathVariable String id) throws Exception {
|
||||
log.debug("----------deleteOracleInfo----------------");
|
||||
Integer num = Integer.valueOf(id);
|
||||
mySqlService.deleteMySql(num);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/oracle/{id}/insert", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public void oracleInsert(@PathVariable String id, @RequestBody GatherOracleInfo oracle) throws Exception {
|
||||
log.debug("----------insertOracleInfo----------------");
|
||||
oracle.setId(Integer.valueOf(id));
|
||||
mySqlService.insertOracle(oracle);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/oracle/{id}/update", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public void oracleUpdate(@PathVariable("id") String id, @RequestBody GatherOracleInfo oracle) throws Exception {
|
||||
log.debug("----------updateOracleInfo-----------------------");
|
||||
log.debug(oracle);
|
||||
mySqlService.updateOracle(oracle);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/task/transfer/list", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object taskTransferList() throws Exception {
|
||||
log.debug("----------/task/transfer/list-----------------------");
|
||||
List<DataInfoEntityMoveTmp> result = moveDataService.findAll();
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/task/transfer/{id}/delete", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object taskTransferDelete(@PathVariable String id) throws Exception {
|
||||
log.debug("----------/task/transfer/{id}/delete-----------------------");
|
||||
DataInfoEntityMoveTmp move = new DataInfoEntityMoveTmp();
|
||||
move.setId(Integer.valueOf(id));
|
||||
int result = moveDataService.delete(move );
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/task/transfer/save", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object taskTransferSave(@RequestBody DataInfoEntity move) throws Exception {
|
||||
log.debug("---------/task/transfer/save-----------------------");
|
||||
int result = dfs.save(move);
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/code/list", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object findCodeList() throws Exception {
|
||||
log.debug("---------/findSystemCode-----------------------");
|
||||
Map<String, Object> result = codeService.findAll();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
package com.platform.controller;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.base.BaseController;
|
||||
import com.platform.entities.DataInfoEntity;
|
||||
import com.platform.entities.DataInfoEntityMoveTmp;
|
||||
import com.platform.entities.FolderNode;
|
||||
import com.platform.entities.GatherOracleInfo;
|
||||
import com.platform.entities.PagerOptions;
|
||||
import com.platform.entities.VolumeEntity;
|
||||
import com.platform.entities.volumeMoveForm;
|
||||
import com.platform.service.DataInfoService;
|
||||
import com.platform.service.ICodeService;
|
||||
import com.platform.service.IGfsService;
|
||||
import com.platform.service.IMoveDataService;
|
||||
import com.platform.service.IMySqlService;
|
||||
import com.platform.service.IOracleExtractService;
|
||||
import com.platform.service.OracleStatusService;
|
||||
import com.platform.utils.Bean2MapUtils;
|
||||
import com.platform.utils.Configs;
|
||||
import com.platform.utils.UtilsHelper;
|
||||
|
||||
@Controller
|
||||
public class DataModelController extends BaseController{
|
||||
|
||||
public static Logger log = Logger.getLogger(DataModelController.class);
|
||||
|
||||
@Resource(name = "dataInfoService")
|
||||
private DataInfoService dfs;
|
||||
|
||||
@Resource(name = "gfsService")
|
||||
private IGfsService gfsService;
|
||||
|
||||
@Resource(name = "mySqlService")
|
||||
private IMySqlService mySqlService;
|
||||
|
||||
@Resource(name = "OracleExtract")
|
||||
private IOracleExtractService OracleExtract;
|
||||
|
||||
@Resource(name = "moveDataService")
|
||||
private IMoveDataService moveDataService;
|
||||
|
||||
@Resource(name = "codeService")
|
||||
private ICodeService codeService;
|
||||
|
||||
public void setDfsImp(DataInfoService dfs) {
|
||||
this.dfs = dfs;
|
||||
}
|
||||
|
||||
@RequestMapping("/data.json")
|
||||
@ResponseBody
|
||||
public ModelMap getAllDataToJson(HttpServletRequest res,
|
||||
HttpServletResponse req) throws UnsupportedEncodingException {
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
Map<String, String[]> paramMap = res.getParameterMap();
|
||||
Set<String> keySet = paramMap.keySet();
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
StringBuffer sb = new StringBuffer().append("当前的请求参数:{");
|
||||
for (String str : keySet) {
|
||||
String value = paramMap.get(str)[0];
|
||||
if (StringUtils.isNotEmpty(value)) {
|
||||
params.put(str, value);
|
||||
sb.append(str).append(":").append(value).append(",");
|
||||
} else {
|
||||
sb.append(str).append(":").append("null").append(",");
|
||||
}
|
||||
}
|
||||
Configs.CONSOLE_LOGGER.info(sb.deleteCharAt(sb.length() - 1)
|
||||
.append("}").toString());
|
||||
PagerOptions pagerOptions = (PagerOptions) UtilsHelper
|
||||
.newObjAndSetAttrsByClass(PagerOptions.class, params);
|
||||
|
||||
return dfs.getPagerTableData(pagerOptions);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/delete/data", method= RequestMethod.POST)
|
||||
public void deleteData(HttpServletRequest res, HttpServletResponse req) throws Exception {
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
Map<String, String[]> paramMap = res.getParameterMap();
|
||||
String[] data = paramMap.get("data");
|
||||
dfs.deleteData(data);
|
||||
req.setStatus(200);
|
||||
}
|
||||
|
||||
@RequestMapping("/connectOracle")
|
||||
public void connectOracle(HttpServletRequest res, HttpServletResponse req) throws UnsupportedEncodingException {
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
Map<String, String[]> paramMap = res.getParameterMap();
|
||||
String[] oraclesName = paramMap.get("oracleName");
|
||||
if (oraclesName != null)
|
||||
for (String rcName : oraclesName) {
|
||||
Configs.CONSOLE_LOGGER.info("连接成功\t" + rcName);
|
||||
new OracleStatusService().connectToOracle(rcName);
|
||||
}
|
||||
req.setStatus(200);
|
||||
}
|
||||
|
||||
@RequestMapping("/cancelOracleConection")
|
||||
public void cancelOracleConnection(HttpServletRequest res,
|
||||
HttpServletResponse req) throws UnsupportedEncodingException {
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
Map<String, String[]> paramMap = res.getParameterMap();
|
||||
String[] oraclesName = paramMap.get("oracleName");
|
||||
String operate = paramMap.get("operation")[0];
|
||||
if (null != oraclesName) {
|
||||
for (String rcName : oraclesName) {
|
||||
Configs.CONSOLE_LOGGER.info("取消连接:\t" + rcName);
|
||||
new OracleStatusService().cancelToOracle(rcName, operate);
|
||||
}
|
||||
}
|
||||
req.setStatus(200);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/oracle/{name}/extract", method= RequestMethod.POST)
|
||||
public void oracleExtract(HttpServletRequest res,
|
||||
HttpServletResponse req,@PathVariable String name) throws Exception {
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
System.out.println("------extract-------");
|
||||
System.out.println(name);
|
||||
Map<String, String[]> paramMap = res.getParameterMap();
|
||||
//汇总库 对象信息--带有tableName-
|
||||
String[] nodes = paramMap.get("target");
|
||||
Map map = null;
|
||||
for (String string : nodes) {
|
||||
JSONObject jsonobject = JSONObject.fromObject(string);
|
||||
map = jsonobject;
|
||||
System.out.println(map);
|
||||
}
|
||||
|
||||
// 采集库对象--(多个采集库抽取到1个汇总库的1个tableName下)
|
||||
String[] inneed = paramMap.get("inneed");
|
||||
List<Map<String, String>> colleclist = new ArrayList<Map<String,String>>();
|
||||
for (String string : nodes) {
|
||||
JSONObject jsonobject = JSONObject.fromObject(string);
|
||||
Map inneedMap = jsonobject;
|
||||
colleclist.add(inneedMap);
|
||||
}
|
||||
OracleExtract.extractOracle(name, colleclist, map);
|
||||
req.setStatus(200);
|
||||
}
|
||||
// public void oracleExtract(HttpServletRequest res,
|
||||
// HttpServletResponse req, String name, @RequestBody GatherOracleInfo gather, @RequestBody List<OracleConnectorParams> collectOracles)
|
||||
// throws Exception {
|
||||
//// res.setCharacterEncoding("UTF-8");
|
||||
// log.debug("------extract-------");
|
||||
//// Map<String, String[]> paramMap = res.getParameterMap();
|
||||
//// log.debug(paramMap);
|
||||
//// //汇总库 对象信息--带有tableName-
|
||||
//// String[] nodes = paramMap.get("target");
|
||||
//// Map map = null;
|
||||
//// for (String string : nodes) {
|
||||
//// JSONObject jsonobject = JSONObject.fromObject(string);
|
||||
//// map = jsonobject;
|
||||
//// System.out.println(map);
|
||||
//// }
|
||||
////
|
||||
//// // 采集库对象--(多个采集库抽取到1个汇总库的1个tableName下)
|
||||
//// String[] inneed = paramMap.get("inneed");
|
||||
//// List<Map<String, String>> colleclist = new ArrayList<Map<String,String>>();
|
||||
//// for (String string : nodes) {
|
||||
//// JSONObject jsonobject = JSONObject.fromObject(string);
|
||||
//// Map inneedMap = jsonobject;
|
||||
//// colleclist.add(inneedMap);
|
||||
//// }
|
||||
// OracleExtract.extractOracle(name, collectOracles, gather);
|
||||
// }
|
||||
|
||||
@RequestMapping(value="/volume/list", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public List<VolumeEntity> volumeList() throws Exception {
|
||||
log.debug("-----/volume/list------");
|
||||
List<VolumeEntity> result = gfsService.getAllVolumes();
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/volume/{name}/move", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public void volumeMove(HttpServletRequest res, HttpServletResponse req,@RequestBody volumeMoveForm form) throws Exception {
|
||||
// res.setCharacterEncoding("UTF-8");
|
||||
// System.out.println("get Request");
|
||||
// Map<String, String[]> paramMap = res.getParameterMap();
|
||||
//// System.out.println(paramMap);
|
||||
// String[] nodes = paramMap.get("selectNode");
|
||||
// Map map = null;
|
||||
// for (String string : nodes) {
|
||||
// System.out.println(string);
|
||||
// JSONObject jsonobject = JSONObject.fromObject(string);
|
||||
// map = jsonobject;
|
||||
// }
|
||||
// String dstVolume = (String) map.get("volume");
|
||||
|
||||
// List<String> listItemPath = new ArrayList<String>();
|
||||
// String[] items = paramMap.get("selectItems");
|
||||
// System.out.println("selectItems");
|
||||
List<DataInfoEntity> datas = new ArrayList<DataInfoEntity>();
|
||||
// List<String> srcVolumes = new ArrayList<String>();
|
||||
// for (String string : items) {
|
||||
// System.out.println(string);
|
||||
// JSONObject jsobj = JSONObject.fromObject(string);
|
||||
// Map itemmap = jsobj;
|
||||
// DataInfoEntity data = (DataInfoEntity) Bean2MapUtils.convertMap(DataInfoEntity.class, itemmap);
|
||||
// datas.add(data);
|
||||
// }
|
||||
List<DataInfoEntity> selectItems = form.getSelectItems();
|
||||
if (null == selectItems) {
|
||||
req.setStatus(200);
|
||||
return;
|
||||
}
|
||||
datas.addAll(selectItems);
|
||||
|
||||
System.out.println("------/volume/{name}/move--------");
|
||||
if (datas.size() >0) {
|
||||
moveDataService.moveData(datas, form.getSelectNode());
|
||||
}
|
||||
req.setStatus(200);
|
||||
}
|
||||
// public Object volumeMove(HttpServletRequest res, HttpServletResponse req, String name,
|
||||
// @RequestBody FolderNode selectNode, @RequestBody List<DataInfoEntity> selectItems) throws Exception {
|
||||
// log.debug("-----/volume/{name}/move------");
|
||||
//// Map<String, String[]> paramMap = res.getParameterMap();
|
||||
//// System.out.println(paramMap);
|
||||
// Map<String, String[]> paramMap = res.getParameterMap();
|
||||
// log.debug(paramMap);
|
||||
// //汇总库 对象信息--带有tableName-
|
||||
// String[] nodes = (String[]) paramMap.get("selectNode");
|
||||
// Map map = null;
|
||||
// JSONObject jsonobject = JSONObject.fromObject(string);
|
||||
// map = jsonobject;
|
||||
//
|
||||
//
|
||||
// log.debug(selectItems);
|
||||
// log.debug(selectNode);
|
||||
// boolean result = false ;
|
||||
// if (selectItems.size() >0) {
|
||||
// result = moveDataService.moveData(selectItems, selectNode.getPath());
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
|
||||
@RequestMapping(value="/oracle/list", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public List<GatherOracleInfo> oracleList() throws Exception {
|
||||
log.debug("----------getOracleInfo-----------------------");
|
||||
List<GatherOracleInfo> result = mySqlService.findAllMySql();
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/oracle/{id}/delete", method= RequestMethod.POST)
|
||||
public void oracleDelete(HttpServletRequest req, HttpServletResponse res, @PathVariable String id) throws Exception {
|
||||
log.debug("----------deleteOracleInfo----------------");
|
||||
Integer num = Integer.valueOf(id);
|
||||
Integer result = mySqlService.deleteMySql(num);
|
||||
log.info("oracleDelete : " + result);
|
||||
res.setStatus(200);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/oracle/{id}/insert", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public void oracleInsert(HttpServletRequest res, HttpServletResponse req, @PathVariable String id, @RequestBody GatherOracleInfo oracle) throws Exception {
|
||||
log.debug("----------insertOracleInfo----------------");
|
||||
oracle.setId(Integer.valueOf(id));
|
||||
mySqlService.insertOracle(oracle);
|
||||
req.setStatus(200);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/oracle/{id}/update", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public void oracleUpdate(HttpServletRequest res, HttpServletResponse req, @PathVariable("id") String id, @RequestBody GatherOracleInfo oracle) throws Exception {
|
||||
log.debug("----------updateOracleInfo-----------------------");
|
||||
log.debug(oracle);
|
||||
mySqlService.updateOracle(oracle);
|
||||
req.setStatus(200);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/task/transfer/list", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object taskTransferList() throws Exception {
|
||||
log.debug("----------/task/transfer/list-----------------------");
|
||||
List<DataInfoEntityMoveTmp> result = moveDataService.findAll();
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/task/transfer/{id}/delete", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object taskTransferDelete(HttpServletRequest res, HttpServletResponse req, @PathVariable String id) throws Exception {
|
||||
log.debug("----------/task/transfer/{id}/delete-----------------------");
|
||||
DataInfoEntityMoveTmp move = new DataInfoEntityMoveTmp();
|
||||
move.setId(Integer.valueOf(id));
|
||||
int result = moveDataService.delete(move );
|
||||
req.setStatus(200);
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/task/transfer/save", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object taskTransferSave(HttpServletRequest res, HttpServletResponse req, @RequestBody DataInfoEntity move) throws Exception {
|
||||
log.debug("---------/task/transfer/save-----------------------");
|
||||
int result = dfs.save(move);
|
||||
req.setStatus(200);
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/code/list", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object findCodeList() throws Exception {
|
||||
log.debug("---------/findSystemCode-----------------------");
|
||||
Map<String, Object> result = codeService.findAll();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -1,32 +1,32 @@
|
||||
|
||||
package com.platform.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.platform.utils.Configs;
|
||||
|
||||
@Controller
|
||||
public class DefaultController {
|
||||
|
||||
@RequestMapping("/")
|
||||
public ModelAndView defaultHandler(HttpServletRequest req, HttpServletResponse res){
|
||||
//处理不匹配的请求
|
||||
System.out.println("index");
|
||||
return new ModelAndView("index");
|
||||
}
|
||||
|
||||
@RequestMapping("/test")
|
||||
public ModelMap test(HttpServletRequest req, HttpServletResponse res){
|
||||
//System.out.println(Class.class.getClass().getResource("/").getPath());
|
||||
System.out.println(Configs.EXTRACT_LOG_LOCALTION);
|
||||
return new ModelMap();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
package com.platform.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.platform.utils.Configs;
|
||||
|
||||
@Controller
|
||||
public class DefaultController {
|
||||
|
||||
@RequestMapping("/")
|
||||
public ModelAndView defaultHandler(HttpServletRequest req, HttpServletResponse res){
|
||||
//处理不匹配的请求
|
||||
System.out.println("index");
|
||||
return new ModelAndView("index");
|
||||
}
|
||||
|
||||
@RequestMapping("/test")
|
||||
public ModelMap test(HttpServletRequest req, HttpServletResponse res){
|
||||
//System.out.println(Class.class.getClass().getResource("/").getPath());
|
||||
System.out.println(Configs.EXTRACT_LOG_LOCALTION);
|
||||
return new ModelMap();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,28 +1,28 @@
|
||||
package com.platform.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.base.BaseController;
|
||||
|
||||
@Controller
|
||||
public class TaskModelController extends BaseController{
|
||||
|
||||
@RequestMapping("/task/transfer/list")
|
||||
@ResponseBody
|
||||
public List<Integer> getTransferTask(HttpServletRequest res, HttpServletResponse req) {
|
||||
List<Integer> list = new ArrayList<Integer>();
|
||||
list.add(1);
|
||||
list.add(2);
|
||||
list.add(3);
|
||||
list.add(4);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
package com.platform.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.base.BaseController;
|
||||
|
||||
@Controller
|
||||
public class TaskModelController extends BaseController{
|
||||
|
||||
@RequestMapping("/task/transfer/list")
|
||||
@ResponseBody
|
||||
public List<Integer> getTransferTask(HttpServletRequest res, HttpServletResponse req) {
|
||||
List<Integer> list = new ArrayList<Integer>();
|
||||
list.add(1);
|
||||
list.add(2);
|
||||
list.add(3);
|
||||
list.add(4);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
@ -1,27 +1,27 @@
|
||||
package com.platform.dao;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.platform.entities.DataInfoEntity;
|
||||
import com.platform.entities.PagerOptions;
|
||||
|
||||
@Repository(value = "dataInfoDao")
|
||||
public interface DataInfoDao {
|
||||
|
||||
int getLimitedDataCount(PagerOptions pagerOptions);
|
||||
|
||||
int getLimitedBeginId(PagerOptions pagerOptions);
|
||||
|
||||
List<DataInfoEntity> getLimitedDataInfoEntities(PagerOptions pagerOptions);
|
||||
|
||||
List<String> getIdIsExist(List<Integer> list)throws Exception;
|
||||
|
||||
int removes(List<Integer> list)throws Exception;
|
||||
|
||||
int save(DataInfoEntity data) throws Exception;
|
||||
|
||||
}
|
||||
package com.platform.dao;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.platform.entities.DataInfoEntity;
|
||||
import com.platform.entities.PagerOptions;
|
||||
|
||||
@Repository(value = "dataInfoDao")
|
||||
public interface DataInfoDao {
|
||||
|
||||
int getLimitedDataCount(PagerOptions pagerOptions);
|
||||
|
||||
int getLimitedBeginId(PagerOptions pagerOptions);
|
||||
|
||||
List<DataInfoEntity> getLimitedDataInfoEntities(PagerOptions pagerOptions);
|
||||
|
||||
List<String> getIdIsExist(List<Integer> list)throws Exception;
|
||||
|
||||
int removes(List<Integer> list)throws Exception;
|
||||
|
||||
int save(DataInfoEntity data) throws Exception;
|
||||
|
||||
}
|
||||
|
@ -1,39 +1,39 @@
|
||||
package com.platform.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.platform.entities.GatherOracleInfo;
|
||||
|
||||
@Repository(value = "gatherOracleDao")
|
||||
public interface GatherOracleDao {
|
||||
|
||||
/**
|
||||
* @return 查询所有的oracle记录
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
public List<GatherOracleInfo> selectAllOracle() throws Exception;
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int deleteOracleById(int id) throws Exception;
|
||||
|
||||
/**
|
||||
* @param oracle
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int insertOracle(GatherOracleInfo oracle) throws Exception;
|
||||
|
||||
/**
|
||||
* @param oracle
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int updateOracleById(GatherOracleInfo oracle) throws Exception;
|
||||
|
||||
}
|
||||
package com.platform.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.platform.entities.GatherOracleInfo;
|
||||
|
||||
@Repository(value = "gatherOracleDao")
|
||||
public interface GatherOracleDao {
|
||||
|
||||
/**
|
||||
* @return 查询所有的oracle记录
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
public List<GatherOracleInfo> selectAllOracle() throws Exception;
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int deleteOracleById(int id) throws Exception;
|
||||
|
||||
/**
|
||||
* @param oracle
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int insertOracle(GatherOracleInfo oracle) throws Exception;
|
||||
|
||||
/**
|
||||
* @param oracle
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int updateOracleById(GatherOracleInfo oracle) throws Exception;
|
||||
|
||||
}
|
||||
|
@ -1,48 +1,48 @@
|
||||
package com.platform.entities;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public enum BasedType {
|
||||
|
||||
STRING("java.lang.String", String.class), INTEGER("java.lang.Integer",
|
||||
Integer.class), SHORT("java.lang.Short", Short.class), LONG(
|
||||
"java.lang.Long", Long.class), DATE("java.util.Date", Date.class);
|
||||
|
||||
private String type;
|
||||
private Class<?> clazz;
|
||||
|
||||
private BasedType(String type, Class<?> clazz) {
|
||||
this.type = type;
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
public static Class<?> getTypeClass(String type) {
|
||||
for (BasedType bt : BasedType.values()) {
|
||||
if (bt.equals(type))
|
||||
return bt.clazz;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Class<?> getClazz() {
|
||||
return clazz;
|
||||
}
|
||||
|
||||
public void setClazz(Class<?> clazz) {
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
}
|
||||
package com.platform.entities;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public enum BasedType {
|
||||
|
||||
STRING("java.lang.String", String.class), INTEGER("java.lang.Integer",
|
||||
Integer.class), SHORT("java.lang.Short", Short.class), LONG(
|
||||
"java.lang.Long", Long.class), DATE("java.util.Date", Date.class);
|
||||
|
||||
private String type;
|
||||
private Class<?> clazz;
|
||||
|
||||
private BasedType(String type, Class<?> clazz) {
|
||||
this.type = type;
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
public static Class<?> getTypeClass(String type) {
|
||||
for (BasedType bt : BasedType.values()) {
|
||||
if (bt.equals(type))
|
||||
return bt.clazz;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Class<?> getClazz() {
|
||||
return clazz;
|
||||
}
|
||||
|
||||
public void setClazz(Class<?> clazz) {
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,269 +1,269 @@
|
||||
package com.platform.entities;
|
||||
|
||||
/**
|
||||
* 数据信息实体类
|
||||
*
|
||||
* @author wuming
|
||||
*
|
||||
*/
|
||||
public class DataInfoEntity {
|
||||
private int id;
|
||||
private String regionalismCode; // 行政区划编码
|
||||
private String cityName; // 市
|
||||
private String districtName; // 区县
|
||||
private int systemCode; // 系统编码
|
||||
private String systemName; // 系统名称
|
||||
private String dataType; // 数据类型:财政\社保\...
|
||||
private int dataVersion; // 数据版本
|
||||
private String submittedBatch; // 上报批次
|
||||
private String dataPath; // 数据路径
|
||||
private String collectingTime; // 采集时间
|
||||
private String collectorContacts; // 采集人的联系
|
||||
private String charset; // 数据的字符编码
|
||||
private String collectorName; // 采集人姓名
|
||||
private String year; // 数据年度
|
||||
|
||||
/** 是否抽取 */
|
||||
private int extractStatus;
|
||||
/** 数据年度起始 */
|
||||
private String startYear;
|
||||
/** 数据年度结束 */
|
||||
private String endYear;
|
||||
|
||||
/** volume的ip */
|
||||
private String volumeIp;
|
||||
/** volume的path */
|
||||
private String volumePath;
|
||||
|
||||
public DataInfoEntity() {
|
||||
}
|
||||
|
||||
public DataInfoEntity(int id, String regionalismCode, String cityName,
|
||||
String districtName, int systemCode, String systemName,
|
||||
String dataType, int dataVersion, String submittedBatch,
|
||||
String dataPath, String collectingTime, String collectorContacts,
|
||||
String charset, String collectorName, String year) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.regionalismCode = regionalismCode;
|
||||
this.cityName = cityName;
|
||||
this.districtName = districtName;
|
||||
this.systemCode = systemCode;
|
||||
this.systemName = systemName;
|
||||
this.dataType = dataType;
|
||||
this.dataVersion = dataVersion;
|
||||
this.submittedBatch = submittedBatch;
|
||||
this.dataPath = dataPath;
|
||||
this.collectingTime = collectingTime;
|
||||
this.collectorContacts = collectorContacts;
|
||||
this.charset = charset;
|
||||
this.collectorName = collectorName;
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getRegionalismCode() {
|
||||
return regionalismCode;
|
||||
}
|
||||
|
||||
public void setRegionalismCode(String regionalismCode) {
|
||||
this.regionalismCode = regionalismCode;
|
||||
}
|
||||
|
||||
public String getCityName() {
|
||||
return cityName;
|
||||
}
|
||||
|
||||
public void setCityName(String cityName) {
|
||||
this.cityName = cityName;
|
||||
}
|
||||
|
||||
public String getDistrictName() {
|
||||
return districtName;
|
||||
}
|
||||
|
||||
public void setDistrictName(String districtName) {
|
||||
this.districtName = districtName;
|
||||
}
|
||||
|
||||
public int getSystemCode() {
|
||||
return systemCode;
|
||||
}
|
||||
|
||||
public void setSystemCode(int systemCode) {
|
||||
this.systemCode = systemCode;
|
||||
}
|
||||
|
||||
public String getSystemName() {
|
||||
return systemName;
|
||||
}
|
||||
|
||||
public void setSystemName(String systemName) {
|
||||
this.systemName = systemName;
|
||||
}
|
||||
|
||||
public String getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public void setDataType(String dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public int getDataVersion() {
|
||||
return dataVersion;
|
||||
}
|
||||
|
||||
public void setDataVersion(int dataVersion) {
|
||||
this.dataVersion = dataVersion;
|
||||
}
|
||||
|
||||
public String getSubmittedBatch() {
|
||||
return submittedBatch;
|
||||
}
|
||||
|
||||
public void setSubmittedBatch(String submittedBatch) {
|
||||
this.submittedBatch = submittedBatch;
|
||||
}
|
||||
|
||||
public String getDataPath() {
|
||||
return dataPath;
|
||||
}
|
||||
|
||||
public void setDataPath(String dataPath) {
|
||||
this.dataPath = dataPath;
|
||||
}
|
||||
|
||||
public String getCollectingTime() {
|
||||
return collectingTime;
|
||||
}
|
||||
|
||||
public void setCollectingTime(String collectingTime) {
|
||||
this.collectingTime = collectingTime;
|
||||
}
|
||||
|
||||
public String getCollectorContacts() {
|
||||
return collectorContacts;
|
||||
}
|
||||
|
||||
public void setCollectorContacts(String collectorContacts) {
|
||||
this.collectorContacts = collectorContacts;
|
||||
}
|
||||
|
||||
public String getCharset() {
|
||||
return charset;
|
||||
}
|
||||
|
||||
public void setCharset(String charset) {
|
||||
this.charset = charset;
|
||||
}
|
||||
|
||||
public String getCollectorName() {
|
||||
return collectorName;
|
||||
}
|
||||
|
||||
public void setCollectorName(String collectorName) {
|
||||
this.collectorName = collectorName;
|
||||
}
|
||||
|
||||
public String getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
public void setYear(String year) {
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the startYear
|
||||
*/
|
||||
public String getStartYear() {
|
||||
return startYear;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param startYear the startYear to set
|
||||
*/
|
||||
public void setStartYear(String startYear) {
|
||||
this.startYear = startYear;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the endYear
|
||||
*/
|
||||
public String getEndYear() {
|
||||
return endYear;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param endYear the endYear to set
|
||||
*/
|
||||
public void setEndYear(String endYear) {
|
||||
this.endYear = endYear;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the extractStatus
|
||||
*/
|
||||
public int getExtractStatus() {
|
||||
return extractStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param extractStatus the extractStatus to set
|
||||
*/
|
||||
public void setExtractStatus(int extractStatus) {
|
||||
this.extractStatus = extractStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the volumeIp
|
||||
*/
|
||||
public String getVolumeIp() {
|
||||
return volumeIp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param volumeIp the volumeIp to set
|
||||
*/
|
||||
public void setVolumeIp(String volumeIp) {
|
||||
this.volumeIp = volumeIp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the volumePath
|
||||
*/
|
||||
public String getVolumePath() {
|
||||
return volumePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param volumePath the volumePath to set
|
||||
*/
|
||||
public void setVolumePath(String volumePath) {
|
||||
this.volumePath = volumePath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "id=" + this.id + " ,regionalismCode=" + this.regionalismCode
|
||||
+ " ,cityName=" + this.cityName + " ,districtName="
|
||||
+ this.districtName + " ,systemCode=" + this.systemCode
|
||||
+ " ,systemName" + this.systemName + " ,dataType="
|
||||
+ this.dataType + " ,dataVersion=" + this.dataVersion
|
||||
+ " ,submittedBatch=" + this.submittedBatch + " ,dataPath="
|
||||
+ this.dataPath + " ,collectingTime=" + this.collectingTime
|
||||
+ " ,collectorContacts=" + this.collectorContacts
|
||||
+ " ,charset=" + this.charset + " ,collectorName="
|
||||
+ this.collectorName + " ,year=" + this.year + " startYear="
|
||||
+this.startYear +" endYear="+this.endYear;
|
||||
}
|
||||
|
||||
}
|
||||
package com.platform.entities;
|
||||
|
||||
/**
|
||||
* 数据信息实体类
|
||||
*
|
||||
* @author wuming
|
||||
*
|
||||
*/
|
||||
public class DataInfoEntity {
|
||||
private int id;
|
||||
private String regionalismCode; // 行政区划编码
|
||||
private String cityName; // 市
|
||||
private String districtName; // 区县
|
||||
private int systemCode; // 系统编码
|
||||
private String systemName; // 系统名称
|
||||
private String dataType; // 数据类型:财政\社保\...
|
||||
private int dataVersion; // 数据版本
|
||||
private String submittedBatch; // 上报批次
|
||||
private String dataPath; // 数据路径
|
||||
private String collectingTime; // 采集时间
|
||||
private String collectorContacts; // 采集人的联系
|
||||
private String charset; // 数据的字符编码
|
||||
private String collectorName; // 采集人姓名
|
||||
private String year; // 数据年度
|
||||
|
||||
/** 是否抽取 */
|
||||
private int extractStatus;
|
||||
/** 数据年度起始 */
|
||||
private String startYear;
|
||||
/** 数据年度结束 */
|
||||
private String endYear;
|
||||
|
||||
/** volume的ip */
|
||||
private String volumeIp;
|
||||
/** volume的path */
|
||||
private String volumePath;
|
||||
|
||||
public DataInfoEntity() {
|
||||
}
|
||||
|
||||
public DataInfoEntity(int id, String regionalismCode, String cityName,
|
||||
String districtName, int systemCode, String systemName,
|
||||
String dataType, int dataVersion, String submittedBatch,
|
||||
String dataPath, String collectingTime, String collectorContacts,
|
||||
String charset, String collectorName, String year) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.regionalismCode = regionalismCode;
|
||||
this.cityName = cityName;
|
||||
this.districtName = districtName;
|
||||
this.systemCode = systemCode;
|
||||
this.systemName = systemName;
|
||||
this.dataType = dataType;
|
||||
this.dataVersion = dataVersion;
|
||||
this.submittedBatch = submittedBatch;
|
||||
this.dataPath = dataPath;
|
||||
this.collectingTime = collectingTime;
|
||||
this.collectorContacts = collectorContacts;
|
||||
this.charset = charset;
|
||||
this.collectorName = collectorName;
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getRegionalismCode() {
|
||||
return regionalismCode;
|
||||
}
|
||||
|
||||
public void setRegionalismCode(String regionalismCode) {
|
||||
this.regionalismCode = regionalismCode;
|
||||
}
|
||||
|
||||
public String getCityName() {
|
||||
return cityName;
|
||||
}
|
||||
|
||||
public void setCityName(String cityName) {
|
||||
this.cityName = cityName;
|
||||
}
|
||||
|
||||
public String getDistrictName() {
|
||||
return districtName;
|
||||
}
|
||||
|
||||
public void setDistrictName(String districtName) {
|
||||
this.districtName = districtName;
|
||||
}
|
||||
|
||||
public int getSystemCode() {
|
||||
return systemCode;
|
||||
}
|
||||
|
||||
public void setSystemCode(int systemCode) {
|
||||
this.systemCode = systemCode;
|
||||
}
|
||||
|
||||
public String getSystemName() {
|
||||
return systemName;
|
||||
}
|
||||
|
||||
public void setSystemName(String systemName) {
|
||||
this.systemName = systemName;
|
||||
}
|
||||
|
||||
public String getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public void setDataType(String dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public int getDataVersion() {
|
||||
return dataVersion;
|
||||
}
|
||||
|
||||
public void setDataVersion(int dataVersion) {
|
||||
this.dataVersion = dataVersion;
|
||||
}
|
||||
|
||||
public String getSubmittedBatch() {
|
||||
return submittedBatch;
|
||||
}
|
||||
|
||||
public void setSubmittedBatch(String submittedBatch) {
|
||||
this.submittedBatch = submittedBatch;
|
||||
}
|
||||
|
||||
public String getDataPath() {
|
||||
return dataPath;
|
||||
}
|
||||
|
||||
public void setDataPath(String dataPath) {
|
||||
this.dataPath = dataPath;
|
||||
}
|
||||
|
||||
public String getCollectingTime() {
|
||||
return collectingTime;
|
||||
}
|
||||
|
||||
public void setCollectingTime(String collectingTime) {
|
||||
this.collectingTime = collectingTime;
|
||||
}
|
||||
|
||||
public String getCollectorContacts() {
|
||||
return collectorContacts;
|
||||
}
|
||||
|
||||
public void setCollectorContacts(String collectorContacts) {
|
||||
this.collectorContacts = collectorContacts;
|
||||
}
|
||||
|
||||
public String getCharset() {
|
||||
return charset;
|
||||
}
|
||||
|
||||
public void setCharset(String charset) {
|
||||
this.charset = charset;
|
||||
}
|
||||
|
||||
public String getCollectorName() {
|
||||
return collectorName;
|
||||
}
|
||||
|
||||
public void setCollectorName(String collectorName) {
|
||||
this.collectorName = collectorName;
|
||||
}
|
||||
|
||||
public String getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
public void setYear(String year) {
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the startYear
|
||||
*/
|
||||
public String getStartYear() {
|
||||
return startYear;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param startYear the startYear to set
|
||||
*/
|
||||
public void setStartYear(String startYear) {
|
||||
this.startYear = startYear;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the endYear
|
||||
*/
|
||||
public String getEndYear() {
|
||||
return endYear;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param endYear the endYear to set
|
||||
*/
|
||||
public void setEndYear(String endYear) {
|
||||
this.endYear = endYear;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the extractStatus
|
||||
*/
|
||||
public int getExtractStatus() {
|
||||
return extractStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param extractStatus the extractStatus to set
|
||||
*/
|
||||
public void setExtractStatus(int extractStatus) {
|
||||
this.extractStatus = extractStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the volumeIp
|
||||
*/
|
||||
public String getVolumeIp() {
|
||||
return volumeIp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param volumeIp the volumeIp to set
|
||||
*/
|
||||
public void setVolumeIp(String volumeIp) {
|
||||
this.volumeIp = volumeIp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the volumePath
|
||||
*/
|
||||
public String getVolumePath() {
|
||||
return volumePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param volumePath the volumePath to set
|
||||
*/
|
||||
public void setVolumePath(String volumePath) {
|
||||
this.volumePath = volumePath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "id=" + this.id + " ,regionalismCode=" + this.regionalismCode
|
||||
+ " ,cityName=" + this.cityName + " ,districtName="
|
||||
+ this.districtName + " ,systemCode=" + this.systemCode
|
||||
+ " ,systemName" + this.systemName + " ,dataType="
|
||||
+ this.dataType + " ,dataVersion=" + this.dataVersion
|
||||
+ " ,submittedBatch=" + this.submittedBatch + " ,dataPath="
|
||||
+ this.dataPath + " ,collectingTime=" + this.collectingTime
|
||||
+ " ,collectorContacts=" + this.collectorContacts
|
||||
+ " ,charset=" + this.charset + " ,collectorName="
|
||||
+ this.collectorName + " ,year=" + this.year + " startYear="
|
||||
+this.startYear +" endYear="+this.endYear;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,124 +1,124 @@
|
||||
package com.platform.entities;
|
||||
|
||||
public class DataInfoEntityMoveTmp extends DataInfoEntity {
|
||||
|
||||
private String dstPath;
|
||||
|
||||
private String completeStatus;
|
||||
|
||||
private int rate;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String lastTime;
|
||||
|
||||
private String dstVolumeIp;
|
||||
|
||||
private String dstVolumePath;
|
||||
|
||||
private int fkid;
|
||||
|
||||
public DataInfoEntityMoveTmp() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dstPath
|
||||
*/
|
||||
public String getDstPath() {
|
||||
return dstPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dstPath the dstPath to set
|
||||
*/
|
||||
public void setDstPath(String dstPath) {
|
||||
this.dstPath = dstPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the completeStatus
|
||||
*/
|
||||
public String getCompleteStatus() {
|
||||
return completeStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param completeStatus the completeStatus to set
|
||||
*/
|
||||
public void setCompleteStatus(String completeStatus) {
|
||||
this.completeStatus = completeStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rate
|
||||
*/
|
||||
public int getRate() {
|
||||
return rate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rate the rate to set
|
||||
*/
|
||||
public void setRate(int rate) {
|
||||
this.rate = rate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the lastTime
|
||||
*/
|
||||
public String getLastTime() {
|
||||
return lastTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param lastTime the lastTime to set
|
||||
*/
|
||||
public void setLastTime(String lastTime) {
|
||||
this.lastTime = lastTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the fkid
|
||||
*/
|
||||
public int getFkid() {
|
||||
return fkid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param fkid the fkid to set
|
||||
*/
|
||||
public void setFkid(int fkid) {
|
||||
this.fkid = fkid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dstVolumeIp
|
||||
*/
|
||||
public String getDstVolumeIp() {
|
||||
return dstVolumeIp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dstVolumeIp the dstVolumeIp to set
|
||||
*/
|
||||
public void setDstVolumeIp(String dstVolumeIp) {
|
||||
this.dstVolumeIp = dstVolumeIp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dstVolumePath
|
||||
*/
|
||||
public String getDstVolumePath() {
|
||||
return dstVolumePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dstVolumePath the dstVolumePath to set
|
||||
*/
|
||||
public void setDstVolumePath(String dstVolumePath) {
|
||||
this.dstVolumePath = dstVolumePath;
|
||||
}
|
||||
|
||||
}
|
||||
package com.platform.entities;
|
||||
|
||||
public class DataInfoEntityMoveTmp extends DataInfoEntity {
|
||||
|
||||
private String dstPath;
|
||||
|
||||
private String completeStatus;
|
||||
|
||||
private int rate;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String lastTime;
|
||||
|
||||
private String dstVolumeIp;
|
||||
|
||||
private String dstVolumePath;
|
||||
|
||||
private int fkid;
|
||||
|
||||
public DataInfoEntityMoveTmp() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dstPath
|
||||
*/
|
||||
public String getDstPath() {
|
||||
return dstPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dstPath the dstPath to set
|
||||
*/
|
||||
public void setDstPath(String dstPath) {
|
||||
this.dstPath = dstPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the completeStatus
|
||||
*/
|
||||
public String getCompleteStatus() {
|
||||
return completeStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param completeStatus the completeStatus to set
|
||||
*/
|
||||
public void setCompleteStatus(String completeStatus) {
|
||||
this.completeStatus = completeStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rate
|
||||
*/
|
||||
public int getRate() {
|
||||
return rate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rate the rate to set
|
||||
*/
|
||||
public void setRate(int rate) {
|
||||
this.rate = rate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the lastTime
|
||||
*/
|
||||
public String getLastTime() {
|
||||
return lastTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param lastTime the lastTime to set
|
||||
*/
|
||||
public void setLastTime(String lastTime) {
|
||||
this.lastTime = lastTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the fkid
|
||||
*/
|
||||
public int getFkid() {
|
||||
return fkid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param fkid the fkid to set
|
||||
*/
|
||||
public void setFkid(int fkid) {
|
||||
this.fkid = fkid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dstVolumeIp
|
||||
*/
|
||||
public String getDstVolumeIp() {
|
||||
return dstVolumeIp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dstVolumeIp the dstVolumeIp to set
|
||||
*/
|
||||
public void setDstVolumeIp(String dstVolumeIp) {
|
||||
this.dstVolumeIp = dstVolumeIp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dstVolumePath
|
||||
*/
|
||||
public String getDstVolumePath() {
|
||||
return dstVolumePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dstVolumePath the dstVolumePath to set
|
||||
*/
|
||||
public void setDstVolumePath(String dstVolumePath) {
|
||||
this.dstVolumePath = dstVolumePath;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,41 +1,41 @@
|
||||
package com.platform.entities;
|
||||
|
||||
/**
|
||||
*
|
||||
* 编码信息实体
|
||||
* 行政区划/系统信息
|
||||
* @author wuming
|
||||
*
|
||||
*/
|
||||
public class EncodedInfoEntity {
|
||||
private String name; //名称
|
||||
private String code; //编码
|
||||
|
||||
public EncodedInfoEntity() {}
|
||||
|
||||
public EncodedInfoEntity(String name, String code) {
|
||||
this.name = name;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return "code=" + this.code + ", name=" + this.name;
|
||||
}
|
||||
}
|
||||
package com.platform.entities;
|
||||
|
||||
/**
|
||||
*
|
||||
* 编码信息实体
|
||||
* 行政区划/系统信息
|
||||
* @author wuming
|
||||
*
|
||||
*/
|
||||
public class EncodedInfoEntity {
|
||||
private String name; //名称
|
||||
private String code; //编码
|
||||
|
||||
public EncodedInfoEntity() {}
|
||||
|
||||
public EncodedInfoEntity(String name, String code) {
|
||||
this.name = name;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return "code=" + this.code + ", name=" + this.name;
|
||||
}
|
||||
}
|
||||
|
@ -1,65 +1,65 @@
|
||||
package com.platform.entities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FolderNode {
|
||||
private String name;
|
||||
private int isFolder; // 1 is file and other integer is folder show children number
|
||||
private String path;
|
||||
private List<FolderNode> childNodes = new ArrayList<FolderNode>();
|
||||
|
||||
|
||||
public FolderNode() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
public FolderNode(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public FolderNode(String name, int isFolder) {
|
||||
this.name = name;
|
||||
this.isFolder = isFolder;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the isFolder
|
||||
*/
|
||||
public int getIsFolder() {
|
||||
return isFolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isFolder the isFolder to set
|
||||
*/
|
||||
public void setIsFolder(int isFolder) {
|
||||
this.isFolder = isFolder;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public List<FolderNode> getChildNodes() {
|
||||
return childNodes;
|
||||
}
|
||||
|
||||
public void setChildNodes(List<FolderNode> childNodes) {
|
||||
this.childNodes = childNodes;
|
||||
}
|
||||
|
||||
}
|
||||
package com.platform.entities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FolderNode {
|
||||
private String name;
|
||||
private int isFolder; // 1 is file and other integer is folder show children number
|
||||
private String path;
|
||||
private List<FolderNode> childNodes = new ArrayList<FolderNode>();
|
||||
|
||||
|
||||
public FolderNode() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
public FolderNode(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public FolderNode(String name, int isFolder) {
|
||||
this.name = name;
|
||||
this.isFolder = isFolder;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the isFolder
|
||||
*/
|
||||
public int getIsFolder() {
|
||||
return isFolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isFolder the isFolder to set
|
||||
*/
|
||||
public void setIsFolder(int isFolder) {
|
||||
this.isFolder = isFolder;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public List<FolderNode> getChildNodes() {
|
||||
return childNodes;
|
||||
}
|
||||
|
||||
public void setChildNodes(List<FolderNode> childNodes) {
|
||||
this.childNodes = childNodes;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,93 +1,93 @@
|
||||
package com.platform.entities;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import com.platform.utils.ConfigPropertyReader;
|
||||
import com.platform.utils.Configs;
|
||||
|
||||
public class OracleConnectorParams {
|
||||
private String port;
|
||||
private String ip;
|
||||
private String name;
|
||||
private String user;
|
||||
private String password;
|
||||
private String databaseName;
|
||||
|
||||
public OracleConnectorParams() {
|
||||
// TODO Auto-generated constructor stub
|
||||
maybeInit();
|
||||
}
|
||||
|
||||
public OracleConnectorParams(String port, String ip, String name) {
|
||||
maybeInit();
|
||||
this.port = port;
|
||||
this.ip = ip;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public OracleConnectorParams(String port, String ip, String name,
|
||||
String user, String password, String database) {
|
||||
this.port = port;
|
||||
this.ip = ip;
|
||||
this.name = name;
|
||||
this.user = user;
|
||||
this.password = password;
|
||||
this.databaseName = database;
|
||||
}
|
||||
|
||||
private void maybeInit() {
|
||||
Properties properties = ConfigPropertyReader.Builder(
|
||||
Configs.CONFIG_LOCALTION).getProperties();
|
||||
this.user = properties.getProperty("collect-user-name");
|
||||
this.password = properties.getProperty("collect-password");
|
||||
this.databaseName = properties.getProperty("collect-service-name");
|
||||
}
|
||||
|
||||
public String getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(String port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(String user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getDatabaseName() {
|
||||
return databaseName;
|
||||
}
|
||||
|
||||
public void setDatabaseName(String databaseName) {
|
||||
this.databaseName = databaseName;
|
||||
}
|
||||
}
|
||||
package com.platform.entities;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import com.platform.utils.ConfigPropertyReader;
|
||||
import com.platform.utils.Configs;
|
||||
|
||||
public class OracleConnectorParams {
|
||||
private String port;
|
||||
private String ip;
|
||||
private String name;
|
||||
private String user;
|
||||
private String password;
|
||||
private String databaseName;
|
||||
|
||||
public OracleConnectorParams() {
|
||||
// TODO Auto-generated constructor stub
|
||||
maybeInit();
|
||||
}
|
||||
|
||||
public OracleConnectorParams(String port, String ip, String name) {
|
||||
maybeInit();
|
||||
this.port = port;
|
||||
this.ip = ip;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public OracleConnectorParams(String port, String ip, String name,
|
||||
String user, String password, String database) {
|
||||
this.port = port;
|
||||
this.ip = ip;
|
||||
this.name = name;
|
||||
this.user = user;
|
||||
this.password = password;
|
||||
this.databaseName = database;
|
||||
}
|
||||
|
||||
private void maybeInit() {
|
||||
Properties properties = ConfigPropertyReader.Builder(
|
||||
Configs.CONFIG_LOCALTION).getProperties();
|
||||
this.user = properties.getProperty("collect-user-name");
|
||||
this.password = properties.getProperty("collect-password");
|
||||
this.databaseName = properties.getProperty("collect-service-name");
|
||||
}
|
||||
|
||||
public String getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(String port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(String user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getDatabaseName() {
|
||||
return databaseName;
|
||||
}
|
||||
|
||||
public void setDatabaseName(String databaseName) {
|
||||
this.databaseName = databaseName;
|
||||
}
|
||||
}
|
||||
|
@ -1,53 +1,53 @@
|
||||
package com.platform.entities;
|
||||
|
||||
public class RegionalismEntity {
|
||||
|
||||
private String code;
|
||||
|
||||
private String cityName;
|
||||
|
||||
private String districtName;
|
||||
|
||||
/**
|
||||
* @return the code
|
||||
*/
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param code the code to set
|
||||
*/
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cityName
|
||||
*/
|
||||
public String getCityName() {
|
||||
return cityName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cityName the cityName to set
|
||||
*/
|
||||
public void setCityName(String cityName) {
|
||||
this.cityName = cityName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the districtName
|
||||
*/
|
||||
public String getDistrictName() {
|
||||
return districtName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param districtName the districtName to set
|
||||
*/
|
||||
public void setDistrictName(String districtName) {
|
||||
this.districtName = districtName;
|
||||
}
|
||||
|
||||
}
|
||||
package com.platform.entities;
|
||||
|
||||
public class RegionalismEntity {
|
||||
|
||||
private String code;
|
||||
|
||||
private String cityName;
|
||||
|
||||
private String districtName;
|
||||
|
||||
/**
|
||||
* @return the code
|
||||
*/
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param code the code to set
|
||||
*/
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cityName
|
||||
*/
|
||||
public String getCityName() {
|
||||
return cityName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cityName the cityName to set
|
||||
*/
|
||||
public void setCityName(String cityName) {
|
||||
this.cityName = cityName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the districtName
|
||||
*/
|
||||
public String getDistrictName() {
|
||||
return districtName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param districtName the districtName to set
|
||||
*/
|
||||
public void setDistrictName(String districtName) {
|
||||
this.districtName = districtName;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,44 +1,44 @@
|
||||
package com.platform.entities;
|
||||
|
||||
public class SimpleConfigParamsBean {
|
||||
private String masterUrl;
|
||||
|
||||
private String oracleUserName;
|
||||
|
||||
private String oraclePassword;
|
||||
|
||||
private String oracleDBName;
|
||||
|
||||
public String getMasterUrl() {
|
||||
return masterUrl;
|
||||
}
|
||||
|
||||
public void setMasterUrl(String masterUrl) {
|
||||
this.masterUrl = masterUrl;
|
||||
}
|
||||
|
||||
public String getOracleUserName() {
|
||||
return oracleUserName;
|
||||
}
|
||||
|
||||
public void setOracleUserName(String oracleUserName) {
|
||||
this.oracleUserName = oracleUserName;
|
||||
}
|
||||
|
||||
public String getOraclePassword() {
|
||||
return oraclePassword;
|
||||
}
|
||||
|
||||
public void setOraclePassword(String oraclePassword) {
|
||||
this.oraclePassword = oraclePassword;
|
||||
}
|
||||
|
||||
public String getOracleDBName() {
|
||||
return oracleDBName;
|
||||
}
|
||||
|
||||
public void setOracleDBName(String oracleDBName) {
|
||||
this.oracleDBName = oracleDBName;
|
||||
}
|
||||
|
||||
}
|
||||
package com.platform.entities;
|
||||
|
||||
public class SimpleConfigParamsBean {
|
||||
private String masterUrl;
|
||||
|
||||
private String oracleUserName;
|
||||
|
||||
private String oraclePassword;
|
||||
|
||||
private String oracleDBName;
|
||||
|
||||
public String getMasterUrl() {
|
||||
return masterUrl;
|
||||
}
|
||||
|
||||
public void setMasterUrl(String masterUrl) {
|
||||
this.masterUrl = masterUrl;
|
||||
}
|
||||
|
||||
public String getOracleUserName() {
|
||||
return oracleUserName;
|
||||
}
|
||||
|
||||
public void setOracleUserName(String oracleUserName) {
|
||||
this.oracleUserName = oracleUserName;
|
||||
}
|
||||
|
||||
public String getOraclePassword() {
|
||||
return oraclePassword;
|
||||
}
|
||||
|
||||
public void setOraclePassword(String oraclePassword) {
|
||||
this.oraclePassword = oraclePassword;
|
||||
}
|
||||
|
||||
public String getOracleDBName() {
|
||||
return oracleDBName;
|
||||
}
|
||||
|
||||
public void setOracleDBName(String oracleDBName) {
|
||||
this.oracleDBName = oracleDBName;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,37 +1,37 @@
|
||||
package com.platform.entities;
|
||||
|
||||
public class SystemEntity {
|
||||
|
||||
private int code;
|
||||
|
||||
private String systemName;
|
||||
|
||||
/**
|
||||
* @return the code
|
||||
*/
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param code the code to set
|
||||
*/
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the systemName
|
||||
*/
|
||||
public String getSystemName() {
|
||||
return systemName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param systemName the systemName to set
|
||||
*/
|
||||
public void setSystemName(String systemName) {
|
||||
this.systemName = systemName;
|
||||
}
|
||||
|
||||
}
|
||||
package com.platform.entities;
|
||||
|
||||
public class SystemEntity {
|
||||
|
||||
private int code;
|
||||
|
||||
private String systemName;
|
||||
|
||||
/**
|
||||
* @return the code
|
||||
*/
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param code the code to set
|
||||
*/
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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,54 @@
|
||||
package com.platform.entities;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class volumeMoveForm {
|
||||
|
||||
private String name;
|
||||
|
||||
private FolderNode selectNode;
|
||||
|
||||
private List<DataInfoEntity> selectItems;
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the selectNode
|
||||
*/
|
||||
public FolderNode getSelectNode() {
|
||||
return selectNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param selectNode the selectNode to set
|
||||
*/
|
||||
public void setSelectNode(FolderNode selectNode) {
|
||||
this.selectNode = selectNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the selectItems
|
||||
*/
|
||||
public List<DataInfoEntity> getSelectItems() {
|
||||
return selectItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param selectItems the selectItems to set
|
||||
*/
|
||||
public void setSelectItems(List<DataInfoEntity> selectItems) {
|
||||
this.selectItems = selectItems;
|
||||
}
|
||||
}
|
@ -1,56 +1,56 @@
|
||||
package com.platform.glusterfs;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.PropertyConfigurator;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.platform.utils.Constant;
|
||||
|
||||
|
||||
|
||||
public class RemoveData {
|
||||
|
||||
public static Logger log = Logger.getLogger ( RemoveData.class);
|
||||
|
||||
|
||||
/**
|
||||
* -1 :error; 0: the filename is not exists ; 1: right
|
||||
* @param folderName
|
||||
* @param fileName
|
||||
* @return
|
||||
*/
|
||||
public int deleteFolder(String folderName){
|
||||
log.info("start delete "+folderName);
|
||||
|
||||
ShowData showData=new ShowData();
|
||||
Map<String,String> reStrings=showData.showFolderData(folderName);
|
||||
|
||||
if(reStrings==null){
|
||||
log.error("3301 "+folderName+" is not exists");
|
||||
return -1;
|
||||
}
|
||||
|
||||
String command="rm -r "+folderName;
|
||||
|
||||
// int status=runCommand.runCommand(command);
|
||||
Constant.ganymedSSH.execCmdNoWaitAcquiescent(command);
|
||||
|
||||
log.info("delete "+folderName+" running");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testDeleteFolderFiles() {
|
||||
PropertyConfigurator.configure("log4j.properties");
|
||||
deleteFolder("/home/ubuntu");
|
||||
}
|
||||
|
||||
}
|
||||
package com.platform.glusterfs;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.PropertyConfigurator;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.platform.utils.Constant;
|
||||
|
||||
|
||||
|
||||
public class RemoveData {
|
||||
|
||||
public static Logger log = Logger.getLogger ( RemoveData.class);
|
||||
|
||||
|
||||
/**
|
||||
* -1 :error; 0: the filename is not exists ; 1: right
|
||||
* @param folderName
|
||||
* @param fileName
|
||||
* @return
|
||||
*/
|
||||
public int deleteFolder(String folderName){
|
||||
log.info("start delete "+folderName);
|
||||
|
||||
ShowData showData=new ShowData();
|
||||
Map<String,String> reStrings=showData.showFolderData(folderName);
|
||||
|
||||
if(reStrings==null){
|
||||
log.error("3301 "+folderName+" is not exists");
|
||||
return -1;
|
||||
}
|
||||
|
||||
String command="rm -r "+folderName;
|
||||
|
||||
// int status=runCommand.runCommand(command);
|
||||
Constant.ganymedSSH.execCmdNoWaitAcquiescent(command);
|
||||
|
||||
log.info("delete "+folderName+" running");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testDeleteFolderFiles() {
|
||||
PropertyConfigurator.configure("log4j.properties");
|
||||
deleteFolder("/home/ubuntu");
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,154 +1,154 @@
|
||||
package com.platform.kubernetes;
|
||||
|
||||
import io.fabric8.kubernetes.api.model.Container;
|
||||
import io.fabric8.kubernetes.api.model.ContainerPort;
|
||||
import io.fabric8.kubernetes.api.model.Pod;
|
||||
import io.fabric8.kubernetes.api.model.ReplicationController;
|
||||
import io.fabric8.kubernetes.client.Config;
|
||||
import io.fabric8.kubernetes.client.ConfigBuilder;
|
||||
import io.fabric8.kubernetes.client.DefaultKubernetesClient;
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.platform.utils.Configs;
|
||||
import com.platform.utils.UtilsHelper;
|
||||
|
||||
public class SimpleKubeClient {
|
||||
private KubernetesClient client;
|
||||
private final static String DEFAULT_NAMESPACE = "default";
|
||||
|
||||
public SimpleKubeClient() {
|
||||
this.client = new DefaultKubernetesClient(Configs.KUBE_MASTER_URL);
|
||||
}
|
||||
|
||||
public SimpleKubeClient(String masterUrl) {
|
||||
this.client = new DefaultKubernetesClient(masterUrl);
|
||||
}
|
||||
|
||||
public SimpleKubeClient(Config config) {
|
||||
Config cf = config;
|
||||
if (null == config) {
|
||||
cf = new ConfigBuilder().withMasterUrl(Configs.KUBE_MASTER_URL).build();
|
||||
}
|
||||
this.client = new DefaultKubernetesClient(cf);
|
||||
}
|
||||
|
||||
public void updateOrAddReplicasLabelById(String namespace,
|
||||
String resourceId, String key, String value) {
|
||||
KubernetesClient kubeClient = client;
|
||||
if (checkClientNull())
|
||||
kubeClient = new DefaultKubernetesClient(Configs.KUBE_MASTER_URL);
|
||||
kubeClient.replicationControllers().inNamespace(namespace)
|
||||
.withName(resourceId).edit().editMetadata()
|
||||
.addToLabels(key, value).endMetadata().done();
|
||||
}
|
||||
|
||||
public void updateOrAddReplicasLabelByEntity(String namespace,
|
||||
ReplicationController replicas, String key, String value) {
|
||||
updateOrAddReplicasLabelById(namespace, replicas.getMetadata()
|
||||
.getName(), key, value);
|
||||
}
|
||||
|
||||
public void updateOrAddReplicasLabelById(String resourceId, String key,
|
||||
String value) {
|
||||
updateOrAddReplicasLabelById(DEFAULT_NAMESPACE, resourceId, key, value);
|
||||
}
|
||||
|
||||
public void updateOrAddReplicasLabelByEntity(
|
||||
ReplicationController replicas, String key, String value) {
|
||||
updateOrAddReplicasLabelByEntity(DEFAULT_NAMESPACE, replicas, key,
|
||||
value);
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
public ReplicationController getReplicationController(String namespace,
|
||||
String replicasName) {
|
||||
KubernetesClient kubeClient = client;
|
||||
if (checkClientNull())
|
||||
kubeClient = new DefaultKubernetesClient(Configs.KUBE_MASTER_URL);
|
||||
return kubeClient.replicationControllers().inNamespace(namespace)
|
||||
.withName(replicasName).get();
|
||||
}
|
||||
|
||||
public ReplicationController getReplicationController(String replicasName) {
|
||||
return getReplicationController(DEFAULT_NAMESPACE, replicasName);
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
public List<Pod> getPodsForApplicaList(ReplicationController rc) {
|
||||
Map<String, String> selector = rc.getSpec().getSelector();
|
||||
KubernetesClient kubeClient = client;
|
||||
if (checkClientNull())
|
||||
kubeClient = new DefaultKubernetesClient(Configs.KUBE_MASTER_URL);
|
||||
List<Pod> podList = kubeClient.pods()
|
||||
.inNamespace(rc.getMetadata().getNamespace()).list().getItems();
|
||||
return getPods(podList, selector);
|
||||
}
|
||||
|
||||
private boolean checkClientNull() {
|
||||
return null == client;
|
||||
}
|
||||
|
||||
public List<Pod> getPods(List<Pod> pods, Map<String, String> selector) {
|
||||
List<Pod> result = new ArrayList<Pod>();
|
||||
for (int i = 0; i < pods.size(); i++)
|
||||
if (UtilsHelper.isSubMap(getLabels(pods.get(i)), selector))
|
||||
result.add(pods.get(i));
|
||||
return result;
|
||||
}
|
||||
|
||||
private Map<String, String> getLabels(Pod pod) {
|
||||
return pod.getMetadata().getLabels();
|
||||
}
|
||||
|
||||
public KubernetesClient getClient() {
|
||||
// TODO Auto-generated method stub
|
||||
return client;
|
||||
}
|
||||
|
||||
public int getPodContainerport(Pod pod) {
|
||||
int port = Configs.ORACLE_DEFAULT_PORT;
|
||||
List<Container> containers = pod.getSpec().getContainers();
|
||||
if (null != containers && containers.size() > 0) {
|
||||
List<ContainerPort> ports = containers.get(0).getPorts();
|
||||
if (null != ports && ports.size() > 0)
|
||||
port = ports.get(0).getHostPort();
|
||||
}
|
||||
return port;
|
||||
}
|
||||
|
||||
public String getPodHostIp(Pod pod) {
|
||||
return pod.getSpec().getNodeName();
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
public Map<String, ReplicationController> getReplicationControllerList(
|
||||
String namespace) {
|
||||
KubernetesClient kubeClient = client;
|
||||
Map<String, ReplicationController> rcMap = new HashMap<String, ReplicationController>();
|
||||
if (checkClientNull())
|
||||
kubeClient = new DefaultKubernetesClient(Configs.KUBE_MASTER_URL);
|
||||
List<ReplicationController> replicasList = kubeClient
|
||||
.replicationControllers().list().getItems();
|
||||
if (replicasList != null)
|
||||
for (int i = 0; i < replicasList.size(); i++) {
|
||||
ReplicationController rController = replicasList.get(i);
|
||||
rcMap.put(rController.getMetadata().getName(), rController);
|
||||
}
|
||||
return rcMap;
|
||||
}
|
||||
|
||||
public Map<String, ReplicationController> getReplicationControllerList() {
|
||||
return getReplicationControllerList(DEFAULT_NAMESPACE);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
if (!checkClientNull())
|
||||
client.close();
|
||||
}
|
||||
|
||||
}
|
||||
package com.platform.kubernetes;
|
||||
|
||||
import io.fabric8.kubernetes.api.model.Container;
|
||||
import io.fabric8.kubernetes.api.model.ContainerPort;
|
||||
import io.fabric8.kubernetes.api.model.Pod;
|
||||
import io.fabric8.kubernetes.api.model.ReplicationController;
|
||||
import io.fabric8.kubernetes.client.Config;
|
||||
import io.fabric8.kubernetes.client.ConfigBuilder;
|
||||
import io.fabric8.kubernetes.client.DefaultKubernetesClient;
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.platform.utils.Configs;
|
||||
import com.platform.utils.UtilsHelper;
|
||||
|
||||
public class SimpleKubeClient {
|
||||
private KubernetesClient client;
|
||||
private final static String DEFAULT_NAMESPACE = "default";
|
||||
|
||||
public SimpleKubeClient() {
|
||||
this.client = new DefaultKubernetesClient(Configs.KUBE_MASTER_URL);
|
||||
}
|
||||
|
||||
public SimpleKubeClient(String masterUrl) {
|
||||
this.client = new DefaultKubernetesClient(masterUrl);
|
||||
}
|
||||
|
||||
public SimpleKubeClient(Config config) {
|
||||
Config cf = config;
|
||||
if (null == config) {
|
||||
cf = new ConfigBuilder().withMasterUrl(Configs.KUBE_MASTER_URL).build();
|
||||
}
|
||||
this.client = new DefaultKubernetesClient(cf);
|
||||
}
|
||||
|
||||
public void updateOrAddReplicasLabelById(String namespace,
|
||||
String resourceId, String key, String value) {
|
||||
KubernetesClient kubeClient = client;
|
||||
if (checkClientNull())
|
||||
kubeClient = new DefaultKubernetesClient(Configs.KUBE_MASTER_URL);
|
||||
kubeClient.replicationControllers().inNamespace(namespace)
|
||||
.withName(resourceId).edit().editMetadata()
|
||||
.addToLabels(key, value).endMetadata().done();
|
||||
}
|
||||
|
||||
public void updateOrAddReplicasLabelByEntity(String namespace,
|
||||
ReplicationController replicas, String key, String value) {
|
||||
updateOrAddReplicasLabelById(namespace, replicas.getMetadata()
|
||||
.getName(), key, value);
|
||||
}
|
||||
|
||||
public void updateOrAddReplicasLabelById(String resourceId, String key,
|
||||
String value) {
|
||||
updateOrAddReplicasLabelById(DEFAULT_NAMESPACE, resourceId, key, value);
|
||||
}
|
||||
|
||||
public void updateOrAddReplicasLabelByEntity(
|
||||
ReplicationController replicas, String key, String value) {
|
||||
updateOrAddReplicasLabelByEntity(DEFAULT_NAMESPACE, replicas, key,
|
||||
value);
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
public ReplicationController getReplicationController(String namespace,
|
||||
String replicasName) {
|
||||
KubernetesClient kubeClient = client;
|
||||
if (checkClientNull())
|
||||
kubeClient = new DefaultKubernetesClient(Configs.KUBE_MASTER_URL);
|
||||
return kubeClient.replicationControllers().inNamespace(namespace)
|
||||
.withName(replicasName).get();
|
||||
}
|
||||
|
||||
public ReplicationController getReplicationController(String replicasName) {
|
||||
return getReplicationController(DEFAULT_NAMESPACE, replicasName);
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
public List<Pod> getPodsForApplicaList(ReplicationController rc) {
|
||||
Map<String, String> selector = rc.getSpec().getSelector();
|
||||
KubernetesClient kubeClient = client;
|
||||
if (checkClientNull())
|
||||
kubeClient = new DefaultKubernetesClient(Configs.KUBE_MASTER_URL);
|
||||
List<Pod> podList = kubeClient.pods()
|
||||
.inNamespace(rc.getMetadata().getNamespace()).list().getItems();
|
||||
return getPods(podList, selector);
|
||||
}
|
||||
|
||||
private boolean checkClientNull() {
|
||||
return null == client;
|
||||
}
|
||||
|
||||
public List<Pod> getPods(List<Pod> pods, Map<String, String> selector) {
|
||||
List<Pod> result = new ArrayList<Pod>();
|
||||
for (int i = 0; i < pods.size(); i++)
|
||||
if (UtilsHelper.isSubMap(getLabels(pods.get(i)), selector))
|
||||
result.add(pods.get(i));
|
||||
return result;
|
||||
}
|
||||
|
||||
private Map<String, String> getLabels(Pod pod) {
|
||||
return pod.getMetadata().getLabels();
|
||||
}
|
||||
|
||||
public KubernetesClient getClient() {
|
||||
// TODO Auto-generated method stub
|
||||
return client;
|
||||
}
|
||||
|
||||
public int getPodContainerport(Pod pod) {
|
||||
int port = Configs.ORACLE_DEFAULT_PORT;
|
||||
List<Container> containers = pod.getSpec().getContainers();
|
||||
if (null != containers && containers.size() > 0) {
|
||||
List<ContainerPort> ports = containers.get(0).getPorts();
|
||||
if (null != ports && ports.size() > 0)
|
||||
port = ports.get(0).getHostPort();
|
||||
}
|
||||
return port;
|
||||
}
|
||||
|
||||
public String getPodHostIp(Pod pod) {
|
||||
return pod.getSpec().getNodeName();
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
public Map<String, ReplicationController> getReplicationControllerList(
|
||||
String namespace) {
|
||||
KubernetesClient kubeClient = client;
|
||||
Map<String, ReplicationController> rcMap = new HashMap<String, ReplicationController>();
|
||||
if (checkClientNull())
|
||||
kubeClient = new DefaultKubernetesClient(Configs.KUBE_MASTER_URL);
|
||||
List<ReplicationController> replicasList = kubeClient
|
||||
.replicationControllers().list().getItems();
|
||||
if (replicasList != null)
|
||||
for (int i = 0; i < replicasList.size(); i++) {
|
||||
ReplicationController rController = replicasList.get(i);
|
||||
rcMap.put(rController.getMetadata().getName(), rController);
|
||||
}
|
||||
return rcMap;
|
||||
}
|
||||
|
||||
public Map<String, ReplicationController> getReplicationControllerList() {
|
||||
return getReplicationControllerList(DEFAULT_NAMESPACE);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
if (!checkClientNull())
|
||||
client.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,76 +1,76 @@
|
||||
package com.platform.oracle;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
import com.platform.utils.Configs;
|
||||
|
||||
public class OracleConnector {
|
||||
static {
|
||||
try {
|
||||
Class.forName("oracle.jdbc.driver.OracleDriver");
|
||||
Configs.CONSOLE_LOGGER.info("Oracle驱动加载成功");
|
||||
} catch (ClassNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Connection ConnectionBuilder(String url, String user,
|
||||
String password) {
|
||||
Connection conn=null;
|
||||
try {
|
||||
conn = DriverManager.getConnection(url, user, password);
|
||||
} catch (SQLException e) {
|
||||
Configs.CONSOLE_LOGGER.info("创建oracle连接失败: [" + e.getMessage() + "]");
|
||||
}
|
||||
return conn;
|
||||
}
|
||||
|
||||
public static boolean canConnect(String url, String user, String password) {
|
||||
return (null != ConnectionBuilder(url, user, password));
|
||||
}
|
||||
|
||||
public ResultSet getSQLExecResultSet(Connection conn, String sql) {
|
||||
ResultSet resultSet = null;
|
||||
try {
|
||||
Statement statement = conn
|
||||
.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
|
||||
ResultSet.CONCUR_UPDATABLE);
|
||||
resultSet = statement.executeQuery(sql);
|
||||
} catch (SQLException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return resultSet;
|
||||
}
|
||||
|
||||
public ResultSet getSQLExecResultSet(String url, String user,
|
||||
String password, String sql) {
|
||||
return getSQLExecResultSet(ConnectionBuilder(url, user, password), sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行对oracle数据库的增、删
|
||||
* @param conn
|
||||
* @param sql
|
||||
* @return 是否执行成功
|
||||
*/
|
||||
public boolean execOracleSQL(Connection conn, String sql) {
|
||||
boolean flag = false;
|
||||
try {
|
||||
Statement statement = conn.createStatement();
|
||||
if (statement.executeUpdate(sql) > 0)
|
||||
flag = true;
|
||||
} catch (SQLException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
package com.platform.oracle;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
import com.platform.utils.Configs;
|
||||
|
||||
public class OracleConnector {
|
||||
static {
|
||||
try {
|
||||
Class.forName("oracle.jdbc.driver.OracleDriver");
|
||||
Configs.CONSOLE_LOGGER.info("Oracle驱动加载成功");
|
||||
} catch (ClassNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Connection ConnectionBuilder(String url, String user,
|
||||
String password) {
|
||||
Connection conn=null;
|
||||
try {
|
||||
conn = DriverManager.getConnection(url, user, password);
|
||||
} catch (SQLException e) {
|
||||
Configs.CONSOLE_LOGGER.info("创建oracle连接失败: [" + e.getMessage() + "]");
|
||||
}
|
||||
return conn;
|
||||
}
|
||||
|
||||
public static boolean canConnect(String url, String user, String password) {
|
||||
return (null != ConnectionBuilder(url, user, password));
|
||||
}
|
||||
|
||||
public ResultSet getSQLExecResultSet(Connection conn, String sql) {
|
||||
ResultSet resultSet = null;
|
||||
try {
|
||||
Statement statement = conn
|
||||
.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
|
||||
ResultSet.CONCUR_UPDATABLE);
|
||||
resultSet = statement.executeQuery(sql);
|
||||
} catch (SQLException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return resultSet;
|
||||
}
|
||||
|
||||
public ResultSet getSQLExecResultSet(String url, String user,
|
||||
String password, String sql) {
|
||||
return getSQLExecResultSet(ConnectionBuilder(url, user, password), sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行对oracle数据库的增、删
|
||||
* @param conn
|
||||
* @param sql
|
||||
* @return 是否执行成功
|
||||
*/
|
||||
public boolean execOracleSQL(Connection conn, String sql) {
|
||||
boolean flag = false;
|
||||
try {
|
||||
Statement statement = conn.createStatement();
|
||||
if (statement.executeUpdate(sql) > 0)
|
||||
flag = true;
|
||||
} catch (SQLException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
@ -1,16 +1,16 @@
|
||||
|
||||
package com.platform.service;
|
||||
|
||||
import org.springframework.ui.ModelMap;
|
||||
|
||||
import com.platform.dao.DataInfoDao;
|
||||
import com.platform.entities.DataInfoEntity;
|
||||
import com.platform.entities.PagerOptions;
|
||||
|
||||
public interface DataInfoService {
|
||||
public ModelMap getPagerTableData(PagerOptions pagerOptions);
|
||||
|
||||
void deleteData(String[] id) throws Exception;
|
||||
|
||||
int save(DataInfoEntity data) throws Exception;
|
||||
}
|
||||
|
||||
package com.platform.service;
|
||||
|
||||
import org.springframework.ui.ModelMap;
|
||||
|
||||
import com.platform.dao.DataInfoDao;
|
||||
import com.platform.entities.DataInfoEntity;
|
||||
import com.platform.entities.PagerOptions;
|
||||
|
||||
public interface DataInfoService {
|
||||
public ModelMap getPagerTableData(PagerOptions pagerOptions);
|
||||
|
||||
void deleteData(String[] id) throws Exception;
|
||||
|
||||
int save(DataInfoEntity data) throws Exception;
|
||||
}
|
||||
|
@ -1,89 +1,89 @@
|
||||
package com.platform.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.ui.ModelMap;
|
||||
|
||||
import com.base.CustomException;
|
||||
import com.platform.dao.DataInfoDao;
|
||||
import com.platform.entities.DataInfoEntity;
|
||||
import com.platform.entities.PagerOptions;
|
||||
import com.platform.utils.Bean2MapUtils;
|
||||
|
||||
@Service(value = "dataInfoService")
|
||||
public class DataInfoServiceImp implements DataInfoService {
|
||||
@Resource(name = "dataInfoDao")
|
||||
private DataInfoDao dfdDao;
|
||||
|
||||
public void setDfdDao(DataInfoDao dfdDao) {
|
||||
this.dfdDao = dfdDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelMap getPagerTableData(PagerOptions pagerOptions) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
String querystr = pagerOptions.getKeyQuery();
|
||||
String[] querys = null;
|
||||
try {
|
||||
if (null != querystr && !"".equals(querystr)) {
|
||||
querys = querystr.split(" ");
|
||||
}
|
||||
pagerOptions.setArray(querys);
|
||||
int count = dfdDao.getLimitedDataCount(pagerOptions); //获取总记录条数
|
||||
System.out.println("total colume " + count);
|
||||
int offset = 0;
|
||||
if (pagerOptions.getCurrentPageNum() > 1) {
|
||||
pagerOptions.setTotalLimit((pagerOptions.getCurrentPageNum() - 1)
|
||||
* pagerOptions.getPriorTableSize());
|
||||
offset = dfdDao.getLimitedBeginId(pagerOptions); //获取起始查询id
|
||||
System.out.println(offset);
|
||||
}
|
||||
pagerOptions.setOffset(offset + 1);
|
||||
List<DataInfoEntity> result = dfdDao
|
||||
.getLimitedDataInfoEntities(pagerOptions);
|
||||
modelMap.addAttribute("data", result);
|
||||
modelMap.addAttribute("length", count);
|
||||
} catch (Exception e) {
|
||||
new CustomException();
|
||||
}
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteData(String[] id) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
List<Integer> ids = new ArrayList<Integer>();
|
||||
for(String idx: id){
|
||||
ids.add(Integer.parseInt(idx));
|
||||
}
|
||||
if (ids.size() > 0) {
|
||||
//数据在不在?
|
||||
List<String> paths = dfdDao.getIdIsExist(ids);
|
||||
if(paths.size()>0){
|
||||
//删除文件操作
|
||||
for (int i = 0; i < paths.size(); i++) {
|
||||
System.out.println(paths.get(i));
|
||||
}
|
||||
//删除数据库记录
|
||||
dfdDao.removes(ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(DataInfoEntity data) throws Exception {
|
||||
int result = 0;
|
||||
try {
|
||||
result = dfdDao.save(data);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
System.out.println("");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
package com.platform.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.ui.ModelMap;
|
||||
|
||||
import com.base.CustomException;
|
||||
import com.platform.dao.DataInfoDao;
|
||||
import com.platform.entities.DataInfoEntity;
|
||||
import com.platform.entities.PagerOptions;
|
||||
import com.platform.utils.Bean2MapUtils;
|
||||
|
||||
@Service(value = "dataInfoService")
|
||||
public class DataInfoServiceImp implements DataInfoService {
|
||||
@Resource(name = "dataInfoDao")
|
||||
private DataInfoDao dfdDao;
|
||||
|
||||
public void setDfdDao(DataInfoDao dfdDao) {
|
||||
this.dfdDao = dfdDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelMap getPagerTableData(PagerOptions pagerOptions) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
String querystr = pagerOptions.getKeyQuery();
|
||||
String[] querys = null;
|
||||
try {
|
||||
if (null != querystr && !"".equals(querystr)) {
|
||||
querys = querystr.split(" ");
|
||||
}
|
||||
pagerOptions.setArray(querys);
|
||||
int count = dfdDao.getLimitedDataCount(pagerOptions); //获取总记录条数
|
||||
System.out.println("total colume " + count);
|
||||
int offset = 0;
|
||||
if (pagerOptions.getCurrentPageNum() > 1) {
|
||||
pagerOptions.setTotalLimit((pagerOptions.getCurrentPageNum() - 1)
|
||||
* pagerOptions.getPriorTableSize());
|
||||
offset = dfdDao.getLimitedBeginId(pagerOptions); //获取起始查询id
|
||||
System.out.println(offset);
|
||||
}
|
||||
pagerOptions.setOffset(offset + 1);
|
||||
List<DataInfoEntity> result = dfdDao
|
||||
.getLimitedDataInfoEntities(pagerOptions);
|
||||
modelMap.addAttribute("data", result);
|
||||
modelMap.addAttribute("length", count);
|
||||
} catch (Exception e) {
|
||||
new CustomException();
|
||||
}
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteData(String[] id) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
List<Integer> ids = new ArrayList<Integer>();
|
||||
for(String idx: id){
|
||||
ids.add(Integer.parseInt(idx));
|
||||
}
|
||||
if (ids.size() > 0) {
|
||||
//数据在不在?
|
||||
List<String> paths = dfdDao.getIdIsExist(ids);
|
||||
if(paths.size()>0){
|
||||
//删除文件操作
|
||||
for (int i = 0; i < paths.size(); i++) {
|
||||
System.out.println(paths.get(i));
|
||||
}
|
||||
//删除数据库记录
|
||||
dfdDao.removes(ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(DataInfoEntity data) throws Exception {
|
||||
int result = 0;
|
||||
try {
|
||||
result = dfdDao.save(data);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
System.out.println("");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
package com.platform.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.platform.entities.EncodedInfoEntity;
|
||||
|
||||
/**
|
||||
* 数据库业务逻辑处理接口
|
||||
*
|
||||
* @author wuming
|
||||
*
|
||||
*/
|
||||
public interface EncodeInfoService {
|
||||
|
||||
public List<EncodedInfoEntity> getAllEncodeInfo(String tableName);
|
||||
|
||||
public int deleteEncodeByCode(String code, String tableName);
|
||||
|
||||
public String getEncodeNameByCode(String code, String name);
|
||||
}
|
||||
package com.platform.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.platform.entities.EncodedInfoEntity;
|
||||
|
||||
/**
|
||||
* 数据库业务逻辑处理接口
|
||||
*
|
||||
* @author wuming
|
||||
*
|
||||
*/
|
||||
public interface EncodeInfoService {
|
||||
|
||||
public List<EncodedInfoEntity> getAllEncodeInfo(String tableName);
|
||||
|
||||
public int deleteEncodeByCode(String code, String tableName);
|
||||
|
||||
public String getEncodeNameByCode(String code, String name);
|
||||
}
|
||||
|
@ -1,25 +1,25 @@
|
||||
package com.platform.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.platform.entities.GatherOracleInfo;
|
||||
|
||||
public interface IMySqlService {
|
||||
|
||||
/**
|
||||
* @return 查询
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<GatherOracleInfo> findAllMySql() throws Exception;
|
||||
|
||||
/** 删除
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int deleteMySql(int id) throws Exception;
|
||||
|
||||
public int insertOracle(GatherOracleInfo oracle) throws Exception;
|
||||
|
||||
public int updateOracle(GatherOracleInfo oracle) throws Exception;
|
||||
|
||||
}
|
||||
package com.platform.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.platform.entities.GatherOracleInfo;
|
||||
|
||||
public interface IMySqlService {
|
||||
|
||||
/**
|
||||
* @return 查询
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<GatherOracleInfo> findAllMySql() throws Exception;
|
||||
|
||||
/** 删除
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int deleteMySql(int id) throws Exception;
|
||||
|
||||
public int insertOracle(GatherOracleInfo oracle) throws Exception;
|
||||
|
||||
public int updateOracle(GatherOracleInfo oracle) throws Exception;
|
||||
|
||||
}
|
||||
|
@ -1,22 +1,22 @@
|
||||
package com.platform.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.platform.entities.DataInfoEntity;
|
||||
import com.platform.entities.GatherOracleInfo;
|
||||
import com.platform.entities.OracleConnectorParams;
|
||||
|
||||
public interface IOracleExtractService {
|
||||
|
||||
/** 抽取数据库
|
||||
* @param name
|
||||
* @param dataInfo //采集库连接参数
|
||||
* @param oracleConnect
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
// public boolean extractOracle(String name, List<OracleConnectorParams> dataInfos, GatherOracleInfo oracleConnect) throws Exception;
|
||||
// public boolean extractOracle(String name, List<DataInfoEntity> dataInfos, Map<String, String> oracleConnect) throws Exception;
|
||||
public boolean extractOracle(String name, List<Map<String, String>> dataInfo, Map<String, String> oracleConnect) throws Exception;
|
||||
}
|
||||
package com.platform.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.platform.entities.DataInfoEntity;
|
||||
import com.platform.entities.GatherOracleInfo;
|
||||
import com.platform.entities.OracleConnectorParams;
|
||||
|
||||
public interface IOracleExtractService {
|
||||
|
||||
/** 抽取数据库
|
||||
* @param name
|
||||
* @param dataInfo //采集库连接参数
|
||||
* @param oracleConnect
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
// public boolean extractOracle(String name, List<OracleConnectorParams> dataInfos, GatherOracleInfo oracleConnect) throws Exception;
|
||||
// public boolean extractOracle(String name, List<DataInfoEntity> dataInfos, Map<String, String> oracleConnect) throws Exception;
|
||||
public boolean extractOracle(String name, List<Map<String, String>> dataInfo, Map<String, String> oracleConnect) throws Exception;
|
||||
}
|
||||
|
@ -1,24 +1,24 @@
|
||||
package com.platform.service;
|
||||
|
||||
|
||||
|
||||
import com.platform.entities.OracleConnectorParams;
|
||||
import com.platform.oracle.OracleConnector;
|
||||
import com.platform.utils.Configs;
|
||||
|
||||
public class OracleExtractService extends Thread implements Runnable {
|
||||
private OracleConnectorParams ocp;
|
||||
private java.sql.Connection conn;
|
||||
|
||||
public OracleExtractService(OracleConnectorParams ocp){
|
||||
this.ocp=ocp;
|
||||
String url = "";
|
||||
this.conn=OracleConnector.ConnectionBuilder(url, Configs.GATHER_USER_NAME, Configs.GATHER_USER_PASSWORD);
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
package com.platform.service;
|
||||
|
||||
|
||||
|
||||
import com.platform.entities.OracleConnectorParams;
|
||||
import com.platform.oracle.OracleConnector;
|
||||
import com.platform.utils.Configs;
|
||||
|
||||
public class OracleExtractService extends Thread implements Runnable {
|
||||
private OracleConnectorParams ocp;
|
||||
private java.sql.Connection conn;
|
||||
|
||||
public OracleExtractService(OracleConnectorParams ocp){
|
||||
this.ocp=ocp;
|
||||
String url = "";
|
||||
this.conn=OracleConnector.ConnectionBuilder(url, Configs.GATHER_USER_NAME, Configs.GATHER_USER_PASSWORD);
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
package com.platform.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
|
||||
import com.platform.entities.SimpleConfigParamsBean;
|
||||
|
||||
public class SimplePropertyReader {
|
||||
@Autowired @Qualifier("simpeConfig")
|
||||
private SimpleConfigParamsBean configParamsBean;
|
||||
|
||||
public void setConfigParamsBean(SimpleConfigParamsBean configParamsBean) {
|
||||
this.configParamsBean = configParamsBean;
|
||||
}
|
||||
|
||||
public SimpleConfigParamsBean getConfigParamsBean() {
|
||||
return configParamsBean;
|
||||
}
|
||||
|
||||
}
|
||||
package com.platform.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
|
||||
import com.platform.entities.SimpleConfigParamsBean;
|
||||
|
||||
public class SimplePropertyReader {
|
||||
@Autowired @Qualifier("simpeConfig")
|
||||
private SimpleConfigParamsBean configParamsBean;
|
||||
|
||||
public void setConfigParamsBean(SimpleConfigParamsBean configParamsBean) {
|
||||
this.configParamsBean = configParamsBean;
|
||||
}
|
||||
|
||||
public SimpleConfigParamsBean getConfigParamsBean() {
|
||||
return configParamsBean;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,66 +1,66 @@
|
||||
package com.platform.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.platform.dao.DataInfoDao;
|
||||
import com.platform.dao.IRegionalismCodeDao;
|
||||
import com.platform.dao.ISystemCodeDao;
|
||||
import com.platform.entities.RegionalismEntity;
|
||||
import com.platform.entities.SystemEntity;
|
||||
import com.platform.service.ICodeService;
|
||||
|
||||
@Service(value = "codeService")
|
||||
public class CodeServiceImpl implements ICodeService {
|
||||
|
||||
@Resource(name = "systemCodeDao")
|
||||
private ISystemCodeDao systemCodeDao;
|
||||
|
||||
@Resource(name = "regionalismCodeDao")
|
||||
private IRegionalismCodeDao regionalismCodeDao;
|
||||
|
||||
@Override
|
||||
public List<SystemEntity> findSystem(SystemEntity sys) throws Exception {
|
||||
List<SystemEntity> result = null;
|
||||
try {
|
||||
result = new ArrayList<SystemEntity>();
|
||||
result = systemCodeDao.findSubSystem(sys);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RegionalismEntity> findRegionalism(RegionalismEntity region) throws Exception {
|
||||
List<RegionalismEntity> result = null;
|
||||
try {
|
||||
result = regionalismCodeDao.findSubRegionalism(region);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> findAll() throws Exception {
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
try {
|
||||
List<RegionalismEntity> regions = regionalismCodeDao.findAllRegionalism();
|
||||
List<SystemEntity> syss = systemCodeDao.findAllSystem();
|
||||
result.put("system", syss);
|
||||
result.put("regionalism", regions);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
package com.platform.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.platform.dao.DataInfoDao;
|
||||
import com.platform.dao.IRegionalismCodeDao;
|
||||
import com.platform.dao.ISystemCodeDao;
|
||||
import com.platform.entities.RegionalismEntity;
|
||||
import com.platform.entities.SystemEntity;
|
||||
import com.platform.service.ICodeService;
|
||||
|
||||
@Service(value = "codeService")
|
||||
public class CodeServiceImpl implements ICodeService {
|
||||
|
||||
@Resource(name = "systemCodeDao")
|
||||
private ISystemCodeDao systemCodeDao;
|
||||
|
||||
@Resource(name = "regionalismCodeDao")
|
||||
private IRegionalismCodeDao regionalismCodeDao;
|
||||
|
||||
@Override
|
||||
public List<SystemEntity> findSystem(SystemEntity sys) throws Exception {
|
||||
List<SystemEntity> result = null;
|
||||
try {
|
||||
result = new ArrayList<SystemEntity>();
|
||||
result = systemCodeDao.findSubSystem(sys);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RegionalismEntity> findRegionalism(RegionalismEntity region) throws Exception {
|
||||
List<RegionalismEntity> result = null;
|
||||
try {
|
||||
result = regionalismCodeDao.findSubRegionalism(region);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> findAll() throws Exception {
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
try {
|
||||
List<RegionalismEntity> regions = regionalismCodeDao.findAllRegionalism();
|
||||
List<SystemEntity> syss = systemCodeDao.findAllSystem();
|
||||
result.put("system", syss);
|
||||
result.put("regionalism", regions);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,56 +1,56 @@
|
||||
package com.platform.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.platform.dao.GatherOracleDao;
|
||||
import com.platform.entities.GatherOracleInfo;
|
||||
import com.platform.service.IMySqlService;
|
||||
|
||||
@Service(value = "mySqlService")
|
||||
public class MySqlServiceImpl implements IMySqlService{
|
||||
|
||||
@Resource(name = "gatherOracleDao")
|
||||
private GatherOracleDao gatherOracleDao;
|
||||
|
||||
@Override
|
||||
public List<GatherOracleInfo> findAllMySql() throws Exception {
|
||||
List<GatherOracleInfo> result = gatherOracleDao.selectAllOracle();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteMySql(int id) throws Exception {
|
||||
|
||||
int result = 0;
|
||||
if (id > 0) {
|
||||
// result = gatherOracleDao.deleteOracleById(id);
|
||||
GatherOracleInfo oracle = new GatherOracleInfo();
|
||||
oracle.setId(id);
|
||||
oracle.setRemove("1");
|
||||
result = gatherOracleDao.updateOracleById(oracle );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public int insertOracle(GatherOracleInfo oracle) throws Exception {
|
||||
int result = gatherOracleDao.insertOracle(oracle);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateOracle(GatherOracleInfo oracle) throws Exception {
|
||||
int result;
|
||||
if (oracle.getId() > 0) {
|
||||
result = gatherOracleDao.updateOracleById(oracle);
|
||||
}
|
||||
else {
|
||||
result = gatherOracleDao.insertOracle(oracle);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
package com.platform.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.platform.dao.GatherOracleDao;
|
||||
import com.platform.entities.GatherOracleInfo;
|
||||
import com.platform.service.IMySqlService;
|
||||
|
||||
@Service(value = "mySqlService")
|
||||
public class MySqlServiceImpl implements IMySqlService{
|
||||
|
||||
@Resource(name = "gatherOracleDao")
|
||||
private GatherOracleDao gatherOracleDao;
|
||||
|
||||
@Override
|
||||
public List<GatherOracleInfo> findAllMySql() throws Exception {
|
||||
List<GatherOracleInfo> result = gatherOracleDao.selectAllOracle();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteMySql(int id) throws Exception {
|
||||
|
||||
int result = 0;
|
||||
if (id > 0) {
|
||||
// result = gatherOracleDao.deleteOracleById(id);
|
||||
GatherOracleInfo oracle = new GatherOracleInfo();
|
||||
oracle.setId(id);
|
||||
oracle.setRemove("1");
|
||||
result = gatherOracleDao.updateOracleById(oracle );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public int insertOracle(GatherOracleInfo oracle) throws Exception {
|
||||
int result = gatherOracleDao.insertOracle(oracle);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateOracle(GatherOracleInfo oracle) throws Exception {
|
||||
int result;
|
||||
if (oracle.getId() > 0) {
|
||||
result = gatherOracleDao.updateOracleById(oracle);
|
||||
}
|
||||
else {
|
||||
result = gatherOracleDao.insertOracle(oracle);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,94 +1,94 @@
|
||||
package com.platform.service.impl;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.platform.entities.DataInfoEntity;
|
||||
import com.platform.entities.GatherOracleInfo;
|
||||
import com.platform.entities.OracleConnectorParams;
|
||||
import com.platform.oracle.OracleConnector;
|
||||
import com.platform.service.IOracleExtractService;
|
||||
import com.platform.service.OracleExtractHelper;
|
||||
import com.platform.utils.Bean2MapUtils;
|
||||
|
||||
@Service(value = "OracleExtract")
|
||||
public class OracleExtractServiceImpl implements IOracleExtractService {
|
||||
|
||||
/**
|
||||
* 抽取
|
||||
*/
|
||||
private OracleExtractHelper oracleExtract = new OracleExtractHelper();
|
||||
|
||||
/**
|
||||
* 数据库连接实现类
|
||||
*/
|
||||
private OracleConnector connect = new OracleConnector();
|
||||
|
||||
@Override
|
||||
public boolean extractOracle(String name, List<Map<String, String>> dataInfoMap,
|
||||
Map<String, String> oracleConnect) throws Exception {
|
||||
boolean isSuccess = false;
|
||||
try{
|
||||
//map转 bean(汇总库信息-带tableName的)
|
||||
GatherOracleInfo oracleModel = (GatherOracleInfo) Bean2MapUtils.convertMap(GatherOracleInfo.class, oracleConnect);
|
||||
|
||||
//采集库连接参数
|
||||
List<OracleConnectorParams> datainfos = new ArrayList<OracleConnectorParams>();
|
||||
for (Map<String, String> map : dataInfoMap) {
|
||||
OracleConnectorParams dataInfoEntity = (OracleConnectorParams) Bean2MapUtils.convertMap(OracleConnectorParams.class, oracleConnect);
|
||||
datainfos.add(dataInfoEntity);
|
||||
}
|
||||
|
||||
Connection conn = OracleConnector.ConnectionBuilder("jdbc:oracle:thin:@" + oracleModel.getIp() + ":" + oracleModel.getPort() + "/"
|
||||
+ oracleModel.getDatabaseName(), oracleModel.getUser(), oracleModel.getPassword());
|
||||
|
||||
for (OracleConnectorParams collectOracle : datainfos) {
|
||||
|
||||
oracleExtract.createDBLink(conn, collectOracle);
|
||||
oracleExtract.createTableSpace(conn, oracleModel);
|
||||
oracleExtract.createUser(conn, oracleModel);
|
||||
oracleExtract.extractColleDB(conn, collectOracle);
|
||||
}
|
||||
isSuccess = true;
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean extractOracle(String name, List<OracleConnectorParams> dataInfos, GatherOracleInfo oracleConnect) throws Exception {
|
||||
// boolean isSuccess = false;
|
||||
// try{
|
||||
// //map转 bean(汇总库信息-带tableName的)
|
||||
//// GatherOracleInfo oracleModel = (GatherOracleInfo) Bean2MapUtils.convertMap(GatherOracleInfo.class, oracleConnect);
|
||||
//
|
||||
// //采集库连接参数
|
||||
//// List<OracleConnectorParams> datainfos = new ArrayList<OracleConnectorParams>();
|
||||
//// for (Map<String, String> map : dataInfoMap) {
|
||||
//// OracleConnectorParams dataInfoEntity = (OracleConnectorParams) Bean2MapUtils.convertMap(OracleConnectorParams.class, oracleConnect);
|
||||
//// datainfos.add(dataInfoEntity);
|
||||
//// }
|
||||
//
|
||||
// Connection conn = OracleConnector.ConnectionBuilder("jdbc:oracle:thin:@" + oracleConnect.getIp() + ":" + oracleConnect.getPort() + "/"
|
||||
// + oracleConnect.getDatabaseName(), oracleConnect.getUser(), oracleConnect.getPassword());
|
||||
//
|
||||
// for (OracleConnectorParams collectOracle : dataInfos) {
|
||||
//
|
||||
// oracleExtract.createDBLink(conn, collectOracle);
|
||||
// oracleExtract.createTableSpace(conn, oracleConnect);
|
||||
// oracleExtract.createUser(conn, oracleConnect);
|
||||
// oracleExtract.extractColleDB(conn, collectOracle);
|
||||
// }
|
||||
// isSuccess = true;
|
||||
// }catch(Exception e){
|
||||
//
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
|
||||
}
|
||||
package com.platform.service.impl;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.platform.entities.DataInfoEntity;
|
||||
import com.platform.entities.GatherOracleInfo;
|
||||
import com.platform.entities.OracleConnectorParams;
|
||||
import com.platform.oracle.OracleConnector;
|
||||
import com.platform.service.IOracleExtractService;
|
||||
import com.platform.service.OracleExtractHelper;
|
||||
import com.platform.utils.Bean2MapUtils;
|
||||
|
||||
@Service(value = "OracleExtract")
|
||||
public class OracleExtractServiceImpl implements IOracleExtractService {
|
||||
|
||||
/**
|
||||
* 抽取
|
||||
*/
|
||||
private OracleExtractHelper oracleExtract = new OracleExtractHelper();
|
||||
|
||||
/**
|
||||
* 数据库连接实现类
|
||||
*/
|
||||
private OracleConnector connect = new OracleConnector();
|
||||
|
||||
@Override
|
||||
public boolean extractOracle(String name, List<Map<String, String>> dataInfoMap,
|
||||
Map<String, String> oracleConnect) throws Exception {
|
||||
boolean isSuccess = false;
|
||||
try{
|
||||
//map转 bean(汇总库信息-带tableName的)
|
||||
GatherOracleInfo oracleModel = (GatherOracleInfo) Bean2MapUtils.convertMap(GatherOracleInfo.class, oracleConnect);
|
||||
|
||||
//采集库连接参数
|
||||
List<OracleConnectorParams> datainfos = new ArrayList<OracleConnectorParams>();
|
||||
for (Map<String, String> map : dataInfoMap) {
|
||||
OracleConnectorParams dataInfoEntity = (OracleConnectorParams) Bean2MapUtils.convertMap(OracleConnectorParams.class, oracleConnect);
|
||||
datainfos.add(dataInfoEntity);
|
||||
}
|
||||
|
||||
Connection conn = OracleConnector.ConnectionBuilder("jdbc:oracle:thin:@" + oracleModel.getIp() + ":" + oracleModel.getPort() + "/"
|
||||
+ oracleModel.getDatabaseName(), oracleModel.getUser(), oracleModel.getPassword());
|
||||
|
||||
for (OracleConnectorParams collectOracle : datainfos) {
|
||||
|
||||
oracleExtract.createDBLink(conn, collectOracle);
|
||||
oracleExtract.createTableSpace(conn, oracleModel);
|
||||
oracleExtract.createUser(conn, oracleModel);
|
||||
oracleExtract.extractColleDB(conn, collectOracle);
|
||||
}
|
||||
isSuccess = true;
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean extractOracle(String name, List<OracleConnectorParams> dataInfos, GatherOracleInfo oracleConnect) throws Exception {
|
||||
// boolean isSuccess = false;
|
||||
// try{
|
||||
// //map转 bean(汇总库信息-带tableName的)
|
||||
//// GatherOracleInfo oracleModel = (GatherOracleInfo) Bean2MapUtils.convertMap(GatherOracleInfo.class, oracleConnect);
|
||||
//
|
||||
// //采集库连接参数
|
||||
//// List<OracleConnectorParams> datainfos = new ArrayList<OracleConnectorParams>();
|
||||
//// for (Map<String, String> map : dataInfoMap) {
|
||||
//// OracleConnectorParams dataInfoEntity = (OracleConnectorParams) Bean2MapUtils.convertMap(OracleConnectorParams.class, oracleConnect);
|
||||
//// datainfos.add(dataInfoEntity);
|
||||
//// }
|
||||
//
|
||||
// Connection conn = OracleConnector.ConnectionBuilder("jdbc:oracle:thin:@" + oracleConnect.getIp() + ":" + oracleConnect.getPort() + "/"
|
||||
// + oracleConnect.getDatabaseName(), oracleConnect.getUser(), oracleConnect.getPassword());
|
||||
//
|
||||
// for (OracleConnectorParams collectOracle : dataInfos) {
|
||||
//
|
||||
// oracleExtract.createDBLink(conn, collectOracle);
|
||||
// oracleExtract.createTableSpace(conn, oracleConnect);
|
||||
// oracleExtract.createUser(conn, oracleConnect);
|
||||
// oracleExtract.extractColleDB(conn, collectOracle);
|
||||
// }
|
||||
// isSuccess = true;
|
||||
// }catch(Exception e){
|
||||
//
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
|
||||
}
|
||||
|
@ -1,47 +1,47 @@
|
||||
package com.platform.service.thread;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.platform.dao.DataInfoMoveTmpDao;
|
||||
import com.platform.entities.DataInfoEntityMoveTmp;
|
||||
import com.platform.service.IMoveDataService;
|
||||
import com.platform.service.impl.MoveDataServiceImpl;
|
||||
import com.platform.utils.Constant;
|
||||
|
||||
public class TreadMoveData2Start extends Thread{
|
||||
|
||||
|
||||
private IMoveDataService dataInfoMove= new MoveDataServiceImpl();
|
||||
|
||||
public TreadMoveData2Start() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
boolean isBreak = false;
|
||||
while(true){
|
||||
if (isBreak) {
|
||||
break;
|
||||
}
|
||||
try {
|
||||
List<DataInfoEntityMoveTmp> resultlist = dataInfoMove.findAll();
|
||||
for (DataInfoEntityMoveTmp moveEntity : resultlist) {
|
||||
if ("1".equals(moveEntity.getCompleteStatus())) {
|
||||
moveEntity.setCompleteStatus("3");
|
||||
dataInfoMove.update(moveEntity);
|
||||
}
|
||||
}
|
||||
isBreak = true;
|
||||
Thread.sleep(Constant.update_dataInfo_sleep_time);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
package com.platform.service.thread;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.platform.dao.DataInfoMoveTmpDao;
|
||||
import com.platform.entities.DataInfoEntityMoveTmp;
|
||||
import com.platform.service.IMoveDataService;
|
||||
import com.platform.service.impl.MoveDataServiceImpl;
|
||||
import com.platform.utils.Constant;
|
||||
|
||||
public class TreadMoveData2Start extends Thread{
|
||||
|
||||
|
||||
private IMoveDataService dataInfoMove= new MoveDataServiceImpl();
|
||||
|
||||
public TreadMoveData2Start() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
boolean isBreak = false;
|
||||
while(true){
|
||||
if (isBreak) {
|
||||
break;
|
||||
}
|
||||
try {
|
||||
List<DataInfoEntityMoveTmp> resultlist = dataInfoMove.findAll();
|
||||
for (DataInfoEntityMoveTmp moveEntity : resultlist) {
|
||||
if ("1".equals(moveEntity.getCompleteStatus())) {
|
||||
moveEntity.setCompleteStatus("3");
|
||||
dataInfoMove.update(moveEntity);
|
||||
}
|
||||
}
|
||||
isBreak = true;
|
||||
Thread.sleep(Constant.update_dataInfo_sleep_time);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,87 +1,87 @@
|
||||
package com.platform.utils;
|
||||
|
||||
import java.beans.BeanInfo;
|
||||
import java.beans.IntrospectionException;
|
||||
import java.beans.Introspector;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Bean2MapUtils {
|
||||
|
||||
/**
|
||||
* 将一个 Map 对象转化为一个 JavaBean
|
||||
* @param type 要转化的类型
|
||||
* @param map 包含属性值的 map
|
||||
* @return 转化出来的 JavaBean 对象
|
||||
* @throws IntrospectionException
|
||||
* 如果分析类属性失败
|
||||
* @throws IllegalAccessException
|
||||
* 如果实例化 JavaBean 失败
|
||||
* @throws InstantiationException
|
||||
* 如果实例化 JavaBean 失败
|
||||
* @throws InvocationTargetException
|
||||
* 如果调用属性的 setter 方法失败
|
||||
*/
|
||||
public static Object convertMap(Class type, Map map)
|
||||
throws IntrospectionException, IllegalAccessException,
|
||||
InstantiationException, InvocationTargetException {
|
||||
BeanInfo beanInfo = Introspector.getBeanInfo(type); // 获取类属性
|
||||
Object obj = type.newInstance(); // 创建 JavaBean 对象
|
||||
|
||||
// 给 JavaBean 对象的属性赋值
|
||||
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
|
||||
for (int i = 0; i< propertyDescriptors.length; i++) {
|
||||
PropertyDescriptor descriptor = propertyDescriptors[i];
|
||||
String propertyName = descriptor.getName();
|
||||
try{
|
||||
if (map.containsKey(propertyName)) {
|
||||
// 下面一句可以 try 起来,这样当一个属性赋值失败的时候就不会影响其他属性赋值。
|
||||
Object value = map.get(propertyName);
|
||||
|
||||
Object[] args = new Object[1];
|
||||
args[0] = value;
|
||||
|
||||
descriptor.getWriteMethod().invoke(obj, args);
|
||||
}
|
||||
}
|
||||
catch(Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将一个 JavaBean 对象转化为一个 Map
|
||||
* @param bean 要转化的JavaBean 对象
|
||||
* @return 转化出来的 Map 对象
|
||||
* @throws IntrospectionException 如果分析类属性失败
|
||||
* @throws IllegalAccessException 如果实例化 JavaBean 失败
|
||||
* @throws InvocationTargetException 如果调用属性的 setter 方法失败
|
||||
*/
|
||||
public static Map convertBean(Object bean)
|
||||
throws IntrospectionException, IllegalAccessException, InvocationTargetException {
|
||||
Class type = bean.getClass();
|
||||
Map returnMap = new HashMap();
|
||||
BeanInfo beanInfo = Introspector.getBeanInfo(type);
|
||||
|
||||
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
|
||||
for (int i = 0; i< propertyDescriptors.length; i++) {
|
||||
PropertyDescriptor descriptor = propertyDescriptors[i];
|
||||
String propertyName = descriptor.getName();
|
||||
if (!propertyName.equals("class")) {
|
||||
Method readMethod = descriptor.getReadMethod();
|
||||
Object result = readMethod.invoke(bean, new Object[0]);
|
||||
if (result != null) {
|
||||
returnMap.put(propertyName, result);
|
||||
} else {
|
||||
returnMap.put(propertyName, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnMap;
|
||||
}
|
||||
}
|
||||
package com.platform.utils;
|
||||
|
||||
import java.beans.BeanInfo;
|
||||
import java.beans.IntrospectionException;
|
||||
import java.beans.Introspector;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Bean2MapUtils {
|
||||
|
||||
/**
|
||||
* 将一个 Map 对象转化为一个 JavaBean
|
||||
* @param type 要转化的类型
|
||||
* @param map 包含属性值的 map
|
||||
* @return 转化出来的 JavaBean 对象
|
||||
* @throws IntrospectionException
|
||||
* 如果分析类属性失败
|
||||
* @throws IllegalAccessException
|
||||
* 如果实例化 JavaBean 失败
|
||||
* @throws InstantiationException
|
||||
* 如果实例化 JavaBean 失败
|
||||
* @throws InvocationTargetException
|
||||
* 如果调用属性的 setter 方法失败
|
||||
*/
|
||||
public static Object convertMap(Class type, Map map)
|
||||
throws IntrospectionException, IllegalAccessException,
|
||||
InstantiationException, InvocationTargetException {
|
||||
BeanInfo beanInfo = Introspector.getBeanInfo(type); // 获取类属性
|
||||
Object obj = type.newInstance(); // 创建 JavaBean 对象
|
||||
|
||||
// 给 JavaBean 对象的属性赋值
|
||||
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
|
||||
for (int i = 0; i< propertyDescriptors.length; i++) {
|
||||
PropertyDescriptor descriptor = propertyDescriptors[i];
|
||||
String propertyName = descriptor.getName();
|
||||
try{
|
||||
if (map.containsKey(propertyName)) {
|
||||
// 下面一句可以 try 起来,这样当一个属性赋值失败的时候就不会影响其他属性赋值。
|
||||
Object value = map.get(propertyName);
|
||||
|
||||
Object[] args = new Object[1];
|
||||
args[0] = value;
|
||||
|
||||
descriptor.getWriteMethod().invoke(obj, args);
|
||||
}
|
||||
}
|
||||
catch(Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将一个 JavaBean 对象转化为一个 Map
|
||||
* @param bean 要转化的JavaBean 对象
|
||||
* @return 转化出来的 Map 对象
|
||||
* @throws IntrospectionException 如果分析类属性失败
|
||||
* @throws IllegalAccessException 如果实例化 JavaBean 失败
|
||||
* @throws InvocationTargetException 如果调用属性的 setter 方法失败
|
||||
*/
|
||||
public static Map convertBean(Object bean)
|
||||
throws IntrospectionException, IllegalAccessException, InvocationTargetException {
|
||||
Class type = bean.getClass();
|
||||
Map returnMap = new HashMap();
|
||||
BeanInfo beanInfo = Introspector.getBeanInfo(type);
|
||||
|
||||
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
|
||||
for (int i = 0; i< propertyDescriptors.length; i++) {
|
||||
PropertyDescriptor descriptor = propertyDescriptors[i];
|
||||
String propertyName = descriptor.getName();
|
||||
if (!propertyName.equals("class")) {
|
||||
Method readMethod = descriptor.getReadMethod();
|
||||
Object result = readMethod.invoke(bean, new Object[0]);
|
||||
if (result != null) {
|
||||
returnMap.put(propertyName, result);
|
||||
} else {
|
||||
returnMap.put(propertyName, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnMap;
|
||||
}
|
||||
}
|
||||
|
@ -1,39 +1,39 @@
|
||||
package com.platform.utils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.platform.entities.FolderNode;
|
||||
import com.platform.entities.VolumeEntity;
|
||||
|
||||
public class CacheTreeData {
|
||||
|
||||
private static List<FolderNode> folders = null;
|
||||
|
||||
private static List<VolumeEntity> volumeList = null;
|
||||
|
||||
public static List<FolderNode> getFolders() {
|
||||
return folders;
|
||||
}
|
||||
|
||||
public static void setFolders(List<FolderNode> folders) {
|
||||
CacheTreeData.folders = folders;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the volumeList
|
||||
*/
|
||||
public static List<VolumeEntity> getVolumeList() {
|
||||
return volumeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param volumeList the volumeList to set
|
||||
*/
|
||||
public static void setVolumeList(List<VolumeEntity> volumeList) {
|
||||
CacheTreeData.volumeList = volumeList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
package com.platform.utils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.platform.entities.FolderNode;
|
||||
import com.platform.entities.VolumeEntity;
|
||||
|
||||
public class CacheTreeData {
|
||||
|
||||
private static List<FolderNode> folders = null;
|
||||
|
||||
private static List<VolumeEntity> volumeList = null;
|
||||
|
||||
public static List<FolderNode> getFolders() {
|
||||
return folders;
|
||||
}
|
||||
|
||||
public static void setFolders(List<FolderNode> folders) {
|
||||
CacheTreeData.folders = folders;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the volumeList
|
||||
*/
|
||||
public static List<VolumeEntity> getVolumeList() {
|
||||
return volumeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param volumeList the volumeList to set
|
||||
*/
|
||||
public static void setVolumeList(List<VolumeEntity> volumeList) {
|
||||
CacheTreeData.volumeList = volumeList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,84 +1,84 @@
|
||||
package com.platform.utils;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
public class ConfigLoder {
|
||||
private String configPath;
|
||||
private volatile static ConfigLoder configLoder;
|
||||
|
||||
private ConfigLoder(String configPath) {
|
||||
this.configPath = configPath;
|
||||
}
|
||||
|
||||
public static ConfigLoder Builder(String configPtah) {
|
||||
if (null == configLoder) {
|
||||
synchronized (ConfigLoder.class) {
|
||||
if (null == configLoder)
|
||||
configLoder = new ConfigLoder(configPtah);
|
||||
}
|
||||
}
|
||||
return configLoder;
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取文Property中的属性值
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public String getProperty(String key) {
|
||||
String value = null;
|
||||
if (StringUtils.isEmpty(key))
|
||||
return value;
|
||||
|
||||
try {
|
||||
InputStream is = new BufferedInputStream(new FileInputStream(
|
||||
new File(configPath)));
|
||||
Properties properties = new Properties();
|
||||
properties.load(is);
|
||||
value = properties.getProperty(key);
|
||||
} catch (FileNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public Properties getProperties() {
|
||||
Properties properties = null;
|
||||
try {
|
||||
InputStream is;
|
||||
properties = new Properties();
|
||||
is = new BufferedInputStream(new FileInputStream(new File(
|
||||
configPath)));
|
||||
properties.load(is);
|
||||
} catch (FileNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
public String getConfigPath() {
|
||||
return configPath;
|
||||
}
|
||||
|
||||
public void setConfigPath(String configPath) {
|
||||
this.configPath = configPath;
|
||||
}
|
||||
|
||||
}
|
||||
package com.platform.utils;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
public class ConfigLoder {
|
||||
private String configPath;
|
||||
private volatile static ConfigLoder configLoder;
|
||||
|
||||
private ConfigLoder(String configPath) {
|
||||
this.configPath = configPath;
|
||||
}
|
||||
|
||||
public static ConfigLoder Builder(String configPtah) {
|
||||
if (null == configLoder) {
|
||||
synchronized (ConfigLoder.class) {
|
||||
if (null == configLoder)
|
||||
configLoder = new ConfigLoder(configPtah);
|
||||
}
|
||||
}
|
||||
return configLoder;
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取文Property中的属性值
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public String getProperty(String key) {
|
||||
String value = null;
|
||||
if (StringUtils.isEmpty(key))
|
||||
return value;
|
||||
|
||||
try {
|
||||
InputStream is = new BufferedInputStream(new FileInputStream(
|
||||
new File(configPath)));
|
||||
Properties properties = new Properties();
|
||||
properties.load(is);
|
||||
value = properties.getProperty(key);
|
||||
} catch (FileNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public Properties getProperties() {
|
||||
Properties properties = null;
|
||||
try {
|
||||
InputStream is;
|
||||
properties = new Properties();
|
||||
is = new BufferedInputStream(new FileInputStream(new File(
|
||||
configPath)));
|
||||
properties.load(is);
|
||||
} catch (FileNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
public String getConfigPath() {
|
||||
return configPath;
|
||||
}
|
||||
|
||||
public void setConfigPath(String configPath) {
|
||||
this.configPath = configPath;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,84 +1,84 @@
|
||||
package com.platform.utils;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
public class ConfigPropertyReader {
|
||||
private String configPath;
|
||||
private volatile static ConfigPropertyReader configLoder;
|
||||
|
||||
private ConfigPropertyReader(String configPath) {
|
||||
this.configPath = configPath;
|
||||
}
|
||||
|
||||
public static ConfigPropertyReader Builder(String configPtah) {
|
||||
if (null == configLoder) {
|
||||
synchronized (ConfigPropertyReader.class) {
|
||||
if (null == configLoder)
|
||||
configLoder = new ConfigPropertyReader(configPtah);
|
||||
}
|
||||
}
|
||||
return configLoder;
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取文Property中的属性值
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public synchronized String getProperty(String key) {
|
||||
String value = null;
|
||||
if (StringUtils.isEmpty(key))
|
||||
return value;
|
||||
|
||||
try {
|
||||
InputStream is = new BufferedInputStream(new FileInputStream(
|
||||
new File(configPath)));
|
||||
Properties properties = new Properties();
|
||||
properties.load(is);
|
||||
value = properties.getProperty(key);
|
||||
} catch (FileNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public Properties getProperties() {
|
||||
Properties properties = null;
|
||||
try {
|
||||
InputStream is;
|
||||
properties = new Properties();
|
||||
is = new BufferedInputStream(new FileInputStream(new File(
|
||||
configPath)));
|
||||
properties.load(is);
|
||||
} catch (FileNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
public String getConfigPath() {
|
||||
return configPath;
|
||||
}
|
||||
|
||||
public void setConfigPath(String configPath) {
|
||||
this.configPath = configPath;
|
||||
}
|
||||
|
||||
}
|
||||
package com.platform.utils;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
public class ConfigPropertyReader {
|
||||
private String configPath;
|
||||
private volatile static ConfigPropertyReader configLoder;
|
||||
|
||||
private ConfigPropertyReader(String configPath) {
|
||||
this.configPath = configPath;
|
||||
}
|
||||
|
||||
public static ConfigPropertyReader Builder(String configPtah) {
|
||||
if (null == configLoder) {
|
||||
synchronized (ConfigPropertyReader.class) {
|
||||
if (null == configLoder)
|
||||
configLoder = new ConfigPropertyReader(configPtah);
|
||||
}
|
||||
}
|
||||
return configLoder;
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取文Property中的属性值
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public synchronized String getProperty(String key) {
|
||||
String value = null;
|
||||
if (StringUtils.isEmpty(key))
|
||||
return value;
|
||||
|
||||
try {
|
||||
InputStream is = new BufferedInputStream(new FileInputStream(
|
||||
new File(configPath)));
|
||||
Properties properties = new Properties();
|
||||
properties.load(is);
|
||||
value = properties.getProperty(key);
|
||||
} catch (FileNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public Properties getProperties() {
|
||||
Properties properties = null;
|
||||
try {
|
||||
InputStream is;
|
||||
properties = new Properties();
|
||||
is = new BufferedInputStream(new FileInputStream(new File(
|
||||
configPath)));
|
||||
properties.load(is);
|
||||
} catch (FileNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
public String getConfigPath() {
|
||||
return configPath;
|
||||
}
|
||||
|
||||
public void setConfigPath(String configPath) {
|
||||
this.configPath = configPath;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,52 +1,52 @@
|
||||
package com.platform.utils;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class Configs {
|
||||
|
||||
/** 全局自定义异常--编码 */
|
||||
public static final String GLOBAL_EXP_CUSTOM = "3001001001";
|
||||
|
||||
/** 全局非自定义异常--编码 */
|
||||
public static final String GLOBAL_EXP_NOT_CUSTOM = "3001001002";
|
||||
|
||||
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 DAILY_ROLLING_LOGGER = Logger
|
||||
.getLogger("dailyRollingFile");
|
||||
|
||||
public static final Logger DAILY_LOGGER = Logger.getLogger("railyFile");
|
||||
|
||||
public static final Logger LOGGER = Logger.getLogger(Configs.class);
|
||||
|
||||
public static String KUBE_MASTER_URL = "http://192.168.0.113:8080/"; // kubernetes集群的maser
|
||||
// URl
|
||||
|
||||
public static int ORACLE_DEFAULT_PORT = 1521; // oracle的默认端口号
|
||||
|
||||
public static String COLLECT_USER_NAME = "system"; //采集统一的登入用户名
|
||||
|
||||
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 GATHER_SERVICE_NAME = "orcl"; //汇总库的服务名
|
||||
|
||||
public static String TABLE_SUFFIX = "_20152016"; //汇总库汇总表的后缀名
|
||||
|
||||
public static String EXTRACT_LOG_LOCALTION = "/home/log"; //数据汇总日志保存位置
|
||||
|
||||
public static String GATHER_TABLESPACE_NAME=""; //表空间名
|
||||
|
||||
public static String GATHER_TABLESPACE_PATH=""; //表空间路径
|
||||
|
||||
public static String GATHER_TABLE_PASSWORD=""; //登入密码
|
||||
}
|
||||
package com.platform.utils;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class Configs {
|
||||
|
||||
/** 全局自定义异常--编码 */
|
||||
public static final String GLOBAL_EXP_CUSTOM = "3001001001";
|
||||
|
||||
/** 全局非自定义异常--编码 */
|
||||
public static final String GLOBAL_EXP_NOT_CUSTOM = "3001001002";
|
||||
|
||||
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 DAILY_ROLLING_LOGGER = Logger
|
||||
.getLogger("dailyRollingFile");
|
||||
|
||||
public static final Logger DAILY_LOGGER = Logger.getLogger("railyFile");
|
||||
|
||||
public static final Logger LOGGER = Logger.getLogger(Configs.class);
|
||||
|
||||
public static String KUBE_MASTER_URL = "http://192.168.0.113:8080/"; // kubernetes集群的maser
|
||||
// URl
|
||||
|
||||
public static int ORACLE_DEFAULT_PORT = 1521; // oracle的默认端口号
|
||||
|
||||
public static String COLLECT_USER_NAME = "system"; //采集统一的登入用户名
|
||||
|
||||
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 GATHER_SERVICE_NAME = "orcl"; //汇总库的服务名
|
||||
|
||||
public static String TABLE_SUFFIX = "_20152016"; //汇总库汇总表的后缀名
|
||||
|
||||
public static String EXTRACT_LOG_LOCALTION = "/home/log"; //数据汇总日志保存位置
|
||||
|
||||
public static String GATHER_TABLESPACE_NAME=""; //表空间名
|
||||
|
||||
public static String GATHER_TABLESPACE_PATH=""; //表空间路径
|
||||
|
||||
public static String GATHER_TABLE_PASSWORD=""; //登入密码
|
||||
}
|
||||
|
@ -1,74 +1,74 @@
|
||||
package com.platform.utils;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
|
||||
public class ConfigsLoader implements ServletContextListener {
|
||||
private static ConfigPropertyReader cReader = null;
|
||||
|
||||
@Override
|
||||
public void contextDestroyed(ServletContextEvent sEvent) {
|
||||
// TODO Auto-generated method stub
|
||||
Configs.CONSOLE_LOGGER.info("系统停止..");
|
||||
}
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
@Override
|
||||
public void contextInitialized(ServletContextEvent sEvent) {
|
||||
// TODO Auto-generated method stub
|
||||
Configs.CONSOLE_LOGGER.info("系统初始化..");
|
||||
String contextPath = sEvent.getServletContext().getRealPath("/")
|
||||
+ "WEB-INF/config/config.properties";
|
||||
this.cReader = ConfigPropertyReader.Builder(contextPath);
|
||||
init();
|
||||
new ThreadVolume("").start();
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
Properties properties = cReader.getProperties();
|
||||
|
||||
Configs.KUBE_MASTER_URL = properties.getProperty("kubeMasterUrl");
|
||||
|
||||
Configs.COLLECT_USER_NAME = properties.getProperty("collect-user-name");
|
||||
|
||||
Configs.COLLECT_PASSWORD = properties.getProperty("collect-password");
|
||||
|
||||
Configs.COLLECT_SERVICE_NAME = properties
|
||||
.getProperty("collect-service-name");
|
||||
|
||||
Configs.GATHER_USER_NAME = properties.getProperty("gather-user-name");
|
||||
|
||||
Configs.GATHER_USER_PASSWORD = properties
|
||||
.getProperty("gather-user-password");
|
||||
|
||||
Configs.GATHER_PORT = properties.getProperty("gather-port");
|
||||
|
||||
Configs.GATHER_SERVICE_NAME = properties
|
||||
.getProperty("gather-service-name");
|
||||
|
||||
Configs.TABLE_SUFFIX = properties.getProperty("table-suffix");
|
||||
|
||||
Configs.EXTRACT_LOG_LOCALTION = properties
|
||||
.getProperty("extract-log-localtion");
|
||||
|
||||
Configs.GATHER_TABLESPACE_NAME = properties
|
||||
.getProperty("gather-tablespace-name");
|
||||
|
||||
Configs.GATHER_TABLESPACE_PATH = properties
|
||||
.getProperty("gather-tablespace-path");
|
||||
|
||||
Configs.GATHER_TABLE_PASSWORD=properties.getProperty("gather-table-user-password");
|
||||
}
|
||||
|
||||
public ConfigPropertyReader getcReader() {
|
||||
return cReader;
|
||||
}
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
public void setcReader(ConfigPropertyReader cReader) {
|
||||
this.cReader = cReader;
|
||||
}
|
||||
|
||||
}
|
||||
package com.platform.utils;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
|
||||
public class ConfigsLoader implements ServletContextListener {
|
||||
private static ConfigPropertyReader cReader = null;
|
||||
|
||||
@Override
|
||||
public void contextDestroyed(ServletContextEvent sEvent) {
|
||||
// TODO Auto-generated method stub
|
||||
Configs.CONSOLE_LOGGER.info("系统停止..");
|
||||
}
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
@Override
|
||||
public void contextInitialized(ServletContextEvent sEvent) {
|
||||
// TODO Auto-generated method stub
|
||||
Configs.CONSOLE_LOGGER.info("系统初始化..");
|
||||
String contextPath = sEvent.getServletContext().getRealPath("/")
|
||||
+ "WEB-INF/config/config.properties";
|
||||
this.cReader = ConfigPropertyReader.Builder(contextPath);
|
||||
init();
|
||||
new ThreadVolume("").start();
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
Properties properties = cReader.getProperties();
|
||||
|
||||
Configs.KUBE_MASTER_URL = properties.getProperty("kubeMasterUrl");
|
||||
|
||||
Configs.COLLECT_USER_NAME = properties.getProperty("collect-user-name");
|
||||
|
||||
Configs.COLLECT_PASSWORD = properties.getProperty("collect-password");
|
||||
|
||||
Configs.COLLECT_SERVICE_NAME = properties
|
||||
.getProperty("collect-service-name");
|
||||
|
||||
Configs.GATHER_USER_NAME = properties.getProperty("gather-user-name");
|
||||
|
||||
Configs.GATHER_USER_PASSWORD = properties
|
||||
.getProperty("gather-user-password");
|
||||
|
||||
Configs.GATHER_PORT = properties.getProperty("gather-port");
|
||||
|
||||
Configs.GATHER_SERVICE_NAME = properties
|
||||
.getProperty("gather-service-name");
|
||||
|
||||
Configs.TABLE_SUFFIX = properties.getProperty("table-suffix");
|
||||
|
||||
Configs.EXTRACT_LOG_LOCALTION = properties
|
||||
.getProperty("extract-log-localtion");
|
||||
|
||||
Configs.GATHER_TABLESPACE_NAME = properties
|
||||
.getProperty("gather-tablespace-name");
|
||||
|
||||
Configs.GATHER_TABLESPACE_PATH = properties
|
||||
.getProperty("gather-tablespace-path");
|
||||
|
||||
Configs.GATHER_TABLE_PASSWORD=properties.getProperty("gather-table-user-password");
|
||||
}
|
||||
|
||||
public ConfigPropertyReader getcReader() {
|
||||
return cReader;
|
||||
}
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
public void setcReader(ConfigPropertyReader cReader) {
|
||||
this.cReader = cReader;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,49 +1,49 @@
|
||||
|
||||
package com.platform.utils;
|
||||
|
||||
|
||||
public class Constant {
|
||||
public static String rootUser = "root";
|
||||
public static String rootPasswd = "root";
|
||||
public static String hostIp = "192.168.0.116";
|
||||
// public static String hostIp = "192.168.1.105";
|
||||
public static int port = 22;
|
||||
public static String glusterPeerStatus = "gluster peer status";
|
||||
public static String glusterVolumeInfo = "gluster volume info ";
|
||||
public static String df = "df -k ";
|
||||
public static String peerincluster_connected = "PeerinCluster(Connected)";
|
||||
public static String peerincluster_disconnected = "PeerinCluster(Disconnected)";
|
||||
public static String peerNotinCluster = "PeerNotinCluster";
|
||||
public static String distributed = "distributed";
|
||||
public static String replica = "replica";
|
||||
public static String stripe = "stripe";
|
||||
public static String noVolume = "No volumes present";
|
||||
public static String success = "success";
|
||||
public static String failed = "failed";
|
||||
public static String noSuchFile = "No such file or directory";
|
||||
public static GanymedSSH ganymedSSH = new GanymedSSH(hostIp, rootUser, rootPasswd, port);
|
||||
public static String fileGetTreeData = "WebContent\\WEB-INF\\config\\getTreedata.sh";
|
||||
public static String AutoMountfile="/gfsAutoMount/AutoRun.sh";
|
||||
public static String MountRecord="/gfsAutoMount/mountPoint.record";
|
||||
public static String strGetTreeData = "function ergodic(){\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 "
|
||||
+ "echo \\$path \n fi\n done\n}\n\nIFS=\\$\\'\\n\\' "
|
||||
+ "#这个必须要,否则会在文件名中有空格时出错\nINIT_PATH=\".\";\nergodic \\$1\n";
|
||||
|
||||
/**
|
||||
* volume 获取的线程休眠时间
|
||||
*/
|
||||
public final static int moveFileMaxNum = 1;
|
||||
|
||||
/**
|
||||
* volume 获取的线程休眠时间
|
||||
*/
|
||||
public final static int get_volume_sleep_time = 180000;
|
||||
|
||||
/**
|
||||
* volume 获取的线程休眠时间
|
||||
*/
|
||||
public final static int update_dataInfo_sleep_time = 30000;
|
||||
|
||||
}
|
||||
|
||||
package com.platform.utils;
|
||||
|
||||
|
||||
public class Constant {
|
||||
public static String rootUser = "root";
|
||||
public static String rootPasswd = "root";
|
||||
public static String hostIp = "192.168.0.110";
|
||||
// public static String hostIp = "192.168.1.105";
|
||||
public static int port = 22;
|
||||
public static String glusterPeerStatus = "gluster peer status";
|
||||
public static String glusterVolumeInfo = "gluster volume info ";
|
||||
public static String df = "df -k ";
|
||||
public static String peerincluster_connected = "PeerinCluster(Connected)";
|
||||
public static String peerincluster_disconnected = "PeerinCluster(Disconnected)";
|
||||
public static String peerNotinCluster = "PeerNotinCluster";
|
||||
public static String distributed = "distributed";
|
||||
public static String replica = "replica";
|
||||
public static String stripe = "stripe";
|
||||
public static String noVolume = "No volumes present";
|
||||
public static String success = "success";
|
||||
public static String failed = "failed";
|
||||
public static String noSuchFile = "No such file or directory";
|
||||
public static GanymedSSH ganymedSSH = new GanymedSSH(hostIp, rootUser, rootPasswd, port);
|
||||
public static String fileGetTreeData = "WebContent\\WEB-INF\\config\\getTreedata.sh";
|
||||
public static String AutoMountfile="/gfsAutoMount/AutoRun.sh";
|
||||
public static String MountRecord="/gfsAutoMount/mountPoint.record";
|
||||
public static String strGetTreeData = "function ergodic(){\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 "
|
||||
+ "echo \\$path \n fi\n done\n}\n\nIFS=\\$\\'\\n\\' "
|
||||
+ "#这个必须要,否则会在文件名中有空格时出错\nINIT_PATH=\".\";\nergodic \\$1\n";
|
||||
|
||||
/**
|
||||
* volume 获取的线程休眠时间
|
||||
*/
|
||||
public final static int moveFileMaxNum = 1;
|
||||
|
||||
/**
|
||||
* volume 获取的线程休眠时间
|
||||
*/
|
||||
public final static int get_volume_sleep_time = 600000;
|
||||
|
||||
/**
|
||||
* volume 获取的线程休眠时间
|
||||
*/
|
||||
public final static int update_dataInfo_sleep_time = 30000;
|
||||
|
||||
}
|
||||
|
@ -1,137 +1,137 @@
|
||||
package com.platform.utils;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class DateForm {
|
||||
|
||||
private static final String date_format_second = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
private static final String date_format_second_non = "yyyy-MM-dd_HH-mm-ss";
|
||||
|
||||
private static final String data_format_min = "yyyy-MM-dd HH:mm";
|
||||
|
||||
private static final String data_format_day = "yyyy-MM-dd";
|
||||
|
||||
private static ThreadLocal<DateFormat> threadLocal_second = new ThreadLocal<DateFormat>();
|
||||
|
||||
private static ThreadLocal<DateFormat> threadLocal_second_non = new ThreadLocal<DateFormat>();
|
||||
|
||||
private static ThreadLocal<DateFormat> threadLocal_min = new ThreadLocal<DateFormat>();
|
||||
|
||||
private static ThreadLocal<DateFormat> threadLocal_day = new ThreadLocal<DateFormat>();
|
||||
|
||||
public static String date2StringBysecond(Date date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
DateFormat format = threadLocal_second.get();
|
||||
if(format == null){
|
||||
format = new SimpleDateFormat(date_format_second);
|
||||
threadLocal_second.set(format);
|
||||
}
|
||||
return format.format(date);
|
||||
}
|
||||
|
||||
public static String date2StringBysecondNon(Date date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
DateFormat format = threadLocal_second_non.get();
|
||||
if(format == null){
|
||||
format = new SimpleDateFormat(date_format_second_non);
|
||||
threadLocal_second_non.set(format);
|
||||
}
|
||||
return format.format(date);
|
||||
}
|
||||
|
||||
public static String date2StringByMin(Date date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
DateFormat format = threadLocal_min.get();
|
||||
if(format == null){
|
||||
format = new SimpleDateFormat(data_format_min);
|
||||
threadLocal_min.set(format);
|
||||
}
|
||||
return format.format(date);
|
||||
}
|
||||
|
||||
public static String date2StringByDay(Date date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
DateFormat format = threadLocal_day.get();
|
||||
if(format == null){
|
||||
format = new SimpleDateFormat(data_format_day);
|
||||
threadLocal_day.set(format);
|
||||
}
|
||||
return format.format(date);
|
||||
}
|
||||
|
||||
public static Date string2DateBysecond(String date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
date = date.trim();
|
||||
if (date.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
DateFormat format = threadLocal_second.get();
|
||||
try {
|
||||
if(format == null){
|
||||
format = new SimpleDateFormat(date_format_second);
|
||||
threadLocal_second.set(format);
|
||||
}
|
||||
return format.parse(date);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Date string2DateByMin(String date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
date = date.trim();
|
||||
if (date.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
DateFormat format = threadLocal_min.get();
|
||||
try {
|
||||
if(format == null){
|
||||
format = new SimpleDateFormat(data_format_min);
|
||||
threadLocal_min.set(format);
|
||||
}
|
||||
return format.parse(date);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Date string2DateByDay(String date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
date = date.trim();
|
||||
if (date.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
DateFormat format = threadLocal_day.get();
|
||||
try {
|
||||
if(format == null){
|
||||
format = new SimpleDateFormat(data_format_day);
|
||||
threadLocal_day.set(format);
|
||||
}
|
||||
return format.parse(date);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
package com.platform.utils;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class DateForm {
|
||||
|
||||
private static final String date_format_second = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
private static final String date_format_second_non = "yyyy-MM-dd_HH-mm-ss";
|
||||
|
||||
private static final String data_format_min = "yyyy-MM-dd HH:mm";
|
||||
|
||||
private static final String data_format_day = "yyyy-MM-dd";
|
||||
|
||||
private static ThreadLocal<DateFormat> threadLocal_second = new ThreadLocal<DateFormat>();
|
||||
|
||||
private static ThreadLocal<DateFormat> threadLocal_second_non = new ThreadLocal<DateFormat>();
|
||||
|
||||
private static ThreadLocal<DateFormat> threadLocal_min = new ThreadLocal<DateFormat>();
|
||||
|
||||
private static ThreadLocal<DateFormat> threadLocal_day = new ThreadLocal<DateFormat>();
|
||||
|
||||
public static String date2StringBysecond(Date date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
DateFormat format = threadLocal_second.get();
|
||||
if(format == null){
|
||||
format = new SimpleDateFormat(date_format_second);
|
||||
threadLocal_second.set(format);
|
||||
}
|
||||
return format.format(date);
|
||||
}
|
||||
|
||||
public static String date2StringBysecondNon(Date date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
DateFormat format = threadLocal_second_non.get();
|
||||
if(format == null){
|
||||
format = new SimpleDateFormat(date_format_second_non);
|
||||
threadLocal_second_non.set(format);
|
||||
}
|
||||
return format.format(date);
|
||||
}
|
||||
|
||||
public static String date2StringByMin(Date date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
DateFormat format = threadLocal_min.get();
|
||||
if(format == null){
|
||||
format = new SimpleDateFormat(data_format_min);
|
||||
threadLocal_min.set(format);
|
||||
}
|
||||
return format.format(date);
|
||||
}
|
||||
|
||||
public static String date2StringByDay(Date date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
DateFormat format = threadLocal_day.get();
|
||||
if(format == null){
|
||||
format = new SimpleDateFormat(data_format_day);
|
||||
threadLocal_day.set(format);
|
||||
}
|
||||
return format.format(date);
|
||||
}
|
||||
|
||||
public static Date string2DateBysecond(String date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
date = date.trim();
|
||||
if (date.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
DateFormat format = threadLocal_second.get();
|
||||
try {
|
||||
if(format == null){
|
||||
format = new SimpleDateFormat(date_format_second);
|
||||
threadLocal_second.set(format);
|
||||
}
|
||||
return format.parse(date);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Date string2DateByMin(String date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
date = date.trim();
|
||||
if (date.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
DateFormat format = threadLocal_min.get();
|
||||
try {
|
||||
if(format == null){
|
||||
format = new SimpleDateFormat(data_format_min);
|
||||
threadLocal_min.set(format);
|
||||
}
|
||||
return format.parse(date);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Date string2DateByDay(String date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
date = date.trim();
|
||||
if (date.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
DateFormat format = threadLocal_day.get();
|
||||
try {
|
||||
if(format == null){
|
||||
format = new SimpleDateFormat(data_format_day);
|
||||
threadLocal_day.set(format);
|
||||
}
|
||||
return format.parse(date);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,95 +1,95 @@
|
||||
package com.platform.utils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* 文件读写操作帮助类
|
||||
*
|
||||
* @author wuming
|
||||
*
|
||||
*/
|
||||
public class FileOperateHelper {
|
||||
|
||||
/**
|
||||
* 以追加的方式将信息写入文件
|
||||
*
|
||||
* @param path
|
||||
* @param message
|
||||
*/
|
||||
@SuppressWarnings("resource")
|
||||
public static void fileWrite(String path, String message) {
|
||||
try {
|
||||
File file = new File(path);
|
||||
if (file.exists())
|
||||
file.createNewFile();
|
||||
FileOutputStream out = new FileOutputStream(file, true); // 如果追加方式用true
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(message).append("\n");
|
||||
out.write(sb.toString().getBytes("utf-8"));
|
||||
} catch (IOException e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件读取方法
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("resource")
|
||||
public static String fileReader(String path) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
String tempString = "";
|
||||
try {
|
||||
File file = new File(path);
|
||||
if (!file.exists())
|
||||
return "";
|
||||
FileInputStream fis = new FileInputStream(file);
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
|
||||
while ((tempString = br.readLine()) != null) {
|
||||
sb.append(tempString);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件读取方法
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
public static String fileReaderAndendline(String path) {
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
String tempString = "";
|
||||
try {
|
||||
File file = new File(path);
|
||||
if (!file.exists())
|
||||
|
||||
return "";
|
||||
|
||||
FileInputStream fis = new FileInputStream(file);
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
|
||||
while ((tempString = br.readLine()) != null) {
|
||||
sb.append(tempString+"\n");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
package com.platform.utils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* 文件读写操作帮助类
|
||||
*
|
||||
* @author wuming
|
||||
*
|
||||
*/
|
||||
public class FileOperateHelper {
|
||||
|
||||
/**
|
||||
* 以追加的方式将信息写入文件
|
||||
*
|
||||
* @param path
|
||||
* @param message
|
||||
*/
|
||||
@SuppressWarnings("resource")
|
||||
public static void fileWrite(String path, String message) {
|
||||
try {
|
||||
File file = new File(path);
|
||||
if (file.exists())
|
||||
file.createNewFile();
|
||||
FileOutputStream out = new FileOutputStream(file, true); // 如果追加方式用true
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(message).append("\n");
|
||||
out.write(sb.toString().getBytes("utf-8"));
|
||||
} catch (IOException e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件读取方法
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("resource")
|
||||
public static String fileReader(String path) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
String tempString = "";
|
||||
try {
|
||||
File file = new File(path);
|
||||
if (!file.exists())
|
||||
return "";
|
||||
FileInputStream fis = new FileInputStream(file);
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
|
||||
while ((tempString = br.readLine()) != null) {
|
||||
sb.append(tempString);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件读取方法
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
public static String fileReaderAndendline(String path) {
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
String tempString = "";
|
||||
try {
|
||||
File file = new File(path);
|
||||
if (!file.exists())
|
||||
|
||||
return "";
|
||||
|
||||
FileInputStream fis = new FileInputStream(file);
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
|
||||
while ((tempString = br.readLine()) != null) {
|
||||
sb.append(tempString+"\n");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,60 +1,60 @@
|
||||
package com.platform.utils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.log4j.*;
|
||||
|
||||
public class RunCommand {
|
||||
|
||||
|
||||
public static Logger log = Logger.getLogger(RunCommand.class);
|
||||
|
||||
public List<String> runCommandWait(String command) {
|
||||
List<String> reStrings = null;
|
||||
String cmds[] = { "/bin/bash", "-c", command };
|
||||
try {
|
||||
Process ps = Runtime.getRuntime().exec(cmds);
|
||||
ps.waitFor();
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(ps.getInputStream()));
|
||||
reStrings = new ArrayList<String>();
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
reStrings.add(line);
|
||||
// System.out.println(line);
|
||||
}
|
||||
|
||||
br = new BufferedReader(new InputStreamReader(ps.getErrorStream()));
|
||||
reStrings = new ArrayList<String>();
|
||||
|
||||
while ((line = br.readLine()) != null) {
|
||||
reStrings.add(line);
|
||||
// System.out.println(line);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
log.error("0001 runCommandWait is error");
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
return reStrings;
|
||||
}
|
||||
|
||||
public int runCommand(String command) {
|
||||
List<String> reStrings = null;
|
||||
String cmds[] = { "/bin/bash", "-c", command };
|
||||
try {
|
||||
Process ps = Runtime.getRuntime().exec(cmds);
|
||||
} catch (Exception e) {
|
||||
|
||||
log.error("0002 runCommand execute " + command + " is error");
|
||||
|
||||
e.printStackTrace();
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
package com.platform.utils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.log4j.*;
|
||||
|
||||
public class RunCommand {
|
||||
|
||||
|
||||
public static Logger log = Logger.getLogger(RunCommand.class);
|
||||
|
||||
public List<String> runCommandWait(String command) {
|
||||
List<String> reStrings = null;
|
||||
String cmds[] = { "/bin/bash", "-c", command };
|
||||
try {
|
||||
Process ps = Runtime.getRuntime().exec(cmds);
|
||||
ps.waitFor();
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(ps.getInputStream()));
|
||||
reStrings = new ArrayList<String>();
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
reStrings.add(line);
|
||||
// System.out.println(line);
|
||||
}
|
||||
|
||||
br = new BufferedReader(new InputStreamReader(ps.getErrorStream()));
|
||||
reStrings = new ArrayList<String>();
|
||||
|
||||
while ((line = br.readLine()) != null) {
|
||||
reStrings.add(line);
|
||||
// System.out.println(line);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
log.error("0001 runCommandWait is error");
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
return reStrings;
|
||||
}
|
||||
|
||||
public int runCommand(String command) {
|
||||
List<String> reStrings = null;
|
||||
String cmds[] = { "/bin/bash", "-c", command };
|
||||
try {
|
||||
Process ps = Runtime.getRuntime().exec(cmds);
|
||||
} catch (Exception e) {
|
||||
|
||||
log.error("0002 runCommand execute " + command + " is error");
|
||||
|
||||
e.printStackTrace();
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
package com.platform.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TestSupport {
|
||||
public List<String> strToList(String str) {
|
||||
List<String> reStrings=new ArrayList<String>();
|
||||
for(String one:str.split("\n")){
|
||||
reStrings.add(one);
|
||||
}
|
||||
return reStrings;
|
||||
}
|
||||
}
|
||||
package com.platform.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TestSupport {
|
||||
public List<String> strToList(String str) {
|
||||
List<String> reStrings=new ArrayList<String>();
|
||||
for(String one:str.split("\n")){
|
||||
reStrings.add(one);
|
||||
}
|
||||
return reStrings;
|
||||
}
|
||||
}
|
||||
|
@ -1,49 +1,49 @@
|
||||
package com.platform.utils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.platform.entities.FolderNode;
|
||||
|
||||
public class getTreeDataByPath {
|
||||
|
||||
/**
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
public FolderNode findByPath(String path) {
|
||||
List<FolderNode> folderNodelist = CacheTreeData.getFolders();
|
||||
if (null == folderNodelist) {
|
||||
return null;
|
||||
}
|
||||
FolderNode folder = null;
|
||||
for (FolderNode folderNode : folderNodelist) {
|
||||
folder = getFolder(folderNode, path);
|
||||
if (null != folder) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return folder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param f
|
||||
* @return
|
||||
*/
|
||||
private FolderNode getFolder(FolderNode f, String path){
|
||||
FolderNode result = null;
|
||||
if(path.equals(f.getPath())){
|
||||
return f;
|
||||
}
|
||||
List<FolderNode> folds = f.getChildNodes();
|
||||
if (null != folds) {
|
||||
for (FolderNode folderNode : folds) {
|
||||
result = getFolder(folderNode, path);
|
||||
if (null != result) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
package com.platform.utils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.platform.entities.FolderNode;
|
||||
|
||||
public class getTreeDataByPath {
|
||||
|
||||
/**
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
public FolderNode findByPath(String path) {
|
||||
List<FolderNode> folderNodelist = CacheTreeData.getFolders();
|
||||
if (null == folderNodelist) {
|
||||
return null;
|
||||
}
|
||||
FolderNode folder = null;
|
||||
for (FolderNode folderNode : folderNodelist) {
|
||||
folder = getFolder(folderNode, path);
|
||||
if (null != folder) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return folder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param f
|
||||
* @return
|
||||
*/
|
||||
private FolderNode getFolder(FolderNode f, String path){
|
||||
FolderNode result = null;
|
||||
if(path.equals(f.getPath())){
|
||||
return f;
|
||||
}
|
||||
List<FolderNode> folds = f.getChildNodes();
|
||||
if (null != folds) {
|
||||
for (FolderNode folderNode : folds) {
|
||||
result = getFolder(folderNode, path);
|
||||
if (null != result) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,51 +0,0 @@
|
||||
package com.platform.websocket;
|
||||
|
||||
import org.springframework.web.socket.CloseStatus;
|
||||
import org.springframework.web.socket.TextMessage;
|
||||
import org.springframework.web.socket.WebSocketHandler;
|
||||
import org.springframework.web.socket.WebSocketMessage;
|
||||
import org.springframework.web.socket.WebSocketSession;
|
||||
|
||||
public class SystemWebSocketHandler implements WebSocketHandler {
|
||||
|
||||
@Override
|
||||
public void afterConnectionClosed(WebSocketSession arg0, CloseStatus arg1)
|
||||
throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterConnectionEstablished(WebSocketSession arg0)
|
||||
throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(WebSocketSession arg0, WebSocketMessage<?> arg1)
|
||||
throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
TextMessage returnMessage = new TextMessage("received at server");
|
||||
sendMessageToUsers(returnMessage);
|
||||
System.out.println("接到请求");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleTransportError(WebSocketSession arg0, Throwable arg1)
|
||||
throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsPartialMessages() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
public void sendMessageToUsers(TextMessage message) {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package com.platform.websocket;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
import org.springframework.web.socket.WebSocketHandler;
|
||||
import org.springframework.web.socket.config.annotation.EnableWebSocket;
|
||||
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
|
||||
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
|
||||
|
||||
|
||||
@Configuration
|
||||
@EnableWebMvc
|
||||
@EnableWebSocket
|
||||
public class WebSocketConfig extends WebMvcConfigurerAdapter implements WebSocketConfigurer {
|
||||
|
||||
@Override
|
||||
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
|
||||
// TODO Auto-generated method stub
|
||||
registry.addHandler(myHandler(), "/webSocketServer");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public WebSocketHandler myHandler() {
|
||||
return new SystemWebSocketHandler();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue