fix confict

glusterfs-api
lily 9 years ago
commit c4b345c6a2

@ -2,18 +2,17 @@
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/> <classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0"> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/MyEclipse Tomcat v7.0">
<attributes> <attributes>
<attribute name="owner.project.facets" value="jst.web"/> <attribute name="owner.project.facets" value="jst.web;#system#"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="owner.project.facets" value="java"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path="build/classes"/>
<classpathentry kind="output" path="target/classes"/>
</classpath> </classpath>

1
.gitignore vendored

@ -1 +1,2 @@
/target/ /target/
/build

@ -26,13 +26,12 @@
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand> <buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name> <name>com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder</name>
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature> <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature> <nature>org.eclipse.wst.common.project.facet.core.nature</nature>

@ -0,0 +1,3 @@
eclipse.preferences.version=1
performed.operation.correct.unbound.jre=1.0
performed.operation.resolve.unknown.runtime=1.0

@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="data_manager_backend"> <wb-module deploy-name="data_manager_backend">
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/test"/>
<property name="java-output-path" value="/data_manager_backend/build/classes"/> <property name="java-output-path" value="/data_manager_backend/build/classes"/>
<property name="context-root" value="/"/> <property name="context-root" value="/"/>
</wb-module> </wb-module>

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<faceted-project> <faceted-project>
<runtime name="Apache Tomcat v7.0"/> <runtime name="MyEclipse Tomcat v7.0"/>
<fixed facet="java"/> <fixed facet="java"/>
<fixed facet="wst.jsdt.web"/> <fixed facet="wst.jsdt.web"/>
<fixed facet="jst.web"/> <fixed facet="jst.web"/>

@ -4,7 +4,7 @@
# 驱动程序 # 驱动程序
jdbc.mysql.driver=com.mysql.jdbc.Driver jdbc.mysql.driver=com.mysql.jdbc.Driver
# 连接url # 连接url
jdbc.mysql.url=jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true jdbc.mysql.url=jdbc:mysql://192.168.0.101:3306/test?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true
# 用户名 # 用户名
jdbc.mysql.username=root jdbc.mysql.username=root
# 密码 # 密码

@ -1 +0,0 @@
/com/

@ -1,108 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
"http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd">
<mapper namespace="com.platform.dao.DataInfoDao">
<resultMap id="getEntityByText" type="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="year" column="data_year" javaType="string"
jdbcType="VARCHAR" />
</resultMap>
<sql id="conditionsFilters">
<if test="PagerOptions.dataType!=null">
and data_details.data_type=#{PagerOptions.dataType}
</if>
<if test="PagerOptions.submittedBatch!=null">
and
data_details.submitted_batch=#{PagerOptions.submittedBatch}
</if>
<if test="PagerOptions.cityName!=null">
and data_details.city_name=#{PagerOptions.cityName}
</if>
<if test="PagerOptions.districtName!=null">
and
data_details.district_name=#{PagerOptions.districtName}
</if>
<if test="PagerOptions.dataVersion !=null">
and data_details.data_version=#{PagerOptions.dataVersion}
</if>
<if test="PagerOptions.systemName !=null">
and data_details=#{PagerOptions.systemName}
</if>
<if test="PagerOptions.dataYear !=null">
and data_details.data_year=#{PagerOptions.dataYear}
</if>
</sql>
<!-- 获取数据符合筛选条件的全部记录信息 -->
<select id="getLimitedDataInfoEntities" parameterType="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,data_year
FROM data_details
<if test="PagerOptions!=null">
<where>
<include refid="conditionsFilters" />
<choose>
<when test="PagerOptions.offset > 0">
and data_details.id>= #{PagerOptions.offset}
</when>
<otherwise>
and data_details.id>=0
</otherwise>
</choose>
</where>
ORDER BY data_details.id
<if test="PagerOptions.limit > 0">
LIMIT #{PagerOptions.limit}
</if>
</if>
</select>
<!-- 获取数据符合筛选条件的总记录条数 -->
<select id="getLimitedDataCount" resultType="java.lang.Integer"
parameterType="PagerOptions">
SELECT COUNT(id) FROM data_details
<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 data_details
ORDER BY id LIMIT 0,#{PagerOptions.totalLimit}) AS TEMP
</select>
</mapper>

@ -1,64 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- 读取db.properties中的属性值 -->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="/WebContent/WEB-INF/config/config.properties"></property>
</bean>
<!-- 连接MySQL数据库 -->
<bean id="mySQLDataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${jdbc.mysql.driver}" />
<property name="url" value="${jdbc.mysql.url}" />
<property name="username" value="${jdbc.mysql.username}" />
<property name="password" value="${jdbc.mysql.password}" />
</bean>
<bean id="mySQLSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="configLocation" value="/WebContent/WEB-INF/config/mybatis-applicationConfig.xml" />
<property name="dataSource" ref="mySQLDataSource" />
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.platform.dao" />
</bean>
<!-- 配置声明式事物 -->
<bean id="mySQLTxManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="mySQLDataSource" />
</bean>
<tx:advice id="txAdvice" transaction-manager="mySQLTxManager">
<tx:attributes>
<tx:method name="delete*" propagation="REQUIRED" />
<tx:method name="insert*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="get*" read-only="true" />
<tx:method name="select*" read-only="true" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut expression="execution(* com.platform.service.*.*(..))"
id="pointcut" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="pointcut" />
</aop:config>
<bean id="user" class="com.platform.test.User">
<property name="name" value="伍名" />
<property name="id" value="1" />
<property name="sex" value="男" />
</bean>
<context:component-scan base-package="com.platform.*">
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Controller" />
</context:component-scan>
</beans>

@ -0,0 +1,63 @@
/**
* BaseController.java
* : XX
* : <>
* 201697
* <>
*/
package com.base;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.web.bind.annotation.ExceptionHandler;
import com.platform.utils.Configs;
/**
* <>
* <>
* @author chen
* @version [201697]
* @see [/]
* @since [/]
*/
public class BaseController {
/** log4j */
public static Logger log = Logger.getRootLogger();
/**
* <> @ExceptionHandler----
* <>
* @param request
* @param ex
* @return
* @see [##]
*/
@ExceptionHandler
public Object exp(HttpServletRequest request, HttpServletResponse response,Exception ex) {
System.out.println("URI"+request.getRequestURI());
request.setAttribute("ex", ex);
System.err.println("BaseController --exp ");
// 根据不同错误转向不同页面
if(ex instanceof CustomException) {
CustomException cuse = (CustomException) ex;
Map<String, String> errmsg = new HashMap<>();
errmsg.put("code", cuse.getCode());
errmsg.put("msg", cuse.getMsg());
log.error(cuse.getCode());
response.setStatus(500);
return response;
} else {
//其他错误则 调到指定页面
log.error(Configs.GLOBAL_EXP_NOT_CUSTOM, ex);
response.setStatus(500);
return response;
}
}
}

@ -0,0 +1,23 @@
package com.base;
/**
* <>
* <>
* @author chen
* @version [201698]
* @see [/]
* @since [/]
*/
public class Constant {
/** 国际话配置文件文件-i18n.properties */
public static String I18N_PROPERTIES_FIEL_PATH = "/com/base/i18n.properties";
/** WritefileThread-线程睡眠时间--3000 */
public final static long THREAD_SLEEP_WRITEFILETHREAD = 3000;
/** CustomException记录报异常的对象的对象个数--10 */
public final static int CustomException_log_object_size = 10;
}

@ -0,0 +1,20 @@
package com.base;
/**
* <>
* <>
* @author chen
* @version [201698]
* @see [/]
* @since [/]
*/
public class Custom4exception {
//3003001001 : 第一位:标识异常, 第二到第四位:标识模块,第五道第七位:标识类别,第八道第十位标识具体异常
/**eg
* 3
* 003
* 001
* 001
*/
}

@ -0,0 +1,124 @@
package com.base;
import org.apache.log4j.Logger;
/**
* <>
* <>
* @author chen
* @version [201698]
* @see [/]
* @since [/]
*/
@SuppressWarnings("serial")
public class CustomException extends Exception {
/** log4j */
public static Logger log = Logger.getRootLogger();
/** 自定义异常信息-错误信息 */
private String msg;
/** 自定义异常信息-错误代码 */
private String code;
/** 操作对象 */
private Object[] objArray;
/** 异常 */
private Throwable cause;
public CustomException() {
super();
}
/**
* @
* @param code
* @param msg
* @param e
* @param obj
*/
public CustomException(String code,Exception e,Object... obj) {
super(code);
StringBuffer sbuf= new StringBuffer();
sbuf.append(msg);
this.code = code;
sbuf.append(code);
sbuf.append("\r\n");
msg = Resource.getProperties().get(code);
// 记录自定义的 异常
if (null != msg) {
sbuf.append(msg);
sbuf.append("\r\n");
}
// 记录原始的异常
if (null != e) {
StackTraceElement[] array = e.getStackTrace();
cause = e.getCause();
for (StackTraceElement stackTraceElement : array) {
sbuf.append(stackTraceElement.toString());
sbuf.append("\r\n");
}
}
//记录 出现异常时 当前的对象
if (null != obj) {
Object[] array = obj;
sbuf.append("Object[] size : ");
sbuf.append(array.length);
int forSize = 0;
if (Constant.CustomException_log_object_size < array.length) {
forSize = Constant.CustomException_log_object_size;
}
else {
forSize = array.length;
}
for (int i = 0; i < forSize; i++) {
sbuf.append(array[i]);
sbuf.append("\r\n");
}
sbuf.append("......");
sbuf.append("\r\n");
}
else {
sbuf.append("null");
sbuf.append("\r\n");
}
sbuf.append("\r\n");
// 是否 写入 文件
log.error(sbuf.toString());
}
/**
* @ msg
* @return msg
*/
public String getMsg() {
return msg;
}
/**
* @return the code
*/
public String getCode() {
return code;
}
/**
* @ objArray
* @return objArray
*/
public Object[] getObjArray() {
return objArray;
}
/**
* @ cause
* @return cause
*/
public Throwable getCause() {
return cause;
}
}

@ -0,0 +1,79 @@
package com.base;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import com.base.Constant;
public class Resource {
private static Map<String, String> properties = new HashMap<>();
static{
// 读取 properties文件
// readPropertiesFile(Constant.SYSTEM_PROPERTIES_FIEL_PATH);
readPropertiesFile4Chinese(Constant.I18N_PROPERTIES_FIEL_PATH);
}
/**
* @
* @param filename "/com/utils/exception/i18n.properties"
*/
public static void readPropertiesFile4Chinese(String filename) {
Properties pro = new Properties();
try {
// 读取属性文件 XXXX.propertiesReader。writer解决中文乱码
// InputStreamReader in= new InputStreamReader(Resource.class.getClassLoader().getResourceAsStream(filename), "UTF-8");
InputStreamReader in= new InputStreamReader(Resource.class.getResourceAsStream(filename), "UTF-8");
BufferedReader bf = new BufferedReader(in);
// InputStreamReader in = new BufferedInputStream(new FileInputStream(filename));
pro.load(bf); // /加载属性列表
Iterator<String> it = pro.stringPropertyNames().iterator();
while (it.hasNext()) {
String key = it.next();
properties.put(key, pro.getProperty(key));
}
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* @ properties
* @return properties
*/
public static Map<String, String> getProperties() {
return properties;
}
/**
* @
* @param filename
*/
public static void readPropertiesFile(String filename) {
Properties pro = new Properties();
try {
// 读取属性文件 XXXX.properties 中文会 乱码)
BufferedInputStream bf = new BufferedInputStream(new FileInputStream(filename));
pro.load(bf); // /加载属性列表
Iterator<String> it = pro.stringPropertyNames().iterator();
while (it.hasNext()) {
String key = it.next();
properties.put(key, pro.getProperty(key));
}
bf.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}

@ -36,7 +36,7 @@ public class DataModelController {
Map<String, String[]> paramMap = res.getParameterMap(); Map<String, String[]> paramMap = res.getParameterMap();
Set<String> keySet = paramMap.keySet(); Set<String> keySet = paramMap.keySet();
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
StringBuffer sb = new StringBuffer().append("当前的请求参数:{"); StringBuffer sb = new StringBuffer().append("当前的请求参数:{");
for (String str : keySet) { for (String str : keySet) {
String value = paramMap.get(str)[0]; String value = paramMap.get(str)[0];
if (StringUtils.isNotEmpty(value)){ if (StringUtils.isNotEmpty(value)){
@ -67,7 +67,7 @@ public class DataModelController {
String[] oraclesName = paramMap.get("oracleName"); String[] oraclesName = paramMap.get("oracleName");
if (oraclesName != null) if (oraclesName != null)
for (String rcName : oraclesName) { for (String rcName : oraclesName) {
Configs.CONSOLE_LOGGER.info("执行后台数据库连接\t" + rcName); Configs.CONSOLE_LOGGER.info("执行后台数据库连接\t" + rcName);
new OracleStatusService().connectToOracle(rcName); new OracleStatusService().connectToOracle(rcName);
} }
} }
@ -80,7 +80,7 @@ public class DataModelController {
String operate = paramMap.get("operation")[0]; String operate = paramMap.get("operation")[0];
if (null != oraclesName) { if (null != oraclesName) {
for (String rcName : oraclesName) { for (String rcName : oraclesName) {
Configs.CONSOLE_LOGGER.info("取消后台数据库连接:\t" + rcName); Configs.CONSOLE_LOGGER.info("取消后台数据库连接:\t" + rcName);
new OracleStatusService().cancelToOracle(rcName, operate); new OracleStatusService().cancelToOracle(rcName, operate);
} }
} }

@ -1,41 +1,30 @@
package com.platform.controller; package com.platform.controller;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import com.platform.utils.Configs; import com.platform.utils.Configs;
@Controller @Controller
public class DefaultController { public class DefaultController {
@RequestMapping("/")
@RequestMapping("/tes") public ModelAndView defaultHandler(HttpServletRequest req, HttpServletResponse res){
public Object defaultHandler(HttpServletRequest req, HttpServletResponse request) { //处理不匹配的请求
//´¦Àí²»Æ¥ÅäµÄÇëÇó System.out.println("index");
try { return new ModelAndView("index");
}
System.out.println("fsdfds");
@RequestMapping("/test")
return "listAll"; public ModelMap test(HttpServletRequest req, HttpServletResponse res){
} catch (Exception e) { //System.out.println(Class.class.getClass().getResource("/").getPath());
e.printStackTrace(); System.out.println(Configs.EXTRACT_LOG_LOCALTION);
return new ModelMap();
return "result"; }
}
}
}
@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();
}
}

@ -0,0 +1,56 @@
package com.platform.controller;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import com.base.BaseController;
import com.base.CustomException;
import com.platform.entities.GfsFolderEntity;
import com.platform.service.IGfsService;
/**
* <>
* <>
* @author chen
* @version [201698]
* @see [/]
* @since [/]
*/
@Controller
@RequestMapping("/folder")
public class FolderController extends BaseController {
@Resource(name = "gfsService")
private IGfsService gfsService;
@RequestMapping("/getAllSubPathByPath")
public Object getAllSubPathByPath(String path) throws Exception {
System.out.println(path);
Object result = null;
if (null != path && !"".equals(path)) {
System.out.println(path);
result = gfsService.getFolder(path);
}
return result;
}
@RequestMapping("/copyFolder")
public Object copyFolder(String srcpath, String dstPath, String name) throws Exception {
// -1 :error; -2: the filename is not exists ;-3 :destFolderName ; 1: right
int result = gfsService.copyFolder(srcpath, dstPath, name);
System.out.println(srcpath);
System.out.println(dstPath);
String obj = "right";
if (1 != result) {
obj = "err";
}
return obj;
}
}

@ -12,7 +12,7 @@ import org.springframework.stereotype.Repository;
import com.platform.entities.EncodedInfoEntity; import com.platform.entities.EncodedInfoEntity;
/** /**
* : * :
* *
* @author wuming * @author wuming
* *
@ -21,49 +21,49 @@ import com.platform.entities.EncodedInfoEntity;
public interface EncodeInfoDao { public interface EncodeInfoDao {
/** /**
* / * /
* *
* @param tableName * @param tableName
* *
* @return : * @return :
*/ */
@Select("SELECT code, name FROM ${tableName}") @Select("SELECT code, name FROM ${tableName}")
public List<EncodedInfoEntity> getAllEntityInfo( public List<EncodedInfoEntity> getAllEntityInfo(
@Param("tableName") String tableName); @Param("tableName") String tableName);
/** /**
* / * /
* *
* @param code * @param code
* *
* @param tableName * @param tableName
* *
* @return * @return
*/ */
@Select("SELECT name FROM ${tableName} WHERE code = #{code}") @Select("SELECT name FROM ${tableName} WHERE code = #{code}")
public String getEncodeNameByCode(@Param("code") String code, public String getEncodeNameByCode(@Param("code") String code,
@Param("tableName") String tableName); @Param("tableName") String tableName);
/** /**
* / * /
* *
* @param name * @param name
* *
* @param tableName * @param tableName
* *
* @return * @return
*/ */
@Select("SELECT code FROM ${tableName} WHERE name = #{name}") @Select("SELECT code FROM ${tableName} WHERE name = #{name}")
public List<String> getEncodeCodeByName(@Param("name") String name, public List<String> getEncodeCodeByName(@Param("name") String name,
@Param("tableName") String tableName); @Param("tableName") String tableName);
/** /**
* / * /
* *
* @param code * @param code
* *
* @param tableName * @param tableName
* *
* @return * @return
*/ */
@Update("UPDATE ${tableName} SET name = #{name} WHERE code = #{code}") @Update("UPDATE ${tableName} SET name = #{name} WHERE code = #{code}")
@ -71,12 +71,12 @@ public interface EncodeInfoDao {
@Param("name") String name, @Param("tableName") String tableName); @Param("name") String name, @Param("tableName") String tableName);
/** /**
* / * /
* *
* @param efe * @param efe
* *
* @param tableName * @param tableName
* *
* @return * @return
*/ */
@Insert("INSERT INTO ${tableName} (code, name) VALUES (#{efe.code}, #{efe.name})") @Insert("INSERT INTO ${tableName} (code, name) VALUES (#{efe.code}, #{efe.name})")
@ -84,12 +84,12 @@ public interface EncodeInfoDao {
@Param("tableName") String tableName); @Param("tableName") String tableName);
/** /**
* / * /
* *
* @param code * @param code
* *
* @param tableName * @param tableName
* *
* @return * @return
*/ */
@Delete("DELETE FROM ${tableName} WHERE code = #{code}") @Delete("DELETE FROM ${tableName} WHERE code = #{code}")

@ -1,27 +1,27 @@
package com.platform.entities; package com.platform.entities;
/** /**
* *
* *
* @author wuming * @author wuming
* *
*/ */
public class DataInfoEntity { public class DataInfoEntity {
private int id; private int id;
private String regionalismCode; // 行政区划编码 private String regionalismCode; // 行政区划编码
private String cityName; // 市 private String cityName; // 市
private String districtName; // 区县 private String districtName; // 区县
private int systemCode; // 系统编码 private int systemCode; // 系统编码
private String systemName; // 系统名称 private String systemName; // 系统名称
private String dataType; // 数据类型:财政\社保\... private String dataType; // 数据类型:财政\社保\...
private int dataVersion; // 数据版本 private int dataVersion; // 数据版本
private String submittedBatch; // 上报批次 private String submittedBatch; // 上报批次
private String dataPath; // 数据路径 private String dataPath; // 数据路径
private String collectingTime; // 采集时间 private String collectingTime; // 采集时间
private String collectorContacts; // 采集人的联系 private String collectorContacts; // 采集人的联系
private String charset; // 数据的字符编码 private String charset; // 数据的字符编码
private String collectorName; // 采集人姓名 private String collectorName; // 采集人姓名
private String year; // 数据年度 private String year; // 数据年度
public DataInfoEntity() { public DataInfoEntity() {
} }

@ -2,14 +2,14 @@ package com.platform.entities;
/** /**
* *
* *
* / * /
* @author wuming * @author wuming
* *
*/ */
public class EncodedInfoEntity { public class EncodedInfoEntity {
private String name; //名称 private String name; //名称
private String code; //编码 private String code; //编码
public EncodedInfoEntity() {} public EncodedInfoEntity() {}

@ -4,8 +4,19 @@ import java.util.List;
public class FolderNode { public class FolderNode {
private String name; private String name;
private int isFolder; // 1 is file and other integer is folder show children number
private String path; private String path;
private List<FolderNode> childNodes; private List<FolderNode> childNodes;
public FolderNode(String name) {
this.name = name;
}
public FolderNode(String name, int isFolder) {
this.name = name;
this.isFolder = isFolder;
}
public String getName() { public String getName() {
return name; return name;
@ -15,6 +26,20 @@ public class FolderNode {
this.name = 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() { public String getPath() {
return path; return path;
} }

@ -0,0 +1,77 @@
/**
* : GfsPathModel.java
* : </>
* : <>
* @author chen
* : <>
* 201698
* <>
*/
package com.platform.entities;
import java.util.List;
/**
* <>
* <>
* @author chen
* @version [201698]
* @see [/]
* @since [/]
*/
public class GfsFolderEntity {
/** 当前路径 */
private String path;
/** 当前路径 */
private String name;
/** 子目录 */
private List<GfsFolderEntity> children;
/**
* @return the path
*/
public String getPath() {
return path;
}
/**
* @param path the path to set
*/
public void setPath(String path) {
this.path = path;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the children
*/
public List<GfsFolderEntity> getChildren() {
return children;
}
/**
* @param children the children to set
*/
public void setChildren(List<GfsFolderEntity> children) {
this.children = children;
}
}

@ -1,29 +1,29 @@
package com.platform.entities; package com.platform.entities;
public class PagerOptions { public class PagerOptions {
private Integer currentPageNum; //当前页码 private Integer currentPageNum; //当前页码
private String dataType; //数据类型 private String dataType; //数据类型
private String submittedBatch; //数据批次 private String submittedBatch; //数据批次
private String cityName; //城市名称 private String cityName; //城市名称
private String districtName; //区县名 private String districtName; //区县名
private Integer dataVersion; //数据版本 private Integer dataVersion; //数据版本
private String systemName; //系统名称 private String systemName; //系统名称
private String dataYear; // 数据年度 private String dataYear; // 数据年度
private Integer limit; //一次查询返回记录条数 private Integer limit; //一次查询返回记录条数
private Integer offset; // 查询偏移量起始id private Integer offset; // 查询偏移量起始id
private Integer totalLimit; //当前页前面已有多少条数据 private Integer totalLimit; //当前页前面已有多少条数据
private Integer priorTableSize; //前一次操作一页显示的数据条数 private Integer priorTableSize; //前一次操作一页显示的数据条数
public Integer getCurrentPageNum() { public Integer getCurrentPageNum() {
return currentPageNum; return currentPageNum;

@ -1,71 +1,80 @@
package com.platform.glusterfs; package com.platform.glusterfs;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator; import org.apache.log4j.Logger;
import org.junit.Test; import org.apache.log4j.PropertyConfigurator;
import org.junit.Test;
import com.platform.utils.Constant;
import com.platform.utils.Constant;
public class CopyData { /**
public static Logger log = Logger.getLogger(CopyData.class); * <>
* <>
public int copyVolumeFiles(String sourceVolumeName, String destVolumeName, String fileName) { * @author chen
log.info("start copy " + fileName + " from " + sourceVolumeName + " to " + destVolumeName); * @version [201698]
int status = -1; * @see [/]
/** * @since [/]
* get mount point of volumeName */
*/
public class CopyData {
String sourceFolderName = sourceVolumeName; public static Logger log = Logger.getLogger(CopyData.class);
String destFolderName = destVolumeName;
status = copyFolderFiles(sourceFolderName, destFolderName, fileName); public int copyVolumeFiles(String sourceVolumeName, String destVolumeName, String fileName) {
return status; log.info("start copy " + fileName + " from " + sourceVolumeName + " to " + destVolumeName);
} int status = -1;
/**
/** * get mount point of volumeName
* -1 :error; -2: the filename is not exists ;-3 :destFolderName ; 1: right */
* not exists
* String sourceFolderName = sourceVolumeName;
* @param folderName String destFolderName = destVolumeName;
* @param fileName status = copyFolderFiles(sourceFolderName, destFolderName, fileName);
* @return return status;
*/ }
public int copyFolderFiles(String sourceFolderName, String destFolderName, String fileName) {
int progress=0; /**
log.info("start copy " + fileName + " from " + sourceFolderName + " to " + destFolderName); * -1 :error; -2: the filename is not exists ;-3 :destFolderName ; 1: right
ShowData showData=new ShowData(); * not exists
Map<String,String> reStrings=showData.showFolderData(destFolderName); *
if(reStrings==null){ * @param folderName
log.info("3201 "+destFolderName+" is not exists"); * @param fileName
return -3; * @return
} */
public int copyFolderFiles(String sourceFolderName, String destFolderName, String fileName) {
reStrings=showData.showFolderData(sourceFolderName+"/"+fileName); int progress=0;
if(reStrings==null){ log.info("start copy " + fileName + " from " + sourceFolderName + " to " + destFolderName);
log.info("3202 "+sourceFolderName+"/"+fileName+" is not exists"); ShowData showData=new ShowData();
return -2; Map<String,String> reStrings=showData.showFolderData(destFolderName);
} if(reStrings==null){
String command = "cp -r " + sourceFolderName + "/" + fileName+" "+destFolderName; log.info("3201 "+destFolderName+" is not exists");
/* return -3;
* RunCommand runCommand = new RunCommand(); }
List<String> reStrings = runCommand.runCommandWait(command); reStrings=showData.showFolderData(sourceFolderName+"/"+fileName);
*/ if(reStrings==null){
Constant.ganymedSSH.execCmdNoWaitAcquiescent(command); log.info("3202 "+sourceFolderName+"/"+fileName+" is not exists");
return -2;
log.info("copy " + sourceFolderName +"/" + fileName+ " to " + destFolderName + " running"); }
return 1; String command = "cp -r " + sourceFolderName + "/" + fileName+" "+destFolderName;
} /*
* RunCommand runCommand = new RunCommand();
@Test List<String> reStrings = runCommand.runCommandWait(command);
public void testCopyFolderFiles() { */
PropertyConfigurator.configure("log4j.properties"); Constant.ganymedSSH.execCmdNoWaitAcquiescent(command);
copyFolderFiles("/home", "/home/ubuntu", "system_data");
} log.info("copy " + sourceFolderName +"/" + fileName+ " to " + destFolderName + " running");
} return 1;
}
@Test
public void testCopyFolderFiles() {
PropertyConfigurator.configure("log4j.properties");
copyFolderFiles("/home", "/home/ubuntu", "system_data");
}
}

@ -1,3 +1,4 @@
package com.platform.glusterfs; package com.platform.glusterfs;
import java.util.ArrayList; import java.util.ArrayList;
@ -6,60 +7,76 @@ import java.util.Map;
import org.apache.log4j.PropertyConfigurator; import org.apache.log4j.PropertyConfigurator;
import org.junit.Test; import org.junit.Test;
import org.springframework.stereotype.Service;
import com.platform.entities.FolderNode;
/**
* <> GFS
* <>
* @author chen
* @version [201698]
* @see [/]
* @since [/]
*/
public class GetTreeData { public class GetTreeData {
ShowData showData = new ShowData(); ShowData showData = new ShowData();
public GetTreeData() { /**
// TODO Auto-generated constructor stub * <>
} * <>
* @param name
public FileOrFolder getDatas(String name) { * @return
FileOrFolder fileOrFolder = new FileOrFolder(name); * @see [##]
*/
public FolderNode getDatas(String name) {
FolderNode fileNode = new FolderNode(name);
Map<String, String> files = showData.showFolderData(name); Map<String, String> files = showData.showFolderData(name);
if(files==null || files.size()==0){ if(files==null || files.size()==0){
return fileOrFolder; return fileNode;
} }
fileOrFolder.isFolder = files.size(); fileNode.setIsFolder(files.size());
fileOrFolder.children = new ArrayList<FileOrFolder>(); List<FolderNode> list = new ArrayList<FolderNode>();
fileNode.setChildNodes(list);
for (Map.Entry<String, String> entry : files.entrySet()) { for (Map.Entry<String, String> entry : files.entrySet()) {
int number = Integer.parseInt(entry.getValue());
if(entry.getKey().equals("app")){ if(entry.getKey().equals("app")){
continue; continue;
} }
int number = Integer.parseInt(entry.getValue());
if (number == 1) { if (number == 1) {
fileOrFolder.children.add(new FileOrFolder(entry.getKey(), number)); fileNode.getChildNodes().add(new FolderNode(entry.getKey(), number));
} }
if (number > 1) { if (number > 1) {
FileOrFolder temp=getDatas(name+"/"+entry.getKey()); FolderNode temp=getDatas(name+"/"+entry.getKey());
fileOrFolder.children.add(temp); fileNode.getChildNodes().add(temp);
} }
} }
return fileOrFolder; return fileNode;
}
public static void main(String[] args) {
GetTreeData getTreeData=new GetTreeData();
FileOrFolder fileOrFolder=getTreeData.getDatas("/home");
System.out.println(fileOrFolder);
}
}
class FileOrFolder {
String name;
int isFolder; // 1 is file and other integer is folder show children number
List<FileOrFolder> children;
public FileOrFolder(String name) {
// TODO Auto-generated constructor stub
this.name = name;
}
public FileOrFolder(String name, int isFolder) {
// TODO Auto-generated constructor stub
this.name = name;
this.isFolder = isFolder;
} }
// public static void main(String[] args) {
// GetTreeData getTreeData=new GetTreeData();
// FileOrFolder fileOrFolder=getTreeData.getDatas("/home");
// System.out.println(fileOrFolder);
// }
} }
//class FileOrFolder {
// String name;
// int isFolder; // 1 is file and other integer is folder show children number
// List<FileOrFolder> children;
//
// public FileOrFolder(String name) {
// // TODO Auto-generated constructor stub
// this.name = name;
// }
//
// public FileOrFolder(String name, int isFolder) {
// // TODO Auto-generated constructor stub
// this.name = name;
// this.isFolder = isFolder;
// }
//}
>>>>>>> 26f098b74e2941e68d0a85c1b9d580a28ed2ac41

@ -14,7 +14,7 @@ public class OracleConnector {
static { static {
try { try {
Class.forName("oracle.jdbc.driver.OracleDriver"); Class.forName("oracle.jdbc.driver.OracleDriver");
Configs.CONSOLE_LOGGER.info("Oracle驱动加载成功"); Configs.CONSOLE_LOGGER.info("Oracle驱动加载成功");
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
@ -59,10 +59,10 @@ public class OracleConnector {
} }
/** /**
* oracle * oracle
* @param conn * @param conn
* @param sql * @param sql
* @return * @return
*/ */
public boolean execOracleSQL(Connection conn, String sql) { public boolean execOracleSQL(Connection conn, String sql) {
boolean flag = false; boolean flag = false;

@ -24,12 +24,12 @@ public class DataInfoServiceImp implements DataInfoService {
public ModelMap getPagerTableData(PagerOptions pagerOptions) { public ModelMap getPagerTableData(PagerOptions pagerOptions) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
ModelMap modelMap = new ModelMap(); ModelMap modelMap = new ModelMap();
int count = dfdDao.getLimitedDataCount(pagerOptions); //获取总记录条数 int count = dfdDao.getLimitedDataCount(pagerOptions); //获取总记录条数
int offset = 0; int offset = 0;
if (pagerOptions.getCurrentPageNum() > 1) { if (pagerOptions.getCurrentPageNum() > 1) {
pagerOptions.setTotalLimit((pagerOptions.getCurrentPageNum() - 1) pagerOptions.setTotalLimit((pagerOptions.getCurrentPageNum() - 1)
* pagerOptions.getPriorTableSize()); * pagerOptions.getPriorTableSize());
offset = dfdDao.getLimitedBeginId(pagerOptions); //获取起始查询id offset = dfdDao.getLimitedBeginId(pagerOptions); //获取起始查询id
System.out.println(offset); System.out.println(offset);
} }
pagerOptions.setOffset(offset + 1); pagerOptions.setOffset(offset + 1);
@ -46,11 +46,11 @@ public class DataInfoServiceImp implements DataInfoService {
for(String idx: id){ for(String idx: id){
List<String> paths = dfdDao.getIdIsExist(Integer.parseInt(idx)); List<String> paths = dfdDao.getIdIsExist(Integer.parseInt(idx));
if(paths.size()>0){ if(paths.size()>0){
//删除文件操作 //删除文件操作
for (int i = 0; i < paths.size(); i++) { for (int i = 0; i < paths.size(); i++) {
System.out.println(paths.get(i)); System.out.println(paths.get(i));
} }
//删除数据库记录 //删除数据库记录
//dfdDao.deleteRow(idx); //dfdDao.deleteRow(idx);
} }
} }

@ -5,7 +5,7 @@ import java.util.List;
import com.platform.entities.EncodedInfoEntity; import com.platform.entities.EncodedInfoEntity;
/** /**
* *
* *
* @author wuming * @author wuming
* *

@ -10,7 +10,7 @@ import com.platform.dao.EncodeInfoDao;
import com.platform.entities.EncodedInfoEntity; import com.platform.entities.EncodedInfoEntity;
/** /**
* *
* *
* @author wuming * @author wuming
* *
@ -26,7 +26,7 @@ public class EncodeInfoServiceImpl implements EncodeInfoService {
} }
/** /**
* tableName/ * tableName/
*/ */
@Override @Override
public List<EncodedInfoEntity> getAllEncodeInfo(String tableName) { public List<EncodedInfoEntity> getAllEncodeInfo(String tableName) {
@ -35,7 +35,7 @@ public class EncodeInfoServiceImpl implements EncodeInfoService {
} }
/** /**
* *
*/ */
@Override @Override
public int deleteEncodeByCode(String code, String tableName) { public int deleteEncodeByCode(String code, String tableName) {

@ -0,0 +1,47 @@
/**
* : IGfsService.java
* : </>
* : <>
* @author chen
* : <>
* 201698
* <>
*/
package com.platform.service;
import com.platform.entities.FolderNode;
/**
* <>
* <>
* @author chen
* @version [201698]
* @see [/]
* @since [/]
*/
public interface IGfsService {
/**
* <> path
* <>
* @param path
* @return
* @throws Exception
* @see [##]
*/
public FolderNode getFolder(String path) throws Exception;
/**
* <> path
* <>
* @param srcPath
* @param dstPath
* @return
* @throws Exception
* @see [##]
*/
public int copyFolder(String src, String dst, String name) throws Exception;
}

@ -14,11 +14,11 @@ public class OracleExtractHelper {
private OracleConnector oConnector; private OracleConnector oConnector;
/** /**
* dblink * dblink
* *
* @param conn * @param conn
* @param linkName * @param linkName
* dblink * dblink
* @return * @return
*/ */
private boolean hasSameNameDBLink(Connection conn, String linkName) { private boolean hasSameNameDBLink(Connection conn, String linkName) {
@ -37,11 +37,11 @@ public class OracleExtractHelper {
} }
/** /**
* dblink * dblink
* *
* @param conn * @param conn
* @param oc * @param oc
* dblink * dblink
*/ */
public void createDBLink(Connection conn, OracleConnectorParams oc) { public void createDBLink(Connection conn, OracleConnectorParams oc) {
String linkName = "LinkTo" + oc.getName(); String linkName = "LinkTo" + oc.getName();
@ -55,7 +55,7 @@ public class OracleExtractHelper {
+ ")))(CONNECT_DATA =(SERVICE_NAME =" + oc.getDatabase() + ")))(CONNECT_DATA =(SERVICE_NAME =" + oc.getDatabase()
+ ")))';"; + ")))';";
if (null != oc) { if (null != oc) {
if (hasSameNameDBLink(conn, linkName)) { // 如果dblink已经存在,先删除dblink在创建dblink if (hasSameNameDBLink(conn, linkName)) { // 如果dblink已经存在,先删除dblink在创建dblink
String deleteSql = "DROP PUBLIC DATABASE LINK LinkTo" String deleteSql = "DROP PUBLIC DATABASE LINK LinkTo"
+ linkName; + linkName;
FileOperateHelper FileOperateHelper
@ -67,13 +67,13 @@ public class OracleExtractHelper {
+ oc.getName(), sql); + oc.getName(), sql);
oConnector.execOracleSQL(conn, sql); oConnector.execOracleSQL(conn, sql);
} else { } else {
Configs.CONSOLE_LOGGER.error("删除已有的DBLink失败,无法创建新的DBLink!"); Configs.CONSOLE_LOGGER.error("删除已有的DBLink失败,无法创建新的DBLink!");
FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION
+ oc.getName(), "删除已有的DBLink失败,无法创建新的DBLink!"); + oc.getName(), "删除已有的DBLink失败,无法创建新的DBLink!");
} }
} else { } else {
// 否则创建dblink // 否则创建dblink
oConnector.execOracleSQL(conn, sql); oConnector.execOracleSQL(conn, sql);
FileOperateHelper.fileWrite( FileOperateHelper.fileWrite(
Configs.EXTRACT_LOG_LOCALTION + oc.getName(), sql); Configs.EXTRACT_LOG_LOCALTION + oc.getName(), sql);
@ -82,7 +82,7 @@ public class OracleExtractHelper {
} }
/** /**
* *
* *
* @param conn * @param conn
* @param oc * @param oc
@ -103,7 +103,7 @@ public class OracleExtractHelper {
} }
/** /**
* *
* *
* @param conn * @param conn
* @param oc * @param oc
@ -119,7 +119,7 @@ public class OracleExtractHelper {
} }
/** /**
* *
* *
* @param conn * @param conn
* @param oc * @param oc

@ -17,9 +17,9 @@ import com.platform.utils.Configs;
public class OracleStatusService { public class OracleStatusService {
private static Map<String, Timer> alliveTask = new Hashtable<String, Timer>(); private static Map<String, Timer> alliveTask = new Hashtable<String, Timer>();
public final static int EXEC_TIME = 10;// 连接多少次后不成功,取消链接 public final static int EXEC_TIME = 10;// 连接多少次后不成功,取消链接
public final static long INTERVAL_TIME = 60 * 1000;// 每隔多少毫秒执行一次连接任务 public final static long INTERVAL_TIME = 60 * 1000;// 每隔多少毫秒执行一次连接任务
public final static long DELAY_TIME = 0; // 延迟多少秒后执行 public final static long DELAY_TIME = 0; // 延迟多少秒后执行
public void connectToOracle(String replicasName) { public void connectToOracle(String replicasName) {
SimpleKubeClient sKubeClient = new SimpleKubeClient(); SimpleKubeClient sKubeClient = new SimpleKubeClient();
@ -55,7 +55,7 @@ public class OracleStatusService {
} }
/** /**
* *
* *
* *
* @param taskName * @param taskName
@ -73,7 +73,7 @@ public class OracleStatusService {
} }
/** /**
* *
*/ */
public void cleanUpAlliveTask() { public void cleanUpAlliveTask() {
Iterator<Map.Entry<String, Timer>> iterator = alliveTask.entrySet() Iterator<Map.Entry<String, Timer>> iterator = alliveTask.entrySet()
@ -86,7 +86,7 @@ public class OracleStatusService {
} }
/** /**
* oracle * oracle
* *
* @author wuming * @author wuming
* *
@ -114,14 +114,14 @@ public class OracleStatusService {
+ ocp.getPort() + ":" + ocp.getDatabase(); + ocp.getPort() + ":" + ocp.getDatabase();
boolean flag = OracleConnector.canConnect(url, ocp.getUser(), boolean flag = OracleConnector.canConnect(url, ocp.getUser(),
ocp.getPassword()); ocp.getPassword());
String message = "失败"; String message = "失败";
if (flag && alliveTask.containsKey(taskName)) { if (flag && alliveTask.containsKey(taskName)) {
client.updateOrAddReplicasLabelById(taskName, "status", "2"); client.updateOrAddReplicasLabelById(taskName, "status", "2");
message = "成功"; message = "成功";
killAlliveTask(taskName); // 连接成功,取消连接 killAlliveTask(taskName); // 连接成功,取消连接
} }
Configs.CONSOLE_LOGGER.info("连接到数据库服务: " + taskName Configs.CONSOLE_LOGGER.info("连接到数据库服务: " + taskName
+ "\t[连接结果: " + message + "]"); + "\t[连接结果: " + message + "]");
} }
count++; count++;
} }

@ -0,0 +1,48 @@
/**
* : GfsServiceImpl.java
* : </>
* : <>
* @author chen
* : <>
* 201698
* <>
*/
package com.platform.service.impl;
import org.springframework.stereotype.Service;
import com.platform.entities.FolderNode;
import com.platform.glusterfs.CopyData;
import com.platform.glusterfs.GetTreeData;
import com.platform.service.IGfsService;
/**
* <>
* <>
* @author chen
* @version [201698]
* @see [/]
* @since [/]
*/
@Service(value = "gfsService")
public class GfsServiceImpl implements IGfsService {
private GetTreeData gfsTree = new GetTreeData();
private CopyData copydata = new CopyData();
@Override
public FolderNode getFolder(String path) {
FolderNode result = gfsTree.getDatas(path);
return result;
}
@Override
public int copyFolder(String src, String dst, String name)
throws Exception {
// TODO Auto-generated method stub
int status = copydata.copyVolumeFiles(src, dst, name);
return status;
}
}

@ -29,7 +29,7 @@ public class ConfigLoder {
} }
/** /**
* Property * Property
* *
* @param key * @param key
* @return * @return

@ -29,7 +29,7 @@ public class ConfigPropertyReader {
} }
/** /**
* Property * Property
* *
* @param key * @param key
* @return * @return

@ -3,6 +3,13 @@ package com.platform.utils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
public class Configs { 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 String CONFIG_LOCALTION = "WebContent/WEB-INF/config/config.properties";
public static final Logger CONSOLE_LOGGER = Logger.getLogger("console"); public static final Logger CONSOLE_LOGGER = Logger.getLogger("console");
@ -14,32 +21,32 @@ public class Configs {
public static final Logger LOGGER = Logger.getLogger(Configs.class); public static final Logger LOGGER = Logger.getLogger(Configs.class);
public static String KUBE_MASTER_URL = "http://192.168.0.113:8080/"; // kubernetes集群的maser public static String KUBE_MASTER_URL = "http://192.168.0.113:8080/"; // kubernetes集群的maser
// URl // URl
public static int ORACLE_DEFAULT_PORT = 1521; // oracle的默认端口号 public static int ORACLE_DEFAULT_PORT = 1521; // oracle的默认端口号
public static String COLLECT_USER_NAME = "system"; //采集统一的登入用户名 public static String COLLECT_USER_NAME = "system"; //采集统一的登入用户名
public static String COLLECT_PASSWORD = "oracle"; //采集统一的登入密码 public static String COLLECT_PASSWORD = "oracle"; //采集统一的登入密码
public static String COLLECT_SERVICE_NAME = "orcl"; //采集库统一的服务名 public static String COLLECT_SERVICE_NAME = "orcl"; //采集库统一的服务名
public static String GATHER_PORT ="1521"; //汇总库的端口号 public static String GATHER_PORT ="1521"; //汇总库的端口号
public static String GATHER_USER_NAME = "system"; //汇总库的登入用户名 public static String GATHER_USER_NAME = "system"; //汇总库的登入用户名
public static String GATHER_USER_PASSWORD = "1"; //汇总库的登入密码 public static String GATHER_USER_PASSWORD = "1"; //汇总库的登入密码
public static String GATHER_SERVICE_NAME = "orcl"; //汇总库的服务名 public static String GATHER_SERVICE_NAME = "orcl"; //汇总库的服务名
public static String TABLE_SUFFIX = "_20152016"; //汇总库汇总表的后缀名 public static String TABLE_SUFFIX = "_20152016"; //汇总库汇总表的后缀名
public static String EXTRACT_LOG_LOCALTION = "/home/log"; //数据汇总日志保存位置 public static String EXTRACT_LOG_LOCALTION = "/home/log"; //数据汇总日志保存位置
public static String GATHER_TABLESPACE_NAME=""; //表空间名 public static String GATHER_TABLESPACE_NAME=""; //表空间名
public static String GATHER_TABLESPACE_PATH=""; //表空间路径 public static String GATHER_TABLESPACE_PATH=""; //表空间路径
public static String GATHER_TABLE_PASSWORD=""; //登入密码 public static String GATHER_TABLE_PASSWORD=""; //登入密码
} }

@ -11,14 +11,14 @@ public class ConfigsLoader implements ServletContextListener {
@Override @Override
public void contextDestroyed(ServletContextEvent sEvent) { public void contextDestroyed(ServletContextEvent sEvent) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
Configs.CONSOLE_LOGGER.info("系统停止.."); Configs.CONSOLE_LOGGER.info("系统停止..");
} }
@SuppressWarnings("static-access") @SuppressWarnings("static-access")
@Override @Override
public void contextInitialized(ServletContextEvent sEvent) { public void contextInitialized(ServletContextEvent sEvent) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
Configs.CONSOLE_LOGGER.info("系统初始化.."); Configs.CONSOLE_LOGGER.info("系统初始化..");
String contextPath = sEvent.getServletContext().getRealPath("/") String contextPath = sEvent.getServletContext().getRealPath("/")
+ "WEB-INF/config/config.properties"; + "WEB-INF/config/config.properties";
this.cReader = ConfigPropertyReader.Builder(contextPath); this.cReader = ConfigPropertyReader.Builder(contextPath);

@ -8,7 +8,7 @@ import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
/** /**
* *
* *
* @author wuming * @author wuming
* *
@ -16,7 +16,7 @@ import java.io.InputStreamReader;
public class FileOperateHelper { public class FileOperateHelper {
/** /**
* *
* *
* @param path * @param path
* @param message * @param message
@ -27,7 +27,7 @@ public class FileOperateHelper {
File file = new File(path); File file = new File(path);
if (file.exists()) if (file.exists())
file.createNewFile(); file.createNewFile();
FileOutputStream out = new FileOutputStream(file, true); // 如果追加方式用true FileOutputStream out = new FileOutputStream(file, true); // 如果追加方式用true
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
sb.append(message).append("\n"); sb.append(message).append("\n");
out.write(sb.toString().getBytes("utf-8")); out.write(sb.toString().getBytes("utf-8"));
@ -37,7 +37,7 @@ public class FileOperateHelper {
} }
/** /**
* *
* @param path * @param path
* @return * @return
*/ */

@ -23,7 +23,7 @@ public class UtilsHelper {
for (Field fs : fileds) { for (Field fs : fileds) {
String fieldName = fs.getName(); String fieldName = fs.getName();
String fieldType = fs.getGenericType().toString() String fieldType = fs.getGenericType().toString()
.replace("class ", ""); // 如果type是类类型则前面包含"class ",后面跟类名 .replace("class ", ""); // 如果type是类类型则前面包含"class ",后面跟类名
if (paramMap.containsKey(fieldName)) { if (paramMap.containsKey(fieldName)) {
Method method = clazz.getDeclaredMethod( Method method = clazz.getDeclaredMethod(
getAttributeSetName(fs), Class.forName(fieldType)); getAttributeSetName(fs), Class.forName(fieldType));
@ -72,11 +72,11 @@ public class UtilsHelper {
} }
/** /**
* {@fs}set * {@fs}set
* *
* @param fs * @param fs
* *
* @return set * @return set
*/ */
private static String getAttributeSetName(Field fs) { private static String getAttributeSetName(Field fs) {
String fieldName = fs.getName(); String fieldName = fs.getName();

@ -35,8 +35,8 @@ public class TestController {
@ResponseBody @ResponseBody
public List<User> getJson(HttpServletRequest res, HttpServletResponse req) { public List<User> getJson(HttpServletRequest res, HttpServletResponse req) {
List<User> list = new ArrayList<User>(); List<User> list = new ArrayList<User>();
list.add(new User("lisi", 1, "ÄÐ")); list.add(new User("lisi", 1, ""));
list.add(new User("zhansan", 2, "ÄÐ")); list.add(new User("zhansan", 2, ""));
return list; return list;
} }

@ -32,26 +32,26 @@ public class TestEncodeInfoDao extends SMBasedTest {
@Test @Test
public void testGetEncodeNameByCode() { public void testGetEncodeNameByCode() {
String result = eiDao.getEncodeNameByCode("1", testTableName); String result = eiDao.getEncodeNameByCode("1", testTableName);
Assert.assertTrue(result.equals("预算执行系统")); Assert.assertTrue(result.equals("预算执行系统"));
} }
@Test @Test
public void testGetEncodeCodeByName() { public void testGetEncodeCodeByName() {
List<String> result = eiDao List<String> result = eiDao
.getEncodeCodeByName("预算执行系统", testTableName); .getEncodeCodeByName("预算执行系统", testTableName);
Assert.assertTrue(result.size() > 0); Assert.assertTrue(result.size() > 0);
} }
@Test @Test
public void testUpdateEncodeNameByCode() { public void testUpdateEncodeNameByCode() {
int result = eiDao int result = eiDao
.updateEncodeNameByCode("3", "财政一体化平台", testTableName); .updateEncodeNameByCode("3", "财政一体化平台", testTableName);
Assert.assertTrue(result > 0); Assert.assertTrue(result > 0);
} }
@Test @Test
public void testInsertEncodeEntity() { public void testInsertEncodeEntity() {
int result = eiDao.insertEncodeEntity(new EncodedInfoEntity("非税收入系统", int result = eiDao.insertEncodeEntity(new EncodedInfoEntity("非税收入系统",
"4"), testTableName); "4"), testTableName);
Assert.assertTrue(result == 1); Assert.assertTrue(result == 1);
} }

@ -24,11 +24,11 @@ public class TestEncodeService extends SMBasedTest {
@Test @Test
public void testGetEncodeNameByCode() { public void testGetEncodeNameByCode() {
String result = eis.getEncodeNameByCode("2", testTableName); String result = eis.getEncodeNameByCode("2", testTableName);
Assert.assertTrue(result.equals("²¿ÃÅÔ¤Ëã")); Assert.assertTrue(result.equals("部门预算"));
} }
/** /**
* ÊÂÎñ²âÊÔ *
*/ */
@Test @Test
public void testDeleteEncodeByCode() { public void testDeleteEncodeByCode() {

Loading…
Cancel
Save