diff --git a/src/com/platform/utils/BeanCopy.java b/src/com/platform/utils/BeanCopy.java index 1de917fa..80fe67de 100644 --- a/src/com/platform/utils/BeanCopy.java +++ b/src/com/platform/utils/BeanCopy.java @@ -122,15 +122,18 @@ public class BeanCopy { field.set(dst, value); // field.set(dst, field.get(src)); } catch (SecurityException e) { + log.error(e); log.error(field.getName() + " is unsafe : SecurityException"); } catch (IllegalArgumentException e) { + log.error(e); log.error(field.getName() + " is inexist or null or OutOfRange : ArgumentException "); } catch (IllegalAccessException e) { + log.error(e); log.error(field.getName() + " Access is false : AccessException"); } catch (NoSuchMethodException e) { - log.error(e.getMessage()); + log.error(e); } catch (InvocationTargetException e) { - log.error(e.getMessage()); + log.error(e); } } } @@ -155,7 +158,7 @@ public class BeanCopy { Object obj = m.invoke(father); f.set(dst, obj); } catch (Exception e) { - log.error(e.getStackTrace()); + log.error(e); } } } diff --git a/src/com/platform/utils/Configs.java b/src/com/platform/utils/Configs.java index ab3bd3ab..5a16e1fc 100644 --- a/src/com/platform/utils/Configs.java +++ b/src/com/platform/utils/Configs.java @@ -90,9 +90,9 @@ public class Configs { public static int dataBefore = 6; /** - * excel导入一次批量导入12个 + * excel导入一次批量导入5个 */ - public static int NUM_ONE_IMPORT_EXCEL = 12; + public static int NUM_ONE_IMPORT_EXCEL = 5; /** * docker启动的 oracle服务 的 实例名称 diff --git a/src/com/platform/utils/ConfigsLoader.java b/src/com/platform/utils/ConfigsLoader.java index 592a59d4..e2c394fb 100644 --- a/src/com/platform/utils/ConfigsLoader.java +++ b/src/com/platform/utils/ConfigsLoader.java @@ -6,6 +6,7 @@ import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import com.platform.http.HttpClientConstant; +import com.platform.utils.excelUtils.ExcelOperation; /** web容器初始化 * @author chen @@ -109,6 +110,7 @@ public class ConfigsLoader implements ServletContextListener { Constant.rootPasswd=properties.getProperty("gfs_control_rootPassWd").trim(); Constant.ganymedSSH = new GanymedSSH(Constant.hostIp, Constant.rootUser, Constant.rootPasswd, Constant.port); + ExcelOperation.initTemplate(Constant.EXCEL_TEMPLATE_INIT_ROW, Constant.EXCEL_TEMPLATE_TOTAL_COL); } public ConfigPropertyReader getcReader() { diff --git a/src/com/platform/utils/Constant.java b/src/com/platform/utils/Constant.java index 8a4bd021..6c14919b 100644 --- a/src/com/platform/utils/Constant.java +++ b/src/com/platform/utils/Constant.java @@ -65,6 +65,9 @@ public class Constant { /** excel模板真实数据的起始行数 */ public final static int EXCEL_TEMPLATE_INIT_ROW = 8; + /** excel模板的 总列 数 */ + public final static int EXCEL_TEMPLATE_TOTAL_COL = 25; + /** excel导入-修改preDataInfo信息 */ public final static String preDataInfo_update = "修改"; diff --git a/src/com/platform/utils/FileOperateHelper.java b/src/com/platform/utils/FileOperateHelper.java index 3bb40c6f..9515da56 100644 --- a/src/com/platform/utils/FileOperateHelper.java +++ b/src/com/platform/utils/FileOperateHelper.java @@ -40,7 +40,7 @@ public class FileOperateHelper { out.write(sb.toString().getBytes("utf-8")); out.close(); } catch (IOException e) { - log.error(e.getStackTrace()); + log.error(e); } } @@ -65,14 +65,14 @@ public class FileOperateHelper { out.write(sb.toString().getBytes("utf-8")); out.close(); } catch (IOException e) { - log.error(e.getStackTrace()); + log.error(e); } finally{ if (null != out) { try { out.close(); } catch (IOException e) { - log.error(e.getStackTrace()); + log.error(e); } } } @@ -99,14 +99,14 @@ public class FileOperateHelper { out.write(sb.toString().getBytes("GBK")); out.close(); } catch (IOException e) { - log.error(e.getStackTrace()); + log.error(e); } finally{ if (null != out) { try { out.close(); } catch (IOException e) { - log.error(e.getStackTrace()); + log.error(e); } } } @@ -132,14 +132,14 @@ public class FileOperateHelper { sb.append(tempString).append("\r\n"); } } catch (Exception e) { - log.error(e.getStackTrace()); + log.error(e); } finally{ if (null != fis) { try { fis.close(); } catch (IOException e) { - log.error(e.getStackTrace()); + log.error(e); } } } @@ -168,14 +168,14 @@ public class FileOperateHelper { sb.append(tempString+"\n"); } } catch (Exception e) { - log.error(e.getStackTrace()); + log.error(e); } finally{ if (null != fis) { try { fis.close(); } catch (IOException e) { - log.error(e.getStackTrace()); + log.error(e); } } } diff --git a/src/com/platform/utils/ProcessMyUtil.java b/src/com/platform/utils/ProcessMyUtil.java index af21a9dd..d28e4a6f 100644 --- a/src/com/platform/utils/ProcessMyUtil.java +++ b/src/com/platform/utils/ProcessMyUtil.java @@ -31,9 +31,9 @@ public class ProcessMyUtil { result.add(line); } } catch (IOException e) { - logger.error(e.getStackTrace()); + logger.error(e); } catch (InterruptedException e) { - logger.error(e.getStackTrace()); + logger.error(e); } return result; } diff --git a/src/com/platform/utils/ThreadRemoveFile.java b/src/com/platform/utils/ThreadRemoveFile.java index 0caedf00..b6800652 100644 --- a/src/com/platform/utils/ThreadRemoveFile.java +++ b/src/com/platform/utils/ThreadRemoveFile.java @@ -29,7 +29,7 @@ public class ThreadRemoveFile extends Thread { try { Thread.sleep(1000); } catch (InterruptedException e) { - log.error(e.getStackTrace()); + log.error(e); } List tmpPathArr = new ArrayList(); if (null != path4Delete && path4Delete.size() > 0) { diff --git a/src/com/platform/utils/XmlOperationByDom4j.java b/src/com/platform/utils/XmlOperationByDom4j.java index b259eb3c..aa381350 100644 --- a/src/com/platform/utils/XmlOperationByDom4j.java +++ b/src/com/platform/utils/XmlOperationByDom4j.java @@ -63,6 +63,31 @@ public class XmlOperationByDom4j { return issuccess; } + public static boolean createNullXml(String fileName, String rootnode) { + + boolean issuccess = false; + Document document = null; + try { + OutputFormat xmlFormat = OutputFormat.createPrettyPrint(); + xmlFormat.setEncoding("UTF-8"); + XMLWriter xmlWriter; + // �ļ��Ƿ���ڣ� + document = DocumentHelper.createDocument(); // �����ĵ� + Element root = document.addElement(rootnode); + // ��� node�����ԣ�������ڵ��� + xmlWriter = new XMLWriter(new OutputStreamWriter(new FileOutputStream(new File(fileName)), "UTF-8"), + xmlFormat); + // ����д�ļ����� + + xmlWriter.write(document); // д���ļ��� + xmlWriter.close(); + issuccess = true; + } catch (Exception e) { + issuccess = false; + } + return issuccess; + } + public static boolean addNode2Xml(String fileName, String rootnode, List nodes) { if (null == nodes || 0 ==nodes.size()) { return false; diff --git a/src/com/platform/utils/ZipCompressUtils.java b/src/com/platform/utils/ZipCompressUtils.java index 0da7d1d4..a2a120f3 100644 --- a/src/com/platform/utils/ZipCompressUtils.java +++ b/src/com/platform/utils/ZipCompressUtils.java @@ -31,7 +31,7 @@ public class ZipCompressUtils { logger.info("压缩结束"); zos.close(); } catch (Exception e) { - logger.error(e.getStackTrace()); + logger.error(e); } } else { @@ -64,7 +64,7 @@ public class ZipCompressUtils { writeFile(zos, file); } } catch (Exception e) { - logger.error(e.getStackTrace()); + logger.error(e); } }