hxx 2 年之前
当前提交
970a365dd9
共有 39 个文件被更改,包括 4092 次插入0 次删除
  1. 33 0
      .gitignore
  2. 117 0
      .mvn/wrapper/MavenWrapperDownloader.java
  3. 二进制
      .mvn/wrapper/maven-wrapper.jar
  4. 2 0
      .mvn/wrapper/maven-wrapper.properties
  5. 310 0
      mvnw
  6. 182 0
      mvnw.cmd
  7. 187 0
      pom.xml
  8. 47 0
      src/main/assembly/assembly.xml
  9. 33 0
      src/main/assembly/bin/start.bat
  10. 81 0
      src/main/assembly/bin/start.sh
  11. 3 0
      src/main/assembly/bin/stop.sh
  12. 15 0
      src/main/java/com/caesolver/CaesolverApplication.java
  13. 63 0
      src/main/java/com/caesolver/controller/SolverController.java
  14. 27 0
      src/main/java/com/caesolver/controller/ThreadConfig.java
  15. 172 0
      src/main/java/com/caesolver/es/BaseElasticService.java
  16. 40 0
      src/main/java/com/caesolver/es/ElasticConfig.java
  17. 35 0
      src/main/java/com/caesolver/es/ElasticEntity.java
  18. 75 0
      src/main/java/com/caesolver/ftp/FtpClientFactory.java
  19. 99 0
      src/main/java/com/caesolver/ftp/FtpConfig.java
  20. 51 0
      src/main/java/com/caesolver/ftp/FtpPool.java
  21. 126 0
      src/main/java/com/caesolver/ftp/FtpUtils.java
  22. 38 0
      src/main/java/com/caesolver/mq/RabbitConfig.java
  23. 39 0
      src/main/java/com/caesolver/server/BeanConfig.java
  24. 38 0
      src/main/java/com/caesolver/server/SendMsgController.java
  25. 21 0
      src/main/java/com/caesolver/server/Solver.java
  26. 203 0
      src/main/java/com/caesolver/server/SolverBladesignOrderUtil.java
  27. 89 0
      src/main/java/com/caesolver/server/SolverCfdOrderUtil.java
  28. 103 0
      src/main/java/com/caesolver/server/SolverFemOrderUtil.java
  29. 213 0
      src/main/java/com/caesolver/server/SolverHcfdOrderUtil.java
  30. 69 0
      src/main/java/com/caesolver/server/SolverMpmOrderUtil.java
  31. 276 0
      src/main/java/com/caesolver/server/SolverService.java
  32. 61 0
      src/main/java/com/caesolver/server/util/FileUtils.java
  33. 311 0
      src/main/java/com/caesolver/server/util/HttpUtils.java
  34. 255 0
      src/main/java/com/caesolver/server/util/TimeUtils.java
  35. 94 0
      src/main/java/com/caesolver/sftp/FileUtil.java
  36. 436 0
      src/main/java/com/caesolver/sftp/SFTPUtil.java
  37. 67 0
      src/main/resources/application.yml
  38. 80 0
      src/main/resources/applicationbak.yml
  39. 1 0
      src/test/.gitignore

+ 33 - 0
.gitignore

@@ -0,0 +1,33 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/

+ 117 - 0
.mvn/wrapper/MavenWrapperDownloader.java

@@ -0,0 +1,117 @@
+/*
+ * Copyright 2007-present the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import java.net.*;
+import java.io.*;
+import java.nio.channels.*;
+import java.util.Properties;
+
+public class MavenWrapperDownloader {
+
+    private static final String WRAPPER_VERSION = "0.5.6";
+    /**
+     * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
+     */
+    private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+        + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
+
+    /**
+     * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
+     * use instead of the default one.
+     */
+    private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
+            ".mvn/wrapper/maven-wrapper.properties";
+
+    /**
+     * Path where the maven-wrapper.jar will be saved to.
+     */
+    private static final String MAVEN_WRAPPER_JAR_PATH =
+            ".mvn/wrapper/maven-wrapper.jar";
+
+    /**
+     * Name of the property which should be used to override the default download url for the wrapper.
+     */
+    private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
+
+    public static void main(String args[]) {
+        System.out.println("- Downloader started");
+        File baseDirectory = new File(args[0]);
+        System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
+
+        // If the maven-wrapper.properties exists, read it and check if it contains a custom
+        // wrapperUrl parameter.
+        File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
+        String url = DEFAULT_DOWNLOAD_URL;
+        if(mavenWrapperPropertyFile.exists()) {
+            FileInputStream mavenWrapperPropertyFileInputStream = null;
+            try {
+                mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
+                Properties mavenWrapperProperties = new Properties();
+                mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
+                url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
+            } catch (IOException e) {
+                System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
+            } finally {
+                try {
+                    if(mavenWrapperPropertyFileInputStream != null) {
+                        mavenWrapperPropertyFileInputStream.close();
+                    }
+                } catch (IOException e) {
+                    // Ignore ...
+                }
+            }
+        }
+        System.out.println("- Downloading from: " + url);
+
+        File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
+        if(!outputFile.getParentFile().exists()) {
+            if(!outputFile.getParentFile().mkdirs()) {
+                System.out.println(
+                        "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
+            }
+        }
+        System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
+        try {
+            downloadFileFromURL(url, outputFile);
+            System.out.println("Done");
+            System.exit(0);
+        } catch (Throwable e) {
+            System.out.println("- Error downloading");
+            e.printStackTrace();
+            System.exit(1);
+        }
+    }
+
+    private static void downloadFileFromURL(String urlString, File destination) throws Exception {
+        if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
+            String username = System.getenv("MVNW_USERNAME");
+            char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
+            Authenticator.setDefault(new Authenticator() {
+                @Override
+                protected PasswordAuthentication getPasswordAuthentication() {
+                    return new PasswordAuthentication(username, password);
+                }
+            });
+        }
+        URL website = new URL(urlString);
+        ReadableByteChannel rbc;
+        rbc = Channels.newChannel(website.openStream());
+        FileOutputStream fos = new FileOutputStream(destination);
+        fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
+        fos.close();
+        rbc.close();
+    }
+
+}

二进制
.mvn/wrapper/maven-wrapper.jar


+ 2 - 0
.mvn/wrapper/maven-wrapper.properties

@@ -0,0 +1,2 @@
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar

+ 310 - 0
mvnw

@@ -0,0 +1,310 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Maven Start Up Batch script
+#
+# Required ENV vars:
+# ------------------
+#   JAVA_HOME - location of a JDK home dir
+#
+# Optional ENV vars
+# -----------------
+#   M2_HOME - location of maven2's installed home dir
+#   MAVEN_OPTS - parameters passed to the Java VM when running Maven
+#     e.g. to debug Maven itself, use
+#       set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+#   MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+# ----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+  if [ -f /etc/mavenrc ] ; then
+    . /etc/mavenrc
+  fi
+
+  if [ -f "$HOME/.mavenrc" ] ; then
+    . "$HOME/.mavenrc"
+  fi
+
+fi
+
+# OS specific support.  $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+mingw=false
+case "`uname`" in
+  CYGWIN*) cygwin=true ;;
+  MINGW*) mingw=true;;
+  Darwin*) darwin=true
+    # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
+    # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
+    if [ -z "$JAVA_HOME" ]; then
+      if [ -x "/usr/libexec/java_home" ]; then
+        export JAVA_HOME="`/usr/libexec/java_home`"
+      else
+        export JAVA_HOME="/Library/Java/Home"
+      fi
+    fi
+    ;;
+esac
+
+if [ -z "$JAVA_HOME" ] ; then
+  if [ -r /etc/gentoo-release ] ; then
+    JAVA_HOME=`java-config --jre-home`
+  fi
+fi
+
+if [ -z "$M2_HOME" ] ; then
+  ## resolve links - $0 may be a link to maven's home
+  PRG="$0"
+
+  # need this for relative symlinks
+  while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+      PRG="$link"
+    else
+      PRG="`dirname "$PRG"`/$link"
+    fi
+  done
+
+  saveddir=`pwd`
+
+  M2_HOME=`dirname "$PRG"`/..
+
+  # make it fully qualified
+  M2_HOME=`cd "$M2_HOME" && pwd`
+
+  cd "$saveddir"
+  # echo Using m2 at $M2_HOME
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+  [ -n "$M2_HOME" ] &&
+    M2_HOME=`cygpath --unix "$M2_HOME"`
+  [ -n "$JAVA_HOME" ] &&
+    JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+  [ -n "$CLASSPATH" ] &&
+    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# For Mingw, ensure paths are in UNIX format before anything is touched
+if $mingw ; then
+  [ -n "$M2_HOME" ] &&
+    M2_HOME="`(cd "$M2_HOME"; pwd)`"
+  [ -n "$JAVA_HOME" ] &&
+    JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+  javaExecutable="`which javac`"
+  if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
+    # readlink(1) is not available as standard on Solaris 10.
+    readLink=`which readlink`
+    if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
+      if $darwin ; then
+        javaHome="`dirname \"$javaExecutable\"`"
+        javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
+      else
+        javaExecutable="`readlink -f \"$javaExecutable\"`"
+      fi
+      javaHome="`dirname \"$javaExecutable\"`"
+      javaHome=`expr "$javaHome" : '\(.*\)/bin'`
+      JAVA_HOME="$javaHome"
+      export JAVA_HOME
+    fi
+  fi
+fi
+
+if [ -z "$JAVACMD" ] ; then
+  if [ -n "$JAVA_HOME"  ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+      # IBM's JDK on AIX uses strange locations for the executables
+      JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+      JAVACMD="$JAVA_HOME/bin/java"
+    fi
+  else
+    JAVACMD="`which java`"
+  fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+  echo "Error: JAVA_HOME is not defined correctly." >&2
+  echo "  We cannot execute $JAVACMD" >&2
+  exit 1
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+  echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+
+  if [ -z "$1" ]
+  then
+    echo "Path not specified to find_maven_basedir"
+    return 1
+  fi
+
+  basedir="$1"
+  wdir="$1"
+  while [ "$wdir" != '/' ] ; do
+    if [ -d "$wdir"/.mvn ] ; then
+      basedir=$wdir
+      break
+    fi
+    # workaround for JBEAP-8937 (on Solaris 10/Sparc)
+    if [ -d "${wdir}" ]; then
+      wdir=`cd "$wdir/.."; pwd`
+    fi
+    # end of workaround
+  done
+  echo "${basedir}"
+}
+
+# concatenates all lines of a file
+concat_lines() {
+  if [ -f "$1" ]; then
+    echo "$(tr -s '\n' ' ' < "$1")"
+  fi
+}
+
+BASE_DIR=`find_maven_basedir "$(pwd)"`
+if [ -z "$BASE_DIR" ]; then
+  exit 1;
+fi
+
+##########################################################################################
+# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+# This allows using the maven wrapper in projects that prohibit checking in binary data.
+##########################################################################################
+if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
+    if [ "$MVNW_VERBOSE" = true ]; then
+      echo "Found .mvn/wrapper/maven-wrapper.jar"
+    fi
+else
+    if [ "$MVNW_VERBOSE" = true ]; then
+      echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
+    fi
+    if [ -n "$MVNW_REPOURL" ]; then
+      jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
+    else
+      jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
+    fi
+    while IFS="=" read key value; do
+      case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
+      esac
+    done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
+    if [ "$MVNW_VERBOSE" = true ]; then
+      echo "Downloading from: $jarUrl"
+    fi
+    wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
+    if $cygwin; then
+      wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
+    fi
+
+    if command -v wget > /dev/null; then
+        if [ "$MVNW_VERBOSE" = true ]; then
+          echo "Found wget ... using wget"
+        fi
+        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+            wget "$jarUrl" -O "$wrapperJarPath"
+        else
+            wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
+        fi
+    elif command -v curl > /dev/null; then
+        if [ "$MVNW_VERBOSE" = true ]; then
+          echo "Found curl ... using curl"
+        fi
+        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+            curl -o "$wrapperJarPath" "$jarUrl" -f
+        else
+            curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
+        fi
+
+    else
+        if [ "$MVNW_VERBOSE" = true ]; then
+          echo "Falling back to using Java to download"
+        fi
+        javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
+        # For Cygwin, switch paths to Windows format before running javac
+        if $cygwin; then
+          javaClass=`cygpath --path --windows "$javaClass"`
+        fi
+        if [ -e "$javaClass" ]; then
+            if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+                if [ "$MVNW_VERBOSE" = true ]; then
+                  echo " - Compiling MavenWrapperDownloader.java ..."
+                fi
+                # Compiling the Java class
+                ("$JAVA_HOME/bin/javac" "$javaClass")
+            fi
+            if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+                # Running the downloader
+                if [ "$MVNW_VERBOSE" = true ]; then
+                  echo " - Running MavenWrapperDownloader.java ..."
+                fi
+                ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
+            fi
+        fi
+    fi
+fi
+##########################################################################################
+# End of extension
+##########################################################################################
+
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
+if [ "$MVNW_VERBOSE" = true ]; then
+  echo $MAVEN_PROJECTBASEDIR
+fi
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+  [ -n "$M2_HOME" ] &&
+    M2_HOME=`cygpath --path --windows "$M2_HOME"`
+  [ -n "$JAVA_HOME" ] &&
+    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+  [ -n "$CLASSPATH" ] &&
+    CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+  [ -n "$MAVEN_PROJECTBASEDIR" ] &&
+    MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
+fi
+
+# Provide a "standardized" way to retrieve the CLI args that will
+# work with both Windows and non-Windows executions.
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
+export MAVEN_CMD_LINE_ARGS
+
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+exec "$JAVACMD" \
+  $MAVEN_OPTS \
+  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+  "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

+ 182 - 0
mvnw.cmd

@@ -0,0 +1,182 @@
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements.  See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership.  The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License.  You may obtain a copy of the License at
+@REM
+@REM    https://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied.  See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Maven Start Up Batch script
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM M2_HOME - location of maven2's installed home dir
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM     e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
+if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
+
+FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+    IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
+)
+
+@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
+if exist %WRAPPER_JAR% (
+    if "%MVNW_VERBOSE%" == "true" (
+        echo Found %WRAPPER_JAR%
+    )
+) else (
+    if not "%MVNW_REPOURL%" == "" (
+        SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
+    )
+    if "%MVNW_VERBOSE%" == "true" (
+        echo Couldn't find %WRAPPER_JAR%, downloading it ...
+        echo Downloading from: %DOWNLOAD_URL%
+    )
+
+    powershell -Command "&{"^
+		"$webclient = new-object System.Net.WebClient;"^
+		"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
+		"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
+		"}"^
+		"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
+		"}"
+    if "%MVNW_VERBOSE%" == "true" (
+        echo Finished downloading %WRAPPER_JAR%
+    )
+)
+@REM End of extension
+
+@REM Provide a "standardized" way to retrieve the CLI args that will
+@REM work with both Windows and non-Windows executions.
+set MAVEN_CMD_LINE_ARGS=%*
+
+%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
+if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%" == "on" pause
+
+if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
+
+exit /B %ERROR_CODE%

+ 187 - 0
pom.xml

@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.springframework.boot</groupId>
+		<artifactId>spring-boot-starter-parent</artifactId>
+		<version>2.3.4.RELEASE</version>
+		<relativePath/> <!-- lookup parent from repository -->
+	</parent>
+	<groupId>com.adisolver</groupId>
+	<artifactId>adisolver</artifactId>
+	<version>0.0.1-SNAPSHOT</version>
+	<name>adisolver</name>
+	<description>Demo project for Spring Boot</description>
+
+	<properties>
+		<java.version>1.8</java.version>
+	</properties>
+
+	<dependencies>
+		<dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-amqp</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-test</artifactId>
+			<scope>test</scope>
+			<exclusions>
+				<exclusion>
+					<groupId>org.junit.vintage</groupId>
+					<artifactId>junit-vintage-engine</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+		<dependency> 
+		 <groupId>org.apache.httpcomponents</groupId> 
+          <artifactId>httpclient</artifactId>
+        </dependency> 
+        <dependency> 
+         <groupId>org.apache.httpcomponents</groupId> 
+          <artifactId>httpclient-cache</artifactId>      
+        </dependency> 
+        <dependency> 
+         <groupId>org.apache.httpcomponents</groupId> 
+          <artifactId>httpmime</artifactId> 
+		 </dependency> 
+		<dependency>
+		<groupId>net.sf.json-lib</groupId>
+		<artifactId>json-lib</artifactId>
+		<version>2.4</version>
+		<classifier>jdk15</classifier>
+		</dependency>
+		 <dependency>
+		    <groupId>com.alibaba</groupId>
+		    <artifactId>fastjson</artifactId>
+		    <version>1.2.43</version>
+		</dependency>
+		<dependency>
+		   <groupId>commons-net</groupId>
+		   <artifactId>commons-net</artifactId>
+		   <version>3.6</version>
+		</dependency>
+		 <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-pool2</artifactId>
+        </dependency>
+        <dependency>
+		  <groupId>commons-io</groupId>
+		  <artifactId>commons-io</artifactId>
+		  <version>2.5</version>
+		</dependency>
+	
+
+
+		<dependency>
+		    <groupId>org.elasticsearch.client</groupId>
+		    <artifactId>elasticsearch-rest-high-level-client</artifactId>
+		    <version>7.4.0</version>
+		    <exclusions>
+		        <exclusion>
+		            <groupId>org.elasticsearch</groupId>
+		            <artifactId>elasticsearch</artifactId>
+		        </exclusion>
+		        <exclusion>
+		            <groupId>org.elasticsearch.client</groupId>
+		            <artifactId>elasticsearch-rest-client</artifactId>
+		        </exclusion>
+		    </exclusions>
+		</dependency>
+		<dependency>
+		    <groupId>org.elasticsearch.client</groupId>
+		    <artifactId>elasticsearch-rest-client</artifactId>
+		    <version>7.4.0</version>
+		</dependency>
+		<dependency>
+		    <groupId>org.elasticsearch</groupId>
+		    <artifactId>elasticsearch</artifactId>
+		    <version>7.4.0</version>
+		</dependency>
+		
+		<dependency>
+			<groupId>org.springframework.amqp</groupId>
+			<artifactId>spring-rabbit-test</artifactId>
+			<scope>test</scope>
+		</dependency>
+		
+				
+		<dependency>  
+		      <groupId>com.jcraft</groupId>  
+		      <artifactId>jsch</artifactId>  
+		      <version>0.1.53</version>  
+		</dependency>  
+		
+		<dependency>
+		    <groupId>com.xuxueli</groupId>
+		    <artifactId>xxl-job-core</artifactId>
+		    <version>2.3.0</version>
+		</dependency>
+		
+	</dependencies>
+
+<build>
+       <finalName>${project.artifactId}</finalName>
+       <plugins>
+       	<plugin>
+		    <groupId>org.apache.maven.plugins</groupId>
+		    <artifactId>maven-jar-plugin</artifactId>
+		    <configuration>
+		        <archive>
+		            <manifest>
+		                <!--指定main入口-->
+		                <mainClass>com.caesolver.CaesolverApplication</mainClass>
+		                <addClasspath>true</addClasspath>
+		                <classpathPrefix>lib/</classpathPrefix>
+		            </manifest>
+		        </archive>
+		    </configuration>
+		</plugin>
+           <!-- 编码和编译和JDK版本 -->
+           <plugin>
+               <groupId>org.apache.maven.plugins</groupId>
+               <artifactId>maven-dependency-plugin</artifactId>
+               <executions>
+                    <execution>
+                        <id>copy-dependencies</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>copy-dependencies</goal>
+                        </goals>
+                       <configuration>
+                           <outputDirectory>${project.build.directory}/lib</outputDirectory>
+                       </configuration>
+                    </execution>
+                </executions>
+           </plugin>
+           <!--添加打包插件声明 -->
+           <plugin>
+               <artifactId>maven-assembly-plugin</artifactId>
+               <configuration>
+                   <descriptors>
+                       <descriptor>src/main/assembly/assembly.xml</descriptor>
+                   </descriptors>
+               </configuration>
+               <!--执行器 mvn assembly:assembly-->
+               <executions>
+                   <execution>
+                       <!--名字任意 -->
+                       <id>make-assembly</id>
+                       <!-- 绑定到package生命周期阶段上 -->
+                       <phase>package</phase>
+                       <!-- 只运行一次 -->
+                       <goals>
+                           <goal>single</goal>
+                       </goals>
+                   </execution>
+               </executions>
+           </plugin>
+       </plugins>
+   </build>
+</project>

+ 47 - 0
src/main/assembly/assembly.xml

@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<assembly>
+    <id>assembly</id>
+  <!-- 输出格式 -->
+    <formats>
+        <!--  <format>tar.gz</format>-->
+        <format>zip</format>
+    </formats>
+    <includeBaseDirectory>true</includeBaseDirectory>
+  <!-- 指定文件组的组装方式 -->
+    <fileSets>
+      <!-- 将项目中src/bin目录下的脚本文件copy到target目录的bin目录下 -->
+        <fileSet>
+            <directory>src/main/assembly/bin</directory>
+            <outputDirectory>bin</outputDirectory>
+ 		<!--
+            0755->即用户具有读/写/执行权限,组用户和其它用户具有读写权限;
+            0644->即用户具有读写权限,组用户和其它用户具有只读权限;
+        -->
+            <fileMode>0755</fileMode>
+        </fileSet>
+      <!-- 将项目中src/main/resources目录下的资源文件copy到target目录的conf目录下 -->
+        <fileSet>
+            <directory>src/main/resources</directory>
+            <outputDirectory>conf</outputDirectory>
+            <fileMode>0644</fileMode>
+        </fileSet>
+      <!-- 将项目中target目录下的包含jar的文件copy到lib目录下 -->
+        <fileSet>
+            <directory>target</directory>
+            <outputDirectory>/</outputDirectory>
+            <includes>
+                <include>*.jar</include>
+            </includes>
+        </fileSet>
+    </fileSets>
+    
+    <!-- 指定依赖jar包输出的目录 -->
+	<dependencySets>
+	  <dependencySet>
+	      <useProjectArtifact>true</useProjectArtifact>
+	      <outputDirectory>lib</outputDirectory>
+	      <!-- 只包含runtime作用域的依赖 -->
+	      <scope>runtime</scope>
+	  </dependencySet>
+	</dependencySets>
+</assembly>

+ 33 - 0
src/main/assembly/bin/start.bat

@@ -0,0 +1,33 @@
+@echo off
+ 
+set APP_NAME=caesolver.jar
+ 
+set CONFIG= -Dlogging.path=../logs  -Dspring.config.location=../conf/application.yml
+ 
+set DEBUG_OPTS=
+if ""%1"" == ""debug"" (
+   set DEBUG_OPTS= -Xloggc:../logs/gc.log -verbose:gc -XX:+PrintGCDetails -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=../logs
+   goto debug
+)
+ 
+set JMX_OPTS=
+if ""%1"" == ""jmx"" (
+   set JMX_OPTS= -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9888 -Dcom.sun.management.jmxremote.ssl=FALSE -Dcom.sun.management.jmxremote.authenticate=FALSE
+   goto jmx
+)
+ 
+echo "Starting the %APP_NAME%"
+java -Xms512m -Xmx512m -server %DEBUG_OPTS% %JMX_OPTS% %CONFIG% -jar ../%APP_NAME%
+goto end
+ 
+:debug
+echo "debug"
+java -Xms512m -Xmx512m -server %DEBUG_OPTS% %CONFIG% -jar ../%APP_NAME%
+goto end
+ 
+:jmx
+java -Xms512m -Xmx512m -server %JMX_OPTS% %CONFIG% -jar ../%APP_NAME%
+goto end
+ 
+:end
+pause

+ 81 - 0
src/main/assembly/bin/start.sh

@@ -0,0 +1,81 @@
+#!/bin/bash
+ 
+SERVER_NAME='caesolver'
+JAR_NAME="$SERVER_NAME.jar"
+CONF_DIR=../conf
+DEPLOY_DIR=../
+ 
+PIDS=`ps -f | grep java | grep "$CONF_DIR" |awk '{print $2}'`
+if [ "$1" = "status" ]; then
+    if [ -n "$PIDS" ]; then
+        echo "The $SERVER_NAME is running...!"
+        echo "PID: $PIDS"
+        exit 0
+    else
+        echo "The $SERVER_NAME is stopped"
+        exit 0
+    fi
+fi
+ 
+if [ -n "$PIDS" ]; then
+    echo "ERROR: The $SERVER_NAME already started!"
+    echo "PID: $PIDS"
+    exit 1
+fi
+ 
+if [ -n "$SERVER_PORT" ]; then
+    SERVER_PORT_COUNT=`netstat -tln | grep $SERVER_PORT | wc -l`
+    if [ $SERVER_PORT_COUNT -gt 0 ]; then
+        echo "ERROR: The $SERVER_NAME port $SERVER_PORT already used!"
+        exit 1
+    fi
+fi
+ 
+LOGS_DIR=/u01/cfd/logs
+if [ ! -d $LOGS_DIR ]; then
+    mkdir $LOGS_DIR
+fi
+STDOUT_FILE=$LOGS_DIR/cfd-solver.log
+ 
+JAVA_OPTS=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true "
+JAVA_DEBUG_OPTS=""
+if [ "$1" = "debug" ]; then
+    JAVA_DEBUG_OPTS=" -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n "
+fi
+ 
+JAVA_JMX_OPTS=""
+if [ "$1" = "jmx" ]; then
+    JAVA_JMX_OPTS=" -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false "
+fi
+ 
+JAVA_MEM_OPTS=""
+BITS=`java -version 2>&1 | grep -i 64-bit`
+if [ -n "$BITS" ]; then
+    JAVA_MEM_OPTS=" -server -Xmx512m -Xms512m -Xmn256m -XX:PermSize=128m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 "
+else
+    JAVA_MEM_OPTS=" -server -Xms512m -Xmx512m -XX:PermSize=128m -XX:SurvivorRatio=2 -XX:+UseParallelGC "
+fi
+ 
+CONFIG_FILES=" -Dlogging.path=$LOGS_DIR -Dspring.config.location=$CONF_DIR/application.yml "
+echo -e "Starting the $SERVER_NAME ..."
+nohup java $JAVA_OPTS $JAVA_MEM_OPTS $JAVA_DEBUG_OPTS $JAVA_JMX_OPTS $CONFIG_FILES -jar $DEPLOY_DIR/$JAR_NAME > $STDOUT_FILE 2>&1 &
+ 
+COUNT=0
+while [ $COUNT -lt 1 ]; do
+    echo -e ".\c"
+    sleep 1
+    if [ -n "$SERVER_PORT" ]; then
+        COUNT=`netstat -an | grep $SERVER_PORT | wc -l`
+    else
+        COUNT=`ps -f | grep java | grep "$DEPLOY_DIR" | awk '{print $2}' | wc -l`
+    fi
+    if [ $COUNT -gt 0 ]; then
+        break
+    fi
+done
+ 
+ 
+echo "OK!"
+PIDS=`ps -f | grep java | grep "$DEPLOY_DIR" | awk '{print $2}'`
+echo "PID: $PIDS"
+echo "STDOUT: $STDOUT_FILE"

+ 3 - 0
src/main/assembly/bin/stop.sh

@@ -0,0 +1,3 @@
+# !/bin/bash
+PID=$(ps -ef | grep "caesolver.jar" | grep -v grep | awk '{ print $2 }')
+kill -9 ${PID}

+ 15 - 0
src/main/java/com/caesolver/CaesolverApplication.java

@@ -0,0 +1,15 @@
+package com.caesolver;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableAsync;
+
+@SpringBootApplication
+@EnableAsync //开启异步调用
+public class CaesolverApplication {
+
+	public static void main(String[] args) {
+		SpringApplication.run(CaesolverApplication.class, args);
+	}
+
+}

+ 63 - 0
src/main/java/com/caesolver/controller/SolverController.java

@@ -0,0 +1,63 @@
+package com.caesolver.controller;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.caesolver.server.SolverService;
+
+import io.netty.util.internal.StringUtil;
+
+@RestController
+public class SolverController {
+	 protected static Logger log=LoggerFactory.getLogger(SolverController.class);
+	@Autowired
+	SolverService solverService;
+	
+	@GetMapping("/test")
+    public String test()  {
+    	return "服务器测试";
+    }
+   
+    @PostMapping("/solver") 
+    public void solver( String jobId, String jobOrder, String projectType,String projectId,String orderType,String vfreq,String afreq)  {
+    	try {
+    		Integer vf =100;
+    		Integer af =100;
+    		if(!StringUtil.isNullOrEmpty(vfreq)) {
+    			vf=Integer.valueOf(vfreq);
+    		}
+    		if(!StringUtil.isNullOrEmpty(afreq)) {
+    			af=Integer.valueOf(afreq);
+    		}
+    		 log.info("Solver end  vfreq={} afreq={}",vfreq,afreq);
+    		 log.info("Solver end  vfreq={} afreq={}",vf,af);
+    		solverService.precessController(jobId, jobOrder, projectType, projectId,orderType,af,vf);
+    	} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+    	}
+    }
+    @PostMapping("/solverres") 
+    public void solver( String jobId, String jobOrder, String projectType,String projectId,String orderType,String vfreq,String afreq,String resources)  {
+    	try {
+    		Integer vf =100;
+    		Integer af =100;
+    		if(!StringUtil.isNullOrEmpty(vfreq)) {
+    			vf=Integer.valueOf(vfreq);
+    		}
+    		if(!StringUtil.isNullOrEmpty(afreq)) {
+    			af=Integer.valueOf(afreq);
+    		}
+    		 log.info("Solver end  vfreq={} afreq={}",vfreq,afreq);
+    		 log.info("Solver end  vfreq={} afreq={}",vf,af);
+    		solverService.precessController(jobId, jobOrder, projectType, projectId,orderType,af,vf,resources);
+    	} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+    	}
+    }
+}

+ 27 - 0
src/main/java/com/caesolver/controller/ThreadConfig.java

@@ -0,0 +1,27 @@
+package com.caesolver.controller;
+
+import java.util.concurrent.Executor;
+
+import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.AsyncConfigurer;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+@Configuration
+
+public class ThreadConfig implements AsyncConfigurer {
+	@Override
+	  public Executor getAsyncExecutor() {
+	    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+	    executor.setCorePoolSize(8);
+	    executor.setMaxPoolSize(1000);
+	    executor.setQueueCapacity(500);
+	    executor.setKeepAliveSeconds(30000);
+	    executor.initialize();
+	    return executor;
+	  }
+	  @Override
+	  public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
+	    return null;
+	  }
+}

+ 172 - 0
src/main/java/com/caesolver/es/BaseElasticService.java

@@ -0,0 +1,172 @@
+package com.caesolver.es;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.elasticsearch.action.index.IndexRequest;
+import org.elasticsearch.action.index.IndexResponse;
+import org.elasticsearch.action.search.SearchRequest;
+import org.elasticsearch.action.search.SearchResponse;
+import org.elasticsearch.client.RequestOptions;
+import org.elasticsearch.client.RestHighLevelClient;
+import org.elasticsearch.client.indices.CreateIndexRequest;
+import org.elasticsearch.client.indices.CreateIndexResponse;
+import org.elasticsearch.client.indices.GetIndexRequest;
+import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.common.xcontent.XContentType;
+import org.elasticsearch.search.SearchHit;
+import org.elasticsearch.search.builder.SearchSourceBuilder;
+import org.elasticsearch.search.sort.SortOrder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.alibaba.fastjson.JSON;
+
+import net.sf.json.JSONObject;
+
+//@Component
+public class BaseElasticService {
+
+//    @Autowired
+    RestHighLevelClient restHighLevelClient;
+    protected static Logger log=LoggerFactory.getLogger(BaseElasticService.class);    
+
+    /** 创建索引
+     * 
+     * @param idxName
+     */
+    public void createIndex(String idxName){
+        try {
+            if (this.isExistsIndex(idxName)) {
+//                log.error(" idxName={} 已经存在",idxName);
+                return;
+            }
+            CreateIndexRequest request = new CreateIndexRequest(idxName);
+            buildSetting(request);
+//            request.mapping(idxSQL, XContentType.JSON);
+            buildIndexMapping(request);
+//            request.settings() 手工指定Setting
+            CreateIndexResponse res = restHighLevelClient.indices().create(request, RequestOptions.DEFAULT);
+            if (!res.isAcknowledged()) {
+                throw new RuntimeException("初始化失败");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.exit(0);
+        }
+    }
+    
+  //设置index的mapping
+    public void buildIndexMapping(CreateIndexRequest request){
+        Map<String, Object> projectId = new HashMap<>();
+        projectId.put("type", "text");
+        Map<String, Object> log = new HashMap<>();
+        log.put("type", "text");
+        Map<String, Object> time = new HashMap<>();
+        time.put("type", "text");
+        Map<String, Object> properties = new HashMap<>();
+        properties.put("projectId", projectId);
+        properties.put("log", log);
+        properties.put("time", time);
+        Map<String, Object> logs = new HashMap<>();
+        logs.put("properties", properties);
+
+        request.mapping(logs);
+    }
+
+    /** 断某个index是否存在
+     * @param idxName index名
+     * @return boolean
+     * @throws
+     * @since
+     */
+    public boolean isExistsIndex(String idxName) throws Exception {
+        return restHighLevelClient.indices().exists(new GetIndexRequest(idxName),RequestOptions.DEFAULT);
+    }
+
+    /** 设置分片
+     * @param request
+     * @return void
+     * @throws
+     * @since
+     */
+    public void buildSetting(CreateIndexRequest request){
+        request.settings(Settings.builder().put("index.number_of_shards",3)
+                .put("index.number_of_replicas",2));
+    }
+    /** 插入对象
+     * @param idxName index
+     * @param entity    对象
+     * @return void
+     * @throws
+     * @since
+     */
+    public String insertOrUpdateOne(String idxName, ElasticEntity entity) {
+        IndexRequest request = new IndexRequest(idxName);
+//        log.error("Data : id={},entity={}",entity.getId(),JSON.toJSONString(entity.getData()));
+        request.id(entity.getId());
+//        request.source(entity.getData(), XContentType.JSON);
+        request.source(JSON.toJSONString(entity.getData()), XContentType.JSON);
+        try {
+        	IndexResponse response= restHighLevelClient.index(request, RequestOptions.DEFAULT);
+        	return response.getResult().toString();
+        } catch (Exception e) {
+             return "";
+        }
+    }
+    /**
+     * @param idxName index
+     * @param builder   查询参数
+     * @param c 结果类对象
+     * @return java.util.List<T>
+     * @throws
+     * @since
+     */
+    public List<String> search(String idxName,int from ,int size) {
+        SearchRequest request = new SearchRequest(idxName);
+        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
+        searchSourceBuilder.sort("_id",SortOrder.DESC);     
+        searchSourceBuilder.from(from);
+        searchSourceBuilder.size(size);
+        request.source(searchSourceBuilder);
+        try {
+            SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
+            SearchHit[] hits = response.getHits().getHits();
+            List<String> res = new ArrayList<String>(hits.length);
+            for (SearchHit hit : hits) {
+//            	System.out.println(hit.getSourceAsString());
+            	JSONObject jb=JSONObject.fromObject(hit.getSourceAsString());
+            	res.add(jb.getString("log"));
+            }
+            return res;
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * @param idxName index
+     * @param builder   查询参数
+     * @param c 结果类对象
+     * @return java.util.List<T>
+     * @throws
+     * @since
+     */
+    public <T> List<T> search(String idxName, SearchSourceBuilder builder, Class<T> c) {
+        SearchRequest request = new SearchRequest(idxName);
+        request.source(builder);
+        try {
+            SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
+            SearchHit[] hits = response.getHits().getHits();
+            List<T> res = new ArrayList<>(hits.length);
+            for (SearchHit hit : hits) {
+                res.add(JSON.parseObject(hit.getSourceAsString(), c));
+            }
+            return res;
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+}

+ 40 - 0
src/main/java/com/caesolver/es/ElasticConfig.java

@@ -0,0 +1,40 @@
+package com.caesolver.es;
+
+import org.apache.http.HttpHost;
+import org.elasticsearch.client.RestClient;
+import org.elasticsearch.client.RestClientBuilder;
+import org.elasticsearch.client.RestHighLevelClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+//@Configuration
+public class ElasticConfig {
+
+    @Value("${es.host}")
+    public String host;
+    @Value("${es.port}")
+    public int port;
+    @Value("${es.scheme}")
+    public String scheme;
+
+    @Bean
+    public RestClientBuilder restClientBuilder() {
+        return RestClient.builder(makeHttpHost());
+    }
+
+    @Bean
+    public RestClient elasticsearchRestClient(){
+        return RestClient.builder(new HttpHost(host, port, scheme)).build();
+    }
+
+    private HttpHost makeHttpHost() {
+        return new HttpHost(host, port, scheme);
+    }
+
+    @Bean
+    public RestHighLevelClient restHighLevelClient(@Autowired RestClientBuilder restClientBuilder){
+        return new RestHighLevelClient(restClientBuilder);
+    }
+}

+ 35 - 0
src/main/java/com/caesolver/es/ElasticEntity.java

@@ -0,0 +1,35 @@
+package com.caesolver.es;
+
+import java.util.Map;
+
+
+public class ElasticEntity {
+
+    /**
+               * 主键标识,用户ES持久化
+     */
+    private String id;
+
+    /**
+     * JSON对象,实际存储数据
+     */
+    private Map<String,Object> data;
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public Map<String, Object> getData() {
+		return data;
+	}
+
+	public void setData(Map<String, Object> data) {
+		this.data = data;
+	}
+    
+    
+}

+ 75 - 0
src/main/java/com/caesolver/ftp/FtpClientFactory.java

@@ -0,0 +1,75 @@
+package com.caesolver.ftp;
+
+import java.io.IOException;
+
+import org.apache.commons.net.ftp.FTP;
+import org.apache.commons.net.ftp.FTPClient;
+import org.apache.commons.pool2.PooledObject;
+import org.apache.commons.pool2.PooledObjectFactory;
+import org.apache.commons.pool2.impl.DefaultPooledObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+//@Component
+public class FtpClientFactory  implements PooledObjectFactory<FTPClient>{
+	 @Autowired
+	    FtpConfig config;
+	    //创建连接到池中
+	    @Override
+	    public PooledObject<FTPClient> makeObject() {
+	            FTPClient ftpClient = new FTPClient();//创建客户端实例
+	            return new DefaultPooledObject<>(ftpClient);
+	    }
+	    //销毁连接,当连接池空闲数量达到上限时,调用此方法销毁连接
+	    @Override
+	    public void destroyObject(PooledObject<FTPClient> pooledObject)  {
+	        FTPClient ftpClient = pooledObject.getObject();
+	        try {
+	            ftpClient.logout();
+	            if (ftpClient.isConnected()) {
+	                ftpClient.disconnect();
+	            }
+	        } catch (IOException e) {
+	            throw new RuntimeException("Could not disconnect from server.", e);
+	        }
+	    }
+	    //链接状态检查
+	    @Override
+	    public boolean validateObject(PooledObject<FTPClient> pooledObject) {
+	        FTPClient ftpClient = pooledObject.getObject();
+	        try {
+	            return ftpClient.sendNoOp();
+	        } catch (IOException e) {
+	            return false;
+	        }
+	    }
+	    //初始化连接
+	    @Override
+	    public void activateObject(PooledObject<FTPClient> pooledObject) throws Exception {
+	        FTPClient ftpClient = pooledObject.getObject();
+	        ftpClient.connect(config.getHost(),config.getPort());
+	        ftpClient.login(config.getUsername(), config.getPassword());
+	        ftpClient.setControlEncoding(config.getEncoding());
+	        ftpClient.setBufferSize(1024*1024);//增大缓存区
+	        ftpClient.changeWorkingDirectory(config.getRoot());//TODO ???
+	        ftpClient.setFileType(FTP.BINARY_FILE_TYPE);//设置上传文件类型为二进制,否则将无法打开文件
+	    }
+	    //钝化连接,使链接变为可用状态
+	    @Override
+	    public void passivateObject(PooledObject<FTPClient> pooledObject) throws Exception {
+	        FTPClient ftpClient = pooledObject.getObject();
+	        try {
+	            ftpClient.changeWorkingDirectory(config.getRoot());//TODO ???
+	            ftpClient.logout();
+	            if (ftpClient.isConnected()) {
+	                ftpClient.disconnect();
+	            }
+	        } catch (IOException e) {
+	            throw new RuntimeException("Could not disconnect from server.", e);
+	        }
+	    }
+	    //用于连接池中获取pool属性
+	    public FtpConfig getConfig() {
+	        return config;
+	    }
+}

+ 99 - 0
src/main/java/com/caesolver/ftp/FtpConfig.java

@@ -0,0 +1,99 @@
+package com.caesolver.ftp;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+//@Component
+public class FtpConfig  {
+	//ftp服务器ip地址
+    @Value("${ftp.host}") // 相关配置放在application.properties 中
+    String host;
+    //端口号
+    @Value("${ftp.port}")
+    Integer port;
+    //用户名
+    @Value("${ftp.username}")
+    String username;
+    //密码
+    @Value("${ftp.password}")
+    String password;
+    @Value("${ftp.encoding}")
+    String encoding;
+    @Value("${ftp.MaxTotal}")
+    Integer maxTotal;
+    @Value("${ftp.MinIdel}")
+    Integer minIdel;
+    @Value("${ftp.MaxWaitMillis}")
+    Integer maxWaitMillis;
+    
+    @Value("${ftp.root}")
+    String root;
+    
+    @Value("${ftp.workDir}")
+    String workDir;
+    
+	public String getHost() {
+		return host;
+	}
+	public void setHost(String host) {
+		this.host = host;
+	}
+	public Integer getPort() {
+		return port;
+	}
+	public void setPort(Integer port) {
+		this.port = port;
+	}
+	public String getUsername() {
+		return username;
+	}
+	public void setUsername(String username) {
+		this.username = username;
+	}
+	public String getPassword() {
+		return password;
+	}
+	public void setPassword(String password) {
+		this.password = password;
+	}
+	public String getEncoding() {
+		return encoding;
+	}
+	public void setEncoding(String encoding) {
+		this.encoding = encoding;
+	}
+	public Integer getMaxTotal() {
+		return maxTotal;
+	}
+	public void setMaxTotal(Integer maxTotal) {
+		this.maxTotal = maxTotal;
+	}
+	public Integer getMinIdel() {
+		return minIdel;
+	}
+	public void setMinIdel(Integer minIdel) {
+		this.minIdel = minIdel;
+	}
+	public Integer getMaxWaitMillis() {
+		return maxWaitMillis;
+	}
+	public void setMaxWaitMillis(Integer maxWaitMillis) {
+		this.maxWaitMillis = maxWaitMillis;
+	}
+	public String getRoot() {
+		return root;
+	}
+	public void setRoot(String root) {
+		this.root = root;
+	}
+	public String getWorkDir() {
+		return workDir;
+	}
+	public void setWorkDir(String workDir) {
+		this.workDir = workDir;
+	}  
+	
+	
+    
+    
+}

+ 51 - 0
src/main/java/com/caesolver/ftp/FtpPool.java

@@ -0,0 +1,51 @@
+package com.caesolver.ftp;
+
+import org.apache.commons.net.ftp.FTPClient;
+import org.apache.commons.pool2.impl.GenericObjectPool;
+import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+//@Component
+public class FtpPool {
+	FtpClientFactory factory;
+    private final GenericObjectPool<FTPClient> internalPool;
+    //初始化连接池
+    public FtpPool(@Autowired FtpClientFactory factory){
+        this.factory=factory;
+        FtpConfig config = factory.getConfig();
+        GenericObjectPoolConfig<FTPClient> poolConfig = new GenericObjectPoolConfig<FTPClient>();
+        poolConfig.setMaxTotal(config.getMaxTotal());
+        poolConfig.setMinIdle(config.getMinIdel());
+        poolConfig.setMaxIdle(config.getMaxTotal());
+        poolConfig.setMaxWaitMillis(config.getMaxWaitMillis());
+        this.internalPool = new GenericObjectPool<FTPClient>(factory,poolConfig);
+    }
+    //从连接池中取连接
+    public  FTPClient getFTPClient() {
+        try {
+            return internalPool.borrowObject();
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+    //将链接归还到连接池
+    public  void returnFTPClient(FTPClient ftpClient) {
+        try {
+            internalPool.returnObject(ftpClient);
+        } catch (Exception e) {
+             e.printStackTrace();
+        }
+    }
+    /**
+     * 销毁池子
+     */
+    public  void destroy() {
+        try {
+            internalPool.close();
+        } catch (Exception e) {
+          e.printStackTrace();
+        }
+    }
+}

+ 126 - 0
src/main/java/com/caesolver/ftp/FtpUtils.java

@@ -0,0 +1,126 @@
+package com.caesolver.ftp;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.net.ftp.FTPClient;
+import org.apache.commons.net.ftp.FTPFile;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+//@Component
+public class FtpUtils {
+	@Autowired
+    FtpConfig config;
+    @Autowired
+    FtpPool pool;
+    protected static Logger log=LoggerFactory.getLogger(FtpUtils.class);
+    
+    /**
+     * 	下载 path 文件夹
+     * @param path
+     * @throws IOException 
+     */
+    public void downLoadAll(String path) throws IOException {
+    	FTPClient ftpClient = pool.getFTPClient();
+        boolean aFlag =ftpClient.isAvailable();
+    	extracted(path, ftpClient);
+    	pool.returnFTPClient(ftpClient);
+    }
+
+	private void extracted(String path, FTPClient ftpClient) throws IOException, FileNotFoundException {
+		FTPFile[] ftpFiles =ftpClient.listFiles(path);
+    	if(ftpFiles!=null&&ftpFiles.length>0) {
+    		for (FTPFile ftpFile : ftpFiles) {
+    			if(ftpFile.isDirectory()) {
+    				File file = new File(config.getWorkDir()+"/"+path+"/"+ftpFile.getName());
+    				file.mkdirs();
+    				if(!file.getName().equals("data_out")) {//结果文件夹不用下载
+    				   extracted(path+"/"+ftpFile.getName(),ftpClient);
+    				}
+    			}else {
+    				File outfile =new File(config.getWorkDir()+"/"+path+"/"+ftpFile.getName());
+    				if(outfile.exists()) {
+    					outfile.delete();
+    				}
+    				outfile.createNewFile();
+    				OutputStream outPutStream = new FileOutputStream(outfile,true);
+    				ftpClient.retrieveFile(path+"/"+ftpFile.getName(),outPutStream);
+    				outPutStream.flush();
+    				outPutStream.close();
+    			}
+			}
+    	}
+	}
+	/**
+     * 	上传结果文件
+     * @param path
+     * @throws IOException 
+     */
+    public void uploadAll(String path) throws IOException {
+    	FTPClient ftpClient = pool.getFTPClient();
+    	ftpClient.setBufferSize(1024 * 1024 * 10);//增加缓冲区
+    	String workPath =config.getWorkDir()+"/"+path;
+    	List<File> files =ListDataOutFiles(workPath);
+    	if(files!=null&&files.size()>0) {
+    		for (File file : files) {
+    			uploadOne(ftpClient,file);
+			}
+    	}
+    	pool.returnFTPClient(ftpClient);
+    }
+   public void uploadOne(FTPClient ftpClient,File file) throws FileNotFoundException, IOException {
+		String filename =file.getName();
+		log.info("filename: {} start",filename);
+		InputStream input= new FileInputStream(file);
+		String workDir =file.getParent().replace("\\","/").replace(config.getWorkDir(),"/");
+		boolean changdir= ftpClient.changeWorkingDirectory(workDir);
+		try {
+		   boolean result=ftpClient.storeFile(filename,input);//执行文件传输
+	        if(!result){//上传失败
+	            throw new RuntimeException(filename+"上传失败");
+	        }
+	    }catch(Exception e){
+	        e.printStackTrace();
+	    }finally {//关闭资源
+	        input.close();
+//				    System.out.println("开始归还连接");
+	    }
+		log.info("filename: {} end",filename);
+	}
+    
+    /**
+     * 	获取文件夹下的所有文件列表
+     * @param path
+     * @throws IOException 
+     */
+    public List<File> ListDataOutFiles(String path) {
+    	List<File> files =new ArrayList<File>();
+    	sonFiles(path, files);
+    	return files;
+    }
+
+	private void sonFiles(String path, List<File> files) {
+		File rootFile = new File(path);
+    	File[] listFiles=rootFile.listFiles();
+    	if(listFiles!=null&&listFiles.length>0) {
+    		for (File file : listFiles) {
+				if(file.isDirectory()) {
+					sonFiles(file.getPath(),files);
+				}else if(file.getParent().indexOf("data_out")>0) {
+					files.add(file);
+				}
+			}
+    	}
+	}
+    
+    
+}	

+ 38 - 0
src/main/java/com/caesolver/mq/RabbitConfig.java

@@ -0,0 +1,38 @@
+package com.caesolver.mq;
+
+
+import org.springframework.amqp.core.Binding;
+import org.springframework.amqp.core.BindingBuilder;
+import org.springframework.amqp.core.Queue;
+import org.springframework.amqp.core.TopicExchange;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+
+//@Configuration
+public class RabbitConfig  {
+	/**
+	 * 	主题交换机 消息  队列名称 为 资源编号 (ip)/资源ID
+	 */
+    public static final String QUEUENAME = "solver.hcfd.N-20210118164414698-10";
+    public static final String PROJECTTYPE ="hcfd";
+    public static final String RESOURECODE = "N-20210118164414698-10";
+    public static final String DIRECT="solver.#";
+    public static final String EXCHANGENAME = "solver";
+    
+    //声明队列
+    @Bean
+    public Queue que(){
+        return new Queue(QUEUENAME,true);
+    }
+    //主题交换机
+    @Bean
+    TopicExchange exchange() {
+        return new TopicExchange(EXCHANGENAME,true,false);
+    } 
+    //队列绑定交换机
+    @Bean
+    Binding binding(){
+        return BindingBuilder.bind(que()).to(exchange()).with(DIRECT);
+    }
+}

+ 39 - 0
src/main/java/com/caesolver/server/BeanConfig.java

@@ -0,0 +1,39 @@
+package com.caesolver.server;
+
+import java.util.concurrent.ThreadPoolExecutor;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.task.TaskExecutor;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+@Configuration
+@EnableAsync
+public class BeanConfig {
+	protected static Logger log=LoggerFactory.getLogger(BeanConfig.class);   
+
+	@Bean
+    public TaskExecutor taskExecutor() {
+		log.info("taskExecutor start");
+        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+        // 设置核心线程数
+        executor.setCorePoolSize(10);
+        // 设置最大线程数
+        executor.setMaxPoolSize(20);
+        // 设置队列容量
+        executor.setQueueCapacity(20);
+        // 设置线程活跃时间(秒)
+        executor.setKeepAliveSeconds(60);
+        // 设置默认线程名称
+        executor.setThreadNamePrefix("solver-");
+        // 设置拒绝策略
+        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
+        // 等待所有任务结束后再关闭线程池
+        executor.setWaitForTasksToCompleteOnShutdown(true);
+        log.info("taskExecutor end");
+        return executor;
+    }
+}

+ 38 - 0
src/main/java/com/caesolver/server/SendMsgController.java

@@ -0,0 +1,38 @@
+package com.caesolver.server;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.caesolver.mq.RabbitConfig;
+
+import net.sf.json.JSONObject;
+
+//@RestController
+public class SendMsgController {
+	
+	@Autowired
+    RabbitTemplate rabbitTemplate;  //使用RabbitTemplate,这提供了接收/发送等等方法
+    @GetMapping("/sendDirectMessage")
+    public String sendDirectMessage() {
+        String messageId = String.valueOf(UUID.randomUUID());
+        String messageData = "test message, hello!";
+        String createTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+        Map<String,Object> map=new HashMap<>();
+        map.put("messageId",messageId);
+        map.put("messageData",messageData);
+        map.put("createTime",createTime);
+        rabbitTemplate.convertAndSend(RabbitConfig.EXCHANGENAME,RabbitConfig.DIRECT, JSONObject.fromObject(map).toString());
+        return "ok";
+    }
+
+}

+ 21 - 0
src/main/java/com/caesolver/server/Solver.java

@@ -0,0 +1,21 @@
+package com.caesolver.server;
+
+import java.io.IOException;
+
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Component;
+
+import com.caesolver.mq.RabbitConfig;
+
+//@Component
+public class Solver {
+	@Autowired
+	SolverService solverService;
+//	@RabbitListener(queues = RabbitConfig.QUEUENAME)
+//    @Async
+    public void process(String testMessage) throws IOException, Exception {
+        solverService.processEx(testMessage);
+    }
+}

+ 203 - 0
src/main/java/com/caesolver/server/SolverBladesignOrderUtil.java

@@ -0,0 +1,203 @@
+package com.caesolver.server;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SolverBladesignOrderUtil {
+	@Value("${BLADESIGN.workdir}")
+	private String BLADESIGN_workdir;
+	@Value("${BLADESIGN.VABSexe}")
+	private String BLADESIGN_VABSexe;
+	@Value("${BLADESIGN.GEBTexe}")
+	private String BLADESIGN_GEBTexe;
+	@Value("${BLADESIGN.RootPath}")
+	private String BLADESIGN_RootPath;
+	@Value("${BLADESIGN.POTexe}")
+	private String BLADESIGN_POTexe;
+	@Value("${BLADESIGN.POTInitialGEBT}")
+	private String BLADESIGN_POTInitialGEBT;
+
+	public String createOrder(String projectId, String orderType) throws IOException {
+		String jobOrder = "";
+		if (this.isWindows()) {// windows
+			createWinBat(projectId);
+			if ("vabs".equals(orderType)) {
+				jobOrder = BLADESIGN_workdir + projectId + "/vabs_run.bat";
+			} else if ("gebt".equals(orderType)) {
+				jobOrder = BLADESIGN_workdir + projectId + "/gebt_run.bat";
+			} else if ("opt".equals(orderType)) {
+				jobOrder = BLADESIGN_workdir + projectId + "/opt_run.bat";
+			}
+		} else {// Linux
+
+		}
+		return jobOrder;
+	}
+
+	private void createWinBat(String projectId) throws IOException {
+		String work_dir = BLADESIGN_workdir + projectId + "/";
+		List<Path> pFilePaths = Files.walk(Paths.get(work_dir)).filter(path -> !path.toFile().isDirectory())
+				.collect(Collectors.toList());
+		Path gebtPath = pFilePaths.stream().filter(path -> path.toString().endsWith("GEBT.dat"))
+				.collect(Collectors.toList()).get(0);
+		List<Path> vabsPathList = pFilePaths.stream().filter(path -> {
+			Pattern p = Pattern.compile("VABS(\\d+).dat");
+			Matcher m = p.matcher(path.getFileName().toString());
+			return m.find();
+		}).collect(Collectors.toList());
+		CreatGebtRunFile(work_dir, gebtPath);
+		CreatVabsRunFile(work_dir, vabsPathList);
+		List<Path> optList = pFilePaths.stream().filter(path -> path.toString().endsWith("OPT.dat"))
+				.collect(Collectors.toList());
+		Path optPath = null;
+		if (optList != null && !optList.isEmpty()) {
+			optPath = optList.get(0);
+		}
+		if (optPath != null) {
+//			copyPOTInitialGEBT(work_dir);//配置文件复制
+			CreatOptRunFile(work_dir, optPath);
+		}
+	}
+	
+	public static void main(String[] args) throws IOException {
+//		Path path =Paths.get("D:\\blanesign_down\\72109c9c55d5450785aaff3bf958433e\\VABS112.dat");
+//		Pattern p = Pattern.compile("VABS(\\d+).dat");
+//		System.out.println(path.getFileName().toString());
+//		Matcher m = p.matcher(path.getFileName().toString());
+//		System.out.println(m.find());
+	}
+	
+	public void copyOutFile(String projectId, String orderType) throws IOException {
+		Path source = Paths.get(BLADESIGN_POTexe+"OPT");
+		Path out =Paths.get(BLADESIGN_workdir + projectId+"/OPT/");
+		Files.createDirectories(out);
+		List<Path> outList=Files.walk(out).filter(path -> !path.toFile().isDirectory()).collect(Collectors.toList());
+		for (Path outpath : outList) {
+			Files.delete(outpath);
+		}
+		List<Path> sourceList=Files.walk(source)
+				.filter(path -> !path.toFile().isDirectory())
+				.filter(path->!path.toFile().getName().startsWith("InitialGEBT"))
+				.collect(Collectors.toList());
+		for (Path sourcePath : sourceList) {
+			Files.move(sourcePath, Paths.get(out.toString()+"/"+sourcePath.getFileName()));
+		}
+	}
+	
+	private void copyPOTInitialGEBT(String work_dir) throws IOException {
+		Path source = Paths.get(BLADESIGN_POTInitialGEBT);
+		File optInit = new File(work_dir + "InitialGEBT.bat");
+		if (!optInit.exists()) {
+			optInit.createNewFile();
+		}
+		Files.copy(source, optInit.toPath(),StandardCopyOption.REPLACE_EXISTING);
+	}
+
+	private void CreatOptRunFile(String work_dir, Path optPath) {
+		// TODO Auto-generated method stub
+		File optrun = new File(work_dir + "opt_run.bat");
+		FileWriter writer = null;
+		try {
+			if (!optrun.exists()) {
+				optrun.createNewFile();
+			} else {
+				optrun.delete();
+				optrun.createNewFile();
+			}
+			writer = new FileWriter(optrun, true);
+			writer.write(BLADESIGN_RootPath+":");
+			writer.write("\r\n");
+			writer.write("cd "+BLADESIGN_POTexe );
+			writer.write("\r\n");
+			writer.write("call OPT_x64.exe  " + work_dir+optPath.getFileName());
+			writer.write("\r\n");
+			writer.close();
+		} catch (Exception o) {
+			o.printStackTrace();
+		} finally {
+			if (writer != null) {
+				try {
+					writer.close();
+				} catch (IOException e1) {
+					e1.printStackTrace();
+				}
+			}
+		}
+	}
+
+	private void CreatVabsRunFile(String work_dir, List<Path> vabsPathList) {
+		File vabsrun = new File(work_dir + "vabs_run.bat");
+		FileWriter writer = null;
+		try {
+			if (!vabsrun.exists()) {
+				vabsrun.createNewFile();
+			} else {
+				vabsrun.delete();
+				vabsrun.createNewFile();
+			}
+			writer = new FileWriter(vabsrun, true);
+			for (int i = 0; i < vabsPathList.size(); i++) {
+				writer.write("call " + BLADESIGN_VABSexe + " " + work_dir + vabsPathList.get(i).getFileName());
+				writer.write("\r\n");
+			}
+			writer.close();
+		} catch (Exception o) {
+			o.printStackTrace();
+		} finally {
+			if (writer != null) {
+				try {
+					writer.close();
+				} catch (IOException e1) {
+					e1.printStackTrace();
+				}
+			}
+		}
+	}
+
+	private void CreatGebtRunFile(String work_dir, Path gebtPath) {
+		File gebtrun = new File(work_dir + "gebt_run.bat");
+		FileWriter writer = null;
+		try {
+			if (!gebtrun.exists()) {
+				gebtrun.createNewFile();
+			} else {
+				gebtrun.delete();
+				gebtrun.createNewFile();
+			}
+			writer = new FileWriter(gebtrun, true);
+			writer.write("call " + BLADESIGN_GEBTexe + " " + work_dir + gebtPath.getFileName());
+			writer.write("\r\n");
+			writer.close();
+		} catch (Exception o) {
+			o.printStackTrace();
+		} finally {
+			if (writer != null) {
+				try {
+					writer.close();
+				} catch (IOException e1) {
+					e1.printStackTrace();
+				}
+			}
+		}
+	}
+
+	private boolean isWindows() {
+		return System.getProperty("os.name").toUpperCase().indexOf("WINDOWS") >= 0 ? true : false;
+	}
+
+	
+
+}

+ 89 - 0
src/main/java/com/caesolver/server/SolverCfdOrderUtil.java

@@ -0,0 +1,89 @@
+package com.caesolver.server;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+@Component
+public class SolverCfdOrderUtil {
+	   @Value("${CFD.workdir}")
+	   private  String workdir;
+	   @Value("${CFD.UNIXPath}")
+	   private  String  UNIXPath;
+	   @Value("${CFD.MPICHPATH}")
+	   private  String  MPICHPATH;
+	   
+	   public String createOrder(String projectId) throws IOException {
+			String jobOrder="";
+		   if(this.isWindows()) {//windows
+//			   jobOrder=createWindowBat(projectId);
+	  		}else {//Linux
+	  			jobOrder=createUnixexe(projectId);
+	  		}
+			return jobOrder;
+		  }
+
+	    
+	    private String createUnixexe(String projectId) throws IOException {
+		// TODO Auto-generated method stub
+	    	String flow_dir =workdir+projectId+"/";
+	    	File batFile = new File(flow_dir+"run");
+	        FileWriter writer =null;
+	        try {
+	            if (!batFile.exists()) {
+	                batFile.createNewFile();
+	            }else{
+	                batFile.delete();
+	                batFile.createNewFile();
+	            }
+	            writer = new FileWriter(batFile,true);
+	            writer.write("#!/bin/bash -f");
+	            writer.write("\n");//换行
+	            writer.write("cd "+flow_dir);
+	            writer.write("\n");//换行
+	            writer.write("\\cp -f "+UNIXPath+"overcfd.lic "+flow_dir);
+	            writer.write("\n");//换行
+	            writer.write("export PATH="+MPICHPATH+":$PATH");
+	            writer.write("\n");//换行
+	            writer.write("export LD_LIBRARY_PATH="+MPICHPATH+":$LD_LIBRARY_PATH");
+	            writer.write("\n");//换行
+	            writer.write("export F_UFMTENDIAN=little;ulimit -s unlimited -d unlimited -m unlimited");
+	            writer.write("\n");//换行r UNix 格式文件 换行
+	            writer.write("mpirun -np 4 "+UNIXPath+"oversetmpi_dp");
+	            writer.write("\n");
+	            writer.close();
+	        }catch (Exception o){
+	            o.printStackTrace();
+	        }finally {
+	            if (writer != null) {
+	                try {
+	                    writer.close();
+	                } catch (IOException e1) {
+	                    e1.printStackTrace();
+	                }
+	            }
+	        }
+	        Runtime runtime = Runtime.getRuntime();
+	        Process p =null;
+	        p= runtime.exec("chmod 777 "+batFile.getPath());
+	        return  flow_dir+"run";
+	    }
+
+
+		private  boolean isWindows() {
+			return System.getProperty("os.name").toUpperCase().indexOf("WINDOWS")>=0?true:false;	
+	    }
+	    
+	    
+	    
+
+}	

+ 103 - 0
src/main/java/com/caesolver/server/SolverFemOrderUtil.java

@@ -0,0 +1,103 @@
+package com.caesolver.server;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+@Component
+public class SolverFemOrderUtil {
+	   @Value("${FEM.workdir}")
+	   private  String fem_workdir;
+	   @Value("${FEM.exePath}")
+	   private  String  exePath;
+	   @Value("${FEM.postPath}")
+	   private  String  postPath;
+	   @Value("${FEM.rootPath}")
+	   private  String  rootPath;
+	   public String createOrder(String projectId) throws IOException {
+			String jobOrder="";
+		   if(this.isWindows()) {//windows
+			   jobOrder=createWindowBat(projectId);
+	  		}else {//Linux
+//	  			jobOrder=createUnixexe(projectId);
+	  		}
+			return jobOrder;
+		  }
+	   
+	   private String getUgriName(String flow_dir) {
+		   String short_1=flow_dir.substring(0, flow_dir.length()-1);
+		   short_1.lastIndexOf("/");
+		   String ugrname =short_1.substring(short_1.lastIndexOf("/")+1,short_1.length());
+		   return ugrname;
+	   }
+	   
+	    /**
+	     * 创建 windows 下bat 执行文件
+	     * @param caeProject
+	     * @param reader
+	     * @return
+	     * @throws IOException 
+	     */
+	    private  String createWindowBat(String projectId) throws IOException {
+	    	Path pFilePaths = Files.walk(Paths.get(this.fem_workdir+"/"+projectId))
+	        		.filter(path -> !path.toFile().isDirectory())
+	        		.filter(path->path.endsWith("fem_analysis.in"))
+	        		.collect(Collectors.toList()).get(0);
+	    	 String flow_dir =pFilePaths.toString().replace("fem_analysis.in", "").replace("\\", "/");
+	         String flow_wind_dir =flow_dir;
+	         Path dbfPath = Files.walk(Paths.get(this.fem_workdir+"/"+projectId))
+		        		.filter(path -> !path.toFile().isDirectory())
+		        		.filter(path-> path.toString().endsWith(".bdf"))
+		        		.collect(Collectors.toList()).get(0);
+	         String dateInDbf =dbfPath.toString().replace("\\", "/");
+	         String gridname =getUgriName(flow_dir);
+	         String dateOutFE =flow_dir+"data_out/"+gridname+"_FE.rst";
+	         String dateOutFENS =flow_dir+"data_out/"+gridname+"_FE_NS.rst";
+	         String dateOutTransient=flow_dir+"data_out/"+"dynamicResponse-transient";
+	         File batFile = new File(flow_dir+ "fem.bat");
+	         FileWriter writer =null;
+	         try {
+	             if (batFile.exists()) {
+	                 batFile.delete();
+	             }
+	             batFile.createNewFile();
+	             writer = new FileWriter(batFile,true);
+	             writer.write(rootPath+":");
+	             writer.write("\r\n");//换行
+	             writer.write("cd "+flow_wind_dir);
+	             writer.write("\r\n");//换行
+	             writer.write(exePath+" -p "+"\""+flow_wind_dir+"\"" +" -c fem_analysis.in");
+	             writer.write("\r\n");//换行
+	             writer.write(postPath +" "+dateInDbf+" "+dateOutFE+" "+dateOutFENS+" "+dateOutTransient);
+	             writer.write("\r\n");//换行
+	             writer.close();
+	         }catch (Exception o){
+	             o.printStackTrace();
+	         }finally {
+	             if (writer != null) {
+	                 try {
+	                     writer.close();
+	                 } catch (IOException e1) {
+	                     e1.printStackTrace();
+	                 }
+	             }
+	         }
+	         return  flow_wind_dir+"fem.bat";
+	    }
+	    private  boolean isWindows() {
+			return System.getProperty("os.name").toUpperCase().indexOf("WINDOWS")>=0?true:false;	
+	    }
+	    
+	    
+	    
+
+}	

+ 213 - 0
src/main/java/com/caesolver/server/SolverHcfdOrderUtil.java

@@ -0,0 +1,213 @@
+package com.caesolver.server;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+@Component
+public class SolverHcfdOrderUtil {
+	   @Value("${HCFD.workdir}")
+	   private  String HCFD_workdir;
+	   @Value("${HCFD.MPICHPATH}")
+	   private  String  MPICHPATH;
+	   @Value("${HCFD.UNIXPath}")
+	   private  String  HCFDUNIXpath;
+	   @Value("${HCFD.RootPath}")
+	   private  String  RootPath;
+	   @Value("${HCFD.ExePath}")
+	   private  String  ExePath;
+	   public String createOrder(String projectId,Integer vfreq,Integer afreq,String resources) throws IOException {
+			String jobOrder="";
+		   if(this.isWindows()) {//windows
+			   jobOrder=createWindowBat(projectId,vfreq,afreq);
+	  		}else{//Linux
+	  			jobOrder=createUnixexe(projectId,vfreq,afreq, resources);
+	  		}
+			return jobOrder;
+		  }
+
+	    /**
+	                 * 创建 unix  执行文件
+	     * @param resources 
+	     * @param caeProject
+	     * @param reader
+	     * @return
+	     */
+	    private String createUnixexe(String projectId,Integer vfreq,Integer afreq, String resources) throws IOException {
+	        String exeorder;
+	        if(StringUtils.isEmpty(resources)) {
+	        	  exeorder= getUnixRunOrder(projectId,vfreq,afreq);
+	        }else {
+	        	  exeorder= getUnixRunOrderRes(projectId,vfreq,afreq,resources);
+	        }
+	      
+	        Path pFilePaths = Files.walk(Paths.get(this.HCFD_workdir+"/"+projectId))
+	        		.filter(path -> path.toFile().isDirectory())
+	        		.filter(path->path.endsWith("test"))
+	        		.collect(Collectors.toList()).get(0);
+	        String flow_dir =pFilePaths.toString();
+	        File batFile = new File(flow_dir+"/runhcfd.sh");
+	        FileWriter writer =null;
+	        try {
+	            if (!batFile.exists()) {
+	                batFile.createNewFile();
+	            }else{
+	                batFile.delete();
+	                batFile.createNewFile();
+	            }
+	            writer = new FileWriter(batFile,true);
+	            writer.write("#!/bin/bash -f");
+	            writer.write("\n");//换行
+	            writer.write("cd "+HCFDUNIXpath);
+	            writer.write("\n");//换行
+//	            writer.write("export PATH="+MPICHPATH+":$PATH");
+//	            writer.write("\n");//换行
+//	            writer.write("export LD_LIBRARY_PATH="+MPICHPATH+":$LD_LIBRARY_PATH");
+//	            writer.write("\n");//换行
+//	            writer.write("export F_UFMTENDIAN=little");
+//	            writer.write("\n");//换行r UNix 格式文件 换行
+	            writer.write(exeorder);
+	            writer.close();
+	        }catch (Exception o){
+	            o.printStackTrace();
+	        }finally {
+	            if (writer != null) {
+	                try {
+	                    writer.close();
+	                } catch (IOException e1) {
+	                    e1.printStackTrace();
+	                }
+	            }
+	        }
+	        Runtime runtime = Runtime.getRuntime();
+	        Process p =null;
+	        p= runtime.exec("chmod 777 "+batFile.getPath());
+	        return "sh "+ batFile.getPath();
+	    }
+
+	    	
+	    private String getUnixRunOrderRes(String projectId, Integer volume_animation_freq, Integer animation_freq, String resources) throws IOException {
+	    	//TODO 修改执行命令
+	    	String[] res=resources.split("\\.");
+	    	String order = "mpirun";
+	        order +=" -np "+res[1]+" ./NHCFD ";
+	        Path pFilePaths = Files.walk(Paths.get(this.HCFD_workdir+"/"+projectId))
+	        		.filter(path -> path.toFile().isDirectory())
+	        		.filter(path->path.endsWith("test"))
+	        		.collect(Collectors.toList()).get(0);
+	        String flow_dir =pFilePaths.toString();
+	        order +=" --flow_dir \""+flow_dir+"\" ";
+	        order +=" --volume_animation_freq "+volume_animation_freq+" ";
+	        order +=" --animation_freq "+animation_freq+" ";
+	        order +=" --ascii_tecplot_output ";
+	        return order;
+		}
+
+		/**
+	     * 获取 unix 下的执行命令
+	     * @param caeProject
+	     * @return
+	     * @throws IOException 
+	     */
+	    public String getUnixRunOrder(String projectId,Integer volume_animation_freq,Integer animation_freq) throws IOException{
+	        String order = "mpirun";
+	        order +=" -np 2 ./NHCFD ";
+	        Path pFilePaths = Files.walk(Paths.get(this.HCFD_workdir+"/"+projectId))
+	        		.filter(path -> path.toFile().isDirectory())
+	        		.filter(path->path.endsWith("test"))
+	        		.collect(Collectors.toList()).get(0);
+	        String flow_dir =pFilePaths.toString();
+	        order +=" --flow_dir \""+flow_dir+"\" ";
+//	        Integer volume_animation_freq = 100;
+	        order +=" --volume_animation_freq "+volume_animation_freq+" ";
+//	        Integer  animation_freq =100;
+	        order +=" --animation_freq "+animation_freq+" ";
+	        order +=" --ascii_tecplot_output ";
+	        return order;
+	    }
+	    
+	    
+	    /**
+	     * 创建 windows 下bat 执行文件
+	     * @param caeProject
+	     * @param reader
+	     * @return
+	     * @throws IOException 
+	     */
+	    private  String createWindowBat(String projectId,Integer vfreq,Integer afreq) throws IOException {
+	        String exeorder;
+	        exeorder= getWindowRunOrder(projectId,vfreq,vfreq);
+	        Path pFilePaths = Files.walk(Paths.get(this.HCFD_workdir+"/"+projectId))
+	        		.filter(path -> path.toFile().isDirectory())
+	        		.filter(path->path.endsWith("test"))
+	        		.collect(Collectors.toList()).get(0);
+	        String flow_dir =pFilePaths.toString();
+	        File batFile = new File(flow_dir+"/hcfd.bat");
+	        FileWriter writer =null;
+	        try {
+	            if (!batFile.exists()) {
+	                batFile.createNewFile();
+	            }else{
+	                batFile.delete();
+	                batFile.createNewFile();
+	            }
+	            writer = new FileWriter(batFile,true);
+	            writer.write(RootPath+":");
+	            writer.write("\r\n");//换行
+	            writer.write("cd "+ExePath);
+	            writer.write("\r\n");//换行
+	            writer.write(exeorder);
+	            writer.close();
+	        }catch (Exception o){
+	            o.printStackTrace();
+	        }finally {
+	            if (writer != null) {
+	                try {
+	                    writer.close();
+	                } catch (IOException e1) {
+	                    e1.printStackTrace();
+	                }
+	            }
+	        }
+	        return  batFile.getPath();
+	    }
+
+	    /**
+	     * 获取 windows 下的执行命令
+	     * @param caeProject
+	     * @return
+	     * @throws IOException 
+	     */
+	    public String getWindowRunOrder(String projectId,Integer vfreq,Integer afreq) throws IOException{
+	        String order ="mpiexec.exe";
+	        order +=" -n 2  NHCFD.exe ";
+	        Path pFilePaths = Files.walk(Paths.get(this.HCFD_workdir+"/"+projectId))
+	        		.filter(path -> path.toFile().isDirectory())
+	        		.filter(path->path.endsWith("test"))
+	        		.collect(Collectors.toList()).get(0);
+	        String flow_dir =pFilePaths.toString().replace("\\test", "/test");
+	        order +=" --flow_dir \""+flow_dir+"\" ";
+	        order +=" --volume_animation_freq "+vfreq+" ";
+	        order +=" --animation_freq "+afreq+" ";
+	        return order;
+	    }
+
+	    
+	    private  boolean isWindows() {
+			return System.getProperty("os.name").toUpperCase().indexOf("WINDOWS")>=0?true:false;	
+	    }
+	    
+	    
+	    
+
+}	

+ 69 - 0
src/main/java/com/caesolver/server/SolverMpmOrderUtil.java

@@ -0,0 +1,69 @@
+package com.caesolver.server;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+@Component
+public class SolverMpmOrderUtil {
+	   @Value("${MPM.workdir}")
+	   private  String mpm_workdir;
+	   @Value("${MPM.exePath}")
+	   private  String  exePath;
+	   
+	   public String createOrder(String projectId) throws IOException {
+			String jobOrder="";
+		   if(this.isWindows()) {//windows
+			   jobOrder=createWindowBat(projectId);
+	  		}else {//Linux
+//	  			jobOrder=createUnixexe(projectId);
+	  		}
+			return jobOrder;
+		  }
+
+	   private  String createWindowBat(String projectId) throws IOException {      
+	        String flow_dir =mpm_workdir +projectId+"/";
+	        File batFile = new File(flow_dir+"run.bat");
+	        FileWriter writer =null;
+	        try {
+	            if (!batFile.exists()) {
+	                batFile.createNewFile();
+	            }else{
+	                batFile.delete();
+	                batFile.createNewFile();
+	            }
+	            writer = new FileWriter(batFile,true);
+	            writer.write("call "+exePath+"700.exe -p \""+flow_dir+"\" -c " +flow_dir+"Analysis.in");
+	            writer.write("\r\n");
+	            writer.close();
+	        }catch (Exception o){
+	            o.printStackTrace();
+	        }finally {
+	            if (writer != null) {
+	                try {
+	                    writer.close();
+	                } catch (IOException e1) {
+	                    e1.printStackTrace();
+	                }
+	            }
+	        }
+	        return  flow_dir+"/run.bat";
+	    }
+	    
+	    private  boolean isWindows() {
+			return System.getProperty("os.name").toUpperCase().indexOf("WINDOWS")>=0?true:false;	
+	    }
+	    
+	    
+	    
+
+}	

+ 276 - 0
src/main/java/com/caesolver/server/SolverService.java

@@ -0,0 +1,276 @@
+package com.caesolver.server;
+
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+
+import com.alibaba.fastjson.JSON;
+import com.caesolver.mq.RabbitConfig;
+import com.caesolver.server.util.HttpUtils;
+import com.caesolver.server.util.TimeUtils;
+import com.caesolver.sftp.SFTPUtil;
+ 
+@Service
+@Async
+public class SolverService {
+	@Value("${caeserverurl}")
+	String url;
+	@Value("${esserverurl}")
+	String esurl;
+//	@Autowired
+//    BaseElasticService elasticServer;
+	@Autowired
+	SolverBladesignOrderUtil bladesignOrderUtil;
+	@Autowired
+	SolverHcfdOrderUtil hcfdOrderUtil;
+	@Autowired
+	SolverFemOrderUtil femOrderUtil;
+	@Autowired
+	SolverMpmOrderUtil mpmOrderUtil;
+	@Autowired
+	SolverCfdOrderUtil cfdOrderUtil;
+	
+	public static final String FEM ="fem";
+	public static final String HCFD ="hcfd";
+	public static final String CFD ="cfd";
+	public static final String MPM ="mpm";
+	public static final String bladesign ="bladesign";
+	
+	@Autowired
+	SFTPUtil sftpUtil;
+
+    protected static Logger log=LoggerFactory.getLogger(SolverService.class);
+  
+    @Async
+    public void processEx(String testMessage) throws IOException, Exception{
+		Map<String, String> map = (Map<String, String>)JSON.parse(testMessage);	        
+        String jobId =  map.get("jobId");
+        String resourcesCode =  map.get("resourcesCode");
+        String jobOrder = map.get("jobOrder");
+        String projectType=map.get("projectType");
+        String projectId=map.get("projectId");
+        precess( jobId, resourcesCode, jobOrder, projectType, projectId,100,100);
+	}
+
+    public void precess( String jobId, String resourcesCode, String jobOrder, String projectType,String projectId,Integer vfreq,Integer afreq) 
+    		throws IOException, Exception {
+    	Runtime runtime = Runtime.getRuntime();
+    	String startTime =TimeUtils.getNow();
+		Integer i=0;
+		if(resourcesCode.equals(RabbitConfig.RESOURECODE)) { 
+			  //求解开始
+			log.info("Solver start   id={}",projectId);
+			esSeverPut(projectId, "Solver start", i,startTime);
+			if(projectType.equals(FEM)) {
+				precessController(jobId, jobOrder, projectType, projectId,"",vfreq,afreq);
+			}else {
+				i=jobExec(runtime, jobOrder, projectId, startTime);
+			}
+			log.info("Solver changJobState start  id={}",projectId);
+			changJobState(jobId, startTime);
+			log.info("Solver changJobState end  id={}",projectId);
+			//求解结束
+			esSeverPut(projectId, "Solver end", ++i,startTime);
+		    log.info("Solver end  id={}",projectId);
+		}
+	}
+    
+    
+    public void precessController( String jobId, String jobOrder, String projectType,String projectId,String orderType,Integer vfreq,Integer afreq) 
+    		throws IOException, Exception {
+    	Runtime runtime = Runtime.getRuntime();
+    	String startTime =TimeUtils.getNow();
+		Integer i=0;
+		log.info("Solver start   id={}",projectId);
+		esSeverPut(projectId, "Solver start", ++i,startTime);
+		log.info("Solver downLoadAll start id={}",projectId);
+		sftpUtil.downloadByProjectId(projectId,projectType);
+		log.info("Solver downLoadAll end  id={}",projectId);
+		log.info("Solver jobExec start  id={}",projectId);
+		
+		
+		jobOrder =createJobOrder(projectId,jobOrder, projectType,orderType,vfreq,afreq,null);	
+		log.info("Solver jobExec start  jobOrder={}",jobOrder);
+		i=jobExec(runtime, jobOrder, projectId, startTime);	
+		
+		log.info("Solver jobExec end  id={}",projectId);
+		log.info("Solver uploadAll start  id={}",projectId);
+		//结果文件处理
+		copyOutFile(projectId, projectType, orderType);	
+		
+		sftpUtil.uploadByProjectId(projectId,projectType);
+		log.info("Solver uploadByProjectId end  id={}",projectId);
+		log.info("Solver changJobState start  id={}",projectId);
+		changJobState(jobId, startTime);
+		log.info("Solver changJobState end  id={}",projectId);
+		//求解结束
+		esSeverPut(projectId, "Solver end", ++i,startTime);
+	    log.info("Solver end  id={}",projectId);
+	}
+    
+    private void copyOutFile(String projectId,String projectType,String orderType) throws IOException {    	
+    	if(projectType.equals(this.bladesign) && orderType.equals("opt")) {
+    		bladesignOrderUtil.copyOutFile(projectId, orderType);
+    	}
+    }
+    
+    private String createJobOrder(String projectId,String jobOrder, 
+    		String projectType,String orderType,Integer vfreq,Integer afreq,String resources
+    		) throws IOException {
+//    	if(projectType.equals(this.CFD)) {
+//    	 	Runtime runtime = Runtime.getRuntime();
+//        	Process p =null;
+//        	p= runtime.exec("chmod 777 "+jobOrder);
+//    	}
+    	if(projectType.equals(this.bladesign)) {
+    		jobOrder =bladesignOrderUtil.createOrder(projectId, orderType);
+    	}else if(projectType.equals(this.HCFD)) {
+    		jobOrder =hcfdOrderUtil.createOrder(projectId,vfreq,afreq,resources);
+    	}else if(projectType.equals(this.FEM)) {
+    		jobOrder=femOrderUtil.createOrder(projectId);
+    	}else if(projectType.equals(this.MPM)){
+    		jobOrder=mpmOrderUtil.createOrder(projectId);
+    	}else if(projectType.equals(this.CFD)) {
+    		jobOrder=cfdOrderUtil.createOrder(projectId);
+    	}
+    	return jobOrder;
+	}
+     
+	private int jobExec(Runtime runtime, String jobOrder, String projectId, String startTime) throws Exception {
+		log.info("Solver jobExec start  jobOrder={}",jobOrder);
+		Process p =null;
+		p= runtime.exec(jobOrder);
+		InputStream fis = p.getInputStream();
+		InputStreamReader isr = new InputStreamReader(fis);
+		BufferedReader br = new BufferedReader(isr);
+		String line = null;
+		int i=0;
+		while ((line = br.readLine()) != null) {
+			log.info(line);
+			 i++;
+			 if(!line.trim().equals("")) {
+				 esSeverPut(projectId,line,i,startTime);
+			 }
+		}
+		return i;
+	}
+	
+	
+	private void  esSeverPut(String projectId,String line, int id,String startTime) throws Exception {
+//		System.out.println(esurl);
+//		System.out.println(line);
+		Map<String, String> paramMap=new HashMap<>();
+		paramMap.put("projectId", projectId);
+		paramMap.put("log", line);
+		paramMap.put("id", String.valueOf(id));
+		paramMap.put("startTime",startTime);
+		HttpUtils.doPost(esurl+"put","","",new HashMap<String, String>(),new HashMap<String, String>(),paramMap);
+	}
+	
+	public static void main(String[] args) throws Exception {
+		String startTime =TimeUtils.getNow();
+		Map<String, String> paramMap=new HashMap<>();
+		paramMap.put("projectId", "72a2cdd2d39f4a08920018cae0a02af1");
+		paramMap.put("log", "擦额啊啊啊");
+		paramMap.put("id", String.valueOf(1));
+		paramMap.put("startTime",startTime);
+		HttpUtils.doPost("http://106.3.96.219:8041/"+"put","","",new HashMap<String, String>(),new HashMap<String, String>(),paramMap);
+	}
+	
+
+	private void changJobState(String jobId, String starTime) throws Exception {
+		
+		Map<String, String> paramMap=new HashMap<>();
+		paramMap.put("channelNo", "service");
+		paramMap.put("clientToken", "e47b87eec69545559d1e81e56626da68");
+		paramMap.put("transCode", "A00111");
+		paramMap.put("id", jobId);
+		paramMap.put("state", "1");
+		paramMap.put("userId","5f06c8bc77234f969d13e160b54c27e3");
+		paramMap.put("startexeTime", starTime);
+		paramMap.put("endexeTime", TimeUtils.getNow());
+		HttpUtils.doPost(url,"","",new HashMap<String, String>(),new HashMap<String, String>(),paramMap);
+	}
+	
+	
+	
+	
+	/**
+	 *  
+	 * @param youNumber
+	 * @return
+	 */
+	public static String int2String(int youNumber) {
+	    String str = String.format("%010d", youNumber);  
+	    return str;
+	}
+
+	public void precessController(String jobId, String jobOrder, String projectType, String projectId, String orderType,
+			Integer afreq, Integer vfreq, String resources) throws Exception {
+		Runtime runtime = Runtime.getRuntime();
+    	String startTime =TimeUtils.getNow();
+		
+    	Integer i=0;
+		log.info("Solver start   id={}",projectId);
+		esSeverPut(projectId, "Solver start", ++i,startTime);
+		log.info("Solver downLoadAll start id={}",projectId);
+		sftpUtil.downloadByProjectId(projectId,projectType);
+		log.info("Solver downLoadAll end  id={}",projectId);
+		log.info("Solver jobExec start  id={}",projectId);
+		jobOrder =createJobOrder(projectId,jobOrder, projectType,orderType,vfreq,afreq,resources);		
+		i=jobExec(runtime, jobOrder, projectId, startTime);	
+		
+		log.info("Solver jobExec end  id={}",projectId);
+		log.info("Solver uploadAll start  id={}",projectId);
+		//结果文件处理
+		copyOutFile(projectId, projectType, orderType);	
+		
+		sftpUtil.uploadByProjectId(projectId,projectType);
+		log.info("Solver uploadByProjectId end  id={}",projectId);
+		log.info("Solver changJobState start  id={}",projectId);
+		changJobState(jobId, startTime);
+		log.info("Solver changJobState end  id={}",projectId);
+		//求解结束
+		esSeverPut(projectId, "Solver end", ++i,startTime);
+	    log.info("Solver end  id={}",projectId);
+	    String endTime =TimeUtils.getNow();
+	    if(projectType.equals(this.HCFD)){
+	    	this.consume(projectId, startTime, endTime,projectType);
+	    }
+		
+	}
+	/**
+	 *	 资源消费接口
+	 * 
+	 */
+	@Async
+	private void consume(String pid,String startTime,String endTime,String type) throws Exception {
+		Map<String, String> paramMap = new HashMap<>();
+		paramMap.put("channelNo", "service");
+		paramMap.put("clientToken", "e47b87eec69545559d1e81e56626da68");
+		paramMap.put("transCode", "HG00003");
+		paramMap.put("otherId", pid);
+		paramMap.put("type", type);
+		paramMap.put("startTime", startTime);
+		paramMap.put("endTime", endTime);
+		paramMap.put("userId", "5f06c8bc77234f969d13e160b54c27e3");
+		HttpUtils.doPost(url, "", "", 
+							new HashMap<String, String>(), 
+							new HashMap<String, String>(), paramMap);
+	}
+
+	
+}

+ 61 - 0
src/main/java/com/caesolver/server/util/FileUtils.java

@@ -0,0 +1,61 @@
+package com.caesolver.server.util;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+public class FileUtils {
+	public static String AsciiToBinary(String asciiString){  
+        byte[] bytes = asciiString.getBytes();  
+        StringBuilder binary = new StringBuilder();  
+        for (byte b : bytes)  
+        {  
+           int val = b;  
+           for (int i = 0; i < 8; i++)  
+           {  
+              binary.append((val & 128) == 0 ? 0 : 1);  
+              val <<= 1;  
+           }  
+        }  
+        return binary.toString();  
+	}
+	
+	/**
+	 * 	根据文件路径读取byte[] 数组
+     */
+    public static byte[] readFileByBytes(String filePath) throws IOException {
+        File file = new File(filePath);
+        if (!file.exists()) {
+            throw new FileNotFoundException(filePath);
+        } else {
+            ByteArrayOutputStream bos = new ByteArrayOutputStream((int) file.length());
+            BufferedInputStream in = null;
+
+            try {
+                in = new BufferedInputStream(new FileInputStream(file));
+                short bufSize = 1024;
+                byte[] buffer = new byte[bufSize];
+                int len1;
+                while (-1 != (len1 = in.read(buffer, 0, bufSize))) {
+                    bos.write(buffer, 0, len1);
+                }
+
+                byte[] var7 = bos.toByteArray();
+                return var7;
+            } finally {
+                try {
+                    if (in != null) {
+                        in.close();
+                    }
+                } catch (IOException var14) {
+                    var14.printStackTrace();
+                }
+
+                bos.close();
+            }
+        }
+    }
+}

+ 311 - 0
src/main/java/com/caesolver/server/util/HttpUtils.java

@@ -0,0 +1,311 @@
+package com.caesolver.server.util;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.http.HttpResponse;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.conn.ClientConnectionManager;
+import org.apache.http.conn.scheme.Scheme;
+import org.apache.http.conn.scheme.SchemeRegistry;
+import org.apache.http.conn.ssl.SSLSocketFactory;
+import org.apache.http.entity.ByteArrayEntity;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.message.BasicNameValuePair;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class HttpUtils {
+	
+	/**
+	 * get
+	 * 
+	 * @param host
+	 * @param path
+	 * @param method
+	 * @param headers
+	 * @param querys
+	 * @return
+	 * @throws Exception
+	 */
+	public static HttpResponse doGet(String host, String path, String method, 
+			Map<String, String> headers, 
+			Map<String, String> querys)
+            throws Exception {    	
+    	HttpClient httpClient = wrapClient(host);
+
+    	HttpGet request = new HttpGet(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+        	request.addHeader(e.getKey(), e.getValue());
+        }
+        
+        return httpClient.execute(request);
+    }
+	
+	/**
+	 * post form
+	 * 
+	 * @param host
+	 * @param path
+	 * @param method
+	 * @param headers
+	 * @param querys
+	 * @param bodys
+	 * @return
+	 * @throws Exception
+	 */
+	public static HttpResponse doPost(String host, String path, String method, 
+			Map<String, String> headers, 
+			Map<String, String> querys, 
+			Map<String, String> bodys)
+            throws Exception {    	
+    	HttpClient httpClient = wrapClient(host);
+
+    	HttpPost request = new HttpPost(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+        	request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (bodys != null) {
+            List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
+
+            for (String key : bodys.keySet()) {
+                nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key)));
+            }
+            UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8");
+            formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8");
+            request.setEntity(formEntity);
+        }
+
+        return httpClient.execute(request);
+    }	
+	
+	/**
+	 * Post String
+	 * 
+	 * @param host
+	 * @param path
+	 * @param method
+	 * @param headers
+	 * @param querys
+	 * @param body
+	 * @return
+	 * @throws Exception
+	 */
+	public static HttpResponse doPost(String host, String path, String method, 
+			Map<String, String> headers, 
+			Map<String, String> querys, 
+			String body)
+            throws Exception {    	
+    	HttpClient httpClient = wrapClient(host);
+
+    	HttpPost request = new HttpPost(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+        	request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (StringUtils.isNotBlank(body)) {
+        	request.setEntity(new StringEntity(body, "utf-8"));
+        }
+
+        return httpClient.execute(request);
+    }
+	
+	/**
+	 * Post stream
+	 * 
+	 * @param host
+	 * @param path
+	 * @param method
+	 * @param headers
+	 * @param querys
+	 * @param body
+	 * @return
+	 * @throws Exception
+	 */
+	public static HttpResponse doPost(String host, String path, String method, 
+			Map<String, String> headers, 
+			Map<String, String> querys, 
+			byte[] body)
+            throws Exception {    	
+    	HttpClient httpClient = wrapClient(host);
+
+    	HttpPost request = new HttpPost(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+        	request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (body != null) {
+        	request.setEntity(new ByteArrayEntity(body));
+        }
+
+        return httpClient.execute(request);
+    }
+	
+	/**
+	 * Put String
+	 * @param host
+	 * @param path
+	 * @param method
+	 * @param headers
+	 * @param querys
+	 * @param body
+	 * @return
+	 * @throws Exception
+	 */
+	public static HttpResponse doPut(String host, String path, String method, 
+			Map<String, String> headers, 
+			Map<String, String> querys, 
+			String body)
+            throws Exception {    	
+    	HttpClient httpClient = wrapClient(host);
+
+    	HttpPut request = new HttpPut(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+        	request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (StringUtils.isNotBlank(body)) {
+        	request.setEntity(new StringEntity(body, "utf-8"));
+        }
+
+        return httpClient.execute(request);
+    }
+	
+	/**
+	 * Put stream
+	 * @param host
+	 * @param path
+	 * @param method
+	 * @param headers
+	 * @param querys
+	 * @param body
+	 * @return
+	 * @throws Exception
+	 */
+	public static HttpResponse doPut(String host, String path, String method, 
+			Map<String, String> headers, 
+			Map<String, String> querys, 
+			byte[] body)
+            throws Exception {    	
+    	HttpClient httpClient = wrapClient(host);
+
+    	HttpPut request = new HttpPut(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+        	request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (body != null) {
+        	request.setEntity(new ByteArrayEntity(body));
+        }
+
+        return httpClient.execute(request);
+    }
+	
+	/**
+	 * Delete
+	 *  
+	 * @param host
+	 * @param path
+	 * @param method
+	 * @param headers
+	 * @param querys
+	 * @return
+	 * @throws Exception
+	 */
+	public static HttpResponse doDelete(String host, String path, String method, 
+			Map<String, String> headers, 
+			Map<String, String> querys)
+            throws Exception {    	
+    	HttpClient httpClient = wrapClient(host);
+
+    	HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+        	request.addHeader(e.getKey(), e.getValue());
+        }
+        
+        return httpClient.execute(request);
+    }
+	
+	private static String buildUrl(String host, String path, Map<String, String> querys) throws UnsupportedEncodingException {
+    	StringBuilder sbUrl = new StringBuilder();
+    	sbUrl.append(host);
+    	if (!StringUtils.isBlank(path)) {
+    		sbUrl.append(path);
+        }
+    	if (null != querys) {
+    		StringBuilder sbQuery = new StringBuilder();
+        	for (Map.Entry<String, String> query : querys.entrySet()) {
+        		if (0 < sbQuery.length()) {
+        			sbQuery.append("&");
+        		}
+        		if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) {
+        			sbQuery.append(query.getValue());
+                }
+        		if (!StringUtils.isBlank(query.getKey())) {
+        			sbQuery.append(query.getKey());
+        			if (!StringUtils.isBlank(query.getValue())) {
+        				sbQuery.append("=");
+        				sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8"));
+        			}        			
+                }
+        	}
+        	if (0 < sbQuery.length()) {
+        		sbUrl.append("?").append(sbQuery);
+        	}
+        }
+    	
+    	return sbUrl.toString();
+    }
+	
+	private static HttpClient wrapClient(String host) {
+		HttpClient httpClient = new DefaultHttpClient();
+		if (host.startsWith("https://")) {
+			sslClient(httpClient);
+		}
+		
+		return httpClient;
+	}
+	
+	private static void sslClient(HttpClient httpClient) {
+        try {
+            SSLContext ctx = SSLContext.getInstance("TLS");
+            X509TrustManager tm = new X509TrustManager() {
+                public X509Certificate[] getAcceptedIssuers() {
+                    return null;
+                }
+                public void checkClientTrusted(X509Certificate[] xcs, String str) {
+                	
+                }
+                public void checkServerTrusted(X509Certificate[] xcs, String str) {
+                	
+                }
+            };
+            ctx.init(null, new TrustManager[] { tm }, null);
+            SSLSocketFactory ssf = new SSLSocketFactory(ctx);
+            ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
+            ClientConnectionManager ccm = httpClient.getConnectionManager();
+            SchemeRegistry registry = ccm.getSchemeRegistry();
+            registry.register(new Scheme("https", 443, ssf));
+        } catch (KeyManagementException ex) {
+            throw new RuntimeException(ex);
+        } catch (NoSuchAlgorithmException ex) {
+        	throw new RuntimeException(ex);
+        }
+    }
+}

+ 255 - 0
src/main/java/com/caesolver/server/util/TimeUtils.java

@@ -0,0 +1,255 @@
+package com.caesolver.server.util;
+
+import org.springframework.util.StringUtils;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+/*
+ * 向超级账本发送报文使用
+ */
+public class TimeUtils {
+	
+	private static Calendar cal;
+	public static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+	public static SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+	public static SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
+	public static SimpleDateFormat sdf3 = new SimpleDateFormat("yyMMddHHmm");
+	public static SimpleDateFormat sdf4 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+	
+	private static final long ONE_MINUTE = 60000L;
+    private static final long ONE_HOUR = 3600000L;
+    private static final long ONE_DAY = 86400000L;
+    private static final long ONE_WEEK = 604800000L;
+
+    private static final String ONE_SECOND_AGO = "秒前";
+    private static final String ONE_MINUTE_AGO = "分钟前";
+    private static final String ONE_HOUR_AGO = "小时前";
+    private static final String ONE_DAY_AGO = "天前";
+    private static final String ONE_MONTH_AGO = "月前";
+    private static final String ONE_YEAR_AGO = "年前";
+
+	//获得当前时间
+	public static String getNow(){ 
+		return sdf1.format(new Date());
+	}
+
+	public static String getTimeStr(Date date){
+		return sdf1.format(date);
+	}
+
+	public static List<String> getNowForNumber(){
+		List<String> strList=new ArrayList<>();
+		Date date=new Date();
+
+		strList.add(sdf1.format(date));
+		strList.add(sdf3.format(date));
+		strList.add(sdf4.format(date));
+
+		return strList;
+	}
+
+	//获得当天的0点
+	public static Calendar getTodayStart(){ 
+		cal = Calendar.getInstance(); 
+		cal.set(Calendar.HOUR_OF_DAY, 0); 
+		cal.set(Calendar.MINUTE, 0);
+		cal.set(Calendar.SECOND, 0);
+		cal.set(Calendar.MILLISECOND, 0); 
+		return cal;
+		//return (int) (cal.getTimeInMillis()/1000); 
+	} 
+	
+	public static String getTodayStartStr() {
+		return sdf1.format(getTodayStart().getTime());
+	}
+	
+	//获得昨天的0点
+	public static Calendar getYesterdayStart(){
+		cal = Calendar.getInstance();
+		cal.setTime(new Date());
+		cal.add(Calendar.DAY_OF_MONTH, -1);
+		cal.set(Calendar.HOUR_OF_DAY, 0);
+		cal.set(Calendar.MINUTE, 0);
+		cal.set(Calendar.SECOND, 0);
+		cal.set(Calendar.MILLISECOND, 0);
+		return cal;
+		//return (int) (cal.getTimeInMillis()/1000);
+	}
+	//获得昨天的0点
+	public static String getYesterdayStartStr(){
+		cal = Calendar.getInstance();
+		cal.setTime(new Date());
+		cal.add(Calendar.DAY_OF_MONTH, -1);
+		cal.set(Calendar.HOUR_OF_DAY, 0);
+		cal.set(Calendar.MINUTE, 0);
+		cal.set(Calendar.SECOND, 0);
+		cal.set(Calendar.MILLISECOND, 0);
+		return sdf1.format(cal.getTime());
+	}
+	//获得昨天的24点
+	public static Calendar getYesterdayEnd(){
+		cal = Calendar.getInstance();
+		cal.setTime(new Date());
+		cal.add(Calendar.DAY_OF_MONTH, -1);
+		cal.set(Calendar.HOUR_OF_DAY, 23);
+		cal.set(Calendar.MINUTE, 59);
+		cal.set(Calendar.SECOND, 59);
+		cal.set(Calendar.MILLISECOND, 0);
+		return cal;
+	}
+	//获得昨天的24点
+	public static String getYesterdayEndStr(){
+		cal = Calendar.getInstance();
+		cal.setTime(new Date());
+		cal.add(Calendar.DAY_OF_MONTH, -1);
+		cal.set(Calendar.HOUR_OF_DAY, 23);
+		cal.set(Calendar.MINUTE, 59);
+		cal.set(Calendar.SECOND, 59);
+		cal.set(Calendar.MILLISECOND, 0);
+		return sdf1.format(cal.getTime());
+	}
+	//获得今天24点
+	public static Calendar getTodayEnd(){ 
+		cal = Calendar.getInstance(); 
+		cal.set(Calendar.HOUR_OF_DAY, 23); 
+		cal.set(Calendar.MINUTE, 23); 
+		cal.set(Calendar.SECOND, 59); 
+		cal.set(Calendar.MILLISECOND, 999); 
+		return cal;
+		//return (int) (cal.getTimeInMillis()/1000); 
+	} 
+	
+	//获得跑批起始时间
+	public static Calendar getBatchStart(){ 
+		cal = Calendar.getInstance(); 
+		cal.set(Calendar.MINUTE, 0);
+		cal.set(Calendar.SECOND, 0); 
+		cal.set(Calendar.MILLISECOND, 0); 
+		return cal;
+	} 
+	
+	//距今多少分/小时/天/月/年
+	public static String fromToday(String time) {
+		if (StringUtils.isEmpty(time)) {
+			return "";
+		}
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date date = null;
+        try {
+            date = format.parse(time);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        long delta = new Date().getTime() - date.getTime();
+        if (delta < 1L * ONE_MINUTE) {
+            long seconds = toSeconds(delta);
+            return (seconds <= 0 ? 1 : seconds) + ONE_SECOND_AGO;
+        }
+        if (delta < 45L * ONE_MINUTE) {
+            long minutes = toMinutes(delta);
+            return (minutes <= 0 ? 1 : minutes) + ONE_MINUTE_AGO;
+        }
+        if (delta < 24L * ONE_HOUR) {
+            long hours = toHours(delta);
+            return (hours <= 0 ? 1 : hours) + ONE_HOUR_AGO;
+        }
+//        错误代码
+//        if (delta < 48L * ONE_HOUR) {
+//            return "昨天";
+//        }
+        //因为你不知道这个月是30天还是31天
+        //后面的算法也有问题,但其实也不用这么精确,大致算一下;毕竟需求也只是大致的时间
+        if (delta < 31L * ONE_DAY) {
+            long days = toDays(delta);
+            return (days <= 0 ? 1 : days) + ONE_DAY_AGO;
+        }
+        //一年也不一定是365
+        if (delta < 365L * ONE_DAY) {
+            long months = toMonths(delta);
+            return (months <= 0 ? 1 : months) + ONE_MONTH_AGO;
+        } else {
+            long years = toYears(delta);
+            return (years <= 0 ? 1 : years) + ONE_YEAR_AGO;
+        }
+    }
+	
+	// 获取当月第一天
+	public static String firstDay(String year, String month) {
+		// 获取前月的第一天
+		Calendar cale = Calendar.getInstance();
+		cale.set(Calendar.YEAR, Integer.parseInt(year));
+		cale.set(Calendar.MONTH, Integer.parseInt(month) - 1);
+        cale.add(Calendar.MONTH, 0);  
+		cale.set(Calendar.DAY_OF_MONTH, 1);
+		cale.set(Calendar.HOUR_OF_DAY, 0);
+		cale.set(Calendar.MINUTE, 0);
+		cale.set(Calendar.SECOND, 0);
+		return sdf1.format(cale.getTime());
+	}
+	// 获取当月最后一天
+	public static String lastDay(String year, String month) {
+		// 获取前月的第一天
+		Calendar cale = Calendar.getInstance();
+		cale.set(Calendar.YEAR, Integer.parseInt(year));
+		cale.set(Calendar.MONTH, Integer.parseInt(month) - 1);
+        cale.add(Calendar.MONTH, 1);  
+        cale.set(Calendar.DAY_OF_MONTH, 0);  
+		cale.set(Calendar.HOUR_OF_DAY, 23);
+		cale.set(Calendar.MINUTE, 59);
+		cale.set(Calendar.SECOND, 59);
+		return sdf1.format(cale.getTime());
+	}
+
+    private static long toSeconds(long date) {
+        return date / 1000L;
+    }
+
+    private static long toMinutes(long date) {
+        return toSeconds(date) / 60L;
+    }
+
+    private static long toHours(long date) {
+        return toMinutes(date) / 60L;
+    }
+
+    private static long toDays(long date) {
+        return toHours(date) / 24L;
+    }
+
+    private static long toMonths(long date) {
+        return toDays(date) / 30L;
+    }
+
+    private static long toYears(long date) {
+        return toMonths(date) / 365L;
+    }
+
+    public static String getDateTimeByStr(String str){
+		SimpleDateFormat format = new SimpleDateFormat("yyyymmddhhmmss");
+		Date date = null;
+		try {
+			date = format.parse(str);
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+
+		return sdf1.format(date);
+	}
+
+	public static Date getDateTime(String str){
+		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		Date date = null;
+		try {
+			date = format.parse(str);
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+
+		return date;
+	}
+}

+ 94 - 0
src/main/java/com/caesolver/sftp/FileUtil.java

@@ -0,0 +1,94 @@
+package com.caesolver.sftp;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.List;
+
+public class FileUtil {
+	 /**
+	   	递归删除目录下的所有文件及子目录下所有文件
+     * @param filepath 将要删除的文件目录
+     */
+	public static void deleteDir(String  filepath) {
+		File f = new File(filepath);//定义文件路径         
+		 if(f.exists() && f.isDirectory()){//目录 
+		     if(f.listFiles().length==0){//若目录下没有文件则直接删除  
+		         f.delete();  
+		     }else{//若有则把文件放进数组,并判断是否有下级目录  
+		         File delFile[]=f.listFiles();  
+		         int i =f.listFiles().length;  
+		         for(int j=0;j<i;j++){  
+		             if(delFile[j].isDirectory()){  
+		            	 deleteDir(delFile[j].getAbsolutePath());//递归调用del方法并取得子目录路径  
+		             }  
+		             delFile[j].delete();//删除文件  
+		         }  
+		     }  
+		 }else if(f.exists()){
+			  f.delete();  
+		 }    
+    }
+    /**
+     * 	获取文件夹下的所有文件列表
+     * @param path
+     * @throws IOException 
+     */
+    public static List<File> ListDataOutFiles(String path,String projectType) {
+    	List<File> files =new ArrayList<File>();
+    	sonFiles(path, files,projectType);
+    	return files;
+    }
+
+	private static void sonFiles(String path, List<File> files,String projectType) {
+		File rootFile = new File(path);
+    	File[] listFiles=rootFile.listFiles();
+    	if(listFiles!=null&&listFiles.length>0) {
+    		for (File file : listFiles) {
+				if(file.isDirectory()) {
+					sonFiles(file.getPath(),files,projectType);
+				}else { 
+					switch (projectType) {
+						case "hcfd":
+							if(file.getParent().indexOf("data_out")>0) {
+								files.add(file);
+							};
+							break;
+						case "fem":
+							if(file.getParent().indexOf("data_out")>0) {
+								files.add(file);
+							}
+							break;
+						case "cfd":
+							if(file.getName().endsWith(".out")) {
+								files.add(file);
+							}
+							break;
+						case "mpm":
+							if(file.getParent().indexOf("dataout")>0) {
+								files.add(file);
+							}
+							break;
+						case "bladesign":
+							if(
+								file.getName().endsWith(".K")||
+								file.getName().endsWith(".v0")||
+								file.getName().endsWith(".opt")||
+								file.getName().endsWith(".ech")||
+								file.getName().endsWith(".v1S")||
+								file.getName().endsWith(".out")||
+								file.getParent().indexOf("OPT")>0
+							) {
+								files.add(file);
+							}
+							break;
+						default:
+							break;
+					}		
+				}
+			}
+    	}
+	}
+	
+}

+ 436 - 0
src/main/java/com/caesolver/sftp/SFTPUtil.java

@@ -0,0 +1,436 @@
+package com.caesolver.sftp;
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.Vector;
+
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import com.jcraft.jsch.Channel;
+import com.jcraft.jsch.ChannelSftp;
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
+import com.jcraft.jsch.SftpException;
+/**
+ * 
+ * @ClassName: SFTPUtil
+ * @Description: sftp连接工具类
+ * @date 2017年5月22日 下午11:17:21
+ * @version 1.0.0
+ */
+@Component
+public class SFTPUtil {
+	private transient Logger log = LoggerFactory.getLogger(this.getClass());
+    
+    private ChannelSftp sftp;
+      
+    private Session session;
+    /** FTP 登录用户名*/  
+    @Value("${sftp.username}")
+    private String username;
+    /** FTP 登录密码*/  
+    @Value("${sftp.password}")
+    private String password;
+    /** 私钥 */  
+    @Value("${sftp.privatekey}")
+    private String privateKey;
+    /** FTP 服务器地址IP地址*/  
+    @Value("${sftp.host}")
+    private String host;
+    /** FTP 端口*/
+    @Value("${sftp.port}")
+    private int port;
+    
+    @Value("${sftp.workdir}")
+    private String sftp_workdir;
+    @Value("${FEM.workdir}")
+    private String FEM_workdir;
+    @Value("${HCFD.workdir}")
+    private String HCFD_workdir;
+    
+    @Value("${CFD.workdir}")
+    private String CFD_workdir;
+    @Value("${MPM.workdir}")
+    private String MPM_workdir;
+    
+    @Value("${BLADESIGN.workdir}")
+    private String BLADESIGN_workdir;
+    
+      
+    public SFTPUtil(){}
+  
+    /**
+                * 连接sftp服务器
+     *
+     * @throws Exception 
+     */
+    public void login(){
+        try {
+            JSch jsch = new JSch();
+            if (privateKey != null&&!StringUtils.isEmpty(privateKey)) {
+                jsch.addIdentity(privateKey);// 设置私钥
+                log.info("sftp connect,path of private key file:{}" , privateKey);
+            }
+            log.info("sftp connect by host:{} username:{}",host,username);
+  
+            session = jsch.getSession(username, host, port);
+            log.info("Session is build");
+            if (password != null) {
+                session.setPassword(password);  
+            }
+            Properties config = new Properties();
+            config.put("StrictHostKeyChecking", "no");
+              
+            session.setConfig(config);
+            session.connect();
+            log.info("Session is connected");
+            
+            Channel channel = session.openChannel("sftp");
+            channel.connect();
+            log.info("channel is connected");
+  
+            sftp = (ChannelSftp) channel;
+            log.info(String.format("sftp server host:[%s] port:[%s] is connect successfull", host, port));
+        } catch (JSchException e) {
+            log.error("Cannot connect to specified sftp server : {}:{} \n Exception message is: {}", new Object[]{host, port, e.getMessage()});  
+        }
+    }  
+  
+    /**
+     * 关闭连接 server 
+     */
+    public void logout(){
+        if (sftp != null) {
+            if (sftp.isConnected()) {
+                sftp.disconnect();
+                log.info("sftp is closed already");
+            }
+        }
+        if (session != null) {
+            if (session.isConnected()) {
+                session.disconnect();
+                log.info("sshSession is closed already");
+            }
+        }
+    }
+  
+    /** 
+     * 将输入流的数据上传到sftp作为文件 
+     *  
+     * @param directory 
+     *            上传到该目录 
+     * @param sftpFileName 
+     *            sftp端文件名 
+     * @param in 
+     *            输入流 
+     * @throws SftpException  
+     * @throws Exception 
+     */  
+    public void upload(String directory, String sftpFileName, InputStream input) throws SftpException{
+        try {  
+            sftp.cd(directory);
+        } catch (SftpException e) {
+            log.warn("directory is not exist");
+            sftp.mkdir(directory);
+            sftp.cd(directory);
+        }
+        sftp.put(input, sftpFileName,ChannelSftp.OVERWRITE);//覆盖上传
+        log.info("file:{} is upload successful" , sftpFileName);
+    }
+    
+    
+    
+    /** 
+     	* 上传单个文件
+     *
+     * @param directory 
+     *            上传到sftp目录 
+     * @param uploadFile
+     *            要上传的文件,包括路径 
+     * @throws FileNotFoundException
+     * @throws SftpException
+     * @throws Exception
+     */
+    public void upload(String directory, String uploadFile) throws FileNotFoundException, SftpException{
+        File file = new File(uploadFile);
+        upload(directory, file.getName(), new FileInputStream(file));
+    }
+ 
+     
+  
+    /**
+	 * 根据项目类型项目ID 下载文件
+	 * @param projectId
+	 * @param projectType
+	 * @throws IOException 
+	 * @throws SftpException 
+	 */
+	public  void downloadByProjectId(String projectId,String projectType) throws SftpException, IOException {
+		this.login();
+		String saveDirectory="";
+		
+		switch (projectType) {
+			case "hcfd":
+				saveDirectory = getSaveDirectory(projectType, saveDirectory);
+				this.downloadDir(this.sftp_workdir+"/"+projectId,saveDirectory+"/"+projectId);
+				break;
+			case "fem":
+				saveDirectory = getSaveDirectory(projectType, saveDirectory);
+				this.downloadDir(this.sftp_workdir+"/"+projectId,saveDirectory+"/"+projectId);
+				break;
+			case "cfd":
+				saveDirectory = getSaveDirectory(projectType, saveDirectory);
+				this.downloadCFDDir(this.sftp_workdir+"/"+projectId,saveDirectory+"/"+projectId);
+				break;
+			case "mpm":
+				saveDirectory = getSaveDirectory(projectType, saveDirectory);
+				this.downloadDir(this.sftp_workdir+"/"+projectId,saveDirectory+"/"+projectId);
+				break;
+			case "bladesign":
+				saveDirectory = getSaveDirectory(projectType, saveDirectory);
+				this.downloadDir(this.sftp_workdir+"/"+projectId,saveDirectory+"/"+projectId);
+				break;
+			default:
+				break;
+		}	
+		this.logout();
+		
+	}
+
+	private String getSaveDirectory(String projectType, String saveDirectory) {
+		switch (projectType) {
+			case "hcfd":
+				saveDirectory=this.HCFD_workdir;
+				break;
+			case "fem":
+				saveDirectory=this.FEM_workdir;
+				break;
+			case "cfd":
+				saveDirectory=this.CFD_workdir;
+				break;
+			case "mpm":
+				saveDirectory=this.MPM_workdir;
+				break;
+			case "bladesign":
+				saveDirectory=this.BLADESIGN_workdir;
+				break;
+			default:
+				break;
+		}
+		return saveDirectory;
+	}
+	
+	/**
+	 * 根据项目类型项目ID 上传结果文件
+	 * @param projectId
+	 * @param projectType
+	 * @throws SftpException 
+	 * @throws FileNotFoundException 
+	 */
+	public  void uploadByProjectId(String projectId,String projectType) throws FileNotFoundException, SftpException {
+		this.login();
+		String saveDirectory="";
+		log.info("uploadByProjectId 1:{} {}" , projectId,projectType);
+		saveDirectory = getSaveDirectory(projectType, saveDirectory);
+		log.info("uploadByProjectId 2: saveDirectory ={} " , saveDirectory);
+		List<File> listFiles=FileUtil.ListDataOutFiles(saveDirectory+projectId,projectType);
+		for (File file : listFiles) {
+			log.info("file:{} upload start " , file.getPath());
+			FileInputStream fileinput =null;
+			try {
+				fileinput =new FileInputStream(file);
+				String directory =sftp_workdir+"/"+file.getParent().replace("\\","/").replace(saveDirectory, "");
+				upload(directory, file.getName(), fileinput);
+				
+				log.info("file:{} upload sucess " , file.getPath());
+				fileinput.close();
+			}catch (Exception e) {
+				e.printStackTrace();
+				// TODO: handle exception
+			}finally {
+				if(fileinput!=null) {
+					try {
+						fileinput.close();
+					} catch (IOException e) {
+						// TODO Auto-generated catch block
+						e.printStackTrace();
+					}
+				}
+			}
+			
+		}  
+		this.logout();
+	}
+	 /**
+	     * 下载文件夹 
+	*
+	*/  
+	public void downloadCFDDir(String directory, String saveDirectory) throws SftpException, IOException{
+		if (directory != null && !"".equals(directory)) {
+			sftp.cd(directory);
+		}
+		Vector v=sftp.ls(directory);//路径下所有文件
+		if(v.size() > 0) {
+		Iterator it = v.iterator();////遍历某路径下的所有文件
+		File savedir =new File(saveDirectory);
+		if(!savedir.exists()||!savedir.isDirectory()) {
+			savedir.mkdirs();
+		}
+		while (it.hasNext()) {
+			ChannelSftp.LsEntry entry = (ChannelSftp.LsEntry) it.next();
+			if(entry.getFilename().equals("..")||entry.getFilename().equals(".")) {
+				continue;
+			}
+			
+			if(entry.getAttrs().isDir()) {
+				File filedir =new File(saveDirectory+"/"+entry.getFilename());
+				if(!filedir.exists()||!filedir.isDirectory()) {
+					filedir.mkdirs();
+				}
+				if(!entry.getFilename().equals("data_out")) {
+					downloadDir(directory+"/"+entry.getFilename(),saveDirectory+"/"+entry.getFilename());
+				}
+			}else {
+				FileOutputStream fileout =null;
+				try {
+					if(!entry.getFilename().endsWith(".out")) {//结果文件不下载
+						File file =new File(saveDirectory+"/"+entry.getFilename());
+			    		if(file.exists()&&!file.isDirectory()) {
+			    			file.delete();//本地存在覆盖
+			    		}
+			    		file.createNewFile();
+			    		fileout = new FileOutputStream(file);
+			    		sftp.get(directory+"/"+entry.getFilename(),fileout);
+			    		log.info("file:{} is download successful" ,file.getPath());
+			    		fileout.close();
+					}
+				} catch (Exception e) {
+					// TODO: handle exception
+					e.printStackTrace();
+				}finally {
+					if(fileout!=null) {
+						try {
+							fileout.close();
+						} catch (IOException e) {
+							// TODO Auto-generated catch block
+							e.printStackTrace();
+						}
+					}
+				}
+//				log.info("file:{} is download successful" , entry.getFilename());
+			}
+		 }
+		
+		}
+	}
+
+
+    /**
+                 * 下载文件夹 
+     *
+     */  
+    public void downloadDir(String directory, String saveDirectory) throws SftpException, IOException{
+    	log.info(directory);;
+        if (directory != null && !"".equals(directory)) {
+            sftp.cd(directory);
+        }
+        Vector v=sftp.ls(directory);//路径下所有文件
+        if(v.size() > 0) {
+        	Iterator it = v.iterator();////遍历某路径下的所有文件
+	        while (it.hasNext()) {
+	        	ChannelSftp.LsEntry entry = (ChannelSftp.LsEntry) it.next();
+	        	if(entry.getFilename().equals("..")||entry.getFilename().equals(".")) {
+	        		continue;
+	        	}
+	        	
+	        	if(entry.getAttrs().isDir()) {
+	        		File filedir =new File(saveDirectory+"/"+entry.getFilename());
+	        		if(!filedir.exists()||!filedir.isDirectory()) {
+	        			filedir.mkdirs();
+	        		}
+	        		if(!entry.getFilename().equals("data_out")) {
+	        			downloadDir(directory+"/"+entry.getFilename(),saveDirectory+"/"+entry.getFilename());
+	        		}
+	        	}else {
+	        		FileOutputStream fileout =null;
+	        		try {
+	        			File file =new File(saveDirectory+"/"+entry.getFilename());
+		        		if(file.exists()&&!file.isDirectory()) {
+		        			file.delete();//本地存在覆盖
+		        		}
+		        		file.createNewFile();
+		        		fileout = new FileOutputStream(file);
+		        		sftp.get(directory+"/"+entry.getFilename(),fileout);
+		        		fileout.close();
+					} catch (Exception e) {
+						// TODO: handle exception
+					}finally {
+						if(fileout!=null) {
+							try {
+								fileout.close();
+							} catch (IOException e) {
+								// TODO Auto-generated catch block
+								e.printStackTrace();
+							}
+						}
+					}
+	        		log.info("file:{} is download successful" , entry.getFilename());
+	        	}
+	         }
+        	
+        }
+    }
+    
+    /**
+     * 下载文件 
+     *
+     * @param directory
+     *            下载目录 
+     * @param downloadFile
+     *            下载的文件
+     * @param saveFile
+     *            存在本地的路径
+     * @throws SftpException
+     * @throws FileNotFoundException
+     * @throws Exception
+     */  
+    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));
+        log.info("file:{} is download successful" , downloadFile);
+    }
+   
+  
+    /**
+     * 删除文件
+     *  
+     * @param directory
+     *            要删除文件所在目录
+     * @param deleteFile
+     *            要删除的文件
+     * @throws SftpException
+     * @throws Exception
+     */
+    public void delete(String directory, String deleteFile) throws SftpException{
+        sftp.cd(directory);
+        sftp.rm(deleteFile);
+    }
+  
+    
+}

+ 67 - 0
src/main/resources/application.yml

@@ -0,0 +1,67 @@
+server:
+  port: 8082
+#spring:
+#  #MQ 配置
+#  rabbitmq:
+#    host: 192.168.0.43
+#    port: 5672
+#    username: admin
+#    password: admin 
+#es:
+#  host: 192.168.0.43
+#  port: 9200
+#  scheme: http
+
+esserverurl: http://192.168.88.3:8031/
+caeserverurl: http://192.168.88.3:8081/
+#
+#ftp:
+#  host: 192.168.0.43
+#  port: 2231
+#  username: ftpmain
+#  password: 123456
+#  encoding: utf-8
+#  MaxTotal: 100
+#  MinIdel: 2
+#  MaxWaitMillis: 3000
+#  root: /
+#  workDir: D:/FEM/
+
+sftp:
+  host: 192.168.0.43
+  port: 22
+  username: root
+  password: Xicae@root
+  privatekey:
+  workdir: /opt/hcfd
+
+FEM:
+  workdir: C:/FEM/
+  exePath: C:/FEMLab_example/ADI_FE.exe
+  postPath: C:/FEMLab_example/FEMPost.exe
+  rootPath: C
+  
+HCFD:
+  workdir: /home/hcfd/solverdown/
+  MPICHPATH: /home/mpi/mpich2_141_gnu/bin
+  UNIXPath: /home/hcfdlab/mavric/test
+  RootPath: D
+  ExePath: D:/Program Files/HCFDLab_example/windows/mavric/test/
+  
+CFD:
+  workdir: /home/cfd/solverdown/
+#  workdir: D:/cfd_down
+  UNIXPath: /home/OverCFD_Apollo/
+  MPICHPATH: /home/mpi/mpich2_141_gnu/bin
+
+MPM:
+  workdir: C:/mpm_down/
+  exePath: C:/MPM/windows_exe/
+  
+BLADESIGN:
+  workdir: C:/bladesign_down/
+  VABSexe: C:/bladesign/VABS_R/VABS.exe
+  GEBTexe: C:/bladesign/GEBT/GEBT.exe
+  RootPath: C
+  POTexe: C:/bladesign/OPT/
+  POTInitialGEBT: C:/bladesign/OPT/OPT/InitialGEBT.dat

+ 80 - 0
src/main/resources/applicationbak.yml

@@ -0,0 +1,80 @@
+server:
+  port: 8082
+#spring:
+#  #MQ 配置
+#  rabbitmq:
+#    host: 192.168.0.43
+#    port: 5672
+#    username: admin
+#    password: admin 
+#es:
+#  host: 192.168.0.43
+#  port: 9200
+#  scheme: http
+
+esserverurl: http://192.168.88.3:8031/
+caeserverurl: http://192.168.88.3:8081/
+#
+#ftp:
+#  host: 192.168.0.43
+#  port: 2231
+#  username: ftpmain
+#  password: 123456
+#  encoding: utf-8
+#  MaxTotal: 100
+#  MinIdel: 2
+#  MaxWaitMillis: 3000
+#  root: /
+#  workDir: D:/FEM/
+
+sftp:
+  host: 192.168.88.3
+  port: 32222
+  username: root
+  password: Adi987654321!
+  privatekey:
+  workdir: /upload/
+
+FEM:
+  workdir: C:/FEM/
+  exePath: C:/FEMLab_example/ADI_FE.exe
+  postPath: C:/FEMLab_example/FEMPost.exe
+  rootPath: C
+  
+HCFD:
+  workdir: /home/hcfd/solverdown/
+  MPICHPATH: /home/mpi/mpich2_141_gnu/bin
+  UNIXPath: /home/hcfdlab/mavric/test
+  RootPath: D
+  ExePath: D:/Program Files/HCFDLab_example/windows/mavric/test/
+  
+CFD:
+  workdir: /home/cfd/solverdown/
+#  workdir: D:/cfd_down
+  UNIXPath: /home/OverCFD_Apollo/
+  MPICHPATH: /home/mpi/mpich2_141_gnu/bin
+
+MPM:
+  workdir: C:/mpm_down/
+  exePath: C:/MPM/windows_exe/
+  
+BLADESIGN:
+  workdir: C:/bladesign_down/
+  VABSexe: C:/bladesign/VABS_R/VABS.exe
+  GEBTexe: C:/bladesign/GEBT/GEBT.exe
+  RootPath: C
+  POTexe: C:/bladesign/OPT/
+  POTInitialGEBT: C:/bladesign/OPT/OPT/InitialGEBT.dat
+
+xxl:
+  job:
+    admin:
+      addresses:  http://192.168.88.3:8000/xxl-job-admin
+    accessToken: 
+    executor:
+      appname: solver-window-executor
+      address: 
+      ip: 
+      port: 9999
+      logpath: /data/applogs/xxl-job/jobhandler
+      logretentiondays: 30

+ 1 - 0
src/test/.gitignore

@@ -0,0 +1 @@
+/java/