15810770710@163.com il y a 3 ans
Parent
commit
a9d729463b
43 fichiers modifiés avec 3632 ajouts et 0 suppressions
  1. 118 0
      .mvn/wrapper/MavenWrapperDownloader.java
  2. BIN
      .mvn/wrapper/maven-wrapper.jar
  3. 2 0
      .mvn/wrapper/maven-wrapper.properties
  4. 310 0
      mvnw
  5. 182 0
      mvnw.cmd
  6. 129 0
      pom.xml
  7. 28 0
      src/main/java/info/aspirecn/iov/sjjh/Application.java
  8. 64 0
      src/main/java/info/aspirecn/iov/sjjh/action/VehicleAction.java
  9. 21 0
      src/main/java/info/aspirecn/iov/sjjh/config/SupplierConfig.java
  10. 29 0
      src/main/java/info/aspirecn/iov/sjjh/config/SwaggerConfig.java
  11. 60 0
      src/main/java/info/aspirecn/iov/sjjh/constant/Constants.java
  12. 35 0
      src/main/java/info/aspirecn/iov/sjjh/constant/ContentType.java
  13. 35 0
      src/main/java/info/aspirecn/iov/sjjh/constant/HttpHeader.java
  14. 33 0
      src/main/java/info/aspirecn/iov/sjjh/constant/HttpMethod.java
  15. 30 0
      src/main/java/info/aspirecn/iov/sjjh/constant/HttpSchema.java
  16. 35 0
      src/main/java/info/aspirecn/iov/sjjh/constant/SystemHeader.java
  17. 198 0
      src/main/java/info/aspirecn/iov/sjjh/entity/Request.java
  18. 28 0
      src/main/java/info/aspirecn/iov/sjjh/entity/RequestObject.java
  19. 82 0
      src/main/java/info/aspirecn/iov/sjjh/entity/Response.java
  20. 38 0
      src/main/java/info/aspirecn/iov/sjjh/entity/VehicleHistoryPositionRequestParam.java
  21. 27 0
      src/main/java/info/aspirecn/iov/sjjh/entity/VehicleHistoryPositionResponse.java
  22. 42 0
      src/main/java/info/aspirecn/iov/sjjh/entity/geocoding/AddressComponent.java
  23. 52 0
      src/main/java/info/aspirecn/iov/sjjh/entity/geocoding/GeocodingResponseObject.java
  24. 17 0
      src/main/java/info/aspirecn/iov/sjjh/entity/geocoding/Location.java
  25. 17 0
      src/main/java/info/aspirecn/iov/sjjh/entity/geocoding/PoiRegions.java
  26. 37 0
      src/main/java/info/aspirecn/iov/sjjh/entity/geocoding/Pois.java
  27. 9 0
      src/main/java/info/aspirecn/iov/sjjh/enums/Method.java
  28. 18 0
      src/main/java/info/aspirecn/iov/sjjh/service/VehicleService.java
  29. 311 0
      src/main/java/info/aspirecn/iov/sjjh/service/impl/VehicleServiceImpl.java
  30. 78 0
      src/main/java/info/aspirecn/iov/sjjh/util/Client.java
  31. 53 0
      src/main/java/info/aspirecn/iov/sjjh/util/DateUtil.java
  32. 482 0
      src/main/java/info/aspirecn/iov/sjjh/util/HttpUtil.java
  33. 311 0
      src/main/java/info/aspirecn/iov/sjjh/util/HttpUtils.java
  34. 118 0
      src/main/java/info/aspirecn/iov/sjjh/util/MessageDigestUtil.java
  35. 79 0
      src/main/java/info/aspirecn/iov/sjjh/util/PostUtil.java
  36. 227 0
      src/main/java/info/aspirecn/iov/sjjh/util/SignUtil.java
  37. 60 0
      src/main/java/info/aspirecn/iov/sjjh/util/ValidateParamUtil.java
  38. 80 0
      src/main/resources/config/application-test.yml
  39. 84 0
      src/main/resources/config/application.yml
  40. 3 0
      src/main/resources/config/banner.txt
  41. 27 0
      src/main/resources/config/bootstrap.yml
  42. 35 0
      src/main/resources/config/logback-spring.xml
  43. 8 0
      src/test/java/info/aspirecn/iov/sjjh/IovSjjhServicenodeSupplierVehicleApplicationTests.java

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

@@ -0,0 +1,118 @@
+/*
+ * 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();
+    }
+
+}

BIN
.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%

+ 129 - 0
pom.xml

@@ -0,0 +1,129 @@
+<?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.2.2.RELEASE</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+    <groupId>info.aspirecn.iov.sjjh</groupId>
+    <artifactId>iov-sjjh-servicenode-supplier-vehicle</artifactId>
+    <version>1.0.0</version>
+    <name>iov-sjjh-servicenode-supplier-vehicle</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.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>net.logstash.logback</groupId>
+            <artifactId>logstash-logback-encoder</artifactId>
+            <version>5.0</version>
+        </dependency>
+
+        <!-- 服务注册 -->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
+            <version>2.0.2.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger2</artifactId>
+            <version>2.9.2</version>
+        </dependency>
+
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger-ui</artifactId>
+            <version>2.9.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-devtools</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-config-client</artifactId>
+            <version>2.0.2.RELEASE</version>
+        </dependency>
+
+        <!-- aspire maven私服 -->
+        <dependency>
+            <groupId>info.aspirecn.rdc</groupId>
+            <artifactId>aspirecloud-commons-sleuthlog-starter</artifactId>
+            <version>5.0.1</version>
+        </dependency>
+
+        <!--错误日志-->
+        <dependency>
+            <groupId>info.aspirecn.rdc</groupId>
+            <artifactId>aspirecloud-commons-errorlog-starter</artifactId>
+            <version>5.0.2</version>
+        </dependency>
+        <dependency>
+            <groupId>com.squareup.okhttp3</groupId>
+            <artifactId>okhttp</artifactId>
+            <version>3.8.1</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>info.aspirecn.iov.sjjh</groupId>
+            <artifactId>iov-sjjh-commons-lang</artifactId>
+            <version>1.0.0</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.15</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5.10</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpcore</artifactId>
+            <version>4.4.14</version>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <excludes>
+                        <exclude>
+                            <groupId>org.projectlombok</groupId>
+                            <artifactId>lombok</artifactId>
+                        </exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 28 - 0
src/main/java/info/aspirecn/iov/sjjh/Application.java

@@ -0,0 +1,28 @@
+package info.aspirecn.iov.sjjh;
+
+import info.aspirecn.rdc.aspirecloud.node.except.annotations.EnableAspireCloudRdcHandleExcept;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
+import org.springframework.context.ApplicationContext;
+import org.springframework.core.env.Environment;
+import org.springframework.util.StopWatch;
+
+@SpringBootApplication
+@EnableAspireCloudRdcHandleExcept
+@Slf4j
+@EnableEurekaClient
+public class Application {
+
+    public static void main(String[] args) {
+        StopWatch watch = new StopWatch();
+        watch.start();
+        ApplicationContext context = SpringApplication.run(Application.class, args);
+        Environment environment = context.getBean(Environment.class);
+        String applicationName = environment.getProperty("spring.application.name");
+        watch.stop();
+        log.info("{} 启动完毕,times={}s", applicationName, watch.getTotalTimeSeconds());
+    }
+
+}

+ 64 - 0
src/main/java/info/aspirecn/iov/sjjh/action/VehicleAction.java

@@ -0,0 +1,64 @@
+package info.aspirecn.iov.sjjh.action;
+
+import info.aspirecn.iov.sjjh.commons.lang.ChannelTypeHandleResponseObject;
+import info.aspirecn.iov.sjjh.commons.lang.Constant;
+import info.aspirecn.iov.sjjh.constant.Constants;
+import info.aspirecn.iov.sjjh.service.VehicleService;
+import info.aspirecn.rdc.aspirecloud.node.except.utils.ErrorUtils;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.tomcat.util.codec.binary.Base64;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+@Slf4j
+@RestController
+public class VehicleAction {
+    @Autowired
+    private VehicleService vehicleService;
+
+    @ApiOperation(value = "车辆历史轨迹接口", notes = "")
+    @PostMapping(value = "/vehicleHistoryPositionQuery.do")
+    public ChannelTypeHandleResponseObject vehicleHistoryPositionQuery(
+            @ApiParam(value="通道ID")@RequestHeader(name="channelId")  String channelId,
+            @ApiParam(value="超时时间,单位:毫秒",example = "10000")@RequestParam(name = "outTime", required = true) int outTime,
+            @ApiParam(value="请求参数JSON串")@RequestParam(name = "customBody", required = true) String customBody) {
+        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
+                .getRequest();
+
+        //调用service
+        ChannelTypeHandleResponseObject ret = vehicleService.vehicleHistoryPositionQuery(request, customBody, outTime);
+
+        //把接口参数、调用结果和是否收费放入访问日志中
+        if(ret.getCode() != Constant.SUCCESS) {
+            request.setAttribute(Constants.Charge_Log_ResponseCode, Constant.CHANNEL_LOG_ERROR_CODE);
+        } else {
+            request.setAttribute(Constants.Charge_Log_ResponseCode, Constant.CHANNEL_LOG_SUCCESS_CODE);
+        }
+        request.setAttribute(Constants.Charge_Log_Key, ret.getIsCharge());
+
+        try {
+            request.setAttribute(Constant.CHANNEL_LOG_QUERY,
+                    Base64.encodeBase64String(customBody.getBytes(Constants.ENCODING)));
+
+        } catch (Exception ex) {
+            ErrorUtils.captureException(ex);
+            log.error("vehicleHistoryPositionQuery.encodeBase64String.Exception={}", ex);
+        }
+
+        request.setAttribute(Constant.CHANNEL_TYPE_KEY,Constant.CHANNEL_TYPE_SYNC);
+        return ret;
+    }
+}

+ 21 - 0
src/main/java/info/aspirecn/iov/sjjh/config/SupplierConfig.java

@@ -0,0 +1,21 @@
+package info.aspirecn.iov.sjjh.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+@Data
+@Component
+@ConfigurationProperties(prefix = "supplier")
+public class SupplierConfig {
+    private String appKey;
+    private String appSecret;
+    private String historyPositionUrl;
+    private String partyFunctionCode;
+    private int addHours;
+    private int reduceHours;
+    private String baiduUrl;
+    private String baiduAk;
+}

+ 29 - 0
src/main/java/info/aspirecn/iov/sjjh/config/SwaggerConfig.java

@@ -0,0 +1,29 @@
+package info.aspirecn.iov.sjjh.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+
+@Configuration
+@EnableSwagger2
+public class SwaggerConfig {
+
+    @Bean
+    public Docket createRestApi() {
+
+        return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()
+                .apis(RequestHandlerSelectors.basePackage("info.aspirecn.iov.sjjh"))
+                .paths(PathSelectors.any()).build();
+    }
+
+    private ApiInfo apiInfo() {
+        return new ApiInfoBuilder().title("车辆相关信息查询-通道API").description("").termsOfServiceUrl("").version("1.0.0").build();
+    }
+}

+ 60 - 0
src/main/java/info/aspirecn/iov/sjjh/constant/Constants.java

@@ -0,0 +1,60 @@
+/*
+ * 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
+ *
+ *     http://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.
+ */
+package info.aspirecn.iov.sjjh.constant;
+
+/**
+ * 通用常量
+ */
+public class Constants {
+    // 签名算法HmacSha256
+    public static final String HMAC_SHA256 = "HmacSHA256";
+    // 编码UTF-8
+    public static final String ENCODING = "UTF-8";
+    // UserAgent
+    public static final String USER_AGENT = "demo/aliyun/java";
+    // 换行符
+    public static final String LF = "\n";
+    // 串联符
+    public static final String SPE1 = ",";
+    // 示意符
+    public static final String SPE2 = ":";
+    // 连接符
+    public static final String SPE3 = "&";
+    // 赋值符
+    public static final String SPE4 = "=";
+    // 问号符
+    public static final String SPE5 = "?";
+    // 默认请求超时时间,单位毫秒
+    public static final int DEFAULT_TIMEOUT = 1000;
+    // 参与签名的系统Header前缀,只有指定前缀的Header才会参与到签名中
+    public static final String CA_HEADER_TO_SIGN_PREFIX_SYSTEM = "X-Ca-";
+    // 参数值为0
+    public static final int PARA_ZERO = 0;
+    // statusCode-200
+    public static final int STATUS_CODE_200 = 200;
+    // resultCode-0
+    public static final String RESULT_CODE_0 = "0";
+    // resultCode-110000
+    public static final String RESULT_CODE_110000 = "110000";
+    // 查询成功,查无结果
+    public static final String NO_RESULT = "查询成功,查无结果";
+    public static String Charge_Log_Key="isCharge";
+    public static String Charge_Log_ResponseCode="respnoseCode";
+    public static String Charge_Log_Up_ResponseCode="upResponseCode";
+}

+ 35 - 0
src/main/java/info/aspirecn/iov/sjjh/constant/ContentType.java

@@ -0,0 +1,35 @@
+/*
+ * 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
+ *
+ *     http://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.
+ */
+package info.aspirecn.iov.sjjh.constant;
+
+/**
+ * 常用HTTP Content-Type常量
+ */
+public class ContentType {
+    //表单类型Content-Type
+    public static final String CONTENT_TYPE_FORM = "application/x-www-form-urlencoded; charset=UTF-8";
+    // 流类型Content-Type
+    public static final String CONTENT_TYPE_STREAM = "application/octet-stream; charset=UTF-8";
+    //JSON类型Content-Type
+    public static final String CONTENT_TYPE_JSON = "application/json; charset=UTF-8";
+    //XML类型Content-Type
+    public static final String CONTENT_TYPE_XML = "application/xml; charset=UTF-8";
+    //文本类型Content-Type
+    public static final String CONTENT_TYPE_TEXT = "application/text; charset=UTF-8";
+}

+ 35 - 0
src/main/java/info/aspirecn/iov/sjjh/constant/HttpHeader.java

@@ -0,0 +1,35 @@
+/*
+ * 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
+ *
+ *     http://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.
+ */
+package info.aspirecn.iov.sjjh.constant;
+
+/**
+ * HTTP头常量
+ */
+public class HttpHeader {
+    //请求Header Accept
+    public static final String HTTP_HEADER_ACCEPT = "Accept";
+    //请求Body内容MD5 Header
+    public static final String HTTP_HEADER_CONTENT_MD5 = "Content-MD5";
+    //请求Header Content-Type
+    public static final String HTTP_HEADER_CONTENT_TYPE = "Content-Type";
+    //请求Header UserAgent
+    public static final String HTTP_HEADER_USER_AGENT = "User-Agent";
+    //请求Header Date
+    public static final String HTTP_HEADER_DATE = "Date";
+}

+ 33 - 0
src/main/java/info/aspirecn/iov/sjjh/constant/HttpMethod.java

@@ -0,0 +1,33 @@
+/*
+ * 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
+ *
+ *     http://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.
+ */
+package info.aspirecn.iov.sjjh.constant;
+
+/**
+ * HTTP方法常量
+ */
+public class HttpMethod {
+    //GET
+    public static final String GET = "GET";
+    //POST
+    public static final String POST = "POST";
+    //PUT
+    public static final String PUT = "PUT";
+    //DELETE
+    public static final String DELETE = "DELETE";
+}

+ 30 - 0
src/main/java/info/aspirecn/iov/sjjh/constant/HttpSchema.java

@@ -0,0 +1,30 @@
+/*
+ * 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
+ *
+ *     http://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.
+ */
+package info.aspirecn.iov.sjjh.constant;
+
+/**
+ * HTTP Schema常量
+ */
+public class HttpSchema {
+    //HTTP
+    public static final String HTTP = "http://";
+    //HTTPS
+    public static final String HTTPS = "https://";
+
+}

+ 35 - 0
src/main/java/info/aspirecn/iov/sjjh/constant/SystemHeader.java

@@ -0,0 +1,35 @@
+/*
+ * 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
+ *
+ *     http://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.
+ */
+package info.aspirecn.iov.sjjh.constant;
+
+/**
+ * 系统HTTP头常量
+ */
+public class SystemHeader {
+    //签名Header
+    public static final String X_CA_SIGNATURE = "X-Ca-Signature";
+    //所有参与签名的Header
+    public static final String X_CA_SIGNATURE_HEADERS = "X-Ca-Signature-Headers";
+    //请求时间戳
+    public static final String X_CA_TIMESTAMP = "X-Ca-Timestamp";
+    //请求放重放Nonce,15分钟内保持唯一,建议使用UUID
+    public static final String X_CA_NONCE = "X-Ca-Nonce";
+    //APP KEY
+    public static final String X_CA_KEY = "X-Ca-Key";
+}

+ 198 - 0
src/main/java/info/aspirecn/iov/sjjh/entity/Request.java

@@ -0,0 +1,198 @@
+/*
+ * 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
+ *
+ *     http://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.
+ */
+package info.aspirecn.iov.sjjh.entity;
+
+import info.aspirecn.iov.sjjh.enums.Method;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Request
+ */
+public class Request {
+
+    public Request() {
+    }
+
+    public Request(Method method, String host, String path, String appKey, String appSecret, int timeout) {
+        this.method = method;
+        this.host = host;
+        this.path = path;
+        this.appKey = appKey;
+        this.appSecret = appSecret;
+        this.timeout = timeout;
+    }
+
+    /**
+     * (必选)请求方法
+     */
+    private Method method;
+
+    /**
+     * (必选)Host
+     */
+    private String host;
+
+    /**
+     * (必选)Path
+     */
+    private String path;
+
+    /**
+     * (必选)APP KEY
+     */
+    private String appKey;
+
+    /**
+     * (必选)APP密钥
+     */
+    private String appSecret;
+
+    /**
+     * (必选)超时时间,单位毫秒,设置零默认使用com.aliyun.apigateway.demo.constant.Constants.DEFAULT_TIMEOUT
+     */
+    private int timeout;
+
+    /**
+     * (可选) HTTP头
+     */
+    private Map<String, String> headers;
+
+    /**
+     * (可选) Querys
+     */
+    private Map<String, String> querys;
+
+    /**
+     * (可选)表单参数
+     */
+    private Map<String, String> bodys;
+
+    /**
+     * (可选)字符串Body体
+     */
+    private String stringBody;
+
+    /**
+     * (可选)字节数组类型Body体
+     */
+    private byte[] bytesBody;
+
+    /**
+     * (可选)自定义参与签名Header前缀
+     */
+    private List<String> signHeaderPrefixList;
+
+    public Method getMethod() {
+        return method;
+    }
+
+    public void setMethod(Method method) {
+        this.method = method;
+    }
+
+    public String getHost() {
+        return host;
+    }
+
+    public void setPath(String path) {
+        this.path = path;
+    }
+
+    public String getPath() {
+        return path;
+    }
+
+    public void setHost(String host) {
+        this.host = host;
+    }
+
+    public String getAppKey() {
+        return appKey;
+    }
+
+    public void setAppKey(String appKey) {
+        this.appKey = appKey;
+    }
+
+    public String getAppSecret() {
+        return appSecret;
+    }
+
+    public void setAppSecret(String appSecret) {
+        this.appSecret = appSecret;
+    }
+
+    public int getTimeout() {
+        return timeout;
+    }
+
+    public void setTimeout(int timeout) {
+        this.timeout = timeout;
+    }
+
+    public Map<String, String> getHeaders() {
+        return headers;
+    }
+
+    public void setHeaders(Map<String, String> headers) {
+        this.headers = headers;
+    }
+
+    public Map<String, String> getQuerys() {
+        return querys;
+    }
+
+    public void setQuerys(Map<String, String> querys) {
+        this.querys = querys;
+    }
+
+    public Map<String, String> getBodys() {
+        return bodys;
+    }
+
+    public void setBodys(Map<String, String> bodys) {
+        this.bodys = bodys;
+    }
+
+    public String getStringBody() {
+        return stringBody;
+    }
+
+    public void setStringBody(String stringBody) {
+        this.stringBody = stringBody;
+    }
+
+    public byte[] getBytesBody() {
+        return bytesBody;
+    }
+
+    public void setBytesBody(byte[] bytesBody) {
+        this.bytesBody = bytesBody;
+    }
+
+    public List<String> getSignHeaderPrefixList() {
+        return signHeaderPrefixList;
+    }
+
+    public void setSignHeaderPrefixList(List<String> signHeaderPrefixList) {
+        this.signHeaderPrefixList = signHeaderPrefixList;
+    }
+}

+ 28 - 0
src/main/java/info/aspirecn/iov/sjjh/entity/RequestObject.java

@@ -0,0 +1,28 @@
+package info.aspirecn.iov.sjjh.entity;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+@Data
+public class RequestObject implements Serializable {
+    // 车牌号
+    private String vehicleNumber;
+
+    // 车牌颜色
+    private String licensePlateTypeCode;
+
+    // 查询起始时间(yyyyMMddHHmmss格式)
+    private String startTime;
+
+    // 查询截止时间(yyyyMMddHHmmss格式)
+    private String endTime;
+
+    private String partyFunctionCode;
+}

+ 82 - 0
src/main/java/info/aspirecn/iov/sjjh/entity/Response.java

@@ -0,0 +1,82 @@
+package info.aspirecn.iov.sjjh.entity;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class Response {
+    private int statusCode;
+    private String contentType;
+    private String requestId;
+    private String errorMessage;
+    private Map<String, String> headers;
+    private String body;
+
+    public Response() {
+
+    }
+
+	public int getStatusCode() {
+		return statusCode;
+	}
+
+	public void setStatusCode(int statusCode) {
+		this.statusCode = statusCode;
+	}
+
+	public String getContentType() {
+		return contentType;
+	}
+
+	public void setContentType(String contentType) {
+		this.contentType = contentType;
+	}
+
+	public String getRequestId() {
+		return requestId;
+	}
+
+	public void setRequestId(String requestId) {
+		this.requestId = requestId;
+	}
+
+	public String getErrorMessage() {
+		return errorMessage;
+	}
+
+	public void setErrorMessage(String errorMessage) {
+		this.errorMessage = errorMessage;
+	}
+
+	public Map<String, String> getHeaders() {
+		return headers;
+	}
+
+	public String getHeader(String key) {
+		if (null != headers) {
+			return headers.get(key);
+		} else {
+			return null;
+		}
+	}
+
+	public void setHeaders(Map<String, String> headers) {
+		this.headers = headers;
+	}
+
+	public void setHeader(String key, String value) {
+		if (null == this.headers) {
+			this.headers = new HashMap<String, String>();
+		}
+		this.headers.put(key, value);
+	}
+
+	public String getBody() {
+		return body;
+	}
+
+	public void setBody(String body) {
+		this.body = body;
+	}
+
+
+}

+ 38 - 0
src/main/java/info/aspirecn/iov/sjjh/entity/VehicleHistoryPositionRequestParam.java

@@ -0,0 +1,38 @@
+package info.aspirecn.iov.sjjh.entity;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+@Data
+public class VehicleHistoryPositionRequestParam {
+    // 车牌号
+    @NotNull(message = "参数名错误")
+    private String plateNumber;
+
+    // 车牌颜色
+    @NotNull(message = "参数名错误")
+    private String plateColor;
+
+    // 查询起始时间(yyyyMMddHHmmss格式)
+    @NotNull(message = "参数名错误")
+    private String startTime;
+
+    // 查询截止时间(yyyyMMddHHmmss格式)
+    @NotNull(message = "参数名错误")
+    private String endTime;
+
+    // 收货地址的国家行政区划代码
+    @NotNull(message = "参数名错误")
+    private String receiptCountrySubdivisionCode;
+
+    // 装货地址的国家行政区划代码
+    @NotNull(message = "参数名错误")
+    private String loadingCountrySubdivisionCode;
+}

+ 27 - 0
src/main/java/info/aspirecn/iov/sjjh/entity/VehicleHistoryPositionResponse.java

@@ -0,0 +1,27 @@
+package info.aspirecn.iov.sjjh.entity;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+@Data
+public class VehicleHistoryPositionResponse {
+    private String resultCode;
+    private String resultMsg;
+    private String traceId;
+    private List<Data> data;
+
+    @lombok.Data
+    public static class Data {
+        private String positionTime;
+        private String longitudeDegree;
+        private String latitudeDegree;
+        private String speed;
+        private String directionOfVehicle;
+    }
+
+}

+ 42 - 0
src/main/java/info/aspirecn/iov/sjjh/entity/geocoding/AddressComponent.java

@@ -0,0 +1,42 @@
+package info.aspirecn.iov.sjjh.entity.geocoding;
+
+import lombok.Data;
+import lombok.ToString;
+
+/**
+ * (注意,国外行政区划,字段仅代表层级)
+ * @author BZH
+ *
+ */
+@Data
+@ToString(callSuper = true, includeFieldNames = true)
+public class AddressComponent {
+	/**国家*/
+	private String country;
+	/**省名*/
+	private String province;
+	/**城市名*/
+	private String city;
+	private int city_level;
+	/**区县名*/
+	private String district;
+	/**乡镇名*/
+	private String town;
+	/**乡镇id*/
+	private String town_code;
+	/**街道名(行政区划中的街道层级)*/
+	private String street;
+	/**街道门牌号*/
+	private String street_number;
+	/**行政区划代码*/
+	private String adcode;
+	/**国家代码*/
+	private int country_code;
+	private String country_code_iso;
+	private String country_code_iso2;
+	/**相对当前坐标点的方向,当有门牌号的时候返回数据*/
+	private String direction;
+	/**相对当前坐标点的距离,当有门牌号的时候返回数据*/
+	private String distance;
+
+}

+ 52 - 0
src/main/java/info/aspirecn/iov/sjjh/entity/geocoding/GeocodingResponseObject.java

@@ -0,0 +1,52 @@
+package info.aspirecn.iov.sjjh.entity.geocoding;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.ToString;
+
+import java.util.List;
+
+/**
+ * 逆地理编码接口响应对象
+ * @author bzh
+ *
+ */
+@Data
+@ToString(callSuper = true, includeFieldNames = true)
+public class GeocodingResponseObject {
+
+	/**返回结果状态值, 成功返回0,其他值请查看下方返回码状态表。*/
+	@JsonProperty("status")
+	private int status;
+	@JsonProperty("result")
+	private GeocodingResponseChildObject result;
+
+	@Data
+	public static class GeocodingResponseChildObject {
+		/**经纬度坐标*/
+		@JsonProperty("location")
+		private Location location;
+		/**结构化地址信息*/
+		@JsonProperty("formatted_address")
+		private String formatted_address;
+		/**坐标所在商圈信息,如 "人民大学,中关村,苏州街"。最多返回3个。*/
+		@JsonProperty("business")
+		private String business;
+		@JsonProperty("addressComponent")
+		private AddressComponent addressComponent;
+		/**(周边poi数组)*/
+		@JsonProperty("pois")
+		private List<Pois> pois;
+		@JsonProperty("poiRegions")
+		private List<PoiRegions> poiRegions;
+		@JsonProperty("roads")
+		private List<String> roads;
+		/**当前位置结合POI的语义化结果描述。*/
+		@JsonProperty("sematic_description")
+		private String sematic_description;
+		/**百度定义的城市id(正常更新与维护,但建议使用adcode)*/
+		@JsonProperty("cityCode")
+		private int cityCode;
+	}
+
+}

+ 17 - 0
src/main/java/info/aspirecn/iov/sjjh/entity/geocoding/Location.java

@@ -0,0 +1,17 @@
+package info.aspirecn.iov.sjjh.entity.geocoding;
+
+import lombok.Data;
+import lombok.ToString;
+
+/**
+ * 经纬度坐标
+ * @author BZH
+ *
+ */
+@Data
+@ToString(callSuper = true, includeFieldNames = true)
+public class Location {
+
+	private float lat;
+	private float lng;
+}

+ 17 - 0
src/main/java/info/aspirecn/iov/sjjh/entity/geocoding/PoiRegions.java

@@ -0,0 +1,17 @@
+package info.aspirecn.iov.sjjh.entity.geocoding;
+
+import lombok.Data;
+import lombok.ToString;
+
+@Data
+@ToString(callSuper = true, includeFieldNames = true)
+public class PoiRegions {
+
+	/**请求中的坐标与所归属区域面的相对位置关系*/
+	private String direction_desc;
+	/**归属区域面名称*/
+	private String name;
+	/**归属区域面类型*/
+	private String tag;
+
+}

+ 37 - 0
src/main/java/info/aspirecn/iov/sjjh/entity/geocoding/Pois.java

@@ -0,0 +1,37 @@
+package info.aspirecn.iov.sjjh.entity.geocoding;
+
+import lombok.Data;
+import lombok.ToString;
+
+/**
+ * (周边poi数组)
+ * @author BZH
+ *
+ */
+@Data
+@ToString(callSuper = true, includeFieldNames = true)
+public class Pois {
+	/**地址信息*/
+	private String addr;
+	/**数据来源(已废弃)*/
+	private String cp;
+	/**和当前坐标点的方向*/
+	private String direction;
+	/**离坐标点距离*/
+	private int distance;
+	/**poi名称*/
+	private String name;
+	/**poi类型,如’美食;中餐厅’。tag与poiType字段均为poi类型,建议使用tag字段,信息更详细*/
+	private String tag;
+	/**poi坐标{x,y}*/
+	private float point;
+	/**电话*/
+	private int tel;
+	/**poi唯一标识*/
+	private String uid;
+	/**邮编*/
+	private int zip;
+	/**poi对应的主点poi(如,海底捞的主点为上地华联,该字段则为上地华联的poi信息。如无,该字段为空),包含子字段和pois基础召回字段相同。*/
+	private String parent_poi;
+
+}

+ 9 - 0
src/main/java/info/aspirecn/iov/sjjh/enums/Method.java

@@ -0,0 +1,9 @@
+package info.aspirecn.iov.sjjh.enums;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+public enum Method {
+    GET, POST_FORM, POST_STRING, POST_BYTES, PUT_FORM, PUT_STRING, PUT_BYTES, DELETE;
+}

+ 18 - 0
src/main/java/info/aspirecn/iov/sjjh/service/VehicleService.java

@@ -0,0 +1,18 @@
+package info.aspirecn.iov.sjjh.service;
+
+import info.aspirecn.iov.sjjh.commons.lang.ChannelTypeHandleResponseObject;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+public interface VehicleService {
+
+    /**
+     * 车辆历史轨迹
+     */
+    ChannelTypeHandleResponseObject vehicleHistoryPositionQuery(HttpServletRequest request, String customBody,
+                                                                        int outTime);
+}

+ 311 - 0
src/main/java/info/aspirecn/iov/sjjh/service/impl/VehicleServiceImpl.java

@@ -0,0 +1,311 @@
+package info.aspirecn.iov.sjjh.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import info.aspirecn.iov.sjjh.commons.lang.ChannelTypeHandleResponseObject;
+import info.aspirecn.iov.sjjh.commons.lang.Constant;
+import info.aspirecn.iov.sjjh.config.SupplierConfig;
+import info.aspirecn.iov.sjjh.constant.Constants;
+import info.aspirecn.iov.sjjh.entity.RequestObject;
+import info.aspirecn.iov.sjjh.entity.Response;
+import info.aspirecn.iov.sjjh.entity.VehicleHistoryPositionRequestParam;
+import info.aspirecn.iov.sjjh.entity.VehicleHistoryPositionResponse;
+import info.aspirecn.iov.sjjh.entity.geocoding.GeocodingResponseObject;
+import info.aspirecn.iov.sjjh.service.VehicleService;
+import info.aspirecn.iov.sjjh.util.DateUtil;
+import info.aspirecn.iov.sjjh.util.PostUtil;
+import info.aspirecn.iov.sjjh.util.ValidateParamUtil;
+import info.aspirecn.rdc.aspirecloud.node.except.utils.ErrorUtils;
+import lombok.extern.slf4j.Slf4j;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+@Slf4j
+@Service
+public class VehicleServiceImpl implements VehicleService {
+    @Autowired
+    private SupplierConfig supplierConfig;
+
+    private OkHttpClient okHttpClient = new OkHttpClient.Builder().build();
+
+    @Override
+    public ChannelTypeHandleResponseObject vehicleHistoryPositionQuery(HttpServletRequest request, String customBody, int outTime) {
+        ChannelTypeHandleResponseObject ret = new ChannelTypeHandleResponseObject();
+        ret.setIsCharge(Constant.INTERFACE_QUERY_NO_FEE);
+        ret.setCode(Constant.SUCCESS);
+        String upstreamCode = "" + Constant.LOG_UPSTREAM_DEFAULT_RESPONSE_CODE;
+        request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
+        if (outTime <= Constants.PARA_ZERO) {
+            outTime = Constant.HTTPCLIENT_CONNECTTIMEOUT;
+        }
+
+        log.info("supplier-vehicle.vehicleHistoryPositionQuery---customBody={},outTime={}", customBody, outTime);
+        // 解析参数
+        ObjectMapper objectMapper = new ObjectMapper();
+        VehicleHistoryPositionRequestParam requestParam;
+        try {
+            requestParam = objectMapper.readValue(customBody, VehicleHistoryPositionRequestParam.class);
+        } catch (IOException ioe) {
+            log.info("supplier-vehicle.vehicleHistoryPositionQuery-解析参数Exception:{}", ioe);
+            ErrorUtils.captureException(ioe);
+            ret.setCode(Constant.FAIL);
+            ret.setResultCode(Constant.INVALID_PARAMETER_CODE);
+            ret.setResultBody(Constant.INVALID_PARAMETER);
+            ret.setResultDesc(Constant.INVALID_PARAMETER);
+            return ret;
+        }
+
+        // 参数校验
+        if (!ValidateParamUtil.validateRequestParams(requestParam)) {
+            ret.setCode(Constant.FAIL);
+            ret.setResultCode(Constant.INVALID_PARAMETER_CODE);
+            ret.setResultBody(Constant.INVALID_PARAMETER);
+            ret.setResultDesc(Constant.INVALID_PARAMETER);
+            return ret;
+        }
+
+        // 接口调用
+        Response response = new Response();
+        try {
+            RequestObject requestObject = new RequestObject();
+            requestObject.setVehicleNumber(requestParam.getPlateNumber());
+            requestObject.setLicensePlateTypeCode(requestParam.getPlateColor());
+            requestObject.setStartTime(DateUtil.addHours(requestParam.getStartTime(), supplierConfig.getReduceHours()));
+            requestObject.setEndTime(DateUtil.addHours(requestParam.getEndTime(), supplierConfig.getAddHours()));
+            requestObject.setPartyFunctionCode(supplierConfig.getPartyFunctionCode());
+            response = PostUtil.postString(supplierConfig.getHistoryPositionUrl(), JSON.toJSONString(requestObject),
+                    supplierConfig.getAppKey(), supplierConfig.getAppSecret(), outTime);
+            System.out.println(JSON.toJSONString(response));
+        } catch (IOException e) {
+            log.info("supplier-vehicle.vehicleHistoryPositionQuery-IOException:{}", e);
+            ErrorUtils.captureException(e);
+            ret.setCode(Constant.REQUEST_TIMEOUT);
+        } catch (Exception e) {
+            log.info("supplier-vehicle.vehicleHistoryPositionQuery-Exception:{}", e);
+            ErrorUtils.captureException(e);
+            ret.setCode(Constant.FAIL);
+        }
+        upstreamCode = setVehicleHistoryPositionQueryResponse(ret, response, requestParam);
+        request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
+        return ret;
+    }
+
+    private String setVehicleHistoryPositionQueryResponse(ChannelTypeHandleResponseObject ret, Response response,
+                                                          VehicleHistoryPositionRequestParam requestParam) {
+        String upstreamCode = "";
+        if (response.getStatusCode() == Constants.STATUS_CODE_200) {
+            VehicleHistoryPositionResponse positionResponse = JSON.toJavaObject(JSON.parseObject(response.getBody()),
+                    VehicleHistoryPositionResponse.class);
+            upstreamCode = positionResponse.getResultCode();
+            if (positionResponse.getResultCode().equals(Constants.RESULT_CODE_0)) {
+                if (positionResponse.getData() != null && positionResponse.getData().size() > 0) {
+                    boolean result = vehicleHistoryPositionQueryByBaidu(positionResponse.getData(), requestParam);
+                    if (result) {
+                        ret.setResultCode(Constant.MATCH_CODE);
+                        ret.setResultBody(positionResponse.getData());
+                        ret.setResultDesc(Constant.QUERY_SUCCESS);
+                    } else {
+                        ret.setResultCode(Constant.UN_MATCH_CODE);
+                        ret.setResultBody("核验不一致");
+                        ret.setResultDesc(Constant.QUERY_SUCCESS);
+                    }
+                } else {
+                    ret.setResultCode(Constant.UN_FIND_NUM_CODE);
+                    ret.setResultBody(Constants.NO_RESULT);
+                    ret.setResultDesc(Constants.NO_RESULT);
+                }
+            } else if (positionResponse.getResultCode().equals(Constants.RESULT_CODE_110000)) {
+                ret.setResultCode(Constant.UN_FIND_NUM_CODE);
+                ret.setResultBody(Constants.NO_RESULT);
+                ret.setResultDesc(Constants.NO_RESULT);
+            } else {
+                ret.setResultCode(Constant.OTHER_ERROR_CODE);
+                ret.setResultBody(Constant.OTHER_ERROR);
+                ret.setResultDesc(Constant.OTHER_ERROR);
+            }
+        } else {
+            ret.setResultCode(Constant.OTHER_ERROR_CODE);
+            ret.setResultBody(Constant.OTHER_ERROR);
+            ret.setResultDesc(Constant.OTHER_ERROR);
+            upstreamCode += response.getStatusCode();
+        }
+        return upstreamCode;
+    }
+
+    private boolean vehicleHistoryPositionQueryByBaidu(List<VehicleHistoryPositionResponse.Data> positionList,
+                                                    VehicleHistoryPositionRequestParam requestParam) {
+        /**
+         * 1、云雁调取A-到B+之间所有的车辆轨迹(每30秒有一个经纬度数据)。
+         * 2、从A-到A+时间区间中每半个小时抽取一个点位信息的行政区划代码集合,将此集合与A点(起点)行政区划代码进行比对,只要有一点比对一致则视为此点核验通过。
+         * 3、从B-到B+时间区间中每半个小时抽取一个点位信息并转化为行政区划代码集合,将此集合与B点(终点)行政区划代码进行比对,只要有一点比对一致则视为此点核验通过。
+         * 4、A点到B点时间小于8小时情况依然按次逻辑处理,不做区分。
+         * 5、A点和B点都核验通过下视为该条轨迹核验通过,否则为核验不通过。
+         * 6、核验不通过情况下返回核验不通过。
+         * 7、核验结果一致的情况下输出结果,并输出A点到B点轨迹信息。
+         */
+        // A-
+        String startTimeA = DateUtil.addHours(requestParam.getStartTime(), supplierConfig.getReduceHours());
+        // A+
+        String endTimeA = DateUtil.addHours(requestParam.getStartTime(), supplierConfig.getAddHours());
+        // B-
+        String startTimeB = DateUtil.addHours(requestParam.getEndTime(), supplierConfig.getReduceHours());
+        // B+
+        String endTimeB = DateUtil.addHours(requestParam.getEndTime(), supplierConfig.getAddHours());
+
+        // 4小时*2=8小时(A-A+间隔),8小时*2=16个点(每半个小时取1个点)
+        int pointNumber = supplierConfig.getAddHours()*2*2;
+        String tempStartTime = startTimeA;
+        boolean checkResultA = false;
+        // todo 这个集合为了查看位置是否正确
+//        List<VehicleHistoryPositionResponse.Data> verificationPositionListA = new ArrayList<>();
+//        for (VehicleHistoryPositionResponse.Data position : positionList) {
+//            String startTime = tempStartTime;
+//            String endTime = DateUtil.addMinutes(startTime, 30);
+//            if (Long.parseLong(position.getPositionTime()) > Long.parseLong(startTime)
+//                    && Long.parseLong(position.getPositionTime()) <= Long.parseLong(endTime)) {
+//                verificationPositionListA.add(position);
+//                tempStartTime = endTime;
+//                if (getGeocodingCheck(3000,
+//                    (position.getLatitudeDegree() + "," + position.getLongitudeDegree()),
+//                    requestParam.getLoadingCountrySubdivisionCode())) {
+//                    checkResultA = true;
+//                }
+//            }
+//
+//        }
+//            // todo 这个集合为了查看位置是否正确
+//        List<VehicleHistoryPositionResponse.Data> verificationPositionListB = new ArrayList<>();
+//        tempStartTime = startTimeB;
+//        boolean checkResultB = false;
+//        for (VehicleHistoryPositionResponse.Data position : positionList) {
+//            String startTime = tempStartTime;
+//            String endTime = DateUtil.addMinutes(startTime, 30);
+//            if (Long.parseLong(position.getPositionTime()) > Long.parseLong(startTime)
+//                    && Long.parseLong(position.getPositionTime()) <= Long.parseLong(endTime)) {
+//                verificationPositionListB.add(position);
+//                tempStartTime = endTime;
+//                if (getGeocodingCheck(3000,
+//                        (position.getLatitudeDegree() + "," + position.getLongitudeDegree()),
+//                        requestParam.getLoadingCountrySubdivisionCode())) {
+//                    checkResultB = true;
+//                }
+//            }
+//
+//        }
+
+
+//        List<String> pointListA = new ArrayList<>();
+//        String tempStartTime = startTimeA;
+//        pointListA.add(tempStartTime);
+//        for (int i = 0; i < pointNumber; i++) {
+//            tempStartTime = DateUtil.addMinutes(tempStartTime, 30);
+//            pointListA.add(tempStartTime);
+//        }
+//        List<VehicleHistoryPositionResponse.Data> verificationPositionListA = new ArrayList<>();
+//        for (VehicleHistoryPositionResponse.Data position : positionList) {
+//            for (int i = 0; i < pointNumber; i++) {
+//                Long startTime = Long.parseLong(pointListA.get(i));
+//                Long endTime = Long.parseLong(pointListA.get(i+1));
+//                Long positionTime = Long.parseLong(position.getPositionTime());
+//                if (positionTime >= startTime && positionTime < endTime) {
+//                    verificationPositionListA.add(position);
+//                    pointListA.remove(i);
+//                    break;
+//                }
+//            }
+//            if (verificationPositionListA.size() == pointNumber) {
+//                break;
+//            }
+//        }
+//        boolean positionA = false;
+//        for (int i = 0; i < verificationPositionListA.size(); i++) {
+//            if (getGeocodingCheck(3000,
+//                    (verificationPositionListA.get(i).getLatitudeDegree() + "," + verificationPositionListA.get(i).getLongitudeDegree()),
+//                    requestParam.getLoadingCountrySubdivisionCode())) {
+//                positionA = true;
+//                break;
+//            }
+//        }
+//
+//        List<String> pointListB = new ArrayList<>();
+//        tempStartTime = startTimeB;
+//        pointListB.add(tempStartTime);
+//        for (int i = 0; i < pointNumber; i++) {
+//            tempStartTime = DateUtil.addMinutes(tempStartTime, 30);
+//            pointListB.add(tempStartTime);
+//        }
+//        List<VehicleHistoryPositionResponse.Data> verificationPositionListB = new ArrayList<>();
+//        for (int i = 0; i < pointNumber; i++) {
+//            for (VehicleHistoryPositionResponse.Data position : positionList) {
+//                Long startTime = Long.parseLong(pointListB.get(i));
+//                Long endTime = Long.parseLong(pointListB.get(i+1));
+//                Long positionTime = Long.parseLong(position.getPositionTime());
+//                if (positionTime >= startTime && positionTime < endTime) {
+//                    verificationPositionListB.add(position);
+//                    break;
+//                }
+//            }
+//            if (verificationPositionListB.size() == pointNumber) {
+//                break;
+//            }
+//        }
+//        boolean positionB = false;
+//        for (int i = 0; i < verificationPositionListB.size(); i++) {
+//            if (getGeocodingCheck(3000,
+//                    (verificationPositionListB.get(i).getLatitudeDegree() + "," + verificationPositionListB.get(i).getLongitudeDegree()),
+//                    requestParam.getLoadingCountrySubdivisionCode())) {
+//                positionB = true;
+//                break;
+//            }
+//        }
+//        if (positionA && positionB) {
+//            return true;
+//        } else {
+//            return false;
+//        }
+        return false;
+    }
+
+    /**
+     * 校验省区划代码是否一致
+     */
+    private Boolean getGeocodingCheck(int outTime, String location,String adcode) {
+        try {
+            ObjectMapper objectMapper = new ObjectMapper();
+            String requestUrl = supplierConfig.getBaiduUrl() + "?ak="+ supplierConfig.getBaiduAk()
+                    + "&output=json&coordtype=wgs84ll&location=" + location;
+            Request okRequest = new Request.Builder().get().url(requestUrl).build();
+            OkHttpClient client = okHttpClient.newBuilder().connectTimeout(outTime, TimeUnit.MILLISECONDS)
+                    .readTimeout(outTime, TimeUnit.MILLISECONDS).writeTimeout(outTime, TimeUnit.MILLISECONDS).build();
+            okhttp3.Response response = client.newCall(okRequest).execute();
+            String responseContext = response.body().string();
+            GeocodingResponseObject responseObject = objectMapper.readValue(responseContext,
+                    GeocodingResponseObject.class);
+            log.info("supplier-vehicle.getGeocodingCheck.responseObject={}", responseContext);
+            if (responseObject!=null) {
+                if (responseObject.getStatus()==0&&adcode.equals(responseObject.getResult().getAddressComponent().getAdcode())) {
+                    return true;
+                }
+            }
+            return false;
+        } catch (Exception e) {
+            ErrorUtils.captureException(e);
+            log.info("supplier-vehicle.Exception.e={}", e);
+        }
+        return false;
+    }
+}

+ 78 - 0
src/main/java/info/aspirecn/iov/sjjh/util/Client.java

@@ -0,0 +1,78 @@
+package info.aspirecn.iov.sjjh.util;
+
+import info.aspirecn.iov.sjjh.entity.Request;
+import info.aspirecn.iov.sjjh.entity.Response;
+import info.aspirecn.iov.sjjh.enums.Method;
+
+/**
+ * Client
+ */
+public class Client {
+    /**
+     * 发送请求
+     *
+     * @param request request对象
+     * @return Response
+     * @throws Exception
+     */
+    public static Response execute(Request request) throws Exception {
+        switch (request.getMethod()) {
+            case GET:
+                return HttpUtil.httpGet(request.getHost(), request.getPath(),
+                		request.getTimeout(),
+                		request.getHeaders(),
+                		request.getQuerys(),
+                		request.getSignHeaderPrefixList(),
+                		request.getAppKey(), request.getAppSecret());
+            case POST_FORM:
+                return HttpUtil.httpPost(request.getHost(), request.getPath(),
+                		request.getTimeout(),
+                		request.getHeaders(),
+                		request.getQuerys(),
+                		request.getBodys(),
+                		request.getSignHeaderPrefixList(),
+                		request.getAppKey(), request.getAppSecret());
+            case POST_STRING:
+                return HttpUtil.httpPost(request.getHost(), request.getPath(),
+                		request.getTimeout(),
+                		request.getHeaders(),
+                		request.getQuerys(),
+                		request.getStringBody(),
+                		request.getSignHeaderPrefixList(),
+                		request.getAppKey(), request.getAppSecret());
+            case POST_BYTES:
+                return HttpUtil.httpPost(request.getHost(), request.getPath(),
+                		request.getTimeout(),
+                		request.getHeaders(),
+                		request.getQuerys(),
+                		request.getBytesBody(),
+                		request.getSignHeaderPrefixList(),
+                		request.getAppKey(), request.getAppSecret());
+            case PUT_STRING:
+                return HttpUtil.httpPut(request.getHost(), request.getPath(),
+                		request.getTimeout(),
+                		request.getHeaders(),
+                		request.getQuerys(),
+                		request.getStringBody(),
+                		request.getSignHeaderPrefixList(),
+                		request.getAppKey(), request.getAppSecret());
+            case PUT_BYTES:
+                return HttpUtil.httpPut(request.getHost(), request.getPath(),
+                		request.getTimeout(),
+                		request.getHeaders(),
+                		request.getQuerys(),
+                		request.getBytesBody(),
+                		request.getSignHeaderPrefixList(),
+                		request.getAppKey(), request.getAppSecret());
+            case DELETE:
+                return HttpUtil.httpDelete(request.getHost(), request.getPath(),
+                		request.getTimeout(),
+                		request.getHeaders(),
+                		request.getQuerys(),
+                		request.getSignHeaderPrefixList(),
+                		request.getAppKey(), request.getAppSecret());
+            default:
+                throw new IllegalArgumentException(String.format("unsupported method:%s", request.getMethod()));
+        }
+    }
+}

+ 53 - 0
src/main/java/info/aspirecn/iov/sjjh/util/DateUtil.java

@@ -0,0 +1,53 @@
+package info.aspirecn.iov.sjjh.util;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+public class DateUtil {
+    public static String addHours(String time, int hours) {
+        SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
+        Date date = null;
+        try {
+            date = format.parse(time);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        if (date == null) {
+            return "";
+        }
+        System.out.println("front:" + format.format(date)); //显示输入的日期
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.add(Calendar.HOUR, hours);// 24小时制
+        date = cal.getTime();
+        String result = format.format(date);
+        System.out.println("after:" + result);  //显示更新后的日期
+        return result;
+    }
+
+    public static String addMinutes(String time, int minutes) {
+        SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
+        Date date = null;
+        try {
+            date = format.parse(time);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        if (date == null) {
+            return "";
+        }
+        System.out.println("front:" + format.format(date)); //显示输入的日期
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.add(Calendar.MINUTE, minutes);// 24小时制
+        date = cal.getTime();
+        String result = format.format(date);
+        System.out.println("after:" + result);  //显示更新后的日期
+        return result;
+    }
+}

+ 482 - 0
src/main/java/info/aspirecn/iov/sjjh/util/HttpUtil.java

@@ -0,0 +1,482 @@
+/*
+ * 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
+ *
+ *     http://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.
+ */
+package info.aspirecn.iov.sjjh.util;
+
+import com.alibaba.fastjson.JSON;
+import info.aspirecn.iov.sjjh.constant.*;
+import info.aspirecn.iov.sjjh.entity.Response;
+import org.apache.commons.lang.StringUtils;
+import org.apache.http.Header;
+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 org.apache.http.params.CoreConnectionPNames;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URLEncoder;
+import java.nio.ByteBuffer;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.WritableByteChannel;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.X509Certificate;
+import java.util.*;
+
+/**
+ * Http工具类
+ */
+public class HttpUtil {
+    /**
+     * HTTP GET
+     * @param host
+     * @param path
+     * @param connectTimeout
+     * @param headers
+     * @param querys
+     * @param signHeaderPrefixList
+     * @param appKey
+     * @param appSecret
+     * @return
+     * @throws Exception
+     */
+    public static Response httpGet(String host, String path, int connectTimeout, Map<String, String> headers, Map<String, String> querys, List<String> signHeaderPrefixList, String appKey, String appSecret)
+            throws Exception {
+        headers = initialBasicHeader(HttpMethod.GET, path, headers, querys, null, signHeaderPrefixList, appKey, appSecret);
+
+        HttpClient httpClient = wrapClient(host);
+        httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, getTimeout(connectTimeout));
+
+        HttpGet get = new HttpGet(initUrl(host, path, querys));
+
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+            get.addHeader(e.getKey(), MessageDigestUtil.utf8ToIso88591(e.getValue()));
+        }
+
+        return convert(httpClient.execute(get));
+    }
+
+    /**
+     * HTTP POST表单
+     * @param host
+     * @param path
+     * @param connectTimeout
+     * @param headers
+     * @param querys
+     * @param bodys
+     * @param signHeaderPrefixList
+     * @param appKey
+     * @param appSecret
+     * @return
+     * @throws Exception
+     */
+    public static Response httpPost(String host, String path, int connectTimeout, Map<String, String> headers, Map<String, String> querys, Map<String, String> bodys, List<String> signHeaderPrefixList, String appKey, String appSecret)
+            throws Exception {
+        if (headers == null) {
+            headers = new HashMap<String, String>();
+        }
+
+        headers.put(HttpHeader.HTTP_HEADER_CONTENT_TYPE, ContentType.CONTENT_TYPE_FORM);
+
+        headers = initialBasicHeader(HttpMethod.POST, path, headers, querys, bodys, signHeaderPrefixList, appKey, appSecret);
+
+        HttpClient httpClient = wrapClient(host);
+        httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, getTimeout(connectTimeout));
+
+        HttpPost post = new HttpPost(initUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+            post.addHeader(e.getKey(), MessageDigestUtil.utf8ToIso88591(e.getValue()));
+        }
+
+        UrlEncodedFormEntity formEntity = buildFormEntity(bodys);
+        if (formEntity != null) {
+            post.setEntity(formEntity);
+        }
+
+        return convert(httpClient.execute(post));
+    }
+
+    /**
+     * Http POST 字符串
+     * @param host
+     * @param path
+     * @param connectTimeout
+     * @param headers
+     * @param querys
+     * @param body
+     * @param signHeaderPrefixList
+     * @param appKey
+     * @param appSecret
+     * @return
+     * @throws Exception
+     */
+    public static Response httpPost(String host, String path, int connectTimeout, Map<String, String> headers, Map<String, String> querys, String body, List<String> signHeaderPrefixList, String appKey, String appSecret)
+            throws Exception {
+    	headers = initialBasicHeader(HttpMethod.POST, path, headers, querys, null, signHeaderPrefixList, appKey, appSecret);
+
+    	HttpClient httpClient = wrapClient(host);
+        httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, getTimeout(connectTimeout));
+
+        HttpPost post = new HttpPost(initUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+            post.addHeader(e.getKey(), MessageDigestUtil.utf8ToIso88591(e.getValue()));
+        }
+
+        if (StringUtils.isNotBlank(body)) {
+            post.setEntity(new StringEntity(body, Constants.ENCODING));
+
+        }
+
+        return convert(httpClient.execute(post));
+    }
+
+    /**
+     * HTTP POST 字节数组
+     * @param host
+     * @param path
+     * @param connectTimeout
+     * @param headers
+     * @param querys
+     * @param bodys
+     * @param signHeaderPrefixList
+     * @param appKey
+     * @param appSecret
+     * @return
+     * @throws Exception
+     */
+    public static Response httpPost(String host, String path, int connectTimeout, Map<String, String> headers, Map<String, String> querys, byte[] bodys, List<String> signHeaderPrefixList, String appKey, String appSecret)
+            throws Exception {
+    	headers = initialBasicHeader(HttpMethod.POST, path, headers, querys, null, signHeaderPrefixList, appKey, appSecret);
+
+    	HttpClient httpClient = wrapClient(host);
+        httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, getTimeout(connectTimeout));
+
+        HttpPost post = new HttpPost(initUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+            post.addHeader(e.getKey(), MessageDigestUtil.utf8ToIso88591(e.getValue()));
+        }
+
+        if (bodys != null) {
+            post.setEntity(new ByteArrayEntity(bodys));
+        }
+
+        return convert(httpClient.execute(post));
+    }
+
+    /**
+     * HTTP PUT 字符串
+     * @param host
+     * @param path
+     * @param connectTimeout
+     * @param headers
+     * @param querys
+     * @param body
+     * @param signHeaderPrefixList
+     * @param appKey
+     * @param appSecret
+     * @return
+     * @throws Exception
+     */
+    public static Response httpPut(String host, String path, int connectTimeout, Map<String, String> headers, Map<String, String> querys, String body, List<String> signHeaderPrefixList, String appKey, String appSecret)
+            throws Exception {
+    	headers = initialBasicHeader(HttpMethod.PUT, path, headers, querys, null, signHeaderPrefixList, appKey, appSecret);
+
+    	HttpClient httpClient = wrapClient(host);
+        httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, getTimeout(connectTimeout));
+
+        HttpPut put = new HttpPut(initUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+            put.addHeader(e.getKey(), MessageDigestUtil.utf8ToIso88591(e.getValue()));
+        }
+
+        if (StringUtils.isNotBlank(body)) {
+            put.setEntity(new StringEntity(body, Constants.ENCODING));
+
+        }
+
+        return convert(httpClient.execute(put));
+    }
+
+    /**
+     * HTTP PUT字节数组
+     * @param host
+     * @param path
+     * @param connectTimeout
+     * @param headers
+     * @param querys
+     * @param bodys
+     * @param signHeaderPrefixList
+     * @param appKey
+     * @param appSecret
+     * @return
+     * @throws Exception
+     */
+    public static Response httpPut(String host, String path, int connectTimeout, Map<String, String> headers, Map<String, String> querys, byte[] bodys, List<String> signHeaderPrefixList, String appKey, String appSecret)
+            throws Exception {
+    	headers = initialBasicHeader(HttpMethod.PUT, path, headers, querys, null, signHeaderPrefixList, appKey, appSecret);
+
+    	HttpClient httpClient = wrapClient(host);
+        httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, getTimeout(connectTimeout));
+
+        HttpPut put = new HttpPut(initUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+        	put.addHeader(e.getKey(), MessageDigestUtil.utf8ToIso88591(e.getValue()));
+        }
+
+        if (bodys != null) {
+        	put.setEntity(new ByteArrayEntity(bodys));
+        }
+
+        return convert(httpClient.execute(put));
+    }
+
+    /**
+     * HTTP DELETE
+     * @param host
+     * @param path
+     * @param connectTimeout
+     * @param headers
+     * @param querys
+     * @param signHeaderPrefixList
+     * @param appKey
+     * @param appSecret
+     * @return
+     * @throws Exception
+     */
+    public static Response httpDelete(String host, String path, int connectTimeout, Map<String, String> headers, Map<String, String> querys, List<String> signHeaderPrefixList, String appKey, String appSecret)
+            throws Exception {
+        headers = initialBasicHeader(HttpMethod.DELETE, path, headers, querys, null, signHeaderPrefixList, appKey, appSecret);
+
+        HttpClient httpClient = wrapClient(host);
+        httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, getTimeout(connectTimeout));
+
+        HttpDelete delete = new HttpDelete(initUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+            delete.addHeader(e.getKey(), MessageDigestUtil.utf8ToIso88591(e.getValue()));
+        }
+
+        return convert(httpClient.execute(delete));
+    }
+
+    /**
+     * 构建FormEntity
+     *
+     * @param formParam
+     * @return
+     * @throws UnsupportedEncodingException
+     */
+    private static UrlEncodedFormEntity buildFormEntity(Map<String, String> formParam)
+            throws UnsupportedEncodingException {
+        if (formParam != null) {
+            List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
+
+            for (String key : formParam.keySet()) {
+                nameValuePairList.add(new BasicNameValuePair(key, formParam.get(key)));
+            }
+            UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, Constants.ENCODING);
+            formEntity.setContentType(ContentType.CONTENT_TYPE_FORM);
+            return formEntity;
+        }
+
+        return null;
+    }
+
+    private static String initUrl(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(Constants.SPE3);
+        		}
+        		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(Constants.SPE4);
+        				sbQuery.append(URLEncoder.encode(query.getValue(), Constants.ENCODING));
+        			}
+                }
+        	}
+        	if (0 < sbQuery.length()) {
+        		sbUrl.append(Constants.SPE5).append(sbQuery);
+        	}
+        }
+
+    	return sbUrl.toString();
+    }
+
+
+    /**
+     * 初始化基础Header
+     * @param method
+     * @param path
+     * @param headers
+     * @param querys
+     * @param bodys
+     * @param signHeaderPrefixList
+     * @param appKey
+     * @param appSecret
+     * @return
+     * @throws MalformedURLException
+     */
+    private static Map<String, String> initialBasicHeader(String method, String path,
+                                                          Map<String, String> headers,
+                                                          Map<String, String> querys,
+                                                          Map<String, String> bodys,
+                                                          List<String> signHeaderPrefixList,
+                                                          String appKey, String appSecret)
+            throws MalformedURLException {
+        if (headers == null) {
+            headers = new HashMap<String, String>();
+        }
+
+        headers.put(SystemHeader.X_CA_TIMESTAMP, String.valueOf(new Date().getTime()));
+        headers.put(SystemHeader.X_CA_NONCE, UUID.randomUUID().toString());
+        headers.put(SystemHeader.X_CA_KEY, appKey);
+        headers.put(SystemHeader.X_CA_SIGNATURE,
+                SignUtil.sign(appSecret, method, path, headers, querys, bodys, signHeaderPrefixList));
+        System.out.println("Header: " + JSON.toJSONString(headers));
+        return headers;
+    }
+
+    /**
+     * 读取超时时间
+     *
+     * @param timeout
+     * @return
+     */
+    private static int getTimeout(int timeout) {
+        if (timeout == 0) {
+            return Constants.DEFAULT_TIMEOUT;
+        }
+
+        return timeout;
+    }
+
+    private static Response convert(HttpResponse response) throws IOException {
+    	Response res = new Response();
+
+    	if (null != response) {
+    		res.setStatusCode(response.getStatusLine().getStatusCode());
+    		for (Header header : response.getAllHeaders()) {
+    			res.setHeader(header.getName(), MessageDigestUtil.iso88591ToUtf8(header.getValue()));
+            }
+
+    		res.setContentType(res.getHeader("Content-Type"));
+    		res.setRequestId(res.getHeader("X-Ca-Request-Id"));
+    		res.setErrorMessage(res.getHeader("X-Ca-Error-Message"));
+    		res.setBody(readStreamAsStr(response.getEntity().getContent()));
+
+    	} else {
+    		//服务器无回应
+    		res.setStatusCode(500);
+    		res.setErrorMessage("No Response");
+    	}
+
+    	return res;
+    }
+
+
+	/**
+	 * 将流转换为字符串
+	 *
+	 * @param is
+	 * @return
+	 * @throws IOException
+	 */
+	public static String readStreamAsStr(InputStream is) throws IOException {
+	    ByteArrayOutputStream bos = new ByteArrayOutputStream();
+	    WritableByteChannel dest = Channels.newChannel(bos);
+	    ReadableByteChannel src = Channels.newChannel(is);
+	    ByteBuffer bb = ByteBuffer.allocate(4096);
+
+	    while (src.read(bb) != -1) {
+	        bb.flip();
+	        dest.write(bb);
+	        bb.clear();
+	    }
+	    src.close();
+	    dest.close();
+
+	    return new String(bos.toByteArray(), Constants.ENCODING);
+	}
+
+	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);
+        }
+    }
+}

+ 311 - 0
src/main/java/info/aspirecn/iov/sjjh/util/HttpUtils.java

@@ -0,0 +1,311 @@
+package info.aspirecn.iov.sjjh.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);
+        }
+    }
+}

+ 118 - 0
src/main/java/info/aspirecn/iov/sjjh/util/MessageDigestUtil.java

@@ -0,0 +1,118 @@
+/*
+ * 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
+ *
+ *     http://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.
+ */
+package info.aspirecn.iov.sjjh.util;
+
+import info.aspirecn.iov.sjjh.constant.Constants;
+import org.apache.commons.codec.binary.Base64;
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * 消息摘要工具
+ */
+public class MessageDigestUtil {
+    /**
+     * 先进行MD5摘要再进行Base64编码获取摘要字符串
+     *
+     * @param str
+     * @return
+     */
+    public static String base64AndMD5(String str) {
+        if (str == null) {
+            throw new IllegalArgumentException("inStr can not be null");
+        }
+        return base64AndMD5(toBytes(str));
+    }
+
+    /**
+     * 先进行MD5摘要再进行Base64编码获取摘要字符串
+     *
+     * @return
+     */
+    public static String base64AndMD5(byte[] bytes) {
+        if (bytes == null) {
+            throw new IllegalArgumentException("bytes can not be null");
+        }
+        try {
+            final MessageDigest md = MessageDigest.getInstance("MD5");
+            md.reset();
+            md.update(bytes);
+            final Base64 base64 = new Base64();
+            final byte[] enbytes = base64.encode(md.digest());
+            return new String(enbytes);
+        } catch (final NoSuchAlgorithmException e) {
+            throw new IllegalArgumentException("unknown algorithm MD5");
+        }
+    }
+
+    /**
+     * UTF-8编码转换为ISO-9959-1
+     *
+     * @param str
+     * @return
+     */
+    public static String utf8ToIso88591(String str) {
+        if (str == null) {
+            return str;
+        }
+
+        try {
+            return new String(str.getBytes("UTF-8"), "ISO-8859-1");
+        } catch (UnsupportedEncodingException e) {
+            throw new RuntimeException(e.getMessage(), e);
+        }
+    }
+
+    /**
+     * ISO-9959-1编码转换为UTF-8
+     *
+     * @param str
+     * @return
+     */
+    public static String iso88591ToUtf8(String str) {
+        if (str == null) {
+            return str;
+        }
+
+        try {
+            return new String(str.getBytes("ISO-8859-1"), "UTF-8");
+        } catch (UnsupportedEncodingException e) {
+            throw new RuntimeException(e.getMessage(), e);
+        }
+    }
+
+    /**
+     * String转换为字节数组
+     *
+     * @param str
+     * @return
+     */
+    private static byte[] toBytes(final String str) {
+        if (str == null) {
+            return null;
+        }
+        try {
+            return str.getBytes(Constants.ENCODING);
+        } catch (final UnsupportedEncodingException e) {
+            throw new RuntimeException(e.getMessage(), e);
+        }
+    }
+}

+ 79 - 0
src/main/java/info/aspirecn/iov/sjjh/util/PostUtil.java

@@ -0,0 +1,79 @@
+/*
+ * 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
+ *
+ *     http://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.
+ */
+package info.aspirecn.iov.sjjh.util;
+
+import info.aspirecn.iov.sjjh.constant.Constants;
+import info.aspirecn.iov.sjjh.constant.ContentType;
+import info.aspirecn.iov.sjjh.constant.HttpHeader;
+import info.aspirecn.iov.sjjh.entity.Request;
+import info.aspirecn.iov.sjjh.entity.Response;
+import info.aspirecn.iov.sjjh.enums.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 调用示例
+ * 请替换APP_KEY,APP_SECRET,HOST,CUSTOM_HEADERS_TO_SIGN_PREFIX为真实配置
+ */
+public class PostUtil {
+	//网关的host地址
+	public static String HOST = "https://gateway.logink.cn";
+
+
+    /**
+     * HTTP POST 字符串
+     *
+     * @throws Exception
+     */
+    public static Response postString(String URL, String BODY,
+                                      String APP_KEY, String APP_SECRET, Integer outTime) throws Exception {
+    	System.out.println("Request:");
+    	System.out.println("Url: " + URL);
+    	String PATH = URL.substring(HOST.length(), URL.length());
+        Map<String, String> headers = new HashMap<String, String>();
+        //(必填)根据期望的Response内容类型设置
+        headers.put(HttpHeader.HTTP_HEADER_ACCEPT, ContentType.CONTENT_TYPE_JSON);
+        //(可选)Body MD5,服务端会校验Body内容是否被篡改,建议Body非Form表单时添加此Header
+        headers.put(HttpHeader.HTTP_HEADER_CONTENT_MD5, MessageDigestUtil.base64AndMD5(BODY));
+        //(POST/PUT请求必选)请求Body内容格式
+        headers.put(HttpHeader.HTTP_HEADER_CONTENT_TYPE, ContentType.CONTENT_TYPE_JSON);
+
+        List<String> CUSTOM_HEADERS_TO_SIGN_PREFIX = new ArrayList<String>();
+
+        Request request = new Request(Method.POST_STRING, HOST,
+        		PATH, APP_KEY, APP_SECRET, outTime);
+        request.setHeaders(headers);
+        request.setSignHeaderPrefixList(CUSTOM_HEADERS_TO_SIGN_PREFIX);
+
+        //(非必填)根据api描述,如果有需要传递的参数,设置请求的query
+        Map<String, String> querys = new HashMap<String, String>();
+        request.setQuerys(querys);
+        request.setStringBody(BODY);
+
+        //调用服务端
+        Response response = Client.execute(request);
+        System.out.println("Body: " + BODY);
+        System.out.println("");
+        System.out.println("Response: ");
+        return response;
+    }
+
+}

+ 227 - 0
src/main/java/info/aspirecn/iov/sjjh/util/SignUtil.java

@@ -0,0 +1,227 @@
+/*
+ * 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
+ *
+ *     http://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.
+ */
+package info.aspirecn.iov.sjjh.util;
+
+import info.aspirecn.iov.sjjh.constant.Constants;
+import info.aspirecn.iov.sjjh.constant.HttpHeader;
+import info.aspirecn.iov.sjjh.constant.SystemHeader;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang.StringUtils;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * 签名工具
+ */
+public class SignUtil {
+
+    /**
+     * 计算签名
+     *
+     * @param secret APP密钥
+     * @param method HttpMethod
+     * @param path
+     * @param headers
+     * @param querys
+     * @param bodys
+     * @param signHeaderPrefixList 自定义参与签名Header前缀
+     * @return 签名后的字符串
+     */
+    public static String sign(String secret, String method, String path,
+    							Map<String, String> headers,
+    							Map<String, String> querys,
+    							Map<String, String> bodys,
+    							List<String> signHeaderPrefixList) {
+        try {
+            Mac hmacSha256 = Mac.getInstance(Constants.HMAC_SHA256);
+            byte[] keyBytes = secret.getBytes(Constants.ENCODING);
+            hmacSha256.init(new SecretKeySpec(keyBytes, 0, keyBytes.length, Constants.HMAC_SHA256));
+
+            return new String(Base64.encodeBase64(
+                    hmacSha256.doFinal(buildStringToSign(method, path, headers, querys, bodys, signHeaderPrefixList)
+                            .getBytes(Constants.ENCODING))),
+                    Constants.ENCODING);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * 构建待签名字符串
+     * @param method
+     * @param path
+     * @param headers
+     * @param querys
+     * @param bodys
+     * @param signHeaderPrefixList
+     * @return
+     */
+    private static String buildStringToSign(String method, String path,
+    										Map<String, String> headers,
+    										Map<String, String> querys,
+    										Map<String, String> bodys,
+                                            List<String> signHeaderPrefixList) {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append(method.toUpperCase()).append(Constants.LF);
+        if (null != headers) {
+        	if (null != headers.get(HttpHeader.HTTP_HEADER_ACCEPT)) {
+                sb.append(headers.get(HttpHeader.HTTP_HEADER_ACCEPT));
+            }
+        	sb.append(Constants.LF);
+        	if (null != headers.get(HttpHeader.HTTP_HEADER_CONTENT_MD5)) {
+                sb.append(headers.get(HttpHeader.HTTP_HEADER_CONTENT_MD5));
+            }
+            sb.append(Constants.LF);
+            if (null != headers.get(HttpHeader.HTTP_HEADER_CONTENT_TYPE)) {
+                sb.append(headers.get(HttpHeader.HTTP_HEADER_CONTENT_TYPE));
+            }
+            sb.append(Constants.LF);
+            if (null != headers.get(HttpHeader.HTTP_HEADER_DATE)) {
+                sb.append(headers.get(HttpHeader.HTTP_HEADER_DATE));
+            }
+        }
+        sb.append(Constants.LF);
+        sb.append(buildHeaders(headers, signHeaderPrefixList));
+        sb.append(buildResource(path, querys, bodys));
+
+        return sb.toString();
+    }
+
+    /**
+     * 构建待签名Path+Query+BODY
+     *
+     * @param path
+     * @param querys
+     * @param bodys
+     * @return 待签名
+     */
+    private static String buildResource(String path, Map<String, String> querys, Map<String, String> bodys) {
+    	StringBuilder sb = new StringBuilder();
+
+    	if (!StringUtils.isBlank(path)) {
+    		sb.append(path);
+        }
+        Map<String, String> sortMap = new TreeMap<String, String>();
+        if (null != querys) {
+        	for (Map.Entry<String, String> query : querys.entrySet()) {
+        		if (!StringUtils.isBlank(query.getKey())) {
+        			sortMap.put(query.getKey(), query.getValue());
+                }
+        	}
+        }
+
+        if (null != bodys) {
+        	for (Map.Entry<String, String> body : bodys.entrySet()) {
+        		if (!StringUtils.isBlank(body.getKey())) {
+        			sortMap.put(body.getKey(), body.getValue());
+                }
+        	}
+        }
+
+        StringBuilder sbParam = new StringBuilder();
+        for (Map.Entry<String, String> item : sortMap.entrySet()) {
+    		if (!StringUtils.isBlank(item.getKey())) {
+    			if (0 < sbParam.length()) {
+    				sbParam.append(Constants.SPE3);
+    			}
+    			sbParam.append(item.getKey());
+    			if (!StringUtils.isBlank(item.getValue())) {
+    				sbParam.append(Constants.SPE4).append(item.getValue());
+    			}
+            }
+    	}
+        if (0 < sbParam.length()) {
+        	sb.append(Constants.SPE5);
+        	sb.append(sbParam);
+        }
+
+        return sb.toString();
+    }
+
+    /**
+     * 构建待签名Http头
+     *
+     * @param headers 请求中所有的Http头
+     * @param signHeaderPrefixList 自定义参与签名Header前缀
+     * @return 待签名Http头
+     */
+    private static String buildHeaders(Map<String, String> headers, List<String> signHeaderPrefixList) {
+    	StringBuilder sb = new StringBuilder();
+
+    	if (null != signHeaderPrefixList) {
+    		signHeaderPrefixList.remove(SystemHeader.X_CA_SIGNATURE);
+    		signHeaderPrefixList.remove(HttpHeader.HTTP_HEADER_ACCEPT);
+    		signHeaderPrefixList.remove(HttpHeader.HTTP_HEADER_CONTENT_MD5);
+    		signHeaderPrefixList.remove(HttpHeader.HTTP_HEADER_CONTENT_TYPE);
+    		signHeaderPrefixList.remove(HttpHeader.HTTP_HEADER_DATE);
+    		Collections.sort(signHeaderPrefixList);
+    		if (null != headers) {
+    			Map<String, String> sortMap = new TreeMap<String, String>();
+    			sortMap.putAll(headers);
+    			StringBuilder signHeadersStringBuilder = new StringBuilder();
+    			for (Map.Entry<String, String> header : sortMap.entrySet()) {
+                    if (isHeaderToSign(header.getKey(), signHeaderPrefixList)) {
+                    	sb.append(header.getKey());
+                    	sb.append(Constants.SPE2);
+                        if (!StringUtils.isBlank(header.getValue())) {
+                        	sb.append(header.getValue());
+                        }
+                        sb.append(Constants.LF);
+                        if (0 < signHeadersStringBuilder.length()) {
+                        	signHeadersStringBuilder.append(Constants.SPE1);
+                        }
+                        signHeadersStringBuilder.append(header.getKey());
+                    }
+                }
+    			headers.put(SystemHeader.X_CA_SIGNATURE_HEADERS, signHeadersStringBuilder.toString());
+    		}
+    	}
+
+        return sb.toString();
+    }
+
+    /**
+     * Http头是否参与签名 return
+     */
+    private static boolean isHeaderToSign(String headerName, List<String> signHeaderPrefixList) {
+        if (StringUtils.isBlank(headerName)) {
+            return false;
+        }
+
+        if (headerName.startsWith(Constants.CA_HEADER_TO_SIGN_PREFIX_SYSTEM)) {
+            return true;
+        }
+
+        if (null != signHeaderPrefixList) {
+            for (String signHeaderPrefix : signHeaderPrefixList) {
+                if (headerName.equalsIgnoreCase(signHeaderPrefix)) {
+                    return true;
+                }
+            }
+        }
+
+        return false;
+    }
+}

+ 60 - 0
src/main/java/info/aspirecn/iov/sjjh/util/ValidateParamUtil.java

@@ -0,0 +1,60 @@
+package info.aspirecn.iov.sjjh.util;
+
+import info.aspirecn.iov.sjjh.commons.lang.Constant;
+import info.aspirecn.iov.sjjh.commons.lang.PatternTools;
+import info.aspirecn.iov.sjjh.entity.VehicleHistoryPositionRequestParam;
+import org.apache.commons.lang3.StringUtils;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+import java.text.SimpleDateFormat;
+import java.util.Set;
+import java.util.regex.Pattern;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+public class ValidateParamUtil {
+    private static final String DATE_REGEX = "^((([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})" +
+            "(((0[13578]|1[02])(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)(0[1-9]|[12][0-9]|30))|(02(0[1-9]|[1][0-9]|2[0-8]))))" +
+            "|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))0229))" +
+            "([0-1]?[0-9]|2[0-3])([0-5][0-9])([0-5][0-9])$";
+    private static final String NUMBER_REGEX = "^(0|[1-9]\\d*)$";
+
+    public static boolean validateRequestParams(VehicleHistoryPositionRequestParam requestParam) {
+        Pattern datePattern = Pattern.compile(DATE_REGEX);
+        Pattern numberPattern = Pattern.compile(NUMBER_REGEX);
+        if (!validateParamNullValue(requestParam)) {
+            return false;
+        } else if (StringUtils.isBlank(requestParam.getPlateNumber())
+                || !PatternTools.checkResult(Constant.PATTERN_CAR_NUMBER_REGEX, requestParam.getPlateNumber())) {
+            return false;
+        } else if (StringUtils.isBlank(requestParam.getPlateColor())
+                || !numberPattern.matcher(requestParam.getPlateColor()).matches()) {
+            return false;
+        } else if (StringUtils.isBlank(requestParam.getStartTime())
+                || !datePattern.matcher(requestParam.getStartTime()).matches()) {
+            return false;
+        } else if (StringUtils.isBlank(requestParam.getEndTime())
+                || !datePattern.matcher(requestParam.getEndTime()).matches()) {
+            return false;
+        } else {
+            return true;
+        }
+    }
+
+    private static boolean validateParamNullValue(Object jsonResolveObject) {
+        ValidatorFactory vf = Validation.buildDefaultValidatorFactory();
+        Validator validator = vf.getValidator();
+        Set<ConstraintViolation<Object>> set = validator.validate(jsonResolveObject);
+        for (ConstraintViolation<Object> con : set) {
+            if (StringUtils.isNotBlank(con.getMessage())) {
+                return false;
+            }
+        }
+        return true;
+    }
+}

+ 80 - 0
src/main/resources/config/application-test.yml

@@ -0,0 +1,80 @@
+server:
+  tomcat:
+    accesslog:
+      buffered: false
+      enabled: true
+      pattern: '{"DateTime":"%{yyyy-MM-dd''T''HH:mm:ss.SSSZZ}t","ClientIP":"%a","Method":"%m","URI":"%U","RequestProtocol":"%H","ResponseCode":%s,
+                "ResponseTime":%D,"UserAgent":"%{user-agent}i","X-Forwarded-For":"%{x-forwarded-for}r","X-User-IP":"%{X-User-IP}i","traceId":"%{x-b3-traceid}i","id":"%{x-b3-spanid}r",
+                "parentId":"%{x-b3-parentspanid}i","ApplicationName":"${spring.application.name}","MG-IsCharge":%{isCharge}r,
+                "MG-ChannelId":%{channelId}i,"MG-CustomBody":"%{x-requestQuery}r","MG-ResultBody":"%{resultBody}o",
+                "MG-ResponseCode":%{respnoseCode}r,"MG-Upstream-ResponseCode":"%{upResponseCode}r","MG-SellingPrice":%{price}i,"req_type":"%{req_type}r","MG-ProductId":%{productId}i,"MG-UserId":%{userid}i}'
+      prefix: access_${HOSTNAME}_${spring.application.name}_${server.port}
+      directory: ${logging.path}
+  servlet:
+    context-path: /
+
+spring:
+  sleuth:
+    sampler:
+      probability: 1
+    web:
+      additional-skip-pattern: /api/v2/spans
+  zipkin:
+    base-url: http://127.0.0.1:${server.port}
+
+  mvc:
+    favicon:
+      enabled: false
+
+#management
+management:
+  endpoints:
+    enabled-by-default: true
+    web:
+      exposure:
+        include: '*'
+  endpoint:
+    health:
+      show-details: always
+    shutdown:
+      enabled: true
+
+#logging
+logging:
+  path: /Users/jkxy/root-logs/apps/var/jakarta/logs
+  level:
+    root: INFO
+    red:
+      microcloud: DEBUG
+  config: classpath:config/logback-spring.xml
+  file: ${logging.path}/catalina_${spring.cloud.client.hostname}_${spring.application.name}_${server.port}.out
+
+#error logging
+#sleuth logging
+rdc:
+  logging:
+    error-file: ${logging.path}/error_${spring.cloud.client.hostname}_${spring.application.name}_${server.port}.log
+    sleuth-file: ${logging.path}/sleuth_${spring.cloud.client.hostname}_${spring.application.name}_${server.port}.log
+
+#eureka
+eureka:
+  instance:
+    prefer-ip-address: true
+    instance-id: ${spring.cloud.client.ipaddress}:${server.port}
+    metadata-map:
+      management:
+        port: ${management.server.port}
+    health-check-url: http://${spring.cloud.client.ipaddress}:${management.server.port}${eureka.instance.health-check-url-path}
+    health-check-url-path: /actuator/health
+  client:
+    serviceUrl:
+      defaultZone: http://localhost:8888/eureka
+
+#custom
+supplier:
+  appKey: 3AA555152F3299F6A37C66C074DEF14D
+  appSecret: A84A975F4C324E20659CB340735DA894
+  historyPositionUrl: https://gateway.logink.cn/gps/getHistoryPosition
+  partyFunctionCode: logink
+swagger:
+  show: true

+ 84 - 0
src/main/resources/config/application.yml

@@ -0,0 +1,84 @@
+server:
+  tomcat:
+    accesslog:
+      buffered: false
+      enabled: true
+      pattern: '{"DateTime":"%{yyyy-MM-dd''T''HH:mm:ss.SSSZZ}t","ClientIP":"%a","Method":"%m","URI":"%U","RequestProtocol":"%H","ResponseCode":%s,
+                "ResponseTime":%D,"UserAgent":"%{user-agent}i","X-Forwarded-For":"%{x-forwarded-for}r","X-User-IP":"%{X-User-IP}i","traceId":"%{x-b3-traceid}i","id":"%{x-b3-spanid}r",
+                "parentId":"%{x-b3-parentspanid}i","ApplicationName":"${spring.application.name}","MG-IsCharge":%{isCharge}r,
+                "MG-ChannelId":%{channelId}i,"MG-CustomBody":"%{x-requestQuery}r","MG-ResultBody":"%{resultBody}o",
+                "MG-ResponseCode":%{respnoseCode}r,"MG-Upstream-ResponseCode":"%{upResponseCode}r","MG-SellingPrice":%{price}i,"req_type":"%{req_type}r","MG-ProductId":%{productId}i,"MG-UserId":%{userid}i}'
+      prefix: access_${HOSTNAME}_${spring.application.name}_${server.port}
+      directory: ${logging.path}
+  servlet:
+    context-path: /
+
+spring:
+  sleuth:
+    sampler:
+      probability: 1
+    web:
+      additional-skip-pattern: /api/v2/spans
+  zipkin:
+    base-url: http://127.0.0.1:${server.port}
+
+  mvc:
+    favicon:
+      enabled: false
+
+#management
+management:
+  endpoints:
+    enabled-by-default: true
+    web:
+      exposure:
+        include: '*'
+  endpoint:
+    health:
+      show-details: always
+    shutdown:
+      enabled: true
+
+#logging
+logging:
+  path: /Users/jkxy/root-logs/apps/var/jakarta/logs
+  level:
+    root: INFO
+    red:
+      microcloud: DEBUG
+  config: classpath:config/logback-spring.xml
+  file: ${logging.path}/catalina_${spring.cloud.client.hostname}_${spring.application.name}_${server.port}.out
+
+#error logging
+#sleuth logging
+rdc:
+  logging:
+    error-file: ${logging.path}/error_${spring.cloud.client.hostname}_${spring.application.name}_${server.port}.log
+    sleuth-file: ${logging.path}/sleuth_${spring.cloud.client.hostname}_${spring.application.name}_${server.port}.log
+
+#eureka
+eureka:
+  instance:
+    prefer-ip-address: true
+    instance-id: ${spring.cloud.client.ipaddress}:${server.port}
+    metadata-map:
+      management:
+        port: ${management.server.port}
+    health-check-url: http://${spring.cloud.client.ipaddress}:${management.server.port}${eureka.instance.health-check-url-path}
+    health-check-url-path: /actuator/health
+  client:
+    serviceUrl:
+      defaultZone: http://localhost:8888/eureka
+
+#custom
+supplier:
+  appKey: 3AA555152F3299F6A37C66C074DEF14D
+  appSecret: A84A975F4C324E20659CB340735DA894
+  historyPositionUrl: https://gateway.logink.cn/gps/getHistoryPosition
+  partyFunctionCode: logink
+  addHours: 4
+  reduceHours: -4
+  baiduUrl: http://api.map.baidu.com/reverse_geocoding/v3/
+  baiduAk: 2cgadO5KodmKx0KBPKO0Ym3BgT0xFDPG
+swagger:
+  show: true

+ 3 - 0
src/main/resources/config/banner.txt

@@ -0,0 +1,3 @@
+*******************************************************************************
+	 @project.artifactId@  (version:@project.version@)
+*******************************************************************************

+ 27 - 0
src/main/resources/config/bootstrap.yml

@@ -0,0 +1,27 @@
+spring:
+  application:
+    name: '@project.artifactId@'
+  banner:
+    location: classpath:config/banner.txt
+#  profiles:
+#    active: test
+#  cloud:
+#    config:
+#      discovery:
+#        enabled: false
+#      uri: http://10.8.18.157:32533
+#      label: trunk
+#      name: ${spring.application.name}
+#      profile: ${spring.profiles.active}
+
+server:
+  port: 25103
+management:
+  server:
+    port: 35103
+
+info:
+  name: '@project.description@'
+  version: '@project.version@'
+
+

+ 35 - 0
src/main/resources/config/logback-spring.xml

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+    <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
+    <include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
+
+    <property name="LOG_FILE"
+			  value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/spring.log}"/>
+
+    <springProperty scope="context" name="LOG_PATH" source="logging.path" defaultValue="/Users/jkxy/root-logs/apps/var/jakarta/logs"/>
+    <springProperty scope="context" name="application_name" source="spring.application.name" defaultValue="test-servicenode-supplier-2"/>
+    <springProperty scope="context" name="sleuth_file" source="rdc.logging.sleuth-file" defaultValue="${LOG_PATH}/sleuth/sleuth.log"/>
+    <springProperty scope="context" name="error_file" source="rdc.logging.error-file" defaultValue="${LOG_PATH}/error/error.log"/>
+
+    <include resource="info/aspirecn/rdc/aspirecloud/node/except/xml/defaults.xml"/>
+    <include resource="info/aspirecn/rdc/aspirecloud/node/brave/xml/defaults.xml"/>
+
+    <appender name="TIME_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <encoder>
+            <pattern>${FILE_LOG_PATTERN}</pattern>
+        </encoder>
+        <file>${LOG_FILE}</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}.%i</fileNamePattern>
+            <maxHistory>2</maxHistory>
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <maxFileSize>100MB</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+        </rollingPolicy>
+    </appender>
+
+    <root level="INFO">
+        <appender-ref ref="CONSOLE"/>
+        <appender-ref ref="TIME_FILE"/>
+    </root>
+</configuration>

+ 8 - 0
src/test/java/info/aspirecn/iov/sjjh/IovSjjhServicenodeSupplierVehicleApplicationTests.java

@@ -0,0 +1,8 @@
+package info.aspirecn.iov.sjjh;
+
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class IovSjjhServicenodeSupplierVehicleApplicationTests {
+
+}