koul 4 years ago
commit
f0a1b2d9c4
70 changed files with 2163 additions and 0 deletions
  1. 29 0
      .idea/artifacts/huid_attch_jar.xml
  2. 7 0
      .idea/compiler.xml
  3. 6 0
      .idea/encodings.xml
  4. 6 0
      .idea/google-java-format.xml
  5. 31 0
      .idea/huid-attch.iml
  6. 36 0
      .idea/inspectionProfiles/Project_Default.xml
  7. 9 0
      .idea/libraries/commons_csv_1_4.xml
  8. 9 0
      .idea/libraries/commons_io_2_4.xml
  9. 9 0
      .idea/libraries/commons_logging_1_2.xml
  10. 9 0
      .idea/libraries/commons_net_3_6.xml
  11. 9 0
      .idea/libraries/dom4j_1_6_1.xml
  12. 9 0
      .idea/libraries/fastjson_1_2_68.xml
  13. 9 0
      .idea/libraries/flexjson_2_1.xml
  14. 9 0
      .idea/libraries/gson_2_8_5.xml
  15. 9 0
      .idea/libraries/httpclient_4_5_6.xml
  16. 9 0
      .idea/libraries/httpcore_4_4_10.xml
  17. 9 0
      .idea/libraries/jackson_core_asl_1_9_13.xml
  18. 9 0
      .idea/libraries/jackson_mapper_asl_1_9_13.xml
  19. 9 0
      .idea/libraries/javax_servlet.xml
  20. 9 0
      .idea/libraries/jsch_0_1_54.xml
  21. 9 0
      .idea/libraries/json_lib_2_4_jdk15.xml
  22. 9 0
      .idea/libraries/junit.xml
  23. 9 0
      .idea/libraries/log4j_1_2_15.xml
  24. 9 0
      .idea/libraries/ojdbc6_11_2_0.xml
  25. 9 0
      .idea/libraries/slf4j_api_1_7_21.xml
  26. 72 0
      .idea/misc.xml
  27. 8 0
      .idea/modules.xml
  28. 7 0
      .idea/vcs.xml
  29. 3 0
      META-INF/MANIFEST.MF
  30. 14 0
      README.md
  31. BIN
      bin/artifacts/huid_attch_jar/huid-attch.jar
  32. BIN
      bin/production/huid-attch/com/uas/main/HttpClient.class
  33. BIN
      bin/production/huid-attch/com/uas/main/Main.class
  34. BIN
      bin/production/huid-attch/com/uas/main/Upload.class
  35. BIN
      bin/production/huid-attch/com/uas/util/BaseUtil.class
  36. BIN
      bin/production/huid-attch/com/uas/util/FtpUtil.class
  37. BIN
      bin/production/huid-attch/com/uas/util/JdbcUtil.class
  38. BIN
      bin/production/huid-attch/com/uas/util/MyX509TrustManager.class
  39. BIN
      bin/production/huid-attch/com/uas/util/SFTPUtil.class
  40. 17 0
      bin/production/huid-attch/properties/dbconfig.properties
  41. 26 0
      bin/production/huid-attch/properties/ftpconfig.properties
  42. 6 0
      bin/production/huid-attch/properties/log4j.properties
  43. BIN
      lib/commons-io-2.4.jar
  44. BIN
      lib/commons-logging-1.2.jar
  45. BIN
      lib/commons-net-3.6.jar
  46. BIN
      lib/dom4j-1.6.1.jar
  47. BIN
      lib/fastjson-1.2.68.jar
  48. BIN
      lib/flexjson-2.1.jar
  49. BIN
      lib/gson-2.8.5.jar
  50. BIN
      lib/httpclient-4.5.6.jar
  51. BIN
      lib/httpcore-4.4.10.jar
  52. BIN
      lib/jackson-core-asl-1.9.13.jar
  53. BIN
      lib/jackson-mapper-asl-1.9.13.jar
  54. BIN
      lib/javax.servlet.jar
  55. BIN
      lib/jsch-0.1.54.jar
  56. BIN
      lib/junit.jar
  57. BIN
      lib/log4j-1.2.15.jar
  58. BIN
      lib/ojdbc6-11.2.0.jar
  59. BIN
      lib/slf4j-api-1.7.21.jar
  60. 384 0
      src/com/uas/main/HttpClient.java
  61. 52 0
      src/com/uas/main/Main.java
  62. 139 0
      src/com/uas/main/Upload.java
  63. 35 0
      src/com/uas/util/BaseUtil.java
  64. 199 0
      src/com/uas/util/FtpUtil.java
  65. 257 0
      src/com/uas/util/JdbcUtil.java
  66. 30 0
      src/com/uas/util/MyX509TrustManager.java
  67. 579 0
      src/com/uas/util/SFTPUtil.java
  68. 17 0
      src/properties/dbconfig.properties
  69. 26 0
      src/properties/ftpconfig.properties
  70. 6 0
      src/properties/log4j.properties

+ 29 - 0
.idea/artifacts/huid_attch_jar.xml

@@ -0,0 +1,29 @@
+<component name="ArtifactManager">
+  <artifact type="jar" name="huid-attch:jar">
+    <output-path>$PROJECT_DIR$/bin/artifacts/huid_attch_jar</output-path>
+    <root id="archive" name="huid-attch.jar">
+      <element id="directory" name="META-INF">
+        <element id="file-copy" path="$PROJECT_DIR$/META-INF/MANIFEST.MF" />
+      </element>
+      <element id="module-output" name="huid-attch" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/dom4j-1.6.1.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/jsch-0.1.54.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/commons-logging-1.2.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/httpcore-4.4.10.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/gson-2.8.5.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/commons-net-3.6.jar" path-in-jar="/" />
+      <element id="library" level="project" name="json-lib-2.4-jdk15" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/ojdbc6-11.2.0.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/junit.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/httpclient-4.5.6.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/jackson-mapper-asl-1.9.13.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/flexjson-2.1.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/jackson-core-asl-1.9.13.jar" path-in-jar="/" />
+      <element id="library" level="project" name="commons-csv-1.4" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/slf4j-api-1.7.21.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/commons-io-2.4.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/log4j-1.2.15.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/javax.servlet.jar" path-in-jar="/" />
+    </root>
+  </artifact>
+</component>

+ 7 - 0
.idea/compiler.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="CompilerConfiguration">
+    <option name="BUILD_PROCESS_HEAP_SIZE" value="2048" />
+    <bytecodeTargetLevel target="8" />
+  </component>
+</project>

+ 6 - 0
.idea/encodings.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8" addBOMForNewFiles="with NO BOM">
+    <file url="PROJECT" charset="UTF-8" />
+  </component>
+</project>

+ 6 - 0
.idea/google-java-format.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="GoogleJavaFormatSettings">
+    <option name="enabled" value="false" />
+  </component>
+</project>

+ 31 - 0
.idea/huid-attch.iml

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+      <excludeFolder url="file://$MODULE_DIR$/bin" />
+    </content>
+    <orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" name="commons-csv-1.4" level="project" />
+    <orderEntry type="library" name="commons-io-2.4" level="project" />
+    <orderEntry type="library" name="commons-net-3.6" level="project" />
+    <orderEntry type="library" name="dom4j-1.6.1" level="project" />
+    <orderEntry type="library" name="flexjson-2.1" level="project" />
+    <orderEntry type="library" name="httpcore-4.4.10" level="project" />
+    <orderEntry type="library" name="jackson-core-asl-1.9.13" level="project" />
+    <orderEntry type="library" name="jackson-mapper-asl-1.9.13" level="project" />
+    <orderEntry type="library" name="javax.servlet" level="project" />
+    <orderEntry type="library" name="jsch-0.1.54" level="project" />
+    <orderEntry type="library" name="junit" level="project" />
+    <orderEntry type="library" name="log4j-1.2.15" level="project" />
+    <orderEntry type="library" name="ojdbc6-11.2.0" level="project" />
+    <orderEntry type="library" name="slf4j-api-1.7.21" level="project" />
+    <orderEntry type="library" name="httpclient-4.5.6" level="project" />
+    <orderEntry type="library" name="commons-logging-1.2" level="project" />
+    <orderEntry type="library" name="json-lib-2.4-jdk15" level="project" />
+    <orderEntry type="library" name="gson-2.8.5" level="project" />
+    <orderEntry type="library" name="fastjson-1.2.68" level="project" />
+  </component>
+</module>

+ 36 - 0
.idea/inspectionProfiles/Project_Default.xml

@@ -0,0 +1,36 @@
+<component name="InspectionProjectProfileManager">
+  <profile version="1.0">
+    <option name="myName" value="Project Default" />
+    <inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
+      <option name="TOP_LEVEL_CLASS_OPTIONS">
+        <value>
+          <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
+          <option name="REQUIRED_TAGS" value="" />
+        </value>
+      </option>
+      <option name="INNER_CLASS_OPTIONS">
+        <value>
+          <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
+          <option name="REQUIRED_TAGS" value="" />
+        </value>
+      </option>
+      <option name="METHOD_OPTIONS">
+        <value>
+          <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
+          <option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
+        </value>
+      </option>
+      <option name="FIELD_OPTIONS">
+        <value>
+          <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
+          <option name="REQUIRED_TAGS" value="" />
+        </value>
+      </option>
+      <option name="IGNORE_DEPRECATED" value="false" />
+      <option name="IGNORE_JAVADOC_PERIOD" value="true" />
+      <option name="IGNORE_DUPLICATED_THROWS" value="false" />
+      <option name="IGNORE_POINT_TO_ITSELF" value="false" />
+      <option name="myAdditionalJavadocTags" value="date" />
+    </inspection_tool>
+  </profile>
+</component>

+ 9 - 0
.idea/libraries/commons_csv_1_4.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="commons-csv-1.4">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/commons-csv-1.4.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 9 - 0
.idea/libraries/commons_io_2_4.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="commons-io-2.4">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/commons-io-2.4.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 9 - 0
.idea/libraries/commons_logging_1_2.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="commons-logging-1.2">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/commons-logging-1.2.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 9 - 0
.idea/libraries/commons_net_3_6.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="commons-net-3.6">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/commons-net-3.6.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 9 - 0
.idea/libraries/dom4j_1_6_1.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="dom4j-1.6.1">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/dom4j-1.6.1.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 9 - 0
.idea/libraries/fastjson_1_2_68.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="fastjson-1.2.68">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/fastjson-1.2.68.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 9 - 0
.idea/libraries/flexjson_2_1.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="flexjson-2.1">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/flexjson-2.1.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 9 - 0
.idea/libraries/gson_2_8_5.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="gson-2.8.5">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/gson-2.8.5.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 9 - 0
.idea/libraries/httpclient_4_5_6.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="httpclient-4.5.6">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/httpclient-4.5.6.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 9 - 0
.idea/libraries/httpcore_4_4_10.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="httpcore-4.4.10">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/httpcore-4.4.10.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 9 - 0
.idea/libraries/jackson_core_asl_1_9_13.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="jackson-core-asl-1.9.13">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/jackson-core-asl-1.9.13.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 9 - 0
.idea/libraries/jackson_mapper_asl_1_9_13.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="jackson-mapper-asl-1.9.13">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/jackson-mapper-asl-1.9.13.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 9 - 0
.idea/libraries/javax_servlet.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="javax.servlet">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/javax.servlet.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 9 - 0
.idea/libraries/jsch_0_1_54.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="jsch-0.1.54">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/jsch-0.1.54.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 9 - 0
.idea/libraries/json_lib_2_4_jdk15.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="json-lib-2.4-jdk15">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/json-lib-2.4-jdk15.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 9 - 0
.idea/libraries/junit.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="junit">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/junit.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 9 - 0
.idea/libraries/log4j_1_2_15.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="log4j-1.2.15">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/log4j-1.2.15.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 9 - 0
.idea/libraries/ojdbc6_11_2_0.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="ojdbc6-11.2.0">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/ojdbc6-11.2.0.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 9 - 0
.idea/libraries/slf4j_api_1_7_21.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="slf4j-api-1.7.21">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/slf4j-api-1.7.21.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 72 - 0
.idea/misc.xml

@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="AndroidDexCompilerConfiguration">
+    <option name="MAX_HEAP_SIZE" value="2048" />
+  </component>
+  <component name="JavaScriptSettings">
+    <option name="languageLevel" value="ES6" />
+  </component>
+  <component name="Kotlin2JsCompilerArguments">
+    <option name="sourceMapEmbedSources" />
+  </component>
+  <component name="ProjectInspectionProfilesVisibleTreeState">
+    <entry key="Project Default">
+      <profile-state>
+        <expanded-state>
+          <State />
+          <State>
+            <id>Class structureJava</id>
+          </State>
+          <State>
+            <id>Code maturityJava</id>
+          </State>
+          <State>
+            <id>Google Web Toolkit</id>
+          </State>
+          <State>
+            <id>JUnitJava</id>
+          </State>
+          <State>
+            <id>Java</id>
+          </State>
+          <State>
+            <id>Java 5Java language level migration aidsJava</id>
+          </State>
+          <State>
+            <id>Java 7Java language level migration aidsJava</id>
+          </State>
+          <State>
+            <id>Java 8Java language level migration aidsJava</id>
+          </State>
+          <State>
+            <id>Java language level migration aidsJava</id>
+          </State>
+          <State>
+            <id>JavadocJava</id>
+          </State>
+          <State>
+            <id>Numeric issuesJava</id>
+          </State>
+          <State>
+            <id>PerformanceJava</id>
+          </State>
+          <State>
+            <id>Spring</id>
+          </State>
+          <State>
+            <id>Spring AOPSpring</id>
+          </State>
+          <State>
+            <id>TestNGJava</id>
+          </State>
+          <State>
+            <id>Threading issuesJava</id>
+          </State>
+        </expanded-state>
+      </profile-state>
+    </entry>
+  </component>
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+    <output url="file://$PROJECT_DIR$/bin" />
+  </component>
+</project>

+ 8 - 0
.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/huid-attch.iml" filepath="$PROJECT_DIR$/.idea/huid-attch.iml" />
+    </modules>
+  </component>
+</project>

+ 7 - 0
.idea/vcs.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="" vcs="Git" />
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
+  </component>
+</project>

+ 3 - 0
META-INF/MANIFEST.MF

@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: com.uas.main.Main
+

+ 14 - 0
README.md

@@ -0,0 +1,14 @@
+# 汇顶数据接口及附件上传
+    封装数据调用接口-->根据接口返回值处理数据
+# 结构
+    --main
+        --HttpClient  接口调用
+        --Main  main方法调用
+        --Upload    上传附件文件
+    --util
+        --BaseUtil  日志
+        --MyX509TrustManager  HTTPS
+        --FtpUtil   FTP服务相关工具类
+        --JdbcUtil  数据库链接等工具
+        --SFTPUtil  SFTP服务相关工具类
+>   具体详细逻辑参考线下文档

BIN
bin/artifacts/huid_attch_jar/huid-attch.jar


BIN
bin/production/huid-attch/com/uas/main/HttpClient.class


BIN
bin/production/huid-attch/com/uas/main/Main.class


BIN
bin/production/huid-attch/com/uas/main/Upload.class


BIN
bin/production/huid-attch/com/uas/util/BaseUtil.class


BIN
bin/production/huid-attch/com/uas/util/FtpUtil.class


BIN
bin/production/huid-attch/com/uas/util/JdbcUtil.class


BIN
bin/production/huid-attch/com/uas/util/MyX509TrustManager.class


BIN
bin/production/huid-attch/com/uas/util/SFTPUtil.class


+ 17 - 0
bin/production/huid-attch/properties/dbconfig.properties

@@ -0,0 +1,17 @@
+{
+	"HUAXK_P":{
+		"url":"jdbc:oracle:thin:@127.0.0.1:1521:orcl",
+		"user":"HUAXK_P",
+		"password":"select!#%*("
+	},
+	"HXK_SU_P":{
+		"url":"jdbc:oracle:thin:@127.0.0.1:1521:orcl",
+		"user":"HXK_SU_P",
+		"password":"select!#%*("
+	},
+	"LHWX_HK_P":{
+		"url":"jdbc:oracle:thin:@127.0.0.1:1521:orcl",
+		"user":"LHWX_HK_P",
+		"password":"select!#%*("
+	}
+}

+ 26 - 0
bin/production/huid-attch/properties/ftpconfig.properties

@@ -0,0 +1,26 @@
+{
+	"HUAXK_P-HDSZ":{
+		"ip":"58.250.26.203",
+		"port":21,
+		"user":"Szhuaxinke",
+		"password":"Hzfek93T**",
+		"in":"Szhuaxinke",
+		"file":""
+	},
+	"HXK_SU_P-HDSZ":{
+		"ip":"58.250.26.203",
+		"port":21,
+		"user":"Szhuaxinke",
+		"password":"Hzfek93T**",
+		"in":"Szhuaxinke",
+		"file":""
+	},
+		"LHWX_HK_P-HDSZ":{
+		"ip":"58.250.26.203",
+		"port":21,
+		"user":"XGlianheWX",
+		"password":"Enakx53T**",
+		"in":"Hklhwx",
+		"file":""
+	}
+}

+ 6 - 0
bin/production/huid-attch/properties/log4j.properties

@@ -0,0 +1,6 @@
+log4j.rootLogger=DEBUG, R     
+log4j.appender.R=org.apache.log4j.FileAppender   
+log4j.appender.R.file=my.log     
+log4j.appender.R.Append=true   
+log4j.appender.R.layout=org.apache.log4j.PatternLayout   
+log4j.appender.R.layout.ConversionPattern=%n%n%d%p[%c]-%m%n   

BIN
lib/commons-io-2.4.jar


BIN
lib/commons-logging-1.2.jar


BIN
lib/commons-net-3.6.jar


BIN
lib/dom4j-1.6.1.jar


BIN
lib/fastjson-1.2.68.jar


BIN
lib/flexjson-2.1.jar


BIN
lib/gson-2.8.5.jar


BIN
lib/httpclient-4.5.6.jar


BIN
lib/httpcore-4.4.10.jar


BIN
lib/jackson-core-asl-1.9.13.jar


BIN
lib/jackson-mapper-asl-1.9.13.jar


BIN
lib/javax.servlet.jar


BIN
lib/jsch-0.1.54.jar


BIN
lib/junit.jar


BIN
lib/log4j-1.2.15.jar


BIN
lib/ojdbc6-11.2.0.jar


BIN
lib/slf4j-api-1.7.21.jar


+ 384 - 0
src/com/uas/main/HttpClient.java

@@ -0,0 +1,384 @@
+package com.uas.main;
+
+import com.alibaba.fastjson.JSONObject;
+import com.google.gson.Gson;
+import com.uas.util.JdbcUtil;
+import com.uas.util.MyX509TrustManager;
+import org.apache.http.*;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.conn.PoolingClientConnectionManager;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+import sun.misc.BASE64Encoder;
+
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocketFactory;
+import javax.net.ssl.TrustManager;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+import static javax.xml.transform.OutputKeys.ENCODING;
+
+/**
+ * @author kl
+ * @email koul@usoftchina.com
+ * @date 2020-01-02 8:53
+ */
+public class HttpClient {
+    private static final String testUrl = "prm-sit.goodix.com";
+    private static final String url = "prm.goodix.com";
+    private static final String serviceUrl = "/goodix/agent/aDelivery/agentAutoDelivery";
+    //private static final String username = "SZhuaxinke";
+    //private static final String password = "test";
+    //HTTPS地址
+    private static final String ur = "https://prm.goodix.com/goodix/agent/aDelivery/agentAutoDelivery";
+
+    public static void runHttp() {
+        //HTTP
+        //httpclientPost("HUAXK_P", "SZhuaxinke", "SZhuaxinke");   //华信科深圳
+       // httpclientPost("HXK_SU_P", "SZhuaxinke", "SZhuaxinke");    //华信科苏州
+       // httpclientPost("LHWX_HK_P", "XGlianheWX", "XGlianheWX");    //联合无线香港
+        //HTTPS
+        sendPost("HUAXK_P", "SZhuaxinke", "SZhuaxinke");   //华信科深圳
+        sendPost("HXK_SU_P", "SZhuaxinke", "SZhuaxinke");    //华信科苏州
+        sendPost("LHWX_HK_P", "XGlianheWX", "XGlianheWX");    //联合无线香港
+    }
+
+    private static List<Map<String, String>> getDate(Statement statement, String sob) {
+        List<Map<String, String>> maps = new ArrayList<>();
+        ResultSet rs = null;
+        try {
+            rs = statement.executeQuery("select ct_id,cd_id,cd_varchar50_1,cd_varchar50_2,cd_varchar50_3," +
+                    "cd_varchar50_4,cd_varchar50_5,cd_varchar50_6,cd_varchar50_7,cd_varchar50_8,cd_varchar50_9,cd_number_1," +
+                    "cd_date_1,cd_varchar50_10,cd_number_2,cd_varchar50_11,cd_varchar50_12 from " + sob +
+                    ".customtabledetail left join " + sob + ".customtable on ct_id = cd_ctid where nvl(cd_number_12,0)= 0 " +
+                    "and ct_status = '已审核' and ct_caller = 'HDXHCHMXB' and cd_varchar100_1 = '出货单' and nvl(cd_number_1,0)>0");
+            while (rs.next()) {
+                Map<String, String> map = new HashMap<>();
+                int cd_id = rs.getInt("cd_id");
+                String cd_date_1 = rs.getString("cd_date_1");
+                cd_date_1 = cd_date_1.substring(0, 10);
+                String cd_varchar50_5 = rs.getString("cd_varchar50_5");
+                String cd_varchar50_6 = rs.getString("cd_varchar50_6");
+                String cd_varchar50_7 = rs.getString("cd_varchar50_7");
+                String cd_varchar50_8 = rs.getString("cd_varchar50_8");
+                String cd_varchar50_1 = rs.getString("cd_varchar50_1");
+                String cd_varchar50_4 = rs.getString("cd_varchar50_4");
+                String cd_varchar50_2 = rs.getString("cd_varchar50_2");
+                //String cd_remark = rs.getString("cd_remark");
+                int cd_number_1 = rs.getInt("cd_number_1");
+                int cd_number_2 = rs.getInt("cd_number_2");
+                String cd_varchar50_9 = rs.getString("cd_varchar50_9");
+                String cd_varchar50_10 = rs.getString("cd_varchar50_10");
+                map.put("cd_id", cd_id + "");
+                map.put("cd_date_1", cd_date_1);
+                map.put("cd_varchar50_5", cd_varchar50_5);
+                map.put("cd_varchar50_6", cd_varchar50_6);
+                map.put("cd_varchar50_7", cd_varchar50_7);
+                map.put("cd_varchar50_8", cd_varchar50_8);
+                if (cd_varchar50_1 != null) {
+                    cd_varchar50_1 = cd_varchar50_1.contains("(") && cd_varchar50_1.contains(")") ?
+                            cd_varchar50_1.replace("(", "(") : cd_varchar50_1;
+                    cd_varchar50_1 = cd_varchar50_1.contains("(") ? cd_varchar50_1.substring(0,
+                            cd_varchar50_1.indexOf("(")) : cd_varchar50_1;
+                }
+                map.put("cd_varchar50_1", cd_varchar50_1);
+                map.put("cd_varchar50_4", cd_varchar50_4);
+                //map.put("cd_remark", cd_remark);
+                map.put("cd_number_1", cd_number_1 + "");
+                map.put("cd_number_2", cd_number_2 + "");
+                map.put("cd_varchar50_9", cd_varchar50_9);
+                map.put("cd_varchar50_10", cd_varchar50_10);
+                map.put("cd_varchar50_2", cd_varchar50_2);
+                maps.add(map);
+            }
+        } catch (SQLException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                rs.close();
+            } catch (SQLException e) {
+                e.printStackTrace();
+            }
+        }
+        return maps;
+    }
+
+    public static void httpclientPost(String sob, String username, String password) {
+        SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
+        String formatdate = format.format(new Date());
+        Connection connect = null;
+        Statement statement = null;
+        try {
+            connect = JdbcUtil.getConnectBySob(sob);
+            statement = connect.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
+            List<Map<String, String>> maps = getDate(statement, sob);
+            for (Map<String, String> map : maps) {
+                List<NameValuePair> params = new ArrayList<NameValuePair>();
+                ResultSet result = null;
+                try {
+                    String name = "";
+                    String cd_varchar50_9 = map.get("cd_varchar50_9");
+                    String cd_varchar50_1 = map.get("cd_varchar50_1");
+                    String cd_varchar50_4 = map.get("cd_varchar50_4");
+                    if (cd_varchar50_9 != null) {
+                        cd_varchar50_9 = cd_varchar50_9.replace(";", ",").substring(0, cd_varchar50_9.length() - 1);
+                        result = statement.executeQuery("select fp_path from " + sob + ".filepath where fp_id in (" + cd_varchar50_9 + ")");
+
+                        if (result.getRow() == 0) {
+                            while (result.next()) {
+                                String path = result.getString("fp_path");
+                                String substring = path.substring(path.lastIndexOf("."));
+                                name = name + cd_varchar50_4 + "_" + formatdate + substring;
+                            }
+                        } else {
+                            while (result.next()) {
+                                String path = result.getString("fp_path");
+                                String substring = path.substring(path.lastIndexOf("."));
+                                name = name + cd_varchar50_4 + "_" + formatdate + substring + ";";
+                            }
+                        }
+                    }
+                    if (map.get("cd_varchar50_2") != null) {
+                        params.add(new BasicNameValuePair("screenCustomerNo", map.get("cd_varchar50_2")));
+                    }
+                    if (map.get("cd_varchar50_6") != null) {
+                        params.add(new BasicNameValuePair("softCustomerNo", map.get("cd_varchar50_6")));
+                    }
+                    params.add(new BasicNameValuePair("terminalCustomerNo", map.get("cd_varchar50_7")));
+                    if (map.get("cd_varchar50_8") != null) {
+                        params.add(new BasicNameValuePair("whiteCustomerName", map.get("cd_varchar50_8")));
+                    }
+                    params.add(new BasicNameValuePair("modelName", cd_varchar50_1));
+                    params.add(new BasicNameValuePair("agentOrderCode", map.get("cd_varchar50_4")));
+                    params.add(new BasicNameValuePair("deliveryTime", map.get("cd_date_1")));
+                    params.add(new BasicNameValuePair("deliveryAmount", map.get("cd_number_1")));
+                    params.add(new BasicNameValuePair("fileName", name));
+                    if (map.get("cd_remark") != null) {
+                        params.add(new BasicNameValuePair("note", map.get("cd_remark")));
+                    }
+
+                } catch (SQLException e) {
+                    e.printStackTrace();
+                } finally {
+                    try {
+                        result.close();
+                    } catch (SQLException e) {
+                        e.printStackTrace();
+                    }
+                }
+                URIBuilder uriBuilder = new URIBuilder();
+                URI uri =
+                        uriBuilder.setScheme("http").setHost(url).setPort(80).setPath(serviceUrl).setParameters(params).build();
+                DefaultHttpClient httpClient = new DefaultHttpClient(new PoolingClientConnectionManager());
+                HttpPost httpPost = new HttpPost(uri);
+                String user = String.format("%s:%s", new Object[]{username, password});
+                httpPost.setHeader("Content-Type", "application/json;charset=UTF-8");
+                String auth = new BASE64Encoder().encode(user.getBytes("UTF-8"));
+                httpPost.setHeader("Authorization", "Basic " + auth);
+                HttpResponse response = httpClient.execute(httpPost);
+                HttpEntity entity = response.getEntity();
+                if (entity != null) {
+                    String resultStr = EntityUtils.toString(entity, "UTF-8");
+                    Gson gson = new Gson();
+                    Map<String, Object> map1 = new HashMap<String, Object>();
+                    map1 = gson.fromJson(resultStr, map1.getClass());
+                    Boolean statu = (Boolean) map1.get("state");
+                    Integer cd_id = Integer.valueOf(map.get("cd_id"));
+                    if (statu) {
+                        statement.execute("update " + sob + ".customtabledetail set cd_number_12 = -1,cd_varchar200_1 = '' where cd_id = " + cd_id);
+                    } else {
+                        String stateInfo = (String) map1.get("stateInfo");
+                        if (stateInfo.indexOf(":") != -1) {
+                            stateInfo = stateInfo.substring(0, stateInfo.indexOf(":"));
+                        }
+                        statement.execute("update " + sob + ".customtabledetail set cd_varchar200_1 = '" + stateInfo + "' " +
+                                "where nvl(cd_number_12,0)=0 and cd_id = " + cd_id);
+                    }
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                statement.close();
+                connect.close();
+            } catch (SQLException e) {
+                e.printStackTrace();
+            }
+
+        }
+    }
+
+    /**
+     * 向指定 URL 发送POST方法的请求
+     *
+     * @return 所代表远程资源的响应结果
+     */
+    public static void sendPost(String sob, String username, String password) {
+        PrintWriter out = null;
+        BufferedReader in = null;
+        SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
+        String formatdate = format.format(new Date());
+        Connection connect = null;
+        Statement statement = null;
+        try {
+            connect = JdbcUtil.getConnectBySob(sob);
+            statement = connect.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
+            List<Map<String, String>> maps = getDate(statement, sob);
+            for (Map<String, String> map : maps) {
+                List<NameValuePair> params = new ArrayList<NameValuePair>();
+                ResultSet result = null;
+                try {
+                    String name = "";
+                    String cd_varchar50_9 = map.get("cd_varchar50_9");
+                    String cd_varchar50_1 = map.get("cd_varchar50_1");
+                    String cd_varchar50_4 = map.get("cd_varchar50_4");
+                    if (cd_varchar50_9 != null) {
+                        cd_varchar50_9 = cd_varchar50_9.replace(";", ",").substring(0, cd_varchar50_9.length() - 1);
+                        result = statement.executeQuery("select fp_path from " + sob + ".filepath where fp_id in (" + cd_varchar50_9 + ")");
+
+                        if (result.getRow() == 0) {
+                            while (result.next()) {
+                                String path = result.getString("fp_path");
+                                String substring = path.substring(path.lastIndexOf("."));
+                                name = name + cd_varchar50_4 + "_" + formatdate + substring;
+                            }
+                        } else {
+                            while (result.next()) {
+                                String path = result.getString("fp_path");
+                                String substring = path.substring(path.lastIndexOf("."));
+                                name = name + cd_varchar50_4 + "_" + formatdate + substring + ";";
+                            }
+                        }
+                    }
+                    if (map.get("cd_varchar50_2") != null) {
+                        params.add(new BasicNameValuePair("screenCustomerNo", map.get("cd_varchar50_2")));
+                    }
+                    if (map.get("cd_varchar50_6") != null) {
+                        params.add(new BasicNameValuePair("softCustomerNo", map.get("cd_varchar50_6")));
+                    }
+                    params.add(new BasicNameValuePair("terminalCustomerNo", map.get("cd_varchar50_7")));
+                    if (map.get("cd_varchar50_8") != null) {
+                        params.add(new BasicNameValuePair("whiteCustomerName", map.get("cd_varchar50_8")));
+                    }
+                    params.add(new BasicNameValuePair("modelName", cd_varchar50_1));
+                    params.add(new BasicNameValuePair("agentOrderCode", map.get("cd_varchar50_4")));
+                    params.add(new BasicNameValuePair("deliveryTime", map.get("cd_date_1")));
+                    params.add(new BasicNameValuePair("deliveryAmount", map.get("cd_number_1")));
+                    params.add(new BasicNameValuePair("fileName", name));
+                    if (map.get("cd_remark") != null) {
+                        params.add(new BasicNameValuePair("note", map.get("cd_remark")));
+                    }
+
+                } catch (SQLException e) {
+                    e.printStackTrace();
+                } finally {
+                    try {
+                        result.close();
+                    } catch (SQLException e) {
+                        e.printStackTrace();
+                    }
+                }
+                // 创建SSLContext对象,并使用我们指定的信任管理器初始化
+                TrustManager[] tm = {new MyX509TrustManager()};
+                SSLContext sslContext = SSLContext.getInstance("SSL");
+                sslContext.init(null, tm, new java.security.SecureRandom());
+
+                // 从上述SSLContext对象中得到SSLSocketFactory对象
+                SSLSocketFactory ssf = sslContext.getSocketFactory();
+
+                // 打开和URL之间的连接
+                String s="";
+                for (NameValuePair nv:params) {
+                    s = s +nv.getName()+"="+URLEncoder.encode(nv.getValue(), "UTF-8") + "&" ;
+                }
+                String ss = ur + "?" +s.substring(0,s.length()-1);
+                URL realUrl = new URL(ss);
+                HttpsURLConnection conn = (HttpsURLConnection) realUrl.openConnection();
+                conn.setSSLSocketFactory(ssf);
+
+                // 设置通用的请求属性
+                conn.setRequestProperty("accept", "*/*");
+                conn.setRequestProperty("connection", "Keep-Alive");
+                conn.setRequestProperty("content-Type", "application/json");
+                conn.setRequestProperty("user-agent",
+                        "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+                String user = String.format("%s:%s", new Object[]{username, password});
+                String auth = new BASE64Encoder().encode(user.getBytes("UTF-8"));
+                conn.setRequestProperty("Authorization", "Basic " + auth);
+                // 发送POST请求必须设置如下两行
+                conn.setDoOutput(true);
+                conn.setDoInput(true);
+                // 获取URLConnection对象对应的输出流
+                out = new PrintWriter(conn.getOutputStream());
+                // 发送请求参数
+                out.print(params);
+                // flush输出流的缓冲
+                out.flush();
+                // 定义BufferedReader输入流来读取URL的响应
+                in = new BufferedReader(
+                        new InputStreamReader(conn.getInputStream()));
+                String line;
+                String res = "";
+                while ((line = in.readLine()) != null) {
+                    res += line;
+                }
+                Gson gson = new Gson();
+                Map<String, Object> map1 = new HashMap<String, Object>();
+                map1 = gson.fromJson(res, map1.getClass());
+                /*JSONObject object = JSONObject.parseObject(res);*/
+                Boolean statu = (Boolean) map1.get("state");
+                Integer cd_id = Integer.valueOf(map.get("cd_id"));
+                if (statu) {
+                    statement.execute("update " + sob + ".customtabledetail set cd_number_12 = -1,cd_varchar200_1 = '' where cd_id = " + cd_id);
+                } else {
+                    String stateInfo = (String) map1.get("stateInfo");
+                    if (stateInfo.indexOf(":") != -1) {
+                        stateInfo = stateInfo.substring(0, stateInfo.indexOf(":"));
+                    }
+                    statement.execute("update " + sob + ".customtabledetail set cd_varchar200_1 = '" + stateInfo + "' " +
+                            "where cd_id = " + cd_id);
+                }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                statement.close();
+                connect.close();
+            } catch (SQLException e) {
+                e.printStackTrace();
+            }
+
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (in != null) {
+                    in.close();
+                }
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+
+        }
+
+    }
+}

+ 52 - 0
src/com/uas/main/Main.java

@@ -0,0 +1,52 @@
+package com.uas.main;
+import com.uas.util.BaseUtil;
+import com.uas.util.FtpUtil;
+import com.uas.util.JdbcUtil;
+
+import static com.uas.main.HttpClient.runHttp;
+import static com.uas.main.Upload.*;
+
+public class Main {
+	
+	public static void main(String[] args) {
+        a();
+	  /**final long timeInterval =5*60*1000;
+	        Runnable runnable = new Runnable() {  
+	            public void run() {  
+	                while (true) {
+	                    // ------- code for task to run  
+	                    a();
+	                    // ------- ends here  
+	                    try {
+	                        Thread.sleep(timeInterval);  
+	                    } catch (InterruptedException e) {  
+	                        e.printStackTrace();  
+	                    }  
+	                }  
+	            }  
+	        };  
+	        Thread thread = new Thread(runnable);  
+	        thread.start();*/
+    }
+	
+	
+	
+	public static  void a() {
+		runHttp();
+		System.out.println("begin");
+		run();
+		
+		try{ //关闭数据库连接
+			if(JdbcUtil.connection!=null){
+				JdbcUtil.connection.close();
+			}
+		}catch(Exception e){
+			BaseUtil.getLogger().error(e.toString());
+			e.printStackTrace();
+		}finally{
+			JdbcUtil.connection = null;
+		}
+		System.out.println("run over!");
+	}
+
+}

+ 139 - 0
src/com/uas/main/Upload.java

@@ -0,0 +1,139 @@
+package com.uas.main;
+
+import java.io.*;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.regex.Pattern;
+
+import com.jcraft.jsch.JSchException;
+import com.uas.util.SFTPUtil;
+import org.apache.commons.net.ftp.FTPClient;
+import org.codehaus.jackson.map.ObjectMapper;
+
+import com.uas.util.BaseUtil;
+import com.uas.util.FtpUtil;
+import com.uas.util.JdbcUtil;
+
+public class Upload {
+
+	public static boolean upload(FTPClient client,String ip,String folder,File file,String name){
+		boolean flag = false;
+		if(client!=null){
+			flag = FtpUtil.uploadFile(client, folder,file,name);
+		}
+		BaseUtil.getLogger().info("upload " + file.getName() + " to " + ip + ":" + folder + " " + (flag?"success":"fail")+"");	
+		return flag;
+	}
+	
+	public static List<Map<String, String>> getData(Statement statement,String sob) throws SQLException{
+		List<Map<String, String>> maps = new ArrayList<>();
+		ResultSet resultSet = statement.executeQuery("select cd_id,cd_varchar50_9,cd_varchar50_10,cd_number_2," +
+				"cd_varchar50_1,cd_varchar50_4 from " + sob +".customtabledetail left " +
+				"join " + sob + ".customtable on ct_id = cd_ctid where ct_status = '已审核' and " +
+				"ct_caller = 'HDXHCHMXB' and cd_varchar100_1 = '出货单' and nvl(cd_number_1,0)>0 and nvl(cd_number_10,0)" +
+				"=0 and cd_number_12 = -1");
+		while (resultSet.next()){
+			Map<String, String> map = new HashMap<>();
+			map.put("cd_id",resultSet.getInt("cd_id")+"");
+			map.put("cd_varchar50_9",resultSet.getString("cd_varchar50_9"));
+			map.put("cd_varchar50_10",resultSet.getString("cd_varchar50_10"));
+			map.put("cd_number_2",resultSet.getInt("cd_number_2")+"");
+			String cd_varchar50_1 = resultSet.getString("cd_varchar50_1");
+			if (cd_varchar50_1!=null){
+				cd_varchar50_1=cd_varchar50_1.contains("(") && cd_varchar50_1.contains(")")?
+						cd_varchar50_1.replace("(", "("):cd_varchar50_1;
+				cd_varchar50_1 = cd_varchar50_1.contains("(")?cd_varchar50_1.substring(0,
+						cd_varchar50_1.indexOf("(")):cd_varchar50_1;
+			}
+			map.put("cd_varchar50_1",cd_varchar50_1);
+			map.put("cd_varchar50_4",resultSet.getString("cd_varchar50_4"));
+			maps.add(map);
+		}
+		return maps;
+	}
+
+	public static void run() {
+		uploadBySob("HUAXK_P","HDSZ");//华信科深圳
+		uploadBySob("HXK_SU_P","HDSZ");//华信科苏州
+		uploadBySob("LHWX_HK_P","HDSZ");//联合无线香港
+	}
+	
+	@SuppressWarnings({ "unchecked"})
+	public static void uploadBySob(String sob,String depot) {
+		Statement statement = null;
+		FTPClient client = null;
+		Map<String,Object> ftpConfig = JdbcUtil.getFtpConfigs();
+		Map<String,Object> config = null;
+		Connection connect = null;
+		SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
+		String s = format.format(new Date());
+		try{
+			connect = JdbcUtil.getConnectBySob(sob);
+			if(connect!=null){
+				statement = connect.createStatement();
+				config = (Map<String, Object>) ftpConfig.get(sob + "-" + depot); //注意上传位置是数据库名+depot
+				client = FtpUtil.connect(config,config.get("in").toString());
+				String folder = "/"+config.get("in").toString()+"/"+s.substring(0,4)+"/"+s.substring(4,6);
+				String dir = "/"+config.get("in").toString()+"/"+s.substring(0,4);
+				client.makeDirectory(dir);
+				client.makeDirectory(folder);
+				List<Map<String, String>> maps = getData(statement, sob);
+				for (Map<String, String> map:maps) {
+					String cd_varchar50_9 = map.get("cd_varchar50_9");
+					String cd_id = map.get("cd_id");
+					String cd_varchar50_1 = map.get("cd_varchar50_1");
+					String cd_varchar50_4 = map.get("cd_varchar50_4");
+					if (cd_varchar50_9!=null) {
+						cd_varchar50_9 = cd_varchar50_9.replace(";", ",").substring(0, cd_varchar50_9.length() - 1);
+						ResultSet result = statement.executeQuery("select fp_path from " + sob + ".filepath where fp_id in (" + cd_varchar50_9 + ")");
+						while (result.next()) {
+							String path = result.getString("fp_path");
+							//path = "C:\\Users\\usoft\\Desktop\\交接\\EDI交接文档_2018-5-24\\OpenAS2HowTo.pdf";
+							String substring = path.substring(path.lastIndexOf("."));
+							File file = new File(path);
+							if (client != null) {
+								String name = cd_varchar50_4+ "_" + s + substring;
+								boolean ip = upload(client, config.get("ip").toString(), folder, file, name);
+								if (ip){
+									statement.execute("update "+sob+".customtabledetail set cd_number_10 = -1 where cd_id = "+cd_id);
+								}
+							}
+
+						}
+					}
+				}
+			}
+		}catch(Exception e){
+			BaseUtil.getLogger().error(e.toString());
+			e.printStackTrace();
+		}finally{
+			if(statement!=null){
+				try {
+					statement.close();
+				} catch (SQLException e1) {
+					BaseUtil.getLogger().error(e1.toString());
+					e1.printStackTrace();
+				}
+				statement = null;				
+			}
+			/*if(client!=null){
+				FtpUtil.closeFtpClient(client);
+			}*/
+			//把当前的连接关闭
+			try {
+				if(connect!=null){
+					connect.close();
+				}
+			} catch (SQLException e) {
+				e.printStackTrace();
+			}finally{
+				connect = null;
+			}
+		}
+
+	}
+}

+ 35 - 0
src/com/uas/util/BaseUtil.java

@@ -0,0 +1,35 @@
+package com.uas.util;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.PropertyConfigurator;
+
+
+public class BaseUtil {
+	public static Logger logger;
+	
+	/**
+	 * 获取日志类
+	 * @return 日志类
+	 */
+	public static Logger getLogger(){
+		if(logger==null){
+			logger = Logger.getLogger(BaseUtil.class);
+		    //loger所需的配置文件路径   
+			Properties prop = new Properties();
+		    try {
+				prop.load(BaseUtil.class.getResourceAsStream("/properties/log4j.properties"));
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		    PropertyConfigurator.configure(prop); 
+		}
+		return logger;
+	}
+	
+	public static void logDownload(String fileName,String ip,String downloadpath){
+		getLogger().info("download " + fileName + " from " + ip + " path:" + downloadpath);
+	}
+}

+ 199 - 0
src/com/uas/util/FtpUtil.java

@@ -0,0 +1,199 @@
+package com.uas.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.SocketException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import com.jcraft.jsch.JSchException;
+import org.apache.commons.net.ftp.FTP;
+import org.apache.commons.net.ftp.FTPClient;
+import org.apache.commons.net.ftp.FTPFile;
+import org.apache.commons.net.ftp.FTPReply;
+
+public class FtpUtil {
+	/**
+	 * 连接到ftp站点,判断是否可以连接
+	 * @param path  要连接到的目录
+	 * @param addr  站点地址
+	 * @param port  端口
+	 * @param username 用户名
+	 * @param password 密码
+	 * @return
+	 * @throws Exception
+	 */
+	public static boolean connect(String path, String addr, int port, String username,
+			String password) {
+		boolean result = false;
+		try {
+			FTPClient ftp = new FTPClient();
+			int reply;
+			ftp.connect(addr, port);
+			ftp.login(username, password);
+			ftp.setFileType(FTPClient.BINARY_FILE_TYPE);
+			reply = ftp.getReplyCode();
+			if (!FTPReply.isPositiveCompletion(reply)) {
+				ftp.disconnect();
+				return result;
+			}
+			ftp.changeWorkingDirectory(path);
+			result = true;
+			return result;
+		}catch (Exception e){
+			SFTPUtil sftp = new SFTPUtil(username, password, addr, port);
+			try {
+				sftp.login();
+				result = true;
+			} catch (JSchException e1) {
+				e1.printStackTrace();
+			}
+			return result;
+		}
+	}
+	
+	/**
+	 * 获取ftp连接,该连接指向ftp配置中的downloadpath文件夹
+	 * @param map 包含ftp连接配置的map
+	 */
+	public static FTPClient connect(Map<String,Object> map) throws Exception {
+		return connect(map,map.get("downloadpath").toString());
+	}
+
+	/**
+	 * 获取ftp连接,该连接指向ftp配置中的downloadpath文件夹
+	 * @param map 包含ftp连接配置的map
+	 */
+	public static FTPClient connect(Map<String,Object> map,String path){
+		FTPClient ftp = null;
+		String addr = null;
+		try{
+			addr = map.get("ip").toString();
+			int port = Integer.parseInt(map.get("port").toString());
+			String username = map.get("user").toString();
+			String password = map.get("password").toString();
+			ftp = new FTPClient();
+			int reply;
+			ftp.connect(addr, port);
+			if(!ftp.login(username, password)){
+				return null;
+			}
+			ftp.setFileType(FTPClient.BINARY_FILE_TYPE);
+			reply = ftp.getReplyCode();
+			if (!FTPReply.isPositiveCompletion(reply)) {
+				ftp.disconnect();
+				return null;
+			}
+			ftp.changeWorkingDirectory(path);
+			return ftp;			
+		}catch(Exception e){ 
+			e.printStackTrace();
+			BaseUtil.getLogger().error("ip:" + addr + e.toString());
+			return null;
+		}
+	}
+
+	/**
+	 * 上传文件
+	 * @param ftpClient 已连接的ftp客户端
+	 * @param pathname 路径
+	 * @param file 待上传的文件
+	 * @return 上传结果
+	 */
+	public static boolean uploadFile(FTPClient ftpClient, String pathname, File file,String name) {
+		boolean flag = false;
+		ftpClient.setControlEncoding("UTF-8");
+		try {
+			ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
+			boolean change = ftpClient.changeWorkingDirectory(pathname+"/");
+			if(!change){
+				BaseUtil.getLogger().info("change to " + pathname + " fail");
+				return false;
+			}
+			InputStream inputStream = new FileInputStream(file);
+			ftpClient.enterLocalPassiveMode();
+			ftpClient.storeFile(name, inputStream);
+			inputStream.close();
+			//ftpClient.logout();
+			flag = true;
+		} catch (Exception e) {
+			e.printStackTrace();
+			BaseUtil.getLogger().error(e.toString());
+			if (ftpClient.isConnected()) {
+				try {
+					ftpClient.disconnect();
+				} catch (IOException e1) {
+					BaseUtil.getLogger().error(e1.toString());
+					e1.printStackTrace();
+				}
+			}
+		}
+		return flag;
+	}
+	
+	/**
+	 * 删除后关闭ftp连接
+	 * @param ftpClient 
+	 * @param filename 要删除的文件名
+	 * @return 删除结果
+	 */
+	public static boolean deleteFile(FTPClient ftpClient,String filename) {
+		boolean flag = false;
+		try {
+			ftpClient.dele(filename);
+			flag = true;
+		} catch (Exception e) {
+			BaseUtil.getLogger().error(e.toString());
+			e.printStackTrace();
+		}
+		return flag;
+	}
+
+	/**
+	 * 
+	 * @param ftpClient
+	 * fileType 需要下载的文件类型
+	 * @return 获取连接到的ftp站点下的文件夹所有文件
+	 */
+	public static List<File> downloadAllFileByType(FTPClient ftpClient,String fileType) {
+		List<File> files = new ArrayList<File>();	
+		try {
+			ftpClient.enterLocalPassiveMode();
+			FTPFile[] ftpFiles = ftpClient.listFiles();
+			for (FTPFile file : ftpFiles) {
+				if(file.getName().toUpperCase().endsWith("." + fileType)){
+					File localFile = new File(System.getProperty("java.io.tmpdir") + File.separator + file.getName());
+					OutputStream os = new FileOutputStream(localFile);
+					ftpClient.retrieveFile(file.getName(), os);
+					os.close();
+					files.add(localFile);					
+				}
+			}
+		} catch (Exception e) {
+			BaseUtil.getLogger().error(e.toString());
+			e.printStackTrace();
+		}
+		return files;
+	}
+	
+	/**
+	 * 关闭ftp连接
+	 * @param ftpClient
+	 */
+	public static void closeFtpClient(FTPClient ftpClient){
+		if (ftpClient.isConnected()) {
+			try {
+				ftpClient.logout();
+			} catch (IOException e) {
+				BaseUtil.getLogger().error(e.toString());
+			}
+		}		
+	}
+	
+}

+ 257 - 0
src/com/uas/util/JdbcUtil.java

@@ -0,0 +1,257 @@
+package com.uas.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.codehaus.jackson.map.ObjectMapper;
+
+public class JdbcUtil {
+	public static Map<String,Object> ftpConfigs;
+	public static Map<String,Object> dbConfigs;
+	public static Connection connection;	
+	
+	/**
+	 * 从ftpconfigs配置文件中获取ftp站点配置信息
+	 * @return Map<String,Object>
+	 */
+	@SuppressWarnings("unchecked")
+	public static Map<String,Object> getFtpConfigs(){
+		if(ftpConfigs==null){
+			try {
+				ftpConfigs = new ObjectMapper().readValue(JdbcUtil.class.getResourceAsStream("/properties/ftpconfig.properties"), HashMap.class);
+			}catch (Exception e) {
+				BaseUtil.getLogger().error(e.toString());
+				e.printStackTrace();
+			}			
+		}
+		return ftpConfigs;
+	}
+	
+	/**
+	 * 从dbconfig配置文件中获取数据库配置信息
+	 * @return Map<String,Object>
+	 */
+	@SuppressWarnings("unchecked")
+	public static Map<String,Object> getDBConfigs(){
+		if(dbConfigs==null){
+			try {
+				dbConfigs = new ObjectMapper().readValue(JdbcUtil.class.getResourceAsStream("/properties/dbconfig.properties"), HashMap.class);
+			}catch (Exception e) {
+				BaseUtil.getLogger().error(e.toString());
+				e.printStackTrace();
+			}			
+		}
+		return dbConfigs;
+	}
+	
+	/**
+	 * 连接到数据库
+	 * @param url 地址
+	 * @param user 用户名
+	 * @param password 密码
+	 * @return 返回一个连接
+	 * @throws Exception
+	 */
+	public static Connection getConnect(String url,String user,String password) throws Exception{
+        Class.forName("oracle.jdbc.driver.OracleDriver");// 加载Oracle驱动程序
+        connection = DriverManager.getConnection(url, user, password);// 获取连接
+        return connection;	       
+	}
+	
+	/**
+	 * 从dbconfig配置文件中获取数据库连接
+	 * @return 返回数据库连接
+	 */
+	public static Connection getConnect(){
+		if(connection==null){
+		    try{
+				InputStream dbinput = JdbcUtil.class.getResourceAsStream("/properties/dbconfig.properties");
+				Properties prop = new Properties();
+				prop.load(dbinput);
+				connection = JdbcUtil.getConnect(prop.getProperty("url"), prop.getProperty("user"), prop.getProperty("password"));
+		    }catch (Exception e){
+		    	try {
+					System.in.read();
+				} catch (IOException e2) {
+					// TODO Auto-generated catch block
+					e2.printStackTrace();
+				}
+		    	BaseUtil.getLogger().error(e.toString());
+		    	try {
+		    		if(connection!=null){
+		    			connection.close();
+		    		}				
+				} catch (SQLException e1) {
+					BaseUtil.getLogger().error(e1.toString());
+					e1.printStackTrace();
+				}finally{
+					connection = null;
+				}
+		        e.printStackTrace();
+		    } 			
+		}
+		return connection;
+	}
+	
+	/**
+	 * 从dbconfig配置文件中获取数据库连接
+	 * @return 返回数据库连接
+	 */
+	@SuppressWarnings("unchecked")
+	public static Connection getConnectBySob(String sob){
+		Map<String,Object> dbServMaps = getDBConfigs();
+		Map<String,Object> dbServMap = (Map<String,Object>)dbServMaps.get(sob);
+		//先把当前的连接关闭
+		try {
+			if(connection!=null){
+				connection.close();
+			}
+		} catch (SQLException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}finally{
+			connection = null;
+		}
+		
+	    try{
+			connection = JdbcUtil.getConnect(dbServMap.get("url").toString(), dbServMap.get("user").toString(), dbServMap.get("password").toString());
+	    }catch (Exception e){
+	    	try {
+				System.in.read();
+			} catch (IOException e2) {
+				// TODO Auto-generated catch block
+				e2.printStackTrace();
+			}
+	    	BaseUtil.getLogger().error(e.toString());
+	    	try {
+	    		if(connection!=null){
+	    			connection.close();
+	    		}				
+			} catch (SQLException e1) {
+				BaseUtil.getLogger().error(e1.toString());
+				e1.printStackTrace();
+			}finally{
+				connection = null;
+			}
+	        e.printStackTrace();
+	    } 
+		
+		return connection;
+	}
+	
+	/**
+	 * 关闭连接
+	 * @param con
+	 * @param pre
+	 * @param result
+	 * @return
+	 */
+	public static boolean closeCn(Connection con,PreparedStatement pre,ResultSet result){
+        try{
+            if (result != null)
+                result.close();
+            	result = null;
+            if (pre != null)
+                pre.close();
+            	pre = null;
+            if (con != null)
+                con.close();
+        }
+        catch (Exception e){
+        	BaseUtil.getLogger().error(e.toString());
+            e.printStackTrace();
+        }
+		return true;
+	}
+	
+	/**
+	 * 执行多条sql语句
+	 * @param connection 连接
+	 * @param str 多条sqls语句
+	 * @return
+	 */
+	@SuppressWarnings("finally")
+	public static boolean executeSqls(Connection connection,List<String> str){
+		Statement statement = null;
+		boolean bol = true;
+		try{		
+			statement = connection.createStatement();		
+			for(String sql:str){
+				statement.addBatch(sql);
+			}
+			try {
+				statement.setQueryTimeout(180);
+				statement.executeBatch();
+			} catch (SQLException e) {
+				bol = false;
+				BaseUtil.getLogger().error(e.toString());
+				try {
+					statement.close();
+				} catch (SQLException e1) {
+					BaseUtil.getLogger().error(e1.toString());
+					e1.printStackTrace();
+				}
+				e.printStackTrace();
+			}
+			statement.close();
+		}catch(Exception e){
+			bol = false;
+			BaseUtil.getLogger().error(e.toString());
+			try {
+				if(connection!=null){
+					connection.rollback();
+				}				
+			} catch (SQLException e1) {
+				BaseUtil.getLogger().error(e1.toString());
+				e1.printStackTrace();
+			}
+			e.printStackTrace();
+		}finally{
+			statement = null;
+			return bol;
+		}
+	}
+	
+	@SuppressWarnings("finally")
+	public static int getIdBySeq(String seq){
+		connection = getConnect();
+		Statement statement = null;
+		int id = 0;
+		if(seq!=null&!"".equals(seq)){
+			try{			
+				statement = connection.createStatement();		
+				ResultSet rs = statement.executeQuery("select " + seq + ".nextval id from dual");
+				if(rs.next()){
+					id = rs.getInt("id");
+				}
+				rs.close();
+				statement.close();
+			}catch(Exception e){
+				BaseUtil.getLogger().error(e.toString());
+				try {
+					if(connection!=null){
+						connection.rollback();
+					}				
+				} catch (SQLException e1) {
+					BaseUtil.getLogger().error(e1.toString());
+					e1.printStackTrace();
+				}
+				e.printStackTrace();
+			}finally{
+				statement = null;
+				return id;
+			}			
+		}
+		return id;
+	}
+}

+ 30 - 0
src/com/uas/util/MyX509TrustManager.java

@@ -0,0 +1,30 @@
+package com.uas.util;
+
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+
+
+import javax.net.ssl.X509TrustManager;
+
+/**
+ * @author koul
+ * @email koul@usoftchina.com
+ * @date 2020-08-26 9:06
+ */
+public class MyX509TrustManager implements X509TrustManager{
+
+    @Override
+    public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
+
+    }
+
+    @Override
+    public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
+
+    }
+
+    @Override
+    public X509Certificate[] getAcceptedIssuers() {
+        return null;
+    }
+}

+ 579 - 0
src/com/uas/util/SFTPUtil.java

@@ -0,0 +1,579 @@
+package com.uas.util;
+
+import java.io.*;
+import java.util.*;
+
+import com.jcraft.jsch.*;
+import org.apache.commons.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * 类说明 sftp工具类
+ */
+public class SFTPUtil {
+    private transient Logger log = LoggerFactory.getLogger(this.getClass());
+
+    private ChannelSftp sftp;
+
+    private Session session;
+    /** SFTP 登录用户名*/
+    private String username;
+    /** SFTP 登录密码*/
+    private String password;
+    /** 私钥 */
+    private String privateKey;
+    /** SFTP 服务器地址IP地址*/
+    private String host;
+    /** SFTP 端口*/
+    private int port;
+
+
+    /**
+     * 构造基于密码认证的sftp对象
+     */
+    public SFTPUtil(String username, String password, String host, int port) {
+        this.username = username;
+        this.password = password;
+        this.host = host;
+        this.port = port;
+    }
+
+    /**
+     * 构造基于秘钥认证的sftp对象
+     */
+    public SFTPUtil(String username, String host, int port, String privateKey) {
+        this.username = username;
+        this.host = host;
+        this.port = port;
+        this.privateKey = privateKey;
+    }
+
+    public SFTPUtil(){}
+
+    /**
+     * 连接sftp服务器
+     */
+    public boolean login() throws JSchException {
+        boolean result = false;
+        JSch jsch = new JSch();
+        if (privateKey != null) {
+            jsch.addIdentity(privateKey);// 设置私钥
+        }
+
+        session = jsch.getSession(username, host, port);
+
+        if (password != null) {
+            session.setPassword(password);
+        }
+        Properties config = new Properties();
+        config.put("StrictHostKeyChecking", "no");
+
+        session.setConfig(config);
+        session.connect();
+
+        Channel channel = session.openChannel("sftp");
+        channel.connect();
+
+        sftp = (ChannelSftp) channel;
+        result = true;
+        return result;
+    }
+
+    /**
+     * 关闭连接 server
+     */
+    public void logout(){
+        if (sftp != null) {
+            if (sftp.isConnected()) {
+                sftp.disconnect();
+            }
+        }
+        if (session != null) {
+            if (session.isConnected()) {
+                session.disconnect();
+            }
+        }
+    }
+
+
+    /**
+     * 将输入流的数据上传到sftp作为文件。文件完整路径=basePath+directory
+     * @param basePath  服务器的基础路径
+     * @param directory  上传到该目录
+     * @param sftpFileName  sftp端文件名
+     * @param input   输入流
+     */
+    public boolean upload(String basePath,String directory, String sftpFileName, InputStream input) throws SftpException{
+        boolean flag =false;
+        try {
+            sftp.cd(basePath);
+            sftp.cd(directory);
+            flag = true;
+            sftp.put(input, sftpFileName);  //上传文件
+        } catch (SftpException e) {
+            //目录不存在,则创建文件夹
+           /* String [] dirs=directory.split("/");
+            String tempPath=basePath;
+            for(String dir:dirs){
+                if(null== dir || "".equals(dir)) continue;
+                tempPath+="/"+dir;
+                try{
+                    sftp.cd(tempPath);
+                }catch(SftpException ex){
+                    sftp.mkdir(tempPath);
+                    sftp.cd(tempPath);
+                }
+            }*/
+            flag = false;
+        }
+        return flag;
+    }
+
+
+    /**
+     * 下载文件。
+     * @param directory 下载目录
+     * @param downloadFile 下载的文件
+     * @param saveFile 存在本地的路径
+     */
+    public void download(String directory, String downloadFile, String saveFile) throws SftpException, FileNotFoundException{
+        if (directory != null && !"".equals(directory)) {
+            sftp.cd(directory);
+        }
+        File file = new File(saveFile);
+        sftp.get(downloadFile, new FileOutputStream(file));
+    }
+
+    /**
+     * 下载文件
+     * @param directory 下载目录
+     * @param downloadFile 下载的文件名
+     * @return 字节数组
+     */
+    public byte[] download(String directory, String downloadFile) throws SftpException, IOException{
+        if (directory != null && !"".equals(directory)) {
+            sftp.cd(directory);
+        }
+        InputStream is = sftp.get(downloadFile);
+
+        byte[] fileData = IOUtils.toByteArray(is);
+
+        return fileData;
+    }
+
+
+    /**
+     * 删除文件
+     * @param directory 要删除文件所在目录
+     * @param deleteFile 要删除的文件
+     */
+    public void delete(String directory, String deleteFile) throws SftpException{
+        sftp.cd(directory);
+        sftp.rm(deleteFile);
+    }
+
+
+    /**
+     * 列出目录下的文件
+     * @param
+     * @param directory 要列出的目录
+     */
+    public List<File> listFiles(String directory) throws SftpException {
+        Vector<ChannelSftp.LsEntry> list = sftp.ls(directory);
+        List<File> files = new ArrayList<>();
+        if (list.size()>0&&list!=null) {
+            for (ChannelSftp.LsEntry entry : list) {
+                if (!".".equals(entry.getFilename()) && !"..".equals(entry.getFilename())) {
+                    File file = new File("/"+directory+"/");
+                    files.add(file);
+                }
+            }
+        }
+        return files;
+    }
+
+    /**
+     * 下载流
+     * @param
+     * @param directory 下载目录
+     */
+    public List<File> download(String directory) {
+        try {
+            Vector<ChannelSftp.LsEntry> list = sftp.ls(directory);
+            List<File> ls = new ArrayList<File>();
+            if (list.size()>0&&list!=null) {
+                for (ChannelSftp.LsEntry entry : list) {
+                    if (!".".equals(entry.getFilename()) && !"..".equals(entry.getFilename())) {
+                        if (entry.getFilename().endsWith(".xml")) {
+                            InputStream is = sftp.get(directory+"/"+entry.getFilename());
+                            File temp= File.createTempFile(entry.getFilename(),"");
+                            OutputStream os = new FileOutputStream(temp);
+                            int bytesRead = 0;
+                            byte[] buffer = new byte[102400];
+                            while ((bytesRead = is.read(buffer, 0, 102400)) != -1) {
+                                os.write(buffer, 0, bytesRead);
+                            }
+                            is.close();
+                            os.close();
+                            ls.add(temp);
+                        }
+                    }
+                }
+            }
+            return ls;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    /**
+     * 根目录
+     *
+     * @return String
+     */
+    private String homeDir()
+    {
+        try {
+            return sftp.getHome();
+        } catch (Exception e) {
+            return "/";
+        }
+    }
+
+    public String currentDir()
+   {
+        try {
+            String pwd = sftp.pwd();
+            System.err.println(pwd);
+            return pwd;
+
+        } catch (Exception e) {
+           log.error("failed to get current dir", e);
+            return homeDir();
+         }
+    }
+
+    /**
+     * 切换工作目录
+     *
+     * @param pathName 路径
+     * @return boolean
+     */
+   public boolean changeDir(String pathName)
+   {
+       if (pathName == null || pathName.trim().equals("")) {
+           log.debug("invalid pathName");
+           return false;
+       }
+       try {
+           sftp.cd(pathName.replaceAll("\\\\", "/"));
+           log.debug("directory successfully changed,current dir=" + sftp.pwd());
+           return true;
+       } catch (SftpException e) {
+           log.error("failed to change directory", e);
+           return false;
+       }
+   }
+
+    /**
+     * 列出当前目录下的文件及文件夹
+     *
+     * @param filter 过滤参数
+     * @return String[]
+     */
+    @SuppressWarnings("unchecked")
+    private String[] list(String filter)
+    {
+        Vector<ChannelSftp.LsEntry> list = null;
+        try {
+            //ls方法会返回两个特殊的目录,当前目录(.)和父目录(..)
+            list = sftp.ls(sftp.pwd());
+        } catch (SftpException e) {
+            log.error("can not list directory", e);
+            return new String[0];
+        }
+        List<String> resultList = new ArrayList<String>();
+        for (ChannelSftp.LsEntry entry : list) {
+            resultList.add(entry.getFilename());
+        }
+        return resultList.toArray(new String[0]);
+    }
+    /**
+     * 指定目录下文件名称列表
+     *
+     * @return String[]
+     */
+    public String[] lsFiles(String pathName) {
+        String currentDir = currentDir();
+         if (!changeDir(pathName)) {
+             return new String[0];
+         }
+        String[] result = list("File");
+         if (!changeDir(currentDir)) {
+             return new String[0];
+        }
+        return result;
+    }
+
+
+    /**
+     * 批量下载文件
+     * @param remotePath:远程下载目录(以路径符号结束,可以为相对路径eg:/assess/sftp/jiesuan_2/2014/)
+     * @param localPath:本地保存目录(以路径符号结束,D:\Duansha\sftp\)
+     * @param fileFormat:下载文件格式(以特定字符开头,为空不做检验)
+     * @param fileEndFormat:下载文件格式(文件格式)
+     * @param del:下载后是否删除sftp文件
+     * @return
+     */
+    public List<String> batchDownLoadFile(String remotePath, String localPath,
+                                          String fileFormat, String fileEndFormat, boolean del)
+    {
+        List<String> filenames = new ArrayList<String>();
+        try
+        {
+            // connect();
+            Vector v = sftp.ls(remotePath);
+            // sftp.cd(remotePath);
+            if (v.size() > 0)
+            {
+                System.out.println("本次处理文件个数不为零,开始下载...fileSize=" + v.size());
+                Iterator it = v.iterator();
+                while (it.hasNext())
+                {
+                    ChannelSftp.LsEntry entry = (ChannelSftp.LsEntry) it.next();
+                    String filename = entry.getFilename();
+                    SftpATTRS attrs = entry.getAttrs();
+                    if (!attrs.isDir())
+                    {
+                        boolean flag = false;
+                        String localFileName = localPath + filename;
+                        fileFormat = fileFormat == null ? "" : fileFormat
+                                .trim();
+                        fileEndFormat = fileEndFormat == null ? ""
+                                : fileEndFormat.trim();
+                        // 三种情况
+                        if (fileFormat.length() > 0 && fileEndFormat.length() > 0)
+                        {
+                            if (filename.startsWith(fileFormat) && filename.endsWith(fileEndFormat))
+                            {
+                                flag = downloadFile(remotePath, filename,localPath, filename);
+                                if (flag)
+                                {
+                                    filenames.add(localFileName);
+                                    if (flag && del)
+                                    {
+                                        //deleteSFTP(remotePath, filename);
+                                    }
+                                }
+                            }
+                        }
+                        else if (fileFormat.length() > 0 && "".equals(fileEndFormat))
+                        {
+                            if (filename.startsWith(fileFormat))
+                            {
+                                flag = downloadFile(remotePath, filename, localPath, filename);
+                                if (flag)
+                                {
+                                    filenames.add(localFileName);
+                                    if (flag && del)
+                                    {
+                                        //sftp.deleteSFTP(remotePath, filename);
+                                    }
+                                }
+                            }
+                        }
+                        else if (fileEndFormat.length() > 0 && "".equals(fileFormat))
+                        {
+                            if (filename.endsWith(fileEndFormat))
+                            {
+                                flag = downloadFile(remotePath, filename,localPath, filename);
+                                if (flag)
+                                {
+                                    filenames.add(localFileName);
+                                    if (flag && del)
+                                    {
+                                        //deleteSFTP(remotePath, filename);
+                                    }
+                                }
+                            }
+                        }
+                        else
+                        {
+                            flag = downloadFile(remotePath, filename,localPath, filename);
+                            if (flag)
+                            {
+                                filenames.add(localFileName);
+                                if (flag && del)
+                                {
+                                    //deleteSFTP(remotePath, filename);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            if (log.isInfoEnabled())
+            {
+                log.info("download file is success:remotePath=" + remotePath
+                        + "and localPath=" + localPath + ",file size is"
+                        + v.size());
+            }
+        }
+        catch (SftpException e)
+        {
+            e.printStackTrace();
+        }
+        finally
+        {
+            // this.disconnect();
+        }
+        return filenames;
+    }
+
+    /**
+     * 下载单个文件
+     * @param remotePath:远程下载目录(以路径符号结束)
+     * @param remoteFileName:下载文件名
+     * @param localPath:本地保存目录(以路径符号结束)
+     * @param localFileName:保存文件名
+     * @return
+     */
+    public boolean downloadFile(String remotePath, String remoteFileName,String localPath, String localFileName)
+    {
+        FileOutputStream fieloutput = null;
+        try
+        {
+            // sftp.cd(remotePath);
+            File file = new File(localPath + localFileName);
+            // mkdirs(localPath + localFileName);
+            fieloutput = new FileOutputStream(file);
+            sftp.get(remotePath + remoteFileName, fieloutput);
+            if (log.isInfoEnabled())
+            {
+                log.info("===DownloadFile:" + remoteFileName + " success from sftp.");
+            }
+            return true;
+        }
+        catch (FileNotFoundException e)
+        {
+            e.printStackTrace();
+        }
+        catch (SftpException e)
+        {
+            e.printStackTrace();
+        }
+        finally
+        {
+            if (null != fieloutput)
+            {
+                try
+                {
+                    fieloutput.close();
+                }
+                catch (IOException e)
+                {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return false;
+    }
+
+    public Boolean rename(String name, String path) {
+        Boolean result = false;
+        try {
+            sftp.rename(name, path);
+            result = true;
+        } catch (SftpException e) {
+            e.printStackTrace();
+        }
+        return result;
+    }
+
+    public boolean copyfile(String src, String path){
+        boolean result = false;
+        try {
+            InputStream tInputStream = null;
+
+            //tChannelSftp.mkdir(路径);
+            System.err.println(src);
+            tInputStream = sftp.get(src);
+
+            //拷贝读取到的文件流
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+            byte[] buffer = new byte[1024];
+            int len;
+            while ((len = tInputStream.read(buffer)) > -1 ) {
+                baos.write(buffer, 0, len);
+            }
+            baos.flush();
+
+            InputStream nInputStream = new ByteArrayInputStream(baos.toByteArray());
+
+            sftp.put(nInputStream, path);
+
+            nInputStream.close();
+            baos.close();
+            tInputStream.close();
+            result = true;
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+       return result;
+    }
+
+    //上传文件测试
+    /*public static void main(String[] args) throws SftpException, IOException {
+        SFTPUtil sftp = new SFTPUtil("wms_ufct", "ZjJ05GFV", "218.17.248.243", 45301);
+       //FtpUtil.connect("/To_XN_TEST/","218.4.62.135",21,"hsltoxn", "HtxN527%#");
+        try {
+            sftp.login();
+        } catch (JSchException e) {
+            e.printStackTrace();
+        }
+        /*File file = new File("C:\\Users\\usoft\\Downloads\\视图字段.xls");
+        InputStream is = new FileInputStream(file);
+
+        sftp.upload("/","To_XN_TEST", "uas_sftp.xls", is);*//*
+        //sftp.listFiles("/stockout/data/");
+        String ss = "/stockout/data/";
+        String addr = "D:/BaiduNetdiskDownload\\";
+        *//*String[] strings = sftp.lsFiles(ss);
+        for (String s:strings) {
+            System.err.println(s);
+            if (!".".equals(s)&&!"..".equals(s)) {
+                *//**//*sftp.download(ss,s,addr);
+                File file = new File(ss+s);
+                InputStream inputStream = new FileInputStream(file);*//**//*
+                boolean bat = sftp.downloadFile(ss, s, "D:/", s);
+                System.err.println(bat);
+            }
+        }
+
+        sftp.logout();*//*
+        String sss = "GR_20190521121137B.xml";
+        String str = "\\stockout\\data\\";
+        String str1= str.replace("\\","/");
+        System.err.println(str);
+        *//*try {
+            InputStream in = new FileInputStream(sss);
+            SAXReader reader = new SAXReader();
+            Document doc = reader.read(in);
+            in.close();
+            Element element = doc.getRootElement();
+            System.err.println(element);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }*//*
+        //String src = "/stockout/data/GR_20190521121137B.xml";
+        //sftp.copyfile(src,"/stockout/backup/GR_20190521121137B.xml");
+        //sftp.logout();
+        boolean connect = FtpUtil.connect("From_QF", "112.74.205.182", 21, "YTZH02", "Ytzh)@2018");
+        System.err.println(connect);
+        FtpUtil.closeFtpClient(new FTPClient());
+    }*/
+}

+ 17 - 0
src/properties/dbconfig.properties

@@ -0,0 +1,17 @@
+{
+	"HUAXK_P":{
+		"url":"jdbc:oracle:thin:@127.0.0.1:1521:orcl",
+		"user":"HUAXK_P",
+		"password":"select!#%*("
+	},
+	"HXK_SU_P":{
+		"url":"jdbc:oracle:thin:@127.0.0.1:1521:orcl",
+		"user":"HXK_SU_P",
+		"password":"select!#%*("
+	},
+	"LHWX_HK_P":{
+		"url":"jdbc:oracle:thin:@127.0.0.1:1521:orcl",
+		"user":"LHWX_HK_P",
+		"password":"select!#%*("
+	}
+}

+ 26 - 0
src/properties/ftpconfig.properties

@@ -0,0 +1,26 @@
+{
+	"HUAXK_P-HDSZ":{
+		"ip":"58.250.26.203",
+		"port":21,
+		"user":"Szhuaxinke",
+		"password":"Hzfek93T**",
+		"in":"Szhuaxinke",
+		"file":""
+	},
+	"HXK_SU_P-HDSZ":{
+		"ip":"58.250.26.203",
+		"port":21,
+		"user":"Szhuaxinke",
+		"password":"Hzfek93T**",
+		"in":"Szhuaxinke",
+		"file":""
+	},
+		"LHWX_HK_P-HDSZ":{
+		"ip":"58.250.26.203",
+		"port":21,
+		"user":"XGlianheWX",
+		"password":"Enakx53T**",
+		"in":"Hklhwx",
+		"file":""
+	}
+}

+ 6 - 0
src/properties/log4j.properties

@@ -0,0 +1,6 @@
+log4j.rootLogger=DEBUG, R     
+log4j.appender.R=org.apache.log4j.FileAppender   
+log4j.appender.R.file=my.log     
+log4j.appender.R.Append=true   
+log4j.appender.R.layout=org.apache.log4j.PatternLayout   
+log4j.appender.R.layout.ConversionPattern=%n%n%d%p[%c]-%m%n