diff --git a/.classpath b/.classpath
index 7155d58e..b39d1be2 100644
--- a/.classpath
+++ b/.classpath
@@ -4,15 +4,11 @@
-
-
-
-
-
+
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/build/classes/.gitignore b/build/classes/.gitignore
index 67f303f0..4bc3afa4 100644
--- a/build/classes/.gitignore
+++ b/build/classes/.gitignore
@@ -1,2 +1,2 @@
-/com/
-/dataSystem.properties
+/com
+/spring-applicationContext-test.xml
diff --git a/build/classes/com/platform/controller/DataModelController.class b/build/classes/com/platform/controller/DataModelController.class
index 6d59835f..837dcfde 100644
Binary files a/build/classes/com/platform/controller/DataModelController.class and b/build/classes/com/platform/controller/DataModelController.class differ
diff --git a/build/classes/com/platform/controller/DefaultController.class b/build/classes/com/platform/controller/DefaultController.class
index f975e29e..91940503 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/entities/EncodedInfoEntity.class b/build/classes/com/platform/entities/EncodedInfoEntity.class
index f920dc4d..ca2439bd 100644
Binary files a/build/classes/com/platform/entities/EncodedInfoEntity.class and b/build/classes/com/platform/entities/EncodedInfoEntity.class differ
diff --git a/build/classes/com/platform/utils/Configs.class b/build/classes/com/platform/utils/Configs.class
index 6bc46bf3..ef6f24b0 100644
Binary files a/build/classes/com/platform/utils/Configs.class and b/build/classes/com/platform/utils/Configs.class differ
diff --git a/src/com/base/BaseController.java b/src/com/base/BaseController.java
index 8a6c02c2..2192dbc5 100644
--- a/src/com/base/BaseController.java
+++ b/src/com/base/BaseController.java
@@ -1,47 +1,54 @@
/**
- * ļ BaseController.java
- * Ȩ : XXƼ˾
- * : <>
- * ʱ䣺201697
- * ݣ<>
+ * 文件名 : BaseController.java
+ * 版权 : XX科技有限公司。
+ * 描述 : <描述>
+ * 修改时间:2016年9月7日
+ * 修改内容:<修改内容>
*/
package com.base;
import javax.servlet.http.HttpServletRequest;
+import org.apache.log4j.Logger;
import org.springframework.web.bind.annotation.ExceptionHandler;
+import com.platform.utils.Configs;
+
/**
- * <һ仰ܼ>
- * <ϸ>
+ * <一句话功能简述>
+ * <功能详细描述>
* @author chen
- * @version [汾ţ201697]
- * @see [/]
- * @since [Ʒ/ģ汾]
+ * @version [版本号,2016年9月7日]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
*/
-public class BaseController {
+public class BaseController {
+
+ /** log4j */
+ public static Logger log = Logger.getRootLogger();
/**
- * <һ仰ܼ> @ExceptionHandler쳣----ȫ쳣
- * <ϸ>
+ * <一句话功能简述> 基于@ExceptionHandler异常处理----全局异常处理
+ * <功能详细描述>
* @param request
- * @param ex 쳣
+ * @param ex 异常
* @return
- * @see [ࡢ##Ա]
+ * @see [类、类#方法、类#成员]
*/
@ExceptionHandler
- public String exp(HttpServletRequest request, Exception ex) {
+ public Object exp(HttpServletRequest request, Exception ex) {
request.setAttribute("ex", ex);
System.err.println("BaseController --exp ");
- // ݲͬתͬҳ
- if(ex instanceof CustomException) {
- //TODO ·װjson
- System.err.println("BaseController --exp -- CustomException ");
- return "error-business";
+ // 根据不同错误转向不同页面
+ if(ex instanceof CustomException) {
+ CustomException cuse = (CustomException) ex;
+ log.error(Configs.GLOBAL_EXP_CUSTOM);
+ //TODO 从新封装json
+ return "{"+Configs.GLOBAL_EXP_CUSTOM+":"+cuse.getMsg()+"}";
} else {
- //TODO ָҳ
-
+ //TODO 其他错误则 调到指定页面
+ log.error(Configs.GLOBAL_EXP_NOT_CUSTOM, ex);
return "error";
}
}
diff --git a/src/com/base/Constant.java b/src/com/base/Constant.java
index 87bd657d..4d336465 100644
--- a/src/com/base/Constant.java
+++ b/src/com/base/Constant.java
@@ -1,32 +1,22 @@
package com.base;
-import java.io.File;
-
/**
- * @
- * @author chen
- * @date 2016830
- * @package com.base
+ * <一句话功能简述>
+ * <功能详细描述>
+ * @author chen
+ * @version [版本号,2016年9月8日]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
*/
public class Constant {
- /** ļļ-dataSystem.properties */
- public static String SYSTEM_PROPERTIES_FIEL_PATH = "/com/base/dataSystem.properties";
-
- /** ʻļļ-i18n.properties */
+ /** 国际话配置文件文件-i18n.properties */
public static String I18N_PROPERTIES_FIEL_PATH = "/com/base/i18n.properties";
- /** ¼쳣ļ-system_exception.txt-λ-- */
- public final static String SYSTEM_EXCEPTION_FILEPATH = "\\log\\system_exception.txt";
-
-
- /** WritefileThread-߳˯ʱ--3000 */
+ /** WritefileThread-线程睡眠时间--3000 */
public final static long THREAD_SLEEP_WRITEFILETHREAD = 3000;
- /** Ƿ쳣дļ */
- public final static String IS_WRITE_LOGFILE = "iswritelogfile";
-
- /** CustomException¼쳣ĶĶ--10 */
+ /** 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
index cfbab1e6..2aeba6c6 100644
--- a/src/com/base/Custom4exception.java
+++ b/src/com/base/Custom4exception.java
@@ -1,41 +1,20 @@
package com.base;
-
/**
- * @ 쳣
- * @author chen
- * @date 2016822
- * @package com.base
+ * <一句话功能简述> 异常常量编码
+ * <功能详细描述>
+ * @author chen
+ * @version [版本号,2016年9月8日]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
*/
public class Custom4exception {
- //3003001001 : һλʶ쳣 ڶλʶģ飬λʶ𣬵ڰ˵ʮλʶ쳣
- /** 3쳣
- * 003ģ
- * 001Դ
- * 001쳣
+ //3003001001 : 第一位:标识异常, 第二到第四位:标识模块,第五道第七位:标识类别,第八道第十位标识具体异常
+ /**eg
+ * 3:异常
+ * 003:虚拟机模块
+ * 001:软件依赖虚拟机资源类别
+ * 001:启动异常
*/
- /** -Դ-VM쳣 */
- public final static String vbox_start_exp = "3003001001";
-
- /** -Դ-VBoxManage.exe 쳣 */
- public final static String vbox_exe_non_exist_exp = "3003001002";
-
- /** --ùļж쳣 */
- public final static String share_dir_interrupted_exp = "3003002001";
-
- /** ݹ-ϱ-жϻд쳣 */
- public final static String data_manage_interrupted_exp = "3004001001";
-
- /** ģutils-xml-xmlǷ쳣 */
- public final static String xml_field_Illega_exp = "3005001001";
-
- /** ģutils-xml-document쳣 */
- public final static String xml_docu_exp = "3005001002";
-
- /** ģutils-xml-д쳣 */
- public final static String xml_io_exp = "3005001003";
-
- /** ģutils-oracle-д쳣 */
- public final static String oracle_io_exp = "3005002001";
}
diff --git a/src/com/base/CustomException.java b/src/com/base/CustomException.java
index f9c4192c..1c1d43e9 100644
--- a/src/com/base/CustomException.java
+++ b/src/com/base/CustomException.java
@@ -1,35 +1,38 @@
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 Object[] objArray;
- /** 쳣 */
+ /** 异常 */
private Throwable cause;
- static{
- // Ƿ ¼ 쳣߳
- if (Boolean.valueOf(Resource.getProperties().get(Constant.IS_WRITE_LOGFILE))) {
- // ¼ 쳣߳
- WritefileThread wt = new WritefileThread();
- wt.start();
- }
- }
-
public CustomException() {
super();
}
/**
- * @ 쳣¼ļ
- * @param code 쳣
- * @param msg Զ쳣Ϣ
+ * @功能 将异常记录进文件
+ * @param code 异常编码
+ * @param msg 自定义异常信息
* @param e
* @param obj
*/
@@ -41,12 +44,12 @@ public class CustomException extends Exception {
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();
@@ -55,7 +58,7 @@ public class CustomException extends Exception {
sbuf.append("\r\n");
}
}
- //¼ 쳣ʱ ǰĶ
+ //记录 出现异常时 当前的对象
if (null != obj) {
Object[] array = obj;
sbuf.append("Object[] size : ");
@@ -80,14 +83,12 @@ public class CustomException extends Exception {
}
sbuf.append("\r\n");
- // Ƿ д ļ
- if (Boolean.valueOf(Resource.getProperties().get(Constant.IS_WRITE_LOGFILE))) {
- WritefileThread.getStrArray().add(sbuf.toString());
- }
+ // 是否 写入 文件
+ log.error(sbuf.toString());
}
/**
- * @ msg
+ * @功能 获得msg
* @return msg
*/
public String getMsg() {
@@ -95,7 +96,7 @@ public class CustomException extends Exception {
}
/**
- * @ objArray
+ * @功能 获得objArray
* @return objArray
*/
public Object[] getObjArray() {
@@ -103,7 +104,7 @@ public class CustomException extends Exception {
}
/**
- * @ cause
+ * @功能 获得cause
* @return cause
*/
public Throwable getCause() {
diff --git a/src/com/base/FileOperate.java b/src/com/base/FileOperate.java
deleted file mode 100644
index 718d3d4d..00000000
--- a/src/com/base/FileOperate.java
+++ /dev/null
@@ -1,383 +0,0 @@
-package com.base;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.RandomAccessFile;
-import java.nio.channels.FileLock;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-
-import javax.swing.filechooser.FileSystemView;
-
-/**
- * @ ļ
- * @author chen
- * @date 201688
- * @package com.utils
- */
-public class FileOperate {
- private final static String localDiskName = "ش";
- private final static String enlocalDiskName = "Local Disk";
- private final static String CD = "CD";
- private final static String DVD = "DVD";
- public static String usbPath = "";
-
- /**
- * @ ȡȫⲿƶӲ·
- *
- * @return
- */
- public static List filterDiskPath() {
- FileSystemView fileSystemView = FileSystemView.getFileSystemView();
- List diskPathName = new ArrayList();
- File[] roots = File.listRoots();
- for (File file : roots) {
- String diskName = fileSystemView.getSystemTypeDescription(file);// ȡ̵Ϣ
- if (diskName.startsWith(localDiskName) || diskName.startsWith(enlocalDiskName) || diskName.contains(CD)
- || diskName.contains(CD) || diskName.contains(DVD)) // Ϊƶʱ{
- continue;
- diskPathName.add(file.getAbsolutePath());
- }
- return diskPathName;
- }
-
- /**
- * @ ļ
- * @param path
- * ϼĿ¼
- * @param dirName
- * Ŀ¼
- * @return
- */
- public static int createDir(String path, String dirName) {
- File dirFile = new File(path + "\\" + dirName);
- if (!dirFile.exists()) {
- if (!dirFile.mkdirs()) {
- System.out.println("Ŀ¼ڣʧܣ");
- return 2;
- }
- return 1;
- }
- return 0;
- }
-
- /**
- * @ ļǷ
- *
- * @param path
- * ļ·
- * @return
- */
- public static boolean isFileExists(String path) {
- File file = new File(path);
- if (file.exists())
- return true;
- return false;
- }
-
- /**
- * @ ļǷ
- *
- * @param name
- * ļ·
- * @return
- */
- public static boolean file_dir_exist(String name) {
-
- try {
- File file = new File(name);
- if (!file.exists()) {
- return false;
- // return true;
- }
- }
- catch (Exception e) {
- // TODO: handle exception
- return false;
- }
- return true;
- }
-
- /**
- * @ 26ڵƴӵַʲôã
- * @param length
- * ƴӴ
- * @return
- */
- public static String getRandomString(int length) { // lengthʾַij
- String base = "abcdefghijklmnopqrstuvwxyz";
- Random random = new Random();
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < length; i++) {
- int number = random.nextInt(base.length());
- sb.append(base.charAt(number));
- }
- return sb.toString();
- }
-
- /**
- * @ ַʽȡļ
- * @param fiel_name
- * ļ
- * @return ַ
- */
- public static String read_fileToStr(String fiel_name) {
- String str = "";
- try {
- File file = new File(fiel_name);
- String lineTxt = "";
- InputStreamReader read = new InputStreamReader(new FileInputStream(file), "gbk");// ǵʽ
- BufferedReader bufferedReader = new BufferedReader(read);
- while ((lineTxt = bufferedReader.readLine()) != null) {
- str = str + lineTxt;
- }
- bufferedReader.close();
- read.close();
- }
- catch (Exception e) {
- e.printStackTrace();
- return "Exception";
- }
- return str;
- }
-
- /**
- * @ ȡļ·ĸĿ¼ʽ
- * @param path_filename
- * ļļ·
- * @return
- */
- public static String get_filename_from_path(String path_filename) {
- String[] strings = path_filename.split("\\\\");
-
- return strings[strings.length - 1];
- }
-
- /**
- * @ dirPathĿ¼µļ
- * @param dirPath
- * Ŀ¼
- * @return ļ
- */
- public static List findAllFilenameFromPath(String dirPath) {
- ArrayList fileAbsolutePaths = new ArrayList<>();
- FileOperate.findFiles(dirPath, fileAbsolutePaths);
- return fileAbsolutePaths;
- }
-
- /**
- * @ ɾĿ¼ļļ
- * @param dirPath
- * Ŀ¼
- * @return
- */
- public static boolean delAllFileByDir(String dirPath) {
- boolean flag = false;
- File file = new File(dirPath);
- // жĿ¼ļǷ
- if (!file.exists()) { // ڷ false
- return flag;
- }
- else {
- // жǷΪļ
- if (file.isFile()) { // Ϊļʱɾļ
- return deleteFile(dirPath);
- }
- else { // ΪĿ¼ʱɾĿ¼
- return deleteDirectory(dirPath);
- }
- }
- }
-
- /**
- * @ дļ
- * @param content
- * ļ
- * @param filePathName
- * ļ·
- */
- public static void writeFile(List