diff --git a/.classpath b/.classpath index 2c740802..b6aa469c 100644 --- a/.classpath +++ b/.classpath @@ -2,18 +2,17 @@ - + + + - + - - - + - + - - + diff --git a/.gitignore b/.gitignore index b83d2226..d8037859 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target/ +/build diff --git a/.project b/.project index aac312bb..ed1fe4a2 100644 --- a/.project +++ b/.project @@ -26,13 +26,12 @@ - org.eclipse.m2e.core.maven2Builder + com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder - org.eclipse.m2e.core.maven2Nature org.eclipse.jem.workbench.JavaEMFNature org.eclipse.wst.common.modulecore.ModuleCoreNature org.eclipse.wst.common.project.facet.core.nature diff --git a/.settings/com.genuitec.eclipse.migration.prefs b/.settings/com.genuitec.eclipse.migration.prefs new file mode 100644 index 00000000..bf0067e7 --- /dev/null +++ b/.settings/com.genuitec.eclipse.migration.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +performed.operation.correct.unbound.jre=1.0 +performed.operation.resolve.unknown.runtime=1.0 diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index d5dd44d5..a576e830 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,8 +1,6 @@ - - diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml index f4228271..ba1bfbde 100644 --- a/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -1,6 +1,6 @@ - + diff --git a/WebContent/WEB-INF/config/config.properties b/WebContent/WEB-INF/config/config.properties index 56b7bdea..6f9d7280 100644 --- a/WebContent/WEB-INF/config/config.properties +++ b/WebContent/WEB-INF/config/config.properties @@ -4,7 +4,7 @@ # 驱动程序 jdbc.mysql.driver=com.mysql.jdbc.Driver # 连接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 # 密码 diff --git a/WebContent/WEB-INF/lib/ganymed-ssh2-build209.jar b/WebContent/WEB-INF/lib/ganymed-ssh2-build209.jar new file mode 100644 index 00000000..95f233ce Binary files /dev/null and b/WebContent/WEB-INF/lib/ganymed-ssh2-build209.jar differ diff --git a/build/classes/.gitignore b/build/classes/.gitignore deleted file mode 100644 index c2d9872a..00000000 --- a/build/classes/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/com/ diff --git a/build/classes/com/dao/mapper/data-detaisl-mapper.xml b/build/classes/com/dao/mapper/data-detaisl-mapper.xml deleted file mode 100644 index 52b98767..00000000 --- a/build/classes/com/dao/mapper/data-detaisl-mapper.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - and data_details.data_type=#{PagerOptions.dataType} - - - and - data_details.submitted_batch=#{PagerOptions.submittedBatch} - - - and data_details.city_name=#{PagerOptions.cityName} - - - and - data_details.district_name=#{PagerOptions.districtName} - - - and data_details.data_version=#{PagerOptions.dataVersion} - - - and data_details=#{PagerOptions.systemName} - - - and data_details.data_year=#{PagerOptions.dataYear} - - - - - - - - - - - - - \ No newline at end of file diff --git a/build/classes/com/platform/controller/DataModelController.class b/build/classes/com/platform/controller/DataModelController.class deleted file mode 100644 index 837dcfde..00000000 Binary files a/build/classes/com/platform/controller/DataModelController.class and /dev/null differ diff --git a/build/classes/com/platform/controller/DefaultController.class b/build/classes/com/platform/controller/DefaultController.class index 004ef797..41222a99 100644 Binary files a/build/classes/com/platform/controller/DefaultController.class and b/build/classes/com/platform/controller/DefaultController.class differ diff --git a/build/classes/com/platform/dao/DataInfoDao.class b/build/classes/com/platform/dao/DataInfoDao.class deleted file mode 100644 index b2c3bfed..00000000 Binary files a/build/classes/com/platform/dao/DataInfoDao.class and /dev/null differ diff --git a/build/classes/com/platform/dao/EncodeInfoDao.class b/build/classes/com/platform/dao/EncodeInfoDao.class deleted file mode 100644 index f6b44c7b..00000000 Binary files a/build/classes/com/platform/dao/EncodeInfoDao.class and /dev/null differ diff --git a/build/classes/com/platform/entities/BasedType.class b/build/classes/com/platform/entities/BasedType.class deleted file mode 100644 index 30ba1020..00000000 Binary files a/build/classes/com/platform/entities/BasedType.class and /dev/null differ diff --git a/build/classes/com/platform/entities/DataInfoEntity.class b/build/classes/com/platform/entities/DataInfoEntity.class deleted file mode 100644 index 0bc0b835..00000000 Binary files a/build/classes/com/platform/entities/DataInfoEntity.class and /dev/null differ diff --git a/build/classes/com/platform/entities/EncodedInfoEntity.class b/build/classes/com/platform/entities/EncodedInfoEntity.class deleted file mode 100644 index ca2439bd..00000000 Binary files a/build/classes/com/platform/entities/EncodedInfoEntity.class and /dev/null differ diff --git a/build/classes/com/platform/entities/FolderNode.class b/build/classes/com/platform/entities/FolderNode.class deleted file mode 100644 index 27432bbb..00000000 Binary files a/build/classes/com/platform/entities/FolderNode.class and /dev/null differ diff --git a/build/classes/com/platform/entities/OracleConnectorParams.class b/build/classes/com/platform/entities/OracleConnectorParams.class deleted file mode 100644 index 2d57408c..00000000 Binary files a/build/classes/com/platform/entities/OracleConnectorParams.class and /dev/null differ diff --git a/build/classes/com/platform/entities/PagerOptions.class b/build/classes/com/platform/entities/PagerOptions.class deleted file mode 100644 index 0f0a2176..00000000 Binary files a/build/classes/com/platform/entities/PagerOptions.class and /dev/null differ diff --git a/build/classes/com/platform/entities/SimpleConfigParamsBean.class b/build/classes/com/platform/entities/SimpleConfigParamsBean.class deleted file mode 100644 index 8e274e5f..00000000 Binary files a/build/classes/com/platform/entities/SimpleConfigParamsBean.class and /dev/null differ diff --git a/build/classes/com/platform/kubernetes/SimpleKubeClient.class b/build/classes/com/platform/kubernetes/SimpleKubeClient.class deleted file mode 100644 index 78331ee3..00000000 Binary files a/build/classes/com/platform/kubernetes/SimpleKubeClient.class and /dev/null differ diff --git a/build/classes/com/platform/oracle/OracleConnector.class b/build/classes/com/platform/oracle/OracleConnector.class deleted file mode 100644 index 04a516c4..00000000 Binary files a/build/classes/com/platform/oracle/OracleConnector.class and /dev/null differ diff --git a/build/classes/com/platform/service/DataInfoService.class b/build/classes/com/platform/service/DataInfoService.class deleted file mode 100644 index 95758eba..00000000 Binary files a/build/classes/com/platform/service/DataInfoService.class and /dev/null differ diff --git a/build/classes/com/platform/service/DataInfoServiceImp.class b/build/classes/com/platform/service/DataInfoServiceImp.class deleted file mode 100644 index 2b8ecde7..00000000 Binary files a/build/classes/com/platform/service/DataInfoServiceImp.class and /dev/null differ diff --git a/build/classes/com/platform/service/EncodeInfoService.class b/build/classes/com/platform/service/EncodeInfoService.class deleted file mode 100644 index 4e7ea229..00000000 Binary files a/build/classes/com/platform/service/EncodeInfoService.class and /dev/null differ diff --git a/build/classes/com/platform/service/EncodeInfoServiceImpl.class b/build/classes/com/platform/service/EncodeInfoServiceImpl.class deleted file mode 100644 index 56590e83..00000000 Binary files a/build/classes/com/platform/service/EncodeInfoServiceImpl.class and /dev/null differ diff --git a/build/classes/com/platform/service/OracleExtractHelper.class b/build/classes/com/platform/service/OracleExtractHelper.class deleted file mode 100644 index cd929b15..00000000 Binary files a/build/classes/com/platform/service/OracleExtractHelper.class and /dev/null differ diff --git a/build/classes/com/platform/service/OracleExtractService.class b/build/classes/com/platform/service/OracleExtractService.class deleted file mode 100644 index 90711c2e..00000000 Binary files a/build/classes/com/platform/service/OracleExtractService.class and /dev/null differ diff --git a/build/classes/com/platform/service/OracleStatusService$connectTask.class b/build/classes/com/platform/service/OracleStatusService$connectTask.class deleted file mode 100644 index 84eef078..00000000 Binary files a/build/classes/com/platform/service/OracleStatusService$connectTask.class and /dev/null differ diff --git a/build/classes/com/platform/service/OracleStatusService.class b/build/classes/com/platform/service/OracleStatusService.class deleted file mode 100644 index b61344b5..00000000 Binary files a/build/classes/com/platform/service/OracleStatusService.class and /dev/null differ diff --git a/build/classes/com/platform/service/SimplePropertyReader.class b/build/classes/com/platform/service/SimplePropertyReader.class deleted file mode 100644 index d54c4934..00000000 Binary files a/build/classes/com/platform/service/SimplePropertyReader.class and /dev/null differ diff --git a/build/classes/com/platform/test/SMBasedTest.class b/build/classes/com/platform/test/SMBasedTest.class deleted file mode 100644 index e64ea7a7..00000000 Binary files a/build/classes/com/platform/test/SMBasedTest.class and /dev/null differ diff --git a/build/classes/com/platform/test/TestController.class b/build/classes/com/platform/test/TestController.class deleted file mode 100644 index 3abc9c41..00000000 Binary files a/build/classes/com/platform/test/TestController.class and /dev/null differ diff --git a/build/classes/com/platform/test/TestEncodeInfoDao.class b/build/classes/com/platform/test/TestEncodeInfoDao.class deleted file mode 100644 index bdfb87d9..00000000 Binary files a/build/classes/com/platform/test/TestEncodeInfoDao.class and /dev/null differ diff --git a/build/classes/com/platform/test/TestEncodeService.class b/build/classes/com/platform/test/TestEncodeService.class deleted file mode 100644 index c4656f12..00000000 Binary files a/build/classes/com/platform/test/TestEncodeService.class and /dev/null differ diff --git a/build/classes/com/platform/test/User.class b/build/classes/com/platform/test/User.class deleted file mode 100644 index a38adbfb..00000000 Binary files a/build/classes/com/platform/test/User.class and /dev/null differ diff --git a/build/classes/com/platform/test/testSystemInfoDao.class b/build/classes/com/platform/test/testSystemInfoDao.class deleted file mode 100644 index f86a419c..00000000 Binary files a/build/classes/com/platform/test/testSystemInfoDao.class and /dev/null differ diff --git a/build/classes/com/platform/utils/ConfigLoder.class b/build/classes/com/platform/utils/ConfigLoder.class deleted file mode 100644 index 9c600c3d..00000000 Binary files a/build/classes/com/platform/utils/ConfigLoder.class and /dev/null differ diff --git a/build/classes/com/platform/utils/ConfigPropertyReader.class b/build/classes/com/platform/utils/ConfigPropertyReader.class deleted file mode 100644 index 81d2b1c3..00000000 Binary files a/build/classes/com/platform/utils/ConfigPropertyReader.class and /dev/null differ diff --git a/build/classes/com/platform/utils/Configs.class b/build/classes/com/platform/utils/Configs.class deleted file mode 100644 index 6bc46bf3..00000000 Binary files a/build/classes/com/platform/utils/Configs.class and /dev/null differ diff --git a/build/classes/com/platform/utils/ConfigsLoader.class b/build/classes/com/platform/utils/ConfigsLoader.class deleted file mode 100644 index c37ec21a..00000000 Binary files a/build/classes/com/platform/utils/ConfigsLoader.class and /dev/null differ diff --git a/build/classes/com/platform/utils/FileOperateHelper.class b/build/classes/com/platform/utils/FileOperateHelper.class deleted file mode 100644 index 40db4e3d..00000000 Binary files a/build/classes/com/platform/utils/FileOperateHelper.class and /dev/null differ diff --git a/build/classes/com/platform/utils/UtilsHelper.class b/build/classes/com/platform/utils/UtilsHelper.class deleted file mode 100644 index e06cff03..00000000 Binary files a/build/classes/com/platform/utils/UtilsHelper.class and /dev/null differ diff --git a/build/classes/spring-applicationContext-test.xml b/build/classes/spring-applicationContext-test.xml deleted file mode 100644 index 27b1248b..00000000 --- a/build/classes/spring-applicationContext-test.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/base/BaseController.java b/src/com/base/BaseController.java new file mode 100644 index 00000000..11797a0b --- /dev/null +++ b/src/com/base/BaseController.java @@ -0,0 +1,63 @@ +/** + * 文件名 : BaseController.java + * 版权 : XX科技有限公司。 + * 描述 : <描述> + * 修改时间:2016年9月7日 + * 修改内容:<修改内容> + */ +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 [版本号,2016年9月7日] + * @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 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; + } + } +} \ No newline at end of file diff --git a/src/com/base/Constant.java b/src/com/base/Constant.java new file mode 100644 index 00000000..4d336465 --- /dev/null +++ b/src/com/base/Constant.java @@ -0,0 +1,23 @@ +package com.base; + +/** + * <一句话功能简述> + * <功能详细描述> + * @author chen + * @version [版本号,2016年9月8日] + * @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; + + +} diff --git a/src/com/base/Custom4exception.java b/src/com/base/Custom4exception.java new file mode 100644 index 00000000..2aeba6c6 --- /dev/null +++ b/src/com/base/Custom4exception.java @@ -0,0 +1,20 @@ +package com.base; + +/** + * <一句话功能简述> 异常常量编码 + * <功能详细描述> + * @author chen + * @version [版本号,2016年9月8日] + * @see [相关类/方法] + * @since [产品/模块版本] + */ +public class Custom4exception { + //3003001001 : 第一位:标识异常, 第二到第四位:标识模块,第五道第七位:标识类别,第八道第十位标识具体异常 + /**eg + * 3:异常 + * 003:虚拟机模块 + * 001:软件依赖虚拟机资源类别 + * 001:启动异常 + */ + +} diff --git a/src/com/base/CustomException.java b/src/com/base/CustomException.java new file mode 100644 index 00000000..d732d004 --- /dev/null +++ b/src/com/base/CustomException.java @@ -0,0 +1,124 @@ +package com.base; + +import org.apache.log4j.Logger; + +/** + * <一句话功能简述> + * <功能详细描述> + * @author chen + * @version [版本号,2016年9月8日] + * @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; + } +} diff --git a/src/com/base/Resource.java b/src/com/base/Resource.java new file mode 100644 index 00000000..0b900bfe --- /dev/null +++ b/src/com/base/Resource.java @@ -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 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.properties(Reader。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 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 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 it = pro.stringPropertyNames().iterator(); + while (it.hasNext()) { + String key = it.next(); + properties.put(key, pro.getProperty(key)); + } + bf.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + +} diff --git a/src/com/base/i18n.properties b/src/com/base/i18n.properties new file mode 100644 index 00000000..e69de29b diff --git a/src/com/platform/controller/DataModelController.java b/src/com/platform/controller/DataModelController.java index eb29d94f..ba2295ca 100644 --- a/src/com/platform/controller/DataModelController.java +++ b/src/com/platform/controller/DataModelController.java @@ -36,7 +36,7 @@ public class DataModelController { Map paramMap = res.getParameterMap(); Set keySet = paramMap.keySet(); Map params = new HashMap(); - StringBuffer sb = new StringBuffer().append("ǰ:{"); + StringBuffer sb = new StringBuffer().append("当前的请求参数:{"); for (String str : keySet) { String value = paramMap.get(str)[0]; if (StringUtils.isNotEmpty(value)){ @@ -67,7 +67,7 @@ public class DataModelController { String[] oraclesName = paramMap.get("oracleName"); if (oraclesName != null) for (String rcName : oraclesName) { - Configs.CONSOLE_LOGGER.info("ִк̨ݿ\t" + rcName); + Configs.CONSOLE_LOGGER.info("执行后台数据库连接\t" + rcName); new OracleStatusService().connectToOracle(rcName); } } @@ -80,7 +80,7 @@ public class DataModelController { String operate = paramMap.get("operation")[0]; if (null != oraclesName) { for (String rcName : oraclesName) { - Configs.CONSOLE_LOGGER.info("ȡ̨ݿ:\t" + rcName); + Configs.CONSOLE_LOGGER.info("取消后台数据库连接:\t" + rcName); new OracleStatusService().cancelToOracle(rcName, operate); } } diff --git a/src/com/platform/controller/DefaultController.java b/src/com/platform/controller/DefaultController.java index ab8070bd..e8ac7479 100644 --- a/src/com/platform/controller/DefaultController.java +++ b/src/com/platform/controller/DefaultController.java @@ -1,41 +1,30 @@ -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("/tes") - public Object defaultHandler(HttpServletRequest req, HttpServletResponse request) { - //ƥ - try { - - System.out.println("fsdfds"); - - return "listAll"; - } catch (Exception e) { - e.printStackTrace(); - - 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(); - } - -} +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(); + } + +} diff --git a/src/com/platform/controller/FolderController.java b/src/com/platform/controller/FolderController.java new file mode 100644 index 00000000..aa28e728 --- /dev/null +++ b/src/com/platform/controller/FolderController.java @@ -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 [版本号,2016年9月8日] + * @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; + } + +} diff --git a/src/com/platform/dao/EncodeInfoDao.java b/src/com/platform/dao/EncodeInfoDao.java index 69bfd819..a877f5f3 100644 --- a/src/com/platform/dao/EncodeInfoDao.java +++ b/src/com/platform/dao/EncodeInfoDao.java @@ -12,7 +12,7 @@ import org.springframework.stereotype.Repository; import com.platform.entities.EncodedInfoEntity; /** - * ݿ: ʵɾġ + * 数据库操作: 实现增、删、改、查 * * @author wuming * @@ -21,49 +21,49 @@ import com.platform.entities.EncodedInfoEntity; public interface EncodeInfoDao { /** - * ȡѯµʵ壨/ϵͳϢ + * 获取查询表下的所有实体(行政区划/系统)信息 * * @param tableName - * ѯı - * @return ʵϢ:ƺͱ + * 查询的表名 + * @return 所有实体信息:名称和编码 */ @Select("SELECT code, name FROM ${tableName}") public List getAllEntityInfo( @Param("tableName") String tableName); /** - * ʵ壨/ϵͳƲѯ + * 根据实体(行政区划/系统)的名称查询编码 * * @param code - * ʵ + * 实体编码 * @param tableName - * ѯı - * @return ѯֻһ¼ + * 查询的表名 + * @return 编码是主键,查询结果最多只有一条记录 */ @Select("SELECT name FROM ${tableName} WHERE code = #{code}") public String getEncodeNameByCode(@Param("code") String code, @Param("tableName") String tableName); /** - * ʵ壨/ϵͳıѯ + * 根据实体(行政区划/系统)的编码查询名称 * * @param name - * ʵ + * 实体名称 * @param tableName - * ѯı - * @return Ʋѯܻж + * 查询的表名 + * @return 名称不是主键,查询结果可能会有多个 */ @Select("SELECT code FROM ${tableName} WHERE name = #{name}") public List getEncodeCodeByName(@Param("name") String name, @Param("tableName") String tableName); /** - * ʵ壨/ϵͳı룬ʵ + * 根据实体(行政区划/系统)的编码,更新实体的名称 * * @param code - * ϵͳ + * 系统编码 * @param tableName - * ѯı + * 查询的表名 * @return */ @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 efe - * ʵϢ + * 插入的实体信息 * @param tableName - * + * 表名 * @return */ @Insert("INSERT INTO ${tableName} (code, name) VALUES (#{efe.code}, #{efe.name})") @@ -84,12 +84,12 @@ public interface EncodeInfoDao { @Param("tableName") String tableName); /** - * ɾеʵ壨/ϵͳ + * 删除表中的实体(行政区划/系统) * * @param code - * ʵı + * 实体的编码 * @param tableName - * + * 表名 * @return */ @Delete("DELETE FROM ${tableName} WHERE code = #{code}") diff --git a/src/com/platform/entities/DataInfoEntity.java b/src/com/platform/entities/DataInfoEntity.java index d3581c89..3db92f4a 100644 --- a/src/com/platform/entities/DataInfoEntity.java +++ b/src/com/platform/entities/DataInfoEntity.java @@ -1,27 +1,27 @@ 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 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; // 数据年度 public DataInfoEntity() { } diff --git a/src/com/platform/entities/EncodedInfoEntity.java b/src/com/platform/entities/EncodedInfoEntity.java index fa6b934c..3f2f425e 100644 --- a/src/com/platform/entities/EncodedInfoEntity.java +++ b/src/com/platform/entities/EncodedInfoEntity.java @@ -2,14 +2,14 @@ package com.platform.entities; /** * - * Ϣʵ - * /ϵͳϢ + * 编码信息实体 + * 行政区划/系统信息 * @author wuming * */ public class EncodedInfoEntity { - private String name; // - private String code; // + private String name; //名称 + private String code; //编码 public EncodedInfoEntity() {} diff --git a/src/com/platform/entities/FolderNode.java b/src/com/platform/entities/FolderNode.java index 84c2057a..da662d0f 100644 --- a/src/com/platform/entities/FolderNode.java +++ b/src/com/platform/entities/FolderNode.java @@ -4,8 +4,19 @@ 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 childNodes; + + + public FolderNode(String name) { + this.name = name; + } + + public FolderNode(String name, int isFolder) { + this.name = name; + this.isFolder = isFolder; + } public String getName() { return name; @@ -15,6 +26,20 @@ public class FolderNode { 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; } diff --git a/src/com/platform/entities/GfsFolderEntity.java b/src/com/platform/entities/GfsFolderEntity.java new file mode 100644 index 00000000..13429ddf --- /dev/null +++ b/src/com/platform/entities/GfsFolderEntity.java @@ -0,0 +1,77 @@ + +/** + * 文件名 : GfsPathModel.java + * 版权 : <版权/公司名> + * 描述 : <描述> + * @author chen + * 版本 : <版本> + * 修改时间: 2016年9月8日 + * 修改内容: <修改内容> + */ +package com.platform.entities; + +import java.util.List; + +/** + * <一句话功能简述> + * <功能详细描述> + * @author chen + * @version [版本号,2016年9月8日] + * @see [相关类/方法] + * @since [产品/模块版本] + */ + +public class GfsFolderEntity { + + /** 当前路径 */ + private String path; + + /** 当前路径 */ + private String name; + + /** 子目录 */ + private List 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 getChildren() { + return children; + } + + /** + * @param children the children to set + */ + public void setChildren(List children) { + this.children = children; + } + +} diff --git a/src/com/platform/entities/PagerOptions.java b/src/com/platform/entities/PagerOptions.java index 046a90cd..f347488f 100644 --- a/src/com/platform/entities/PagerOptions.java +++ b/src/com/platform/entities/PagerOptions.java @@ -1,29 +1,29 @@ package com.platform.entities; 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() { return currentPageNum; diff --git a/src/com/platform/glusterfs/CopyData.java b/src/com/platform/glusterfs/CopyData.java index c0eb2c23..1e9972ea 100644 --- a/src/com/platform/glusterfs/CopyData.java +++ b/src/com/platform/glusterfs/CopyData.java @@ -1,71 +1,80 @@ -package com.platform.glusterfs; - -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 CopyData { - public static Logger log = Logger.getLogger(CopyData.class); - - public int copyVolumeFiles(String sourceVolumeName, String destVolumeName, String fileName) { - log.info("start copy " + fileName + " from " + sourceVolumeName + " to " + destVolumeName); - int status = -1; - /** - * get mount point of volumeName - */ - - String sourceFolderName = sourceVolumeName; - String destFolderName = destVolumeName; - status = copyFolderFiles(sourceFolderName, destFolderName, fileName); - return status; - } - - /** - * -1 :error; -2: the filename is not exists ;-3 :destFolderName ; 1: right - * not exists - * - * @param folderName - * @param fileName - * @return - */ - public int copyFolderFiles(String sourceFolderName, String destFolderName, String fileName) { - int progress=0; - log.info("start copy " + fileName + " from " + sourceFolderName + " to " + destFolderName); - ShowData showData=new ShowData(); - Map reStrings=showData.showFolderData(destFolderName); - if(reStrings==null){ - log.info("3201 "+destFolderName+" is not exists"); - return -3; - } - - reStrings=showData.showFolderData(sourceFolderName+"/"+fileName); - if(reStrings==null){ - log.info("3202 "+sourceFolderName+"/"+fileName+" is not exists"); - return -2; - } - String command = "cp -r " + sourceFolderName + "/" + fileName+" "+destFolderName; - /* - * RunCommand runCommand = new RunCommand(); - - List reStrings = runCommand.runCommandWait(command); - */ - Constant.ganymedSSH.execCmdNoWaitAcquiescent(command); - - log.info("copy " + sourceFolderName +"/" + fileName+ " to " + destFolderName + " running"); - return 1; - } - - - @Test - public void testCopyFolderFiles() { - PropertyConfigurator.configure("log4j.properties"); - copyFolderFiles("/home", "/home/ubuntu", "system_data"); - } -} +package com.platform.glusterfs; + +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; + + +/** + * <一句话功能简述> 复制数据 + * <功能详细描述> + * @author chen + * @version [版本号,2016年9月8日] + * @see [相关类/方法] + * @since [产品/模块版本] + */ + +public class CopyData { + public static Logger log = Logger.getLogger(CopyData.class); + + public int copyVolumeFiles(String sourceVolumeName, String destVolumeName, String fileName) { + log.info("start copy " + fileName + " from " + sourceVolumeName + " to " + destVolumeName); + int status = -1; + /** + * get mount point of volumeName + */ + + String sourceFolderName = sourceVolumeName; + String destFolderName = destVolumeName; + status = copyFolderFiles(sourceFolderName, destFolderName, fileName); + return status; + } + + /** + * -1 :error; -2: the filename is not exists ;-3 :destFolderName ; 1: right + * not exists + * + * @param folderName + * @param fileName + * @return + */ + public int copyFolderFiles(String sourceFolderName, String destFolderName, String fileName) { + int progress=0; + log.info("start copy " + fileName + " from " + sourceFolderName + " to " + destFolderName); + ShowData showData=new ShowData(); + Map reStrings=showData.showFolderData(destFolderName); + if(reStrings==null){ + log.info("3201 "+destFolderName+" is not exists"); + return -3; + } + + reStrings=showData.showFolderData(sourceFolderName+"/"+fileName); + if(reStrings==null){ + log.info("3202 "+sourceFolderName+"/"+fileName+" is not exists"); + return -2; + } + String command = "cp -r " + sourceFolderName + "/" + fileName+" "+destFolderName; + /* + * RunCommand runCommand = new RunCommand(); + + List reStrings = runCommand.runCommandWait(command); + */ + Constant.ganymedSSH.execCmdNoWaitAcquiescent(command); + + log.info("copy " + sourceFolderName +"/" + fileName+ " to " + destFolderName + " running"); + return 1; + } + + + @Test + public void testCopyFolderFiles() { + PropertyConfigurator.configure("log4j.properties"); + copyFolderFiles("/home", "/home/ubuntu", "system_data"); + } +} diff --git a/src/com/platform/glusterfs/GetTreeData.java b/src/com/platform/glusterfs/GetTreeData.java index 4098ab50..df951cd7 100644 --- a/src/com/platform/glusterfs/GetTreeData.java +++ b/src/com/platform/glusterfs/GetTreeData.java @@ -1,3 +1,4 @@ + package com.platform.glusterfs; import java.util.ArrayList; @@ -6,60 +7,76 @@ import java.util.Map; import org.apache.log4j.PropertyConfigurator; import org.junit.Test; +import org.springframework.stereotype.Service; + +import com.platform.entities.FolderNode; +/** + * <一句话功能简述> 获得GFS某个目录下的子目录 + * <功能详细描述> + * @author chen + * @version [版本号,2016年9月8日] + * @see [相关类/方法] + * @since [产品/模块版本] + */ public class GetTreeData { ShowData showData = new ShowData(); - public GetTreeData() { - // TODO Auto-generated constructor stub - } - - public FileOrFolder getDatas(String name) { - FileOrFolder fileOrFolder = new FileOrFolder(name); + /** + * <一句话功能简述> 获得所以子目录 + * <功能详细描述> + * @param name + * @return + * @see [类、类#方法、类#成员] + */ + public FolderNode getDatas(String name) { + FolderNode fileNode = new FolderNode(name); Map files = showData.showFolderData(name); if(files==null || files.size()==0){ - return fileOrFolder; + return fileNode; } - fileOrFolder.isFolder = files.size(); - fileOrFolder.children = new ArrayList(); + fileNode.setIsFolder(files.size()); + List list = new ArrayList(); + fileNode.setChildNodes(list); for (Map.Entry entry : files.entrySet()) { - int number = Integer.parseInt(entry.getValue()); if(entry.getKey().equals("app")){ continue; } + int number = Integer.parseInt(entry.getValue()); if (number == 1) { - fileOrFolder.children.add(new FileOrFolder(entry.getKey(), number)); + fileNode.getChildNodes().add(new FolderNode(entry.getKey(), number)); } if (number > 1) { - FileOrFolder temp=getDatas(name+"/"+entry.getKey()); - fileOrFolder.children.add(temp); + FolderNode temp=getDatas(name+"/"+entry.getKey()); + fileNode.getChildNodes().add(temp); } } - return fileOrFolder; - } - 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 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; + 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 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 diff --git a/src/com/platform/oracle/OracleConnector.java b/src/com/platform/oracle/OracleConnector.java index 28d24135..90f29a7d 100644 --- a/src/com/platform/oracle/OracleConnector.java +++ b/src/com/platform/oracle/OracleConnector.java @@ -14,7 +14,7 @@ public class OracleConnector { static { try { Class.forName("oracle.jdbc.driver.OracleDriver"); - Configs.CONSOLE_LOGGER.info("Oracleسɹ"); + Configs.CONSOLE_LOGGER.info("Oracle驱动加载成功"); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -59,10 +59,10 @@ public class OracleConnector { } /** - * ִжoracleݿɾ + * 执行对oracle数据库的增、删 * @param conn * @param sql - * @return Ƿִгɹ + * @return 是否执行成功 */ public boolean execOracleSQL(Connection conn, String sql) { boolean flag = false; diff --git a/src/com/platform/service/DataInfoServiceImp.java b/src/com/platform/service/DataInfoServiceImp.java index 3c89b60e..124e0aca 100644 --- a/src/com/platform/service/DataInfoServiceImp.java +++ b/src/com/platform/service/DataInfoServiceImp.java @@ -24,12 +24,12 @@ public class DataInfoServiceImp implements DataInfoService { public ModelMap getPagerTableData(PagerOptions pagerOptions) { // TODO Auto-generated method stub ModelMap modelMap = new ModelMap(); - int count = dfdDao.getLimitedDataCount(pagerOptions); //ȡܼ¼ + int count = dfdDao.getLimitedDataCount(pagerOptions); //获取总记录条数 int offset = 0; if (pagerOptions.getCurrentPageNum() > 1) { pagerOptions.setTotalLimit((pagerOptions.getCurrentPageNum() - 1) * pagerOptions.getPriorTableSize()); - offset = dfdDao.getLimitedBeginId(pagerOptions); //ȡʼѯid + offset = dfdDao.getLimitedBeginId(pagerOptions); //获取起始查询id System.out.println(offset); } pagerOptions.setOffset(offset + 1); @@ -46,11 +46,11 @@ public class DataInfoServiceImp implements DataInfoService { for(String idx: id){ List paths = dfdDao.getIdIsExist(Integer.parseInt(idx)); if(paths.size()>0){ - //ɾļ + //删除文件操作 for (int i = 0; i < paths.size(); i++) { System.out.println(paths.get(i)); } - //ɾݿ¼ + //删除数据库记录 //dfdDao.deleteRow(idx); } } diff --git a/src/com/platform/service/EncodeInfoService.java b/src/com/platform/service/EncodeInfoService.java index 8ef13844..36a200bc 100644 --- a/src/com/platform/service/EncodeInfoService.java +++ b/src/com/platform/service/EncodeInfoService.java @@ -5,7 +5,7 @@ import java.util.List; import com.platform.entities.EncodedInfoEntity; /** - * ݿҵ߼ӿ + * 数据库业务逻辑处理接口 * * @author wuming * diff --git a/src/com/platform/service/EncodeInfoServiceImpl.java b/src/com/platform/service/EncodeInfoServiceImpl.java index 3e5fe735..8492485d 100644 --- a/src/com/platform/service/EncodeInfoServiceImpl.java +++ b/src/com/platform/service/EncodeInfoServiceImpl.java @@ -10,7 +10,7 @@ import com.platform.dao.EncodeInfoDao; import com.platform.entities.EncodedInfoEntity; /** - * ҵ߼ľʵ + * 业务逻辑的具体实现类 * * @author wuming * @@ -26,7 +26,7 @@ public class EncodeInfoServiceImpl implements EncodeInfoService { } /** - * ݴݵtableNameȡӦʵϢ/ϵͳ + * 根据传递的tableName参数获取对应实体信息(行政区划/系统) */ @Override public List getAllEncodeInfo(String tableName) { @@ -35,7 +35,7 @@ public class EncodeInfoServiceImpl implements EncodeInfoService { } /** - * + * 测试事物 */ @Override public int deleteEncodeByCode(String code, String tableName) { diff --git a/src/com/platform/service/IGfsService.java b/src/com/platform/service/IGfsService.java new file mode 100644 index 00000000..4e5c8160 --- /dev/null +++ b/src/com/platform/service/IGfsService.java @@ -0,0 +1,47 @@ + +/** + * 文件名 : IGfsService.java + * 版权 : <版权/公司名> + * 描述 : <描述> + * @author chen + * 版本 : <版本> + * 修改时间: 2016年9月8日 + * 修改内容: <修改内容> + */ +package com.platform.service; + +import com.platform.entities.FolderNode; + +/** + * <一句话功能简述> + * <功能详细描述> + * @author chen + * @version [版本号,2016年9月8日] + * @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; + +} diff --git a/src/com/platform/service/OracleExtractHelper.java b/src/com/platform/service/OracleExtractHelper.java index dd8eb368..73043995 100644 --- a/src/com/platform/service/OracleExtractHelper.java +++ b/src/com/platform/service/OracleExtractHelper.java @@ -14,11 +14,11 @@ public class OracleExtractHelper { private OracleConnector oConnector; /** - * жdblinkǷѾ + * 判断dblink是否已经存在 * * @param conn * @param linkName - * dblink + * dblink的名称 * @return */ private boolean hasSameNameDBLink(Connection conn, String linkName) { @@ -37,11 +37,11 @@ public class OracleExtractHelper { } /** - * dblink + * 创建dblink * * @param conn * @param oc - * dblinkӲʵ + * dblink连接参数实体 */ public void createDBLink(Connection conn, OracleConnectorParams oc) { String linkName = "LinkTo" + oc.getName(); @@ -55,7 +55,7 @@ public class OracleExtractHelper { + ")))(CONNECT_DATA =(SERVICE_NAME =" + oc.getDatabase() + ")))';"; if (null != oc) { - if (hasSameNameDBLink(conn, linkName)) { // dblinkѾ,ɾdblinkڴdblink + if (hasSameNameDBLink(conn, linkName)) { // 如果dblink已经存在,先删除dblink,在创建dblink String deleteSql = "DROP PUBLIC DATABASE LINK LinkTo" + linkName; FileOperateHelper @@ -67,13 +67,13 @@ public class OracleExtractHelper { + oc.getName(), sql); oConnector.execOracleSQL(conn, sql); } else { - Configs.CONSOLE_LOGGER.error("ɾеDBLinkʧ,޷µDBLink!"); + Configs.CONSOLE_LOGGER.error("删除已有的DBLink失败,无法创建新的DBLink!"); FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION - + oc.getName(), "ɾеDBLinkʧ,޷µDBLink!"); + + oc.getName(), "删除已有的DBLink失败,无法创建新的DBLink!"); } } else { - // 򣬴dblink + // 否则,创建dblink oConnector.execOracleSQL(conn, sql); FileOperateHelper.fileWrite( Configs.EXTRACT_LOG_LOCALTION + oc.getName(), sql); @@ -82,7 +82,7 @@ public class OracleExtractHelper { } /** - * ռ + * 创建表空间 * * @param conn * @param oc @@ -103,7 +103,7 @@ public class OracleExtractHelper { } /** - * ûȨ + * 创建用户并授权 * * @param conn * @param oc @@ -119,7 +119,7 @@ public class OracleExtractHelper { } /** - * ִлܲ + * 执行汇总操作 * * @param conn * @param oc diff --git a/src/com/platform/service/OracleStatusService.java b/src/com/platform/service/OracleStatusService.java index 158eaf3f..0b081a88 100644 --- a/src/com/platform/service/OracleStatusService.java +++ b/src/com/platform/service/OracleStatusService.java @@ -17,9 +17,9 @@ import com.platform.utils.Configs; public class OracleStatusService { private static Map alliveTask = new Hashtable(); - public final static int EXEC_TIME = 10;// Ӷٴκ󲻳ɹȡ - public final static long INTERVAL_TIME = 60 * 1000;// ÿٺִһ - public final static long DELAY_TIME = 0; // ӳٶִ + public final static int EXEC_TIME = 10;// 连接多少次后不成功,取消链接 + public final static long INTERVAL_TIME = 60 * 1000;// 每隔多少毫秒执行一次连接任务 + public final static long DELAY_TIME = 0; // 延迟多少秒后执行 public void connectToOracle(String replicasName) { SimpleKubeClient sKubeClient = new SimpleKubeClient(); @@ -55,7 +55,7 @@ public class OracleStatusService { } /** - * ȡƳָʱ + * 取消并移除指定定时任务 * * * @param taskName @@ -73,7 +73,7 @@ public class OracleStatusService { } /** - * նʱ + * 清空定时任务 */ public void cleanUpAlliveTask() { Iterator> iterator = alliveTask.entrySet() @@ -86,7 +86,7 @@ public class OracleStatusService { } /** - * oracle + * 链接oracle任务类 * * @author wuming * @@ -114,14 +114,14 @@ public class OracleStatusService { + ocp.getPort() + ":" + ocp.getDatabase(); boolean flag = OracleConnector.canConnect(url, ocp.getUser(), ocp.getPassword()); - String message = "ʧ"; + String message = "失败"; if (flag && alliveTask.containsKey(taskName)) { client.updateOrAddReplicasLabelById(taskName, "status", "2"); - message = "ɹ"; - killAlliveTask(taskName); // ӳɹȡ + message = "成功"; + killAlliveTask(taskName); // 连接成功,取消连接 } - Configs.CONSOLE_LOGGER.info("ӵݿ " + taskName - + "\t[ӽ " + message + "]"); + Configs.CONSOLE_LOGGER.info("连接到数据库服务: " + taskName + + "\t[连接结果: " + message + "]"); } count++; } diff --git a/src/com/platform/service/impl/GfsServiceImpl.java b/src/com/platform/service/impl/GfsServiceImpl.java new file mode 100644 index 00000000..00b1cc9e --- /dev/null +++ b/src/com/platform/service/impl/GfsServiceImpl.java @@ -0,0 +1,48 @@ + +/** + * 文件名 : GfsServiceImpl.java + * 版权 : <版权/公司名> + * 描述 : <描述> + * @author chen + * 版本 : <版本> + * 修改时间: 2016年9月8日 + * 修改内容: <修改内容> + */ +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 [版本号,2016年9月8日] + * @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; + } + +} diff --git a/src/com/platform/utils/ConfigLoder.java b/src/com/platform/utils/ConfigLoder.java index fe3ef0f9..ce3b30a0 100644 --- a/src/com/platform/utils/ConfigLoder.java +++ b/src/com/platform/utils/ConfigLoder.java @@ -29,7 +29,7 @@ public class ConfigLoder { } /** - * ȡPropertyеֵ + * 读取文Property中的属性值 * * @param key * @return diff --git a/src/com/platform/utils/ConfigPropertyReader.java b/src/com/platform/utils/ConfigPropertyReader.java index 7f9df866..d2a3bd9b 100644 --- a/src/com/platform/utils/ConfigPropertyReader.java +++ b/src/com/platform/utils/ConfigPropertyReader.java @@ -29,7 +29,7 @@ public class ConfigPropertyReader { } /** - * ȡPropertyеֵ + * 读取文Property中的属性值 * * @param key * @return diff --git a/src/com/platform/utils/Configs.java b/src/com/platform/utils/Configs.java index 87ee6c2e..bb2afede 100644 --- a/src/com/platform/utils/Configs.java +++ b/src/com/platform/utils/Configs.java @@ -3,6 +3,13 @@ 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"); @@ -14,32 +21,32 @@ public class Configs { 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 - 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=""; //登入密码 } diff --git a/src/com/platform/utils/ConfigsLoader.java b/src/com/platform/utils/ConfigsLoader.java index 1b1c1959..44f00e7f 100644 --- a/src/com/platform/utils/ConfigsLoader.java +++ b/src/com/platform/utils/ConfigsLoader.java @@ -11,14 +11,14 @@ public class ConfigsLoader implements ServletContextListener { @Override public void contextDestroyed(ServletContextEvent sEvent) { // TODO Auto-generated method stub - Configs.CONSOLE_LOGGER.info("ϵͳֹͣ.."); + Configs.CONSOLE_LOGGER.info("系统停止.."); } @SuppressWarnings("static-access") @Override public void contextInitialized(ServletContextEvent sEvent) { // TODO Auto-generated method stub - Configs.CONSOLE_LOGGER.info("ϵͳʼ.."); + Configs.CONSOLE_LOGGER.info("系统初始化.."); String contextPath = sEvent.getServletContext().getRealPath("/") + "WEB-INF/config/config.properties"; this.cReader = ConfigPropertyReader.Builder(contextPath); diff --git a/src/com/platform/utils/FileOperateHelper.java b/src/com/platform/utils/FileOperateHelper.java index 31827547..b2b9fa9b 100644 --- a/src/com/platform/utils/FileOperateHelper.java +++ b/src/com/platform/utils/FileOperateHelper.java @@ -8,7 +8,7 @@ import java.io.IOException; import java.io.InputStreamReader; /** - * ļд + * 文件读写操作帮助类 * * @author wuming * @@ -16,7 +16,7 @@ import java.io.InputStreamReader; public class FileOperateHelper { /** - * ׷ӵķʽϢдļ + * 以追加的方式将信息写入文件 * * @param path * @param message @@ -27,7 +27,7 @@ public class FileOperateHelper { File file = new File(path); if (file.exists()) file.createNewFile(); - FileOutputStream out = new FileOutputStream(file, true); // ׷ӷʽtrue + FileOutputStream out = new FileOutputStream(file, true); // 如果追加方式用true StringBuffer sb = new StringBuffer(); sb.append(message).append("\n"); out.write(sb.toString().getBytes("utf-8")); @@ -37,7 +37,7 @@ public class FileOperateHelper { } /** - * ļȡ + * 文件读取方法 * @param path * @return */ diff --git a/src/com/platform/utils/UtilsHelper.java b/src/com/platform/utils/UtilsHelper.java index 348f7a54..3da84c22 100644 --- a/src/com/platform/utils/UtilsHelper.java +++ b/src/com/platform/utils/UtilsHelper.java @@ -23,7 +23,7 @@ public class UtilsHelper { for (Field fs : fileds) { String fieldName = fs.getName(); String fieldType = fs.getGenericType().toString() - .replace("class ", ""); // typeͣǰ"class " + .replace("class ", ""); // 如果type是类类型,则前面包含"class ",后面跟类名 if (paramMap.containsKey(fieldName)) { Method method = clazz.getDeclaredMethod( getAttributeSetName(fs), Class.forName(fieldType)); @@ -72,11 +72,11 @@ public class UtilsHelper { } /** - * {@fs}set + * 生成属性{@fs}的set方法的名字 * * @param fs - * Զ - * @return set + * 属性对象 + * @return set方法的名字 */ private static String getAttributeSetName(Field fs) { String fieldName = fs.getName(); diff --git a/test/com/platform/test/TestController.java b/test/com/platform/test/TestController.java index 662ee505..94e8aaf0 100644 --- a/test/com/platform/test/TestController.java +++ b/test/com/platform/test/TestController.java @@ -35,8 +35,8 @@ public class TestController { @ResponseBody public List getJson(HttpServletRequest res, HttpServletResponse req) { List list = new ArrayList(); - list.add(new User("lisi", 1, "")); - list.add(new User("zhansan", 2, "")); + list.add(new User("lisi", 1, "男")); + list.add(new User("zhansan", 2, "男")); return list; } diff --git a/test/com/platform/test/TestEncodeInfoDao.java b/test/com/platform/test/TestEncodeInfoDao.java index 8e729bf5..3ad7d492 100644 --- a/test/com/platform/test/TestEncodeInfoDao.java +++ b/test/com/platform/test/TestEncodeInfoDao.java @@ -32,26 +32,26 @@ public class TestEncodeInfoDao extends SMBasedTest { @Test public void testGetEncodeNameByCode() { String result = eiDao.getEncodeNameByCode("1", testTableName); - Assert.assertTrue(result.equals("Ԥִϵͳ")); + Assert.assertTrue(result.equals("预算执行系统")); } @Test public void testGetEncodeCodeByName() { List result = eiDao - .getEncodeCodeByName("Ԥִϵͳ", testTableName); + .getEncodeCodeByName("预算执行系统", testTableName); Assert.assertTrue(result.size() > 0); } @Test public void testUpdateEncodeNameByCode() { int result = eiDao - .updateEncodeNameByCode("3", "һ廯ƽ̨", testTableName); + .updateEncodeNameByCode("3", "财政一体化平台", testTableName); Assert.assertTrue(result > 0); } @Test public void testInsertEncodeEntity() { - int result = eiDao.insertEncodeEntity(new EncodedInfoEntity("˰ϵͳ", + int result = eiDao.insertEncodeEntity(new EncodedInfoEntity("非税收入系统", "4"), testTableName); Assert.assertTrue(result == 1); } diff --git a/test/com/platform/test/TestEncodeService.java b/test/com/platform/test/TestEncodeService.java index 3b4f40c6..a790ebe4 100644 --- a/test/com/platform/test/TestEncodeService.java +++ b/test/com/platform/test/TestEncodeService.java @@ -24,11 +24,11 @@ public class TestEncodeService extends SMBasedTest { @Test public void testGetEncodeNameByCode() { String result = eis.getEncodeNameByCode("2", testTableName); - Assert.assertTrue(result.equals("Ԥ")); + Assert.assertTrue(result.equals("部门预算")); } /** - * + * 事务测试 */ @Test public void testDeleteEncodeByCode() {