{"id":954,"date":"2018-10-05T10:35:13","date_gmt":"2018-10-05T02:35:13","guid":{"rendered":"https:\/\/199604.com\/?p=954"},"modified":"2019-07-13T11:28:35","modified_gmt":"2019-07-13T03:28:35","slug":"java%e5%af%b9%e6%af%94%e5%85%a5%e5%ba%93%e5%b0%8f%e7%a8%8b%e5%ba%8f","status":"publish","type":"post","link":"https:\/\/199604.com\/954","title":{"rendered":"java\u5bf9\u6bd4\u5165\u5e93\u5c0f\u7a0b\u5e8f"},"content":{"rendered":"<p>\u9700\u6c42\uff1a\u5bf9\u6bd4\u89c4\u5219\u8868\u548c\u7d2f\u8ba1\u8868\uff0c\u7b26\u5408\u6761\u4ef6\u7684\u8fdb\u884c\u5199\u5165\u6587\u4ef6\u3002<\/p>\n<p>\u7a0b\u5e8f\u7ed3\u6784<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/199604.com\/wp-content\/uploads\/2018\/10\/20181005101615.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"274\" height=\"532\" class=\"alignnone size-full wp-image-955\" data-original=\"https:\/\/199604.com\/wp-content\/uploads\/2018\/10\/20181005101615.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\"  sizes=\"auto, (max-width: 274px) 100vw, 274px\" \/><\/div><\/p>\n<p>pom.xml<\/p>\n<pre class=\"lang:default decode:true \">&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\n  &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\n  &lt;groupId&gt;com.htjf&lt;\/groupId&gt;\n  &lt;artifactId&gt;iot_ana&lt;\/artifactId&gt;\n  &lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt;\n  \n  &lt;name&gt;iot_ana&lt;\/name&gt;\n  &lt;url&gt;http:\/\/maven.apache.org&lt;\/url&gt;\n  \n  &lt;repositories&gt;\n   \t&lt;repository&gt;\n  \t\t&lt;id&gt;alimaven&lt;\/id&gt;\n  \t\t&lt;url&gt;http:\/\/maven.aliyun.com\/nexus\/content\/repositories\/central\/&lt;\/url&gt;\n  \t&lt;\/repository&gt;\n  \t&lt;repository&gt;\n  \t\t&lt;id&gt;hortonworks&lt;\/id&gt;\n  \t\t&lt;url&gt;http:\/\/repo.hortonworks.com\/content\/groups\/public\/&lt;\/url&gt;\n  \t&lt;\/repository&gt;\n  &lt;\/repositories&gt;\n  &lt;dependencies&gt;\n\t&lt;dependency&gt;\n\t    &lt;groupId&gt;commons-io&lt;\/groupId&gt;\n\t    &lt;artifactId&gt;commons-io&lt;\/artifactId&gt;\n\t    &lt;version&gt;2.4&lt;\/version&gt;\n\t&lt;\/dependency&gt;\n  \t&lt;dependency&gt;\n\t\t&lt;groupId&gt;junit&lt;\/groupId&gt;\n\t\t&lt;artifactId&gt;junit&lt;\/artifactId&gt;\n\t\t&lt;version&gt;3.8.1&lt;\/version&gt;\n\t\t&lt;!-- \n\t\t&lt;scope&gt;test&lt;\/scope&gt;\n\t\t --&gt;\n\t&lt;\/dependency&gt;\n  \t&lt;dependency&gt;\n\t\t&lt;groupId&gt;log4j&lt;\/groupId&gt;\n\t\t&lt;artifactId&gt;log4j&lt;\/artifactId&gt;\n\t\t&lt;version&gt;1.2.17&lt;\/version&gt;\n\t&lt;\/dependency&gt;\n\t&lt;dependency&gt;\n\t\t&lt;groupId&gt;dom4j&lt;\/groupId&gt;\n\t\t&lt;artifactId&gt;dom4j&lt;\/artifactId&gt;\n\t\t&lt;version&gt;1.6.1&lt;\/version&gt;\n\t&lt;\/dependency&gt;\n\t&lt;dependency&gt;  \n        &lt;groupId&gt;com.oracle&lt;\/groupId&gt;  \n        &lt;artifactId&gt;ojdbc14&lt;\/artifactId&gt;  \n        &lt;version&gt;10.2.0.1.0&lt;\/version&gt;  \n     &lt;\/dependency&gt;\n  &lt;\/dependencies&gt;\n  &lt;build&gt;\n  \t&lt;plugins&gt;\n  \t\t&lt;plugin&gt;\n  \t\t\t&lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt;\n\t\t\t&lt;artifactId&gt;maven-compiler-plugin&lt;\/artifactId&gt;  \n\t\t\t&lt;version&gt;3.2&lt;\/version&gt;\n\t\t\t&lt;configuration&gt;  \n            \t&lt;source&gt;1.7&lt;\/source&gt;  \n            \t&lt;target&gt;1.7&lt;\/target&gt;  \n            \t&lt;encoding&gt;UTF-8&lt;\/encoding&gt;\n            &lt;\/configuration&gt; \n  \t\t&lt;\/plugin&gt;\n  \t&lt;\/plugins&gt;\n  &lt;\/build&gt;\n  \n&lt;\/project&gt;<\/pre>\n<p>ana\u5305\u4e0b\u7684\u4e24\u4e2ajava\u6587\u4ef6(\u4e3b\u7c7b\u5305)<\/p>\n<p>AnalysisBean<\/p>\n<pre class=\"lang:default decode:true \">package com.htjf.ana;\n\npublic class AnalysisBean {\n\t\n\tprivate String iotId;\/\/iot\u8bbe\u5907ID\n\tprivate String ruleId;\/\/\u89c4\u5219\u552f\u4e00id\n\tprivate String iotRule;\/\/iot\u89c4\u5219\n\tprivate String matchType;\/\/\u5339\u914d\u89c4\u52190\uff1a\u5b8c\u5168\u5339\u914d\uff0c1\uff1a\u6a21\u7cca\u5339\u914d\n\t\n\tprivate String imei;\n\tprivate String iotType;\/\/\u53ef\u80fd\u662fhost\/ua\/apn...\n\tprivate String dt;\/\/\u76f8\u5dee\u65f6\u95f4\uff08LT-FT\uff09\n\t\n\tpublic AnalysisBean(String iotId, String ruleId, String iotRule,\n\t\t\tString matchType) {\n\t\tsuper();\n\t\tthis.iotId = iotId;\n\t\tthis.ruleId = ruleId;\n\t\tthis.iotRule = iotRule;\n\t\tthis.matchType = matchType;\n\t}\n\t\n\tpublic void setData(String imei, String iotType, String dt) {\n\t\tthis.imei = imei;\n\t\tthis.iotType = iotType;\n\t\tthis.dt = dt;\n\t}\n\t\n\tpublic AnalysisBean() {\n\t\tsuper();\n\t}\n\t\n\tpublic String getIotId() {\n\t\treturn iotId;\n\t}\n\tpublic void setIotId(String iotId) {\n\t\tthis.iotId = iotId;\n\t}\n\tpublic String getRuleId() {\n\t\treturn ruleId;\n\t}\n\tpublic void setRuleId(String ruleId) {\n\t\tthis.ruleId = ruleId;\n\t}\n\tpublic String getIotRule() {\n\t\treturn iotRule;\n\t}\n\tpublic void setIotRule(String iotRule) {\n\t\tthis.iotRule = iotRule;\n\t}\n\tpublic String getMatchType() {\n\t\treturn matchType;\n\t}\n\tpublic void setMatchType(String matchType) {\n\t\tthis.matchType = matchType;\n\t}\n\tpublic String getImei() {\n\t\treturn imei;\n\t}\n\tpublic void setImei(String imei) {\n\t\tthis.imei = imei;\n\t}\n\tpublic String getIotType() {\n\t\treturn iotType;\n\t}\n\tpublic void setIotType(String iotType) {\n\t\tthis.iotType = iotType;\n\t}\n\tpublic String getDt() {\n\t\treturn dt;\n\t}\n\tpublic void setDt(String dt) {\n\t\tthis.dt = dt;\n\t}\n\n\t@Override\n\tpublic String toString() {\n\t\treturn iotId + \",\" + ruleId + \",\" +matchType+ \",\" + imei  + \",\" + dt+ \"\";\n\t}\n\t\n}\n<\/pre>\n<p>IotAllAnalysis(\u4e3b\u7a0b\u5e8f)<\/p>\n<pre class=\"lang:default decode:true \">package com.htjf.ana;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.sql.Connection;\nimport java.sql.ResultSet;\nimport java.sql.SQLException;\nimport java.sql.Statement;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.apache.commons.io.FileUtils;\nimport org.apache.log4j.Logger;\n\nimport com.htjf.util.ConfigUtil;\nimport com.htjf.util.DBHiberUtil;\nimport com.htjf.util.DateUtil;\nimport com.htjf.util.FileUtil;\n\npublic class IotAllAnalysis {\n\tprivate static Logger logger = Logger.getLogger(IotAllAnalysis.class);\n\t\n\tprivate Map&lt;String ,AnalysisBean&gt;actuMap=new HashMap&lt;String,AnalysisBean&gt;();\n\tprivate Map&lt;String ,AnalysisBean&gt;likeMap=new HashMap&lt;String,AnalysisBean&gt;();\n\tprivate long maxFileSize = ConfigUtil.getMaxFileSise();\/\/\u9650\u5236\u6587\u4ef6\u5927\u5c0f\n\tprivate int maxCountRow = ConfigUtil.getMaxCountRow();\/\/\u9650\u5236\u884c\u6570\u5927\u5c0f\n\tprivate String initFileEndName = ConfigUtil.getInitFileEndName();\/\/\u6587\u4ef6\u7684\u540e\u7f00\u540d(.temp)\n\tprivate String fileEndName = ConfigUtil.getFileEndName();\/\/\u6587\u4ef6\u7684\u540e\u7f00\u540d(.csv)\n\tpublic IotAllAnalysis(){\n\t\tsuper();\n\t}\n\tpublic void doAction(){\n\t\tString[] dataList = ConfigUtil.getDataType().split(\",\");\n\t\tfor(int i =0;i&lt;dataList.length;i++){\n\t\t\tString dataType = dataList[i].toString();\n\t\t\tloadRule(dataType);\n\t\t\treadAllData(dataType);\n\t\t}\n\t}\n\t\/**\n\t * \u5339\u914d\u89c4\u5219\n\t * \u7cbe\u51c6\u4f18\u5148(\u5f53\u7cbe\u786e\u5339\u914d\u5230\u4e0d\u518d\u5339\u914d\u6a21\u7cca)\n\t * \u6a21\u7cca\u4e4b\u540e\n\t * @param iotType\n\t * @return\n\t *\/\n\tpublic AnalysisBean matchIotType(String iotType){\n\t\tif(null==iotType||\"\".equals(iotType)){\n\t\t\treturn null;\n\t\t}\n\t\tiotType = iotType.toUpperCase();\/\/\u8f6c\u5316\u4e3a\u5927\u5199\n\t\tAnalysisBean analysisBean = null;\n\t\tfor (String actuMapStr : actuMap.keySet()) {\n\t\t\tif(iotType.equals(actuMapStr)){\n\t\t\t\tanalysisBean = actuMap.get(actuMapStr);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(null!=analysisBean){\n\t\t\treturn analysisBean;\n\t\t}\n\t\t\n\t\tfor(String likeMapStr : likeMap.keySet()) {\n\t\t\tif(iotType.contains(likeMapStr)){\n\t\t\t\treturn likeMap.get(iotType);\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn null;\n\t}\n\t\n\t\/**\n\t * \u8bfb\u53d6\u7d2f\u8ba1\u8868\u7684\u6570\u636e\n\t *\/\n\tpublic void readAllData(String dataType){\n\t\tConnection conn = null;\n\t\tStatement stmt = null;\n\t\tResultSet rs = null;\n\t\t\n\t\tList&lt;AnalysisBean&gt; list = new ArrayList&lt;&gt;();\n\t\tFile writeFile = null;\n\t\t\n\t\tString sql  = ConfigUtil.getQueryDataType(dataType);\n\t\tlogger.info(\"\u67e5\u8be2\u7684sql\u8bed\u53e5\"+sql);\n\t\ttry {\n\t\t\tconn = DBHiberUtil.getConnection();\n\t\t\tstmt = conn.createStatement();\n\t\t\trs = stmt.executeQuery(sql);\n\t\t\t\n\t\t\tString initFilePathName = ConfigUtil.getFilePath()+File.separator+dataType+File.separator+dataType+\"_\"+\n\t\t\t\t\tDateUtil.nowTime()+\"_\"+ConfigUtil.getRandomNum()+initFileEndName;\n\t\t\twriteFile = new File(initFilePathName); \/\/\u6587\u4ef6\u8def\u5f84\u540d\n\t\t\tlogger.info(\"===&gt;\u751f\u6210\u6587\u4ef6\"+writeFile.getName());\n\t\t\tlong start = System.currentTimeMillis();\n\t\t\tlong countTime = 0;\n\t\t\tlong countrow = 0;\n\t\t\twhile(rs.next()){\n\t\t\t\tcountrow++;\n\t\t\t\tString imei = rs.getString(\"imei\");\n\t\t\t\tString iotType = rs.getString(\"iotType\");\/\/\u5982\u679c\u63a5\u5165\u591a\u4e2a\u8fd9\u91cc\u9700\u8981\u4fee\u6539\n\t\t\t\tString dt = rs.getString(\"dt\");\n\t\t\t\t\/\/\u83b7\u53d6\u6bcf\u4e00\u884c\u6570\u636e-\u5339\u914d\u89c4\u5219\n\t\t\t\tAnalysisBean analysisBean = matchIotType(iotType);\n\t\t\t\tif(null!=analysisBean){\n\t\t\t\t\t\/\/\u5339\u914d\u5230\u6570\u636e\n\t\t\t\t\tanalysisBean.setData(imei, iotType, dt);\n\t\t\t\t\tlist.add(analysisBean);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif(list.size()%maxCountRow==0){\n\t\t\t\t\t\t\tcountTime++;\n\t\t\t\t\t\t\tif(ConfigUtil.isAddFile()){\n\t\t\t\t\t\t\t\tif(writeFile.length()&gt;maxFileSize){\n\t\t\t\t\t\t\t\t\t\/\/\u4ece.termp\u4e34\u65f6\u6587\u4ef6\u8f6c\u4e3a.csv\u540e\u7f00\u6587\u4ef6\n\t\t\t\t\t\t\t\t\twriteFile = FileUtil.rename(writeFile, initFileEndName, fileEndName);\n\t\t\t\t\t\t\t\t\tlogger.info(writeFile.getName()+\",\u5927\u4e8emaxFileSize\u9650\u5236\u7684\"+(maxFileSize\/1024\/1024)+\"M\uff0c\u9700\u91cd\u65b0\u521b\u5efa\u6587\u4ef6\");\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tlong end = System.currentTimeMillis();\n\t\t\t\t\t\t\t\t\tlogger.info(\"\u751f\u6210\u4e00\u4e2a\u6587\u4ef6\u8017\u65f6\uff1a\" + ((end - start)\/1000) +\" \u79d2\");\n\t\t\t\t\t\t\t\t\tstart = end;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tinitFilePathName = ConfigUtil.getFilePath()+File.separator+dataType+File.separator+dataType+\"_\"+\n\t\t\t\t\t\t\t\t\t\t\tDateUtil.nowTime()+\"_\"+ConfigUtil.getRandomNum()+initFileEndName;\n\t\t\t\t\t\t\t\t\twriteFile = new File(initFilePathName); \/\/\u6587\u4ef6\u8def\u5f84\u540d\t\t\n\t\t\t\t\t\t\t\t\tlogger.info(\"===&gt;\u751f\u6210\u6587\u4ef6\"+writeFile.getName());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tFileUtils.writeLines(writeFile, list,true);\n\t\t\t\t\t\t\t\t\tlogger.info(\"\u7b2c\"+countrow+\"\u4e2a,\u7b2c\"+countTime+\"\u6279\u6b21===&gt;\u5339\u914d\u5230\u6570\u636e\u5927\u4e8e\"+maxCountRow+\"\u6761\u4e86,\u5e76\u4e14\u5199\u5165\u4e86--&gt;\"+writeFile.getName());\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\tinitFilePathName = ConfigUtil.getFilePath()+File.separator+dataType+File.separator+dataType+\"_\"+\n\t\t\t\t\t\t\t\t\t\tDateUtil.nowTime()+\"_\"+ConfigUtil.getRandomNum()+initFileEndName;\n\t\t\t\t\t\t\t\tFile file = new File(initFilePathName);\n\t\t\t\t\t\t\t\tFileUtils.writeLines(file, list);\n\t\t\t\t\t\t\t\tfile = FileUtil.rename(file, initFileEndName, fileEndName);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlist = new ArrayList&lt;&gt;();\/\/\/\/\u6e05\u7a7a\u6570\u636e\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t\/\/ TODO Auto-generated catch block\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t}\t\t\t \n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\ttry {\n\t\t\t\tif(ConfigUtil.isAddFile()){\n\t\t\t\t\tlogger.info(\"===&gt;\u6700\u540e\u6570\u636e\uff1a\"+list.size()+\"\uff0c\u5e76\u4e14\u5199\u5165\u4e86\u6587\u4ef6--&gt;.\"+writeFile.getName());\n\t\t\t\t\tFileUtils.writeLines(writeFile, list,true);\n\t\t\t\t}else{\n\t\t\t\t\tinitFilePathName = ConfigUtil.getFilePath()+File.separator+dataType+File.separator+dataType+\"_\"+\n\t\t\t\t\t\t\tDateUtil.nowTime()+\"_\"+ConfigUtil.getRandomNum()+initFileEndName;\n\t\t\t\t\tFile file = new File(initFilePathName);\n\t\t\t\t\tFileUtils.writeLines(file, list);\n\t\t\t\t\tfile = FileUtil.rename(file, initFileEndName, fileEndName);\n\t\t\t\t}\n\t\t\t\tlist = new ArrayList&lt;&gt;();\/\/\/\/\u6e05\u7a7a\u6570\u636e\n\t\t\t} catch (IOException e) {\n\t\t\t\t\/\/ TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\t\/\/\u6700\u540e\u4e0d\u7b26\u5408\u9650\u5236\u5927\u5c0f\u6587\u4ef6\u4e5f\u9700\u8981\u8f6c\u6362\u540e\u7f00\u540d\n\t\t\twriteFile = FileUtil.rename(writeFile, initFileEndName, fileEndName);\n\t\t} catch (SQLException e) {\n\t\t\t\/\/ TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t\tlogger.error(\"\u67e5\u8be2\u8bfb\u53d6\u7d2f\u8ba1\u8868\u7684\u6570\u636esql\u8bed\u53e5\u51fa\u9519\uff01\u8bf7\u68c0\u67e5\"+e);\n\t\t}finally{\n\t\t\ttry {\n\t\t\t\tDBHiberUtil.close(rs, stmt, conn);\n\t\t\t} catch (SQLException e) {\n\t\t\t\t\/\/ TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\t\n\t}\n\t\n\t\/**\n\t * \u8bfb\u53d6\u89c4\u5219\u8868\u6570\u636e\n\t *\/\n\tpublic void loadRule(String dataType){\n\t\tlogger.info(\"\u51c6\u5907\u8f7d\u5165\"+dataType+\"\u89c4\u5219\u6570\u636e!!!\");\n\t\tConnection conn = null;\n\t\tStatement stmt = null;\n\t\tResultSet rs = null;\n\t\t\n\n\t\tString sql = ConfigUtil.getQueryRule(dataType);\n\t\tlogger.info(\"\u67e5\u8be2\u7684sql\u8bed\u53e5\"+sql);\n\t\ttry {\n\t\t\tconn = DBHiberUtil.getConnection();\n\t\t\tstmt = conn.createStatement();\n\t\t\trs = stmt.executeQuery(sql);\n\t\t\twhile (rs.next()) {\n\t\t\t\tString iot_id = rs.getString(\"iot_id\");\n\t\t\t\tString rule_id = rs.getString(\"rule_id\");\n\t\t\t\tString iot_rule = rs.getString(\"iot_rule\");\n\t\t\t\tString use_way = rs.getString(\"use_way\");\n\t\t\t\t\n\t\t\t\tiot_rule = iot_rule.toUpperCase();\/\/\u8f6c\u5316\u4e3a\u5927\u5199\n\t\t\t\tif(\"0\".equals(use_way)){\n\t\t\t\t\t\/\/\u7cbe\u786e\u5339\u914d\u89c4\u5219\n\t\t\t\t\tAnalysisBean analysisBean = new AnalysisBean(iot_id, rule_id, iot_rule, use_way);\n\t\t\t\t\tactuMap.put(iot_rule, analysisBean);\n\t\t\t\t\t\n\t\t\t\t}else if(\"1\".equals(use_way)){\n\t\t\t\t\tiot_rule = iot_rule.replace(\"%\", \"\");\n\t\t\t\t\t\/\/\u6a21\u7cca\u5339\u914d\u89c4\u5219\n\t\t\t\t\tAnalysisBean analysisBean = new AnalysisBean(iot_id, rule_id, iot_rule, use_way);\n\t\t\t\t\tlikeMap.put(iot_rule, analysisBean);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (SQLException e) {\n\t\t\t\/\/ TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t\tlogger.error(\"\u67e5\u8be2\u8f7d\u5165\u89c4\u5219sql\u8bed\u53e5\u51fa\u9519\uff01\u8bf7\u68c0\u67e5\"+e);\n\t\t}finally{\n\t\t\ttry {\n\t\t\t\tDBHiberUtil.close(rs, stmt, conn);\n\t\t\t} catch (SQLException e) {\n\t\t\t\t\/\/ TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t}\n\tpublic static void main(String[] args) {\n\t\tIotAllAnalysis allAnalysis = new IotAllAnalysis();\n\t\tallAnalysis.doAction();\n\t}\n}\n<\/pre>\n<p>util\u5305(\u5de5\u5177\u5305)<\/p>\n<p>ConfigureUtil<\/p>\n<pre class=\"lang:default decode:true \">package com.htjf.util;\n\nimport java.util.Map;\nimport org.apache.log4j.Logger;\n\n\n\/**\n * \u7cfb\u7edf\u914d\u7f6e\u7c7b\n * @author Jiomer\n *\n *\/\npublic class ConfigureUtil {\n\t\tprivate static Logger logger = Logger.getLogger(ConfigureUtil.class);\n\t    public static ConfigureUtil instance = null;\n\t    \n\t    @SuppressWarnings(\"rawtypes\")\n\t\tprivate Map configureMap = null;\n\n\t    public ConfigureUtil() {\n\t    \t\n\t    \tString file = ClassLoader.getSystemResource(\"\").getPath()+\"cfg.xml\";\/\/\u6b63\u5f0f\u73af\u5883\n\/\/\t    \tString file = this.getClass().getResource(\"\/\").getPath()+\"cfg.xml\";\/\/\u6d4b\u8bd5\u73af\u5883\n\/\/\t    \tString file = ConfigureUtil.class.getClassLoader().getResource(\"cfg1.xml\").getPath();\/\/\u6d4b\u8bd5\u73af\u5883\n\t    \tSystem.out.println(file);\n\t    \tlogger.info(\"\u83b7\u53d6\u4e86cfg.xml\u8def\u5f84\uff1a\"+file);\n\t    \ttry {\n\t    \t\tconfigureMap = new XmlSupportImpl().readDocument(file);\n\t\t\t} catch (Exception e) {\n\t\t\t\t\/\/ TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t    }\n\t    public ConfigureUtil(String isHiber) {\n\t    \t String file = this.getClass().getResource(\"\/\").getPath()+\"cfghiber.xml\";\n\t    \ttry {\n\t    \t\tconfigureMap = new XmlSupportImpl().readDocument(file);\n\t\t\t} catch (Exception e) {\n\t\t\t\t\/\/ TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t    }\n\n\t    \/*\n\t     * (non-Javadoc)\n\t     * @see proc.gmcc.sso.config.Configure#getValue(java.lang.String)\n\t     *\/\n\t    public String getValue(String key) {\n\t    \treturn (String) configureMap.get(key);\n\t    }\n\t    \n\t\tpublic static ConfigureUtil  getInstance(){\n\t\t\tif(null== instance ){\n\t\t\t\tsynchronized(ConfigureUtil.class){\n\t\t\t\t\tif(null== instance){\n\t\t\t\t\t\tinstance = new ConfigureUtil ();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn instance;\n\t\t}\n\t    public static void main(String[] args) {\n\t    \tSystem.out.println(new ConfigureUtil().getValue(\"driverURL\"));\n\t\t}\n\n}<\/pre>\n<p>ConfigUtil<\/p>\n<pre class=\"lang:default decode:true \">package com.htjf.util;\n\nimport java.io.File;\n\nimport org.apache.log4j.Logger;\n\npublic class ConfigUtil {\n\tprivate static Logger logger = Logger.getLogger(ConfigUtil.class);\n\t\n\tpublic static String getXMLConfigValueBYName(String name) {\n\t\treturn ConfigureUtil.getInstance().getValue(name);\n\t}\n\t\n\t\/**\n\t * \u83b7\u53d6\n\t * @return\n\t *\/\n\tpublic static boolean isAddFile(){\n\t\tString isAddFile = getXMLConfigValueBYName(\"IS_ADD\");\n\t\treturn \"true\".equals(isAddFile);\n\t}\n\t\n\t\/**\n\t * \u83b7\u53d6\n\t * @return\n\t *\/\n\tpublic static int getMaxCountRow(){\n\t\tString maxCountRow = getXMLConfigValueBYName(\"MAX_COUNT_ROW\");\n\t\tint intMaxCountRow = Integer.parseInt(maxCountRow);\n\t\treturn intMaxCountRow;\n\t}\n\t\/**\n\t * \u521d\u59cb\u751f\u6210\u6587\u4ef6\u7684\u540e\u7f00\u540d(.temp)\n\t * @return\n\t *\/\n\tpublic static String getInitFileEndName(){\n\t\tString initFileEndName = getXMLConfigValueBYName(\"INIT_FILE_ENDNAME\");\n\t\treturn initFileEndName;\n\t}\n\t\/**\n\t * \u6700\u7ec8\u751f\u6210\u6587\u4ef6\u7684\u540e\u7f00\u540d(.csv)\n\t * @return\n\t *\/\n\tpublic static String getFileEndName(){\n\t\tString fileEndName = getXMLConfigValueBYName(\"FILE_ENDNAME\");\n\t\treturn fileEndName;\n\t}\n\t\/**\n\t * \u83b7\u53d6\u5b58\u653e\u751f\u6210\u6587\u4ef6\u7684\u672c\u5730\u8def\u5f84\n\t * @return\n\t *\/\n\tpublic static String getFilePath(){\n\t\tString filePath = getXMLConfigValueBYName(\"FILE_BASE_PATH\");\n\t\tFile file = new File(filePath);\n\t\tif(!file.exists()&amp;&amp;!file .isDirectory()){\n\t\t\t\tfile.mkdir();\n\t\t\t\treturn filePath;\n\t\t}\n\/\/\t\tlogger.info(\"\u83b7\u53d6filePath\uff1a\"+filePath);\n\t\treturn filePath;\n\t}\n\t\n\t\/**\n\t * \u83b7\u53d6\u9650\u5236\u6587\u4ef6\u5927\u5c0f\n\t * @return\n\t *\/\n\tpublic static long getMaxFileSise(){\n\t\tString strMaxFileSise = getXMLConfigValueBYName(\"MAX_FILE_SIZE\");\n\t\tlong longMaxFileSise = Long.parseLong(strMaxFileSise)*1024*1024;\n\t\tlogger.info(\"\u83b7\u53d6\u6587\u4ef6\u9650\u5236\u5927\u5c0f\uff1a\"+strMaxFileSise+\"(MB)\");\n\t\treturn longMaxFileSise;\n\t}\n\t\n\t\/**\n\t * \u751f\u62105\u4f4d\u968f\u673a\u6570\n\t * @return\n\t *\/\n\tpublic static int getRandomNum(){\n\t\tint randomNum = (int)((Math.random()*9+1)*10000);\n\t\treturn randomNum;\n\t}\n\t\/**\n\t * \u83b7\u53d6\u9700\u8981\u5206\u6790\u7684\u7c7b\u578b\n\t * @return\n\t *\/\n\tpublic static String getDataType(){\n\t\tString dataType = getXMLConfigValueBYName(\"DATA_TYPE\");\n\t\t\/\/\u5168\u90e8\u8f6c\u6210\u5927\u5199\n\t\tdataType = dataType.toUpperCase();\n\t\treturn dataType;\n\t}\n\t\/**\n\t * \u83b7\u53d6\u7d2f\u8ba1\u8868\u7684sql\n\t * @return\n\t *\/\n\tpublic static String getQueryDataType(String dataType){\n\t\tString sql = getXMLConfigValueBYName(\"QUERY_\"+dataType+\"_DATA\");\n\t\treturn sql;\n\t}\n\t\/**\n\t * \u83b7\u53d6\u89c4\u5219\u8868\u7684sql\n\t * @return\n\t *\/\n\tpublic static String getQueryRule(String dataType){\n\t\tString sql = getXMLConfigValueBYName(\"QUERY_\"+dataType+\"_RULE\");\n\t\treturn sql;\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tSystem.out.println(getMaxFileSise());\n\t}\n}\n<\/pre>\n<p>DateUtil<\/p>\n<pre class=\"lang:default decode:true \">package com.htjf.util;\n\nimport java.text.ParseException;\nimport java.text.SimpleDateFormat;\nimport java.util.Calendar;\nimport java.util.Date;\n\npublic class DateUtil {\n\t\n\t\/**\n\t * \u83b7\u53d6\u5f53\u524d\u5929\u7684\u524d\u4e00\u5929\n\t * @return\n\t *\/\n\tpublic static String proFormatDay(){\n\t\tSimpleDateFormat simpleDateFormat = new SimpleDateFormat(\"yyyyMMdd\");    \n\t\tDate today = new Date();    \n\t\tCalendar calendar = Calendar.getInstance();\n\t\tcalendar.setTime(today);\n\t\tcalendar.add(Calendar.DAY_OF_MONTH, -1);\n\t\tString proDay = simpleDateFormat.format(calendar.getTime()).toString();\n\t\treturn proDay;\n\t}\n\t\/**\n\t * \u83b7\u53d6\u5f53\u5929 yyyymmdd\n\t * @return\n\t *\/\n\tpublic static String formatDay(){\n\t\tSimpleDateFormat simpleDateFormat = new SimpleDateFormat(\"yyyyMMdd\");    \n\t\tDate date = new Date();    \n\t\tString today = simpleDateFormat.format(date).toString();\n\t\treturn today;\n\t}\n\t\/**\n\t * \u83b7\u53d6\u5f53\u524d\u65f6\u95f4yyyyMMddHHmmss\n\t * @return\n\t *\/\n\tpublic static String nowTime(){\n\t\tSimpleDateFormat simpleDateFormat = new java.text.SimpleDateFormat(\"yyyyMMddHHmmss\");    \n\t\tDate currentTime1 = new java.util.Date();    \n\t\tString nowTime = simpleDateFormat.format(currentTime1).toString();\n\t\treturn nowTime;\n\t}\n\n}\n<\/pre>\n<p>DBHiberUtil<\/p>\n<pre class=\"lang:default decode:true \">package com.htjf.util;\n\nimport java.sql.Connection;\nimport java.sql.DriverManager;\nimport java.sql.PreparedStatement;\nimport java.sql.ResultSet;\nimport java.sql.ResultSetMetaData;\nimport java.sql.SQLException;\nimport java.sql.Statement;\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.apache.log4j.Logger;\n\n\/**\n * \u6570\u636e\u5e93\u8fde\u63a5\u76f8\u5173\u64cd\u4f5c\u7c7b\n * @author Jiomer\n *\n *\/\npublic class DBHiberUtil {\n\t\/\/private static final transient Log log = LogFactory.getLog(DBHiberUtil.class);\n\tprivate static Logger logger = Logger.getLogger(DBHiberUtil.class);\n\n\t\/**\n\t * \u83b7\u53d6\u6570\u636e\u5e93\u94fe\u63a5\n\t * @return\n\t *\/\n    public static Connection getConnection() {\n        Connection conn = null;\n        ConfigureUtil configUtil = new ConfigureUtil();\n        String driverURL = configUtil.getValue(\"driverURL\").trim();\n        String dataBaseAccount = configUtil.getValue(\"dataBaseAccount\").trim();\n        String dataBasePassWord = configUtil.getValue(\"dataBasePassWord\").trim();;\n        \/\/System.out.println(\"getConnection-----\"+driverURL+\"--\"+dataBaseAccount+\"--\"+dataBasePassWord);\n        try {\n            Class.forName(\"oracle.jdbc.driver.OracleDriver\");\n            conn = DriverManager.getConnection(driverURL, dataBaseAccount, dataBasePassWord);\n           \/\/System.out.println(\"Connection \u5f00\u542f\uff01\");\n            logger.info(\"Connection \u5f00\u542f\uff01\");\n        }\n        catch (Exception e) {\n        \tlogger.error(\"Connection \u5931\u8d25\"+e);\n            e.printStackTrace();\n        }\n        return conn;\n    }\n\n    \/**\n     * \u65ad\u5f00\u6570\u636e\u5e93\u8fde\u63a5\n     * @param conn\n     * @throws SQLException\n     *\/\n    public static void close(Connection conn) throws SQLException {\n        if (conn != null) {\n            conn.close();\n        }\n    }\n\n    \/**\n     * \u65ad\u5f00\u6570\u636e\u5e93\u8fde\u63a5\n     * @param conn\n     *\/\n    public static void closeQuiet(Connection conn) {\n        try {\n            close(conn);\n        }\n        catch (Exception e) {\n            e.printStackTrace();\n        }\n    }\n\n    \/**\n     * \u5173\u95ed\u67e5\u8be2\u7ed3\u679c\u96c6\u5bf9\u8c61\n     * @param rs\n     *\/\n    public static void closeQuiet(ResultSet rs) {\n        try {\n            close(rs);\n        }\n        catch (Exception e) {\n            e.printStackTrace();\n        }\n    }\n\n    \/**\n     * \u5173\u95ed\u67e5\u8be2\u7ed3\u679c\u96c6\u5bf9\u8c61\n     * @param rs\n     * @throws SQLException\n     *\/\n    public static void close(ResultSet rs) throws SQLException {\n        if (rs != null) {\n            rs.close();\n        }\n    }\n\n    \/**\n     * \u5173\u95ed\u6307\u5b9aStatement\u5bf9\u8c61\n     * @param stmt\n     *\/\n    public static void closeQuiet(Statement stmt) {\n        try {\n            close(stmt);\n        }\n        catch (Exception e) {\n            e.printStackTrace();\n        }\n    }\n\n    \/**\n     * \u5173\u95ed\u6307\u5b9aStatement\u5bf9\u8c61\n     * @param stmt\n     * @throws SQLException\n     *\/\n    public static void close(Statement stmt) throws SQLException {\n        if (stmt != null) {\n            stmt.close();\n        }\n    }\n\n    \/**\n     * \u5173\u95ed\u6307\u5b9aStatement\u5bf9\u8c61\u548cResultSet\u5bf9\u8c61\n     * @param rs\n     * @param stmt\n     *\/\n    public static void closeQuiet(ResultSet rs, Statement stmt) {\n        closeQuiet(rs);\n        closeQuiet(stmt);\n    }\n\n    \/**\n     * \u5173\u95ed\u6307\u5b9aStatement\u5bf9\u8c61\u548cResultSet\u5bf9\u8c61\n     * @param rs\n     * @param stmt\n     * @throws SQLException\n     *\/\n    public static void close(ResultSet rs, Statement stmt) throws SQLException {\n        close(rs);\n        close(stmt);\n    }\n\n    \/**\n     * \u5173\u95ed\u6307\u5b9aStatement\u5bf9\u8c61\u548c\u65ad\u5f00\u6570\u636e\u5e93\u8fde\u63a5\n     * @param stmt\n     * @param conn\n     *\/\n    public static void closeQuiet(Statement stmt, Connection conn) {\n        closeQuiet(stmt);\n        closeQuiet(conn);\n    }\n\n    \/**\n     * \u5173\u95ed\u6307\u5b9aStatement\u5bf9\u8c61\u548c\u65ad\u5f00\u6570\u636e\u5e93\u94fe\u63a5\n     * @param stmt\n     * @param conn\n     * @throws SQLException\n     *\/\n    public static void close(Statement stmt, Connection conn) throws SQLException {\n        close(stmt);\n        close(conn);\n    }\n\n    \/**\n     * \u5173\u95ed\u6307\u5b9aResultSet\u3001Statement\u5bf9\u8c61\u548c\u65ad\u5f00\u6570\u636e\u5e93\u94fe\u63a5\n     * @param rs\n     * @param stmt\n     * @param conn\n     *\/\n    public static void closeQuiet(ResultSet rs, Statement stmt, Connection conn) {\n        closeQuiet(rs);\n        closeQuiet(stmt, conn);\n    }\n\n    \/**\n     * \u5173\u95ed\u6307\u5b9aResultSet\u3001Statement\u5bf9\u8c61\u548c\u65ad\u5f00\u6570\u636e\u5e93\u94fe\u63a5\n     * @param rs\n     * @param stmt\n     * @param conn\n     * @throws SQLException\n     *\/\n    public static void close(ResultSet rs, Statement stmt, Connection conn) throws SQLException {\n        close(rs);\n        close(stmt, conn);\n        logger.info(\"Connection \u5173\u95ed\uff01\");\n    }\n    \/**\n     * \u83b7\u53d6\u8868\u4e2d\u6240\u6709\u5b57\u6bb5\u540d\u79f0\n     * @param tableName \u8868\u540d\n     * @return\n     *\/\n    public static List&lt;String&gt; getColumnNames(String tableName){\n    \tList&lt;String&gt; columnNames = new ArrayList&lt;&gt;();\n    \tConnection connection = null;\n\t\tPreparedStatement ps = null;\n\t\tResultSet rs = null;\n\t\tResultSetMetaData rsmd = null;\n\t\tString sql = \"select * from \"+tableName;\n\t\ttry {\n\t\t\tconnection = DBHiberUtil.getConnection();\n\t\t\tps = connection.prepareStatement(sql);\n\t\t\trs = ps.executeQuery(sql);\n\t\t\trsmd = rs.getMetaData();\n\t\t\tfor (int i = 1; i &lt;=rsmd.getColumnCount() ; i++) {\n\t\t\t\tcolumnNames.add(rsmd.getColumnName(i));\n\t\t\t}\n\t\t} catch (SQLException e) {\n\t\t\t\/\/ TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}finally{\n\t\t\ttry {\n\t\t\t\tconnection.close();\n\t\t\t\tps.close();\n\t\t\t\trs.close();\n\t\t\t} catch (SQLException e) {\n\t\t\t\t\/\/ TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n    \treturn columnNames;\n    }\n\n}\n<\/pre>\n<p>FileUtil<\/p>\n<pre class=\"lang:default decode:true \">package com.htjf.util;\n\nimport java.io.File;\n\npublic class FileUtil {\n\t\n\t\/**\n\t * \u6587\u4ef6\u5904\u7406\u524d\u91cd\u547d\u540d(\u4ee5\u6269\u5c55\u540d\u66ff\u6362\u7684\u5f62\u5f0f)\n\t * @param srcFile \u9700\u8981\u91cd\u547d\u540d\u7684\u6587\u4ef6\n\t * @param tar \u91cd\u547d\u540d\u76ee\u6807\u5b57\u7b26\u4e32\n\t * @param rep \u66ff\u6362\u5b57\u7b26\u4e32\n\t * @return \u91cd\u547d\u540d\u540e\u6587\u4ef6\n\t *\/\n\tpublic static File rename(File srcFile, String tar, String rep) {\n\t\tString perMatchFileName =  srcFile.getPath().replace(tar, rep);\n\t\tFile newNameFile = new File(perMatchFileName);\n\t\tsrcFile.renameTo(newNameFile);\n\t\treturn newNameFile;\n\t}\n}\n<\/pre>\n<p>ParseXmlUtil<\/p>\n<pre class=\"lang:default decode:true\">package com.htjf.util;\n\nimport java.io.File;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.apache.log4j.Logger;\nimport org.dom4j.Document;\nimport org.dom4j.DocumentException;\nimport org.dom4j.Element;\nimport org.dom4j.io.SAXReader;\n\/**\n * \n * @author Jiomer\n *\n *\/\npublic class ParseXmlUtil {\n\tprivate static Logger logger = Logger.getLogger(ParseXmlUtil.class);\n\tprivate static ParseXmlUtil  instance = null;\n\tprivate Map&lt;String,String&gt; configureMap = null;\n\tprivate Document doc=null;\n\tprivate String path= ClassLoader.getSystemResource(\"\").getPath() + \"cfg.xml\";\n\t\n\/\/\tprivate String path2 = this.getClass().getResource(\"\/\").getPath()+\"cfg.xml\";\n\/\/\tprivate String path3 = ConfigureUtil.class.getClassLoader().getResource(\"cfg.xml\").getPath();\/\/\u6d4b\u8bd5\u73af\u5883\n\t\n\tprivate ParseXmlUtil (){\n\t\ttry {\n\t\t\t\/\/\u6253\u5305\u6210jar\u5305\uff0c\u76f4\u63a5\u8bfb\u53d6jar\u5305\u540c\u7ea7\u76ee\u5f55\u7684\u5305\u5916\u914d\u7f6e\u6587\u4ef6\n\/\/\t\t\tpath= \"cfg.xml\";\n\t\t\treLoadData();\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\tpublic String getPath() {\n\t\treturn path;\n\t}\n\t\n\tpublic void setPath(String path) {\n\t\tthis.path = path;\n\t}\n\t\n\tpublic Document getDoc() {\n\t\treturn doc;\n\t}\n\t\n\tpublic void setDoc(Document doc) {\n\t\tthis.doc = doc;\n\t}\n\n\tpublic void reLoadData(){\n\t\ttry {\n\t\t\tlogger.info(\"\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6\"+getPath());\n\t\t\tdoc = new SAXReader().read(new File(getPath()));\n\t\t\tconfigureMap=initLoadConfig();\n\t\t} catch (DocumentException e) {\n\t\t\t\/\/ TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\t\n\tpublic static ParseXmlUtil  getInstance(){\n\t\tif(null== instance ){\n\t\t\tsynchronized(ParseXmlUtil.class){\n\t\t\t\tif(null== instance){\n\t\t\t\t\tinstance = new ParseXmlUtil ();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn instance;\n\t}\n\t\n\t\/**\n\t * \u6307\u5b9a\u914d\u7f6e\u6587\u4ef6\u76ee\u5f55\u521d\u59cb\u5316\u6587\u4ef6\u52a0\n\t * @param path\n\t * @return\n\t *\/\n\tprivate Map&lt;String,String&gt; initLoadConfig(){\n\t\t Map&lt;String,String&gt; map =new HashMap&lt;String,String&gt;();\n\t\t try {\n\t           Element root = doc.getRootElement();\n\t           @SuppressWarnings(\"unchecked\")\n\t           List&lt;Element&gt; list = root.elements();\n\t           for(Element actionNode : list)\n\t           {\n\t        \t   map.put(actionNode.getName(),actionNode.getTextTrim());\n\t           }\n\t           return map;\n\t       } catch (Exception e) {\n\t           e.printStackTrace();\n\t           return null;\n\t       }\n\t}\n\t\/**\n\t * @param name\n\t * @return\n\t *\/\n\tpublic String getConfigValueBYName(String name){\n\t\treturn configureMap.get(name);\n\t}\n}\n<\/pre>\n<p>XmlSupport<\/p>\n<pre class=\"lang:default decode:true \">package com.htjf.util;\n\nimport java.util.Map;\n\nimport org.dom4j.Document;\n\/**\n * @author Jiomer\n *\/\npublic interface XmlSupport {\n\t\/**\n\t * \u521b\u5efaxml\u6587\u4ef6\n\t * @return\n\t *\/\n\tpublic Document createDocument();\n\t\n\t\/**\n\t * \u8bfbxml\u6587\u4ef6\n\t * @param file\n\t * @return\n\t * @throws Exception\n\t *\/\n\tpublic Map readDocument(String file)throws Exception;\n\t\n\t\/**\n\t * \u5199xml\u6587\u4ef6\n\t * @throws Exception\n\t *\/\n\tpublic void writerDocument() throws Exception;\n\t\/**\n\t * \u66f4\u65b0xml\u6587\u4ef6\n\t *\/\n\tpublic void updateDocument() ;\n}\n<\/pre>\n<p>XmlSupportImpl<\/p>\n<pre class=\"lang:default decode:true \">package com.htjf.util;\n\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.FileWriter;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.dom4j.Document;\nimport org.dom4j.DocumentHelper;\nimport org.dom4j.Element;\nimport org.dom4j.io.OutputFormat;\nimport org.dom4j.io.SAXReader;\nimport org.dom4j.io.XMLWriter;\n\/**\n * \n * @author Jiomer\n *\n *\/\npublic class XmlSupportImpl implements XmlSupport{\n\n\t@Override\n\tpublic Document createDocument() {\n\t\t\/\/ TODO Auto-generated method stub\n\t\tDocument document = DocumentHelper.createDocument();\n\t\tElement rootElement = document.addElement(\"root\");\n\n\t\tElement uploadFileElement = rootElement.addElement(\"uploadFile\");\n\n\t\tElement path = uploadFileElement.addElement(\"path\");\n\t\tpath.setText(\"\/hjtInfoUpload\/\");\n\t\tElement size = uploadFileElement.addElement(\"size\");\n\t\tsize.setText(\"10240\");\n\t\tElement type = uploadFileElement.addElement(\"type\");\n\t\ttype.setText(\"zip,rar,png,jpg,gif\");\n\n\t\treturn document;\n\t}\n\n\t@Override\n\tpublic Map readDocument(String file) throws Exception {\n\t\t\/\/ TODO Auto-generated method stub\n\t\tMap map = new HashMap();\n\t\tSAXReader saxReader =  new SAXReader();\n\t\t\n\t\tDocument document = saxReader.read(new FileInputStream(new File(file)));\n\t\tElement root = document.getRootElement();\n\t\tList list = root.elements();\n\t\tfor(int i=0;i&lt;list.size();i++){\n\t\t\tElement ele = (Element) list.get(i);\n\t\t\tmap.put(ele.getName(), ele.getText());\n\t\t}\n\t\treturn map;\n\t}\n\n\t@Override\n\tpublic void writerDocument() throws Exception {\n\t\t\/\/ TODO Auto-generated method stub\n\t\tOutputFormat of = new OutputFormat(\"   \", true);\n\t\tXMLWriter xmlWriter = new XMLWriter(new FileWriter(\"hjt_info.xml\"), of);\n\t\t\/\/LoggerUtil.info(\"XmlSupportImpl\",new File(\"hjt_info.xml\").getAbsolutePath());\n\t\txmlWriter.write(this.createDocument());\n\t\txmlWriter.close();\n\t}\n\n\t@Override\n\tpublic void updateDocument() {\n\t\t\/\/ TODO Auto-generated method stub\n\t\t\n\t}\n\n}\n<\/pre>\n<p>log4j.properties<\/p>\n<pre class=\"lang:default decode:true \">log4j.rootLogger=stdout,ERROR,logfile\n#\\u8f93\\u51fa\\u5230\\u63a7\\u5236\\u53f0#  \nlog4j.appender.stdout=org.apache.log4j.ConsoleAppender\nlog4j.appender.stdout.Threshold=INFO\nlog4j.appender.stdout.layout=org.apache.log4j.PatternLayout\nlog4j.appender.stdout.layout.ConversionPattern = %d %-5p [%-8t] [%-17c{1}]-%m%n\n\n#\\u8f93\\u51fa\\u5230\\u9879\\u76ee\\u6587\\u4ef6\\u4e0b#\nlog4j.appender.logfile = org.apache.log4j.DailyRollingFileAppender\nlog4j.appender.logfile.File = .\/logs\/info_log.log\nlog4j.appender.logfile.Append = true\nlog4j.appender.logfile.Threshold = INFO\nlog4j.appender.logfile.layout = org.apache.log4j.PatternLayout\nlog4j.appender.logfile.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss,SSS} %5p %c{1}:%L - %m%n\n##log4j.appender.logfile.layout.ConversionPattern= %d %-5p [%-8t] [%-17c{1}]-%m%n\n\n#\\u9519\\u8bef\\u4fe1\\u606f\\u8f93\\u51fa\\u5230\\u9879\\u76ee\\u5b50\\u6587\\u4ef6\\u5939\\u4e0b#\nlog4j.appender.ERROR=org.apache.log4j.DailyRollingFileAppender\nlog4j.appender.ERROR.File = .\/logs\/err_log.log\nlog4j.appenile.ERROR.Append = true\nlog4j.appender.ERROR.Threshold = ERROR\nlog4j.appender.ERROR.layout = org.apache.log4j.PatternLayout\nlog4j.appender.ERROR.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss,SSS} %5p %c{1}:%L - %m%n<\/pre>\n<p>cfg.xml<\/p>\n<pre class=\"lang:default decode:true\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;cfgs&gt;\n    &lt;driver-class&gt;oracle.jdbc.driver.OracleDriver&lt;\/driver-class&gt;\n    &lt;!-- \u672c\u5730\u6d4b\u8bd5\u73af\u5883 \n\t\t--&gt;\n    &lt;driverURL&gt;\n      jdbc:oracle:thin:@192.168.20.201:1521:mmdsdb\n    &lt;\/driverURL&gt; \n    &lt;dataBaseAccount&gt;T_MMDS&lt;\/dataBaseAccount&gt;\n    &lt;dataBasePassWord&gt;testmmds&lt;\/dataBasePassWord&gt; \n    \n    &lt;!-- \u57fa\u7840\u914d\u7f6e\u9879 --&gt;\n    &lt;INIT_FILE_ENDNAME&gt;.temp&lt;\/INIT_FILE_ENDNAME&gt;&lt;!-- \u521d\u59cb\u5316\u6587\u4ef6\u540e\u7f00\u540d --&gt;\n    &lt;FILE_ENDNAME&gt;.csv&lt;\/FILE_ENDNAME&gt;&lt;!-- \u751f\u6210\u6587\u4ef6\u7684\u540e\u7f00\u540d .csv\/.txt  --&gt;\n    &lt;MAX_FILE_SIZE&gt;10&lt;\/MAX_FILE_SIZE&gt;&lt;!-- \u751f\u6210\u6587\u4ef6\u5927\u5c0f\u9650\u5236\u591a\u5927 \u5355\u4f4dMB --&gt;\n    &lt;MAX_COUNT_ROW&gt;10000&lt;\/MAX_COUNT_ROW&gt;&lt;!-- \u8bbe\u7f6e\u591a\u5c11\u884c\uff0c\u751f\u6210\/\u5199\u5165 --&gt;\n    &lt;IS_ADD&gt;true&lt;\/IS_ADD&gt;&lt;!-- \u662f\u5426\u8ffd\u52a0\u5728\u6e90\u6587\u4ef6 --&gt;\n    &lt;DATA_TYPE&gt;host&lt;\/DATA_TYPE&gt;\n\t&lt;FILE_BASE_PATH&gt;G:\/test12&lt;\/FILE_BASE_PATH&gt;\n\t&lt;!-- \u751f\u6210\u6587\u4ef6\u5b58\u653e\u7684\u7236\u8def\u5f84 \n\t&lt;FILE_BASE_PATH&gt;\/export\/a5duser\/iot_ana\/file&lt;\/FILE_BASE_PATH&gt;\n\t--&gt;\n\t&lt;QUERY_HOST_DATA&gt;select imei,host iotType,(lt-ft)dt from IOT_DIG_HOST_COUNT&lt;\/QUERY_HOST_DATA&gt;\n\t&lt;QUERY_HOST_RULE&gt;select iot_id,rule_id,iot_rule,use_way from iot_base_hreg_info where enable = 0&lt;\/QUERY_HOST_RULE&gt;\n\t&lt;QUERY_UA_DATA&gt;select imei,ua iotType,(lt-ft)dt from IOT_DIG_UA_COUNT&lt;\/QUERY_UA_DATA&gt;\n\t&lt;QUERY_UA_RULE&gt;select iot_id,rule_id,iot_rule,use_way from iot_base_ureg_info where enable = 0&lt;\/QUERY_UA_RULE&gt;\n&lt;\/cfgs&gt;\n<\/pre>\n<p>end..<\/p>\n<hr \/>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/qn.199604.com\/wp-content\/uploads\/2017\/07\/zhifubao.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large\" data-original=\"http:\/\/qn.199604.com\/wp-content\/uploads\/2017\/07\/zhifubao.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" width=\"318\" height=\"406\" \/><\/div><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/qn.199604.com\/wp-content\/uploads\/2017\/07\/weixin.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large\" data-original=\"http:\/\/qn.199604.com\/wp-content\/uploads\/2017\/07\/weixin.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" width=\"268\" height=\"291\" \/><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9700\u6c42\uff1a\u5bf9\u6bd4\u89c4\u5219\u8868\u548c\u7d2f\u8ba1\u8868\uff0c\u7b26\u5408\u6761\u4ef6\u7684\u8fdb\u884c\u5199\u5165\u6587\u4ef6\u3002 \u7a0b\u5e8f\u7ed3\u6784 pom.xml &lt;project xmln [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[130],"tags":[129],"class_list":["post-954","post","type-post","status-publish","format-standard","hentry","category-java","tag-java"],"_links":{"self":[{"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/posts\/954","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/comments?post=954"}],"version-history":[{"count":2,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/posts\/954\/revisions"}],"predecessor-version":[{"id":1205,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/posts\/954\/revisions\/1205"}],"wp:attachment":[{"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/media?parent=954"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/categories?post=954"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/tags?post=954"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}