Ver código fonte

增加自动发送公网地址到数据中心

zhuoning 3 anos atrás
pai
commit
ac3f28bba1

+ 33 - 0
huimv-farm-device/huimv-farm-netip/.gitignore

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

BIN
huimv-farm-device/huimv-farm-netip/.mvn/wrapper/maven-wrapper.jar


+ 2 - 0
huimv-farm-device/huimv-farm-netip/.mvn/wrapper/maven-wrapper.properties

@@ -0,0 +1,2 @@
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.3/apache-maven-3.8.3-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar

+ 331 - 0
huimv-farm-device/huimv-farm-netip/mvnw

@@ -0,0 +1,331 @@
+#!/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 /usr/local/etc/mavenrc ]; then
+    . /usr/local/etc/mavenrc
+  fi
+
+  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="$(
+      \unset -f command
+      \command -v 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/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+  else
+    jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.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" || rm -f "$wrapperJarPath"
+    else
+      wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$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 \
+  $MAVEN_DEBUG_OPTS \
+  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+  "-Dmaven.home=${M2_HOME}" \
+  "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

+ 188 - 0
huimv-farm-device/huimv-farm-netip/mvnw.cmd

@@ -0,0 +1,188 @@
+@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 "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
+if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\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/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+
+FOR /F "usebackq 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%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.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 "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
+if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\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%
+
+cmd /C exit /B %ERROR_CODE%

+ 78 - 0
huimv-farm-device/huimv-farm-netip/pom.xml

@@ -0,0 +1,78 @@
+<?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.6.2</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+    <groupId>com.huimv</groupId>
+    <artifactId>huimv-farm-netip</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <name>huimv-farm-netip</name>
+    <description>Demo project for Spring Boot</description>
+    <properties>
+        <java.version>1.8</java.version>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <!-- lombok -->
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <version>1.16.18</version>
+            <scope>provided</scope>
+        </dependency>
+        <!-- fastjson -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.28</version>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5.5</version>
+        </dependency>
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.7.16</version>
+            <scope>compile</scope>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/io.netty/netty-all -->
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-all</artifactId>
+            <version>4.1.16.Final</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+            <!--  -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-resources-plugin</artifactId>
+                <version>2.6</version>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 15 - 0
huimv-farm-device/huimv-farm-netip/src/main/java/com/huimv/huimvfarmnetip/HuimvFarmNetipApplication.java

@@ -0,0 +1,15 @@
+package com.huimv.huimvfarmnetip;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+@SpringBootApplication
+@EnableScheduling
+public class HuimvFarmNetipApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(HuimvFarmNetipApplication.class, args);
+    }
+
+}

+ 95 - 0
huimv-farm-device/huimv-farm-netip/src/main/java/com/huimv/huimvfarmnetip/task/ScheduledService.java

@@ -0,0 +1,95 @@
+package com.huimv.huimvfarmnetip.task;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.huimv.huimvfarmnetip.utils.HttpTemplete;
+import com.huimv.huimvfarmnetip.utils.IPUtils;
+import com.huimv.huimvfarmnetip.utils.TextUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.biosafety.uface.controller
+ * @Description : TODO
+ * @Version : 1.0
+ * @Author : ZhuoNing
+ * @Create : 2020-12-25
+ **/
+@Slf4j
+@Component
+public class ScheduledService {
+    @Autowired
+    private IPUtils ipUtils;
+    //发送每次称重服务
+    @Value("${dataCenter.service.netIp}")
+    private String updateNetIpService;
+    //数据中心地址
+    @Value("${dataCenter.ipAddr}")
+    private String ipAddr;
+    //数据中心地址
+    @Value("${dataCenter.port}")
+    private String port;
+    //shellFile
+    @Value("${local.shellFile}")
+    private String shellFile;
+    //farmID
+    @Value("${local.farmID}")
+    private String farmId;
+    //relayPort
+    @Value("${local.relay.port}")
+    private String relayPort;
+    @Autowired
+    private HttpTemplete httpTemplete;
+    @Autowired
+    private TextUtil textUtil;
+
+    @Scheduled(cron = "0/3 * * * * *")
+    public void scheduled() throws UnsupportedEncodingException {
+//        log.info("=====>>>>>使用cron  {}",System.currentTimeMillis());
+        String ip = ipUtils.run(shellFile).replace("\n","");
+        JSONObject ipJo= new JSONObject();
+        ipJo.put("farmId",farmId);
+        ipJo.put("farmName","玉环牧场");
+        ipJo.put("netIp",ip+relayPort);
+        log.info("发送数据>>"+ipJo.toJSONString());
+        //发送数据
+        _doPostSimple(updateNetIpService, textUtil.encode(ipJo.toJSONString()));
+    }
+
+    //发送简单数据
+    private void _doPostSimple(String apiService, String data) {
+        String url = ipAddr + port + apiService;
+        log.info("推送数据地址:" + url);
+        //
+        Map<String, String> paramsMap = new HashMap<String, String>();
+        paramsMap.put("data", data);
+        //
+        Map<String, Integer> timeoutMap = new HashMap<String, Integer>();
+        timeoutMap.put("connectTimeout", 5000);
+        timeoutMap.put("requestTimeout", 5000);
+        timeoutMap.put("socketTimeout", 5000);
+        try {
+            // 用Post方法推送接口数据
+            httpTemplete.doPost(url, paramsMap, timeoutMap);
+        } catch (IOException e) {
+            System.out.println("###错误信息:" + e.getMessage());
+        }
+    }
+//    @Scheduled(fixedRate = 5000)
+//    public void scheduled1() {
+//        log.info("=====>>>>>使用fixedRate{}", System.currentTimeMillis());
+//    }
+//    @Scheduled(fixedDelay = 5000)
+//    public void scheduled2() {
+//        log.info("=====>>>>>fixedDelay{}",System.currentTimeMillis());
+//    }
+}

+ 496 - 0
huimv-farm-device/huimv-farm-netip/src/main/java/com/huimv/huimvfarmnetip/utils/HttpTemplete.java

@@ -0,0 +1,496 @@
+package com.huimv.huimvfarmnetip.utils;
+
+import com.alibaba.fastjson.JSONObject;
+import org.apache.http.HttpEntity;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.*;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+import org.springframework.stereotype.Component;
+
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.biosafety.uface.controller
+ * @Description : TODO
+ * @Version : 1.0
+ * @Author : ZhuoNing
+ * @Create : 2020-12-25
+ **/
+@Component
+public class HttpTemplete {
+    private String testHttpIp = "http://localhost:9105";
+
+//    public static void main(String[] args) throws Exception {
+//        //
+//        HttpTemplete client = new HttpTemplete();
+////        client.testGetRequest1();
+//        client.testGetRequest2();
+//    }
+    private Integer connectTimeout = null;
+    private Integer requestTimeout = null;
+    private Integer socketTimeout = null;
+
+    static {
+    }
+
+    /**
+     * @Method      : doPost
+     * @Description : post方式推送接口
+     * @Params      : [url, paramsMap, timeoutMap]
+     * @Return      : com.alibaba.fastjson.JSONObject
+     * 
+     * @Author      : ZhuoNing
+     * @Date        : 2021/11/19       
+     * @Time        : 14:55
+     */
+    public JSONObject doPost(String url, Map<String, String> paramsMap, Map<String, Integer> timeoutMap) throws IOException {
+        // 创建默认的httpClient实例.
+        CloseableHttpClient httpClient = getHttpClientConnection();
+        //
+        int connectTimeout = timeoutMap.get("connectTimeout");
+        int requestTimeout = timeoutMap.get("requestTimeout");
+        int socketTimeout = timeoutMap.get("socketTimeout");
+        // 创建httpPost
+        HttpPost httpPost = new HttpPost(url);
+        RequestConfig requestConfig = RequestConfig.custom()
+                .setSocketTimeout(socketTimeout) //服务器响应超时时间
+                .setConnectTimeout(connectTimeout) //连接服务器超时时间
+                .setConnectionRequestTimeout(requestTimeout)
+                .build();
+        httpPost.setConfig(requestConfig);
+        // 创建参数队列
+        List<NameValuePair> paramsList = new ArrayList<NameValuePair>();
+        Set<Map.Entry<String, String>> entrySet = paramsMap.entrySet();
+        for (Map.Entry<String, String> e : entrySet) {
+            String name = e.getKey();
+            String value = e.getValue();
+            NameValuePair pair = new BasicNameValuePair(name, value);
+            paramsList.add(pair);
+        }
+        UrlEncodedFormEntity content = new UrlEncodedFormEntity(paramsList, "UTF-8");
+        //处理乱码
+//        StringEntity content = new StringEntity(paramsList.toString(), Charset.forName("UTF-8"));// 第二个参数,设置后才会对,内容进行编码
+//        content.setContentType("application/soap+xml; charset=UTF-8");
+//        content.setContentEncoding("UTF-8");
+        httpPost.setEntity(content);
+//        HttpUriRequest httpPost = RequestBuilder.post().setUri(url).setEntity(content).setConfig(requestConfig);
+        CloseableHttpResponse response = httpClient.execute(httpPost);
+        // 获取响应实体
+        HttpEntity entity = response.getEntity();
+        try {
+            if (response.getStatusLine().getStatusCode() == 200) {
+                // 打印响应内容
+                String text = EntityUtils.toString(entity, "utf-8");
+                JSONObject resultJo = new JSONObject();
+                resultJo.put("status", true);
+                resultJo.put("content", text);
+                return resultJo;
+            }else{
+                String text = EntityUtils.toString(entity, "utf-8");
+                JSONObject resultJo = new JSONObject();
+                resultJo.put("status", false);
+                resultJo.put("content", text);
+                return resultJo;
+            }
+        } finally {
+            //释放资源
+            if (response != null) {
+                response.close();
+            }
+            if (httpClient != null) {
+                httpClient.close();
+            }
+        }
+    }
+
+    /**
+     * @Method      : setTimeout
+     * @Description : 
+     * @Params      : [connectTimeout, requestTimeout, socketTimeout]
+     * @Return      : void
+     * 
+     * @Author      : ZhuoNing
+     * @Date        : 2021/11/23       
+     * @Time        : 9:36
+     */
+    public Map<String, Integer> setTimeout(Integer connectTimeout, Integer requestTimeout, Integer socketTimeout){
+        //
+        if(connectTimeout == null){
+            this.connectTimeout = 3000;
+        }else{
+            this.connectTimeout = connectTimeout;
+        }
+        //
+        if(requestTimeout == null){
+            this.requestTimeout = 3000;
+        }else{
+            this.requestTimeout = requestTimeout;
+        }
+        //
+        if(socketTimeout == null){
+            this.socketTimeout = 3000;
+        }else{
+            this.socketTimeout = socketTimeout;
+        }
+        Map<String, Integer> timeoutMap = new HashMap<String, Integer>();
+        timeoutMap.put("connectTimeout", this.connectTimeout);
+        timeoutMap.put("requestTimeout", this.requestTimeout);
+        timeoutMap.put("socketTimeout", this.socketTimeout);
+        return timeoutMap;
+    }
+
+    /**
+     * @Method      : setTimeout
+     * @Description : 
+     * @Params      : [connectTimeout, requestTimeout, socketTimeout]
+     * @Return      : java.util.Map<java.lang.String,java.lang.Integer>
+     * 
+     * @Author      : ZhuoNing
+     * @Date        : 2021/11/23       
+     * @Time        : 9:41
+     */
+    public Map<String, Integer> setTimeout(String connectTimeout, String requestTimeout, String socketTimeout){
+        //
+        if(connectTimeout == null){
+            this.connectTimeout = 3000;
+        }else{
+            this.connectTimeout = Integer.parseInt(connectTimeout);
+        }
+        //
+        if(requestTimeout == null){
+            this.requestTimeout = 3000;
+        }else{
+            this.requestTimeout = Integer.parseInt(requestTimeout);
+        }
+        //
+        if(socketTimeout == null){
+            this.socketTimeout = 3000;
+        }else{
+            this.socketTimeout = Integer.parseInt(socketTimeout);
+        }
+        Map<String, Integer> timeoutMap = new HashMap<String, Integer>();
+        timeoutMap.put("connectTimeout", this.connectTimeout);
+        timeoutMap.put("requestTimeout", this.requestTimeout);
+        timeoutMap.put("socketTimeout", this.socketTimeout);
+        return timeoutMap;
+    }
+
+    /**
+     * @Method      : doGet
+     * @Description : 
+     * @Params      : [url, paramsMap]
+     * @Return      : com.alibaba.fastjson.JSONObject
+     * 
+     * @Author      : ZhuoNing
+     * @Date        : 2021/11/23       
+     * @Time        : 9:34
+     */
+    public JSONObject doGet(String url, Map<String, String> paramsMap) throws IOException {
+        //
+        if(this.connectTimeout == null){
+            this.connectTimeout = 3000;
+        }
+        //
+        if(this.requestTimeout == null)
+        {
+            this.requestTimeout = 3000;
+        }
+        //
+        if(this.socketTimeout == null){
+            this.socketTimeout = 3000;
+        }
+        Map<String, Integer> timeoutMap = new HashMap<String, Integer>();
+        timeoutMap.put("connectTimeout", this.connectTimeout);
+        timeoutMap.put("requestTimeout", this.requestTimeout);
+        timeoutMap.put("socketTimeout", this.socketTimeout);
+        //
+        CloseableHttpClient httpClient = getHttpClientConnection();
+        //执行//获取请求内容
+        CloseableHttpResponse response = httpClient.execute(getHttpRequest(url, paramsMap, timeoutMap));
+        try {
+            // 获取响应实体
+            HttpEntity entity = response.getEntity();
+            // 打印响应状态
+            if (response.getStatusLine().getStatusCode() == 200) {
+                // 打印响应内容
+                String text = EntityUtils.toString(entity, "utf-8");
+                JSONObject resultJo = new JSONObject();
+                resultJo.put("status", true);
+                resultJo.put("content", text);
+                return resultJo;
+            } else {
+                String text = EntityUtils.toString(entity, "utf-8");
+                JSONObject resultJo = new JSONObject();
+                resultJo.put("status", false);
+                resultJo.put("content", text);
+                return resultJo;
+            }
+        } finally {
+            //释放资源
+            if (response != null) {
+                response.close();
+            }
+            if (httpClient != null) {
+                httpClient.close();
+            }
+        }
+    }
+
+    private CloseableHttpClient httpClient = null;
+    private CloseableHttpResponse response = null;
+
+    public JSONObject doGetBatch(String url, Map<String, String> paramsMap) throws IOException {
+        //
+        if(this.connectTimeout == null){
+            this.connectTimeout = 3000;
+        }
+        //
+        if(this.requestTimeout == null)
+        {
+            this.requestTimeout = 3000;
+        }
+        //
+        if(this.socketTimeout == null){
+            this.socketTimeout = 3000;
+        }
+        Map<String, Integer> timeoutMap = new HashMap<String, Integer>();
+        timeoutMap.put("connectTimeout", this.connectTimeout);
+        timeoutMap.put("requestTimeout", this.requestTimeout);
+        timeoutMap.put("socketTimeout", this.socketTimeout);
+        //
+        httpClient = getHttpClientConnection();
+        //执行//获取请求内容
+        response = httpClient.execute(getHttpRequest(url, paramsMap, timeoutMap));
+        // 获取响应实体
+        HttpEntity entity = response.getEntity();
+        // 打印响应状态
+        if (response.getStatusLine().getStatusCode() == 200) {
+                // 打印响应内容
+                String text = EntityUtils.toString(entity, "utf-8");
+                JSONObject resultJo = new JSONObject();
+                resultJo.put("status", true);
+                resultJo.put("content", text);
+                return resultJo;
+        } else {
+                String text = EntityUtils.toString(entity, "utf-8");
+                JSONObject resultJo = new JSONObject();
+                resultJo.put("status", false);
+                resultJo.put("content", text);
+                return resultJo;
+        }
+    }
+
+    //关闭http连接
+    public void closeHttpConn() throws IOException {
+        System.out.println("开始释放http连接资源");
+        //释放资源
+        if (response != null) {
+            response.close();
+        }
+        if (httpClient != null) {
+            httpClient.close();
+        }
+    }
+
+    /**
+     * @Method : doGet
+     * @Description :get方式推送接口
+     * @Params : [url, paramsMap, timeoutMap]
+     * @Return : com.alibaba.fastjson.JSONObject
+     * @Author : ZhuoNing
+     * @Date : 2021/11/18
+     * @Time : 17:39
+     */
+    public JSONObject doGet(String url, Map<String, String> paramsMap, Map<String, Integer> timeoutMap) throws IOException {
+        if (timeoutMap == null) {
+            timeoutMap.put("connectTimeout", 5000);
+            timeoutMap.put("requestTimeout", 5000);
+            timeoutMap.put("socketTimeout", 5000);
+        }
+        //
+        CloseableHttpClient httpClient = getHttpClientConnection();
+        //执行//获取请求内容
+        CloseableHttpResponse response = httpClient.execute(getHttpRequest(url, paramsMap, timeoutMap));
+        try {
+            // 获取响应实体
+            HttpEntity entity = response.getEntity();
+            // 打印响应状态
+            if (response.getStatusLine().getStatusCode() == 200) {
+                // 打印响应内容
+                String text = EntityUtils.toString(entity, "utf-8");
+                JSONObject resultJo = new JSONObject();
+                resultJo.put("status", true);
+                resultJo.put("content", text);
+                return resultJo;
+            } else {
+                String text = EntityUtils.toString(entity, "utf-8");
+                JSONObject resultJo = new JSONObject();
+                resultJo.put("status", false);
+                resultJo.put("content", text);
+                return resultJo;
+            }
+        } finally {
+            //释放资源
+            if (response != null) {
+                response.close();
+            }
+            if (httpClient != null) {
+                httpClient.close();
+            }
+        }
+    }
+
+    private void testGetRequest1() throws IOException {
+        Map<String, Integer> timeoutMap = new HashMap<String, Integer>();
+        timeoutMap.put("connectTimeout", 5000);
+        timeoutMap.put("requestTimeout", 5000);
+        timeoutMap.put("socketTimeout", 5000);
+        String url = testHttpIp + "/token/getToken?userId=20210501&timestamp=45546546454&random=1156&sign=7fa431325504e01e9fa87ed0e274c40c";
+        // test error
+        url = testHttpIp + "/token/getToken?userId=20210501&timestamp=45546546454&random=1156&sign=7fa431325504e01e9fa87ed0e274c40c&userId=20210501&timestamp=45546546454&random=1156&sign=7fa431325504e01e9fa87ed0e274c40c";
+        CloseableHttpClient httpClient = getHttpClientConnection();
+        CloseableHttpResponse response = httpClient.execute(getHttpRequest(url, timeoutMap));
+        // 打印响应状态
+        System.out.println("响应状态1 =" + response.getStatusLine());
+        try {
+            if (response.getStatusLine().getStatusCode() == 200) {
+                // 获取响应实体
+                HttpEntity entity = response.getEntity();
+                // 打印响应内容
+                String text = EntityUtils.toString(entity, "utf-8");
+                System.out.println("响应内容=" + text);
+
+                JSONObject resultJo = JSONObject.parseObject(text);
+                System.out.println("accessToken=" + resultJo.getString("accessToken"));
+            } else {
+                System.out.println("请求失败");
+            }
+        } finally {
+            //释放资源
+            if (response != null) {
+                response.close();
+            }
+            if (httpClient != null) {
+                httpClient.close();
+            }
+        }
+    }
+
+    //
+    private CloseableHttpClient getHttpClientConnection() {
+        //创建默认实例
+        CloseableHttpClient httpclient = HttpClients.createDefault();
+        //
+//        CloseableHttpClient httpClient = HttpClientBuilder.create().build();
+        return httpclient;
+    }
+    //
+    private HttpUriRequest getHttpRequest(String url, Map<String, String> map, Map<String, Integer> timeoutMap) {
+        int connectTimeout = timeoutMap.get("connectTimeout");
+        int requestTimeout = timeoutMap.get("requestTimeout");
+        int socketTimeout = timeoutMap.get("socketTimeout");
+//        System.out.println("core connectTimeout="+connectTimeout);
+//        System.out.println("core requestTimeout="+requestTimeout);
+//        System.out.println("core socketTimeout="+socketTimeout);
+
+        List<NameValuePair> params = new ArrayList<NameValuePair>();
+        Set<Map.Entry<String, String>> entrySet = map.entrySet();
+        for (Map.Entry<String, String> e : entrySet) {
+            String name = e.getKey();
+            String value = e.getValue();
+            NameValuePair pair = new BasicNameValuePair(name, value);
+            params.add(pair);
+        }
+        //
+        RequestConfig requestConfig = RequestConfig.custom()
+                .setConnectTimeout(connectTimeout).setConnectionRequestTimeout(requestTimeout)
+                .setSocketTimeout(socketTimeout).build();
+        HttpUriRequest httpGet = RequestBuilder.get().setUri(url)
+                .addParameters(params.toArray(new BasicNameValuePair[params.size()]))
+                .setConfig(requestConfig).build();
+        return httpGet;
+    }
+    //
+    private HttpGet getHttpRequest(String url, Map<String, Integer> timeoutMap) {
+        int connectTimeout = timeoutMap.get("connectTimeout");
+        int requestTimeout = timeoutMap.get("requestTimeout");
+        int socketTimeout = timeoutMap.get("socketTimeout");
+
+        HttpGet httpGet = new HttpGet(url);
+        //设置超时时间
+        RequestConfig requestConfig = RequestConfig.custom()
+                .setConnectTimeout(connectTimeout).setConnectionRequestTimeout(requestTimeout)
+                .setSocketTimeout(socketTimeout).build();
+        httpGet.setConfig(requestConfig);
+        return httpGet;
+    }
+
+    //test
+    private void get() {
+//        CloseableHttpClient httpclient = HttpClients.createDefault();
+//        try {
+//            // 创建httpget.
+//            HttpGet httpget = new HttpGet(httpIp + "/token/getToken?userId=20210501&timestamp=45546546454&random=1156&sign=7fa431325504e01e9fa87ed0e274c40c");
+//            System.out.println("executing request " + httpget.getURI());
+//            // 执行get请求.
+//            CloseableHttpResponse response = httpclient.execute(httpget);
+//            try {
+//                // 获取响应实体
+//                HttpEntity entity = response.getEntity();
+//                System.out.println("--------------------------------------");
+//                // 打印响应状态
+//                System.out.println(response.getStatusLine());
+//                if (entity != null) {
+//                    // 打印响应内容长度
+//                    System.out.println("Response content length: " + entity.getContentLength());
+//                    // 打印响应内容
+//                    System.out.println("Response content: " + EntityUtils.toString(entity));
+//                }
+//                System.out.println("------------------------------------");
+//            } finally {
+//                response.close();
+//            }
+//        } catch (ClientProtocolException e) {
+//            e.printStackTrace();
+//        } catch (ParseException e) {
+//            e.printStackTrace();
+//        } catch (IOException e) {
+//            e.printStackTrace();
+//        } finally {
+//            // 关闭连接,释放资源
+//            try {
+//                httpclient.close();
+//            } catch (IOException e) {
+//                e.printStackTrace();
+//            }
+//        }
+    }
+
+
+    private void getRequest() throws IOException {
+//        //1.打开浏览器
+//        CloseableHttpClient httpClient = HttpClients.createDefault();
+//        //2.声明get请求
+//        HttpGet httpGet = new HttpGet(httpIp + "/token/getToken?userId=20210501&timestamp=45546546454&random=1156&sign=7fa431325504e01e9fa87ed0e274c40c");
+//        //3.发送请求
+//        CloseableHttpResponse response = httpClient.execute(httpGet);
+//        System.out.println("StatusCode=" + response.getStatusLine().getStatusCode());
+//        //4.判断状态码
+//        if (response.getStatusLine().getStatusCode() == 200) {
+//            HttpEntity entity = response.getEntity();
+//            //使用工具类EntityUtils,从响应中取出实体表示的内容并转换成字符串
+//            String string = EntityUtils.toString(entity, "utf-8");
+//            System.out.println(string);
+//        }
+//        //5.关闭资源
+//        response.close();
+//        httpClient.close();
+    }
+}

+ 125 - 0
huimv-farm-device/huimv-farm-netip/src/main/java/com/huimv/huimvfarmnetip/utils/IPUtils.java

@@ -0,0 +1,125 @@
+package com.huimv.huimvfarmnetip.utils;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.biosafety.uface.controller
+ * @Description : TODO
+ * @Version : 1.0
+ * @Author : ZhuoNing
+ * @Create : 2020-12-25
+ **/
+
+@Component
+@Slf4j
+public class IPUtils {
+    /**
+     * 执行shell脚本命令
+     * @param file
+     */
+    public void doExec(String file)
+    {
+
+        try
+        {
+            Runtime.getRuntime().exec("bash " + file);
+            log.info("bash " + file);
+
+        }
+        catch (IOException e)
+        {
+            log.warn("Exec " + file + " IOException:", e);
+        }
+    }
+
+    /**
+     * 执行一个Shell脚本
+     */
+    public boolean execute(String shellFile)
+    {
+        //脚本文件为NULL或空值
+        if (null == shellFile || shellFile.equals(""))
+        {
+            log.warn("ShellCommand shellFile is null.");
+            return false;
+        }
+
+        if (log.isDebugEnabled())
+        {
+            log.debug("bash " + shellFile);
+        }
+
+        try
+        {
+            Process process = Runtime.getRuntime().exec("bash " + shellFile);
+            int iretCode = process.waitFor();
+
+            try
+            {
+                if (iretCode != 0)
+                {
+                    BufferedReader br = new BufferedReader(
+                            new InputStreamReader(process.getErrorStream()));
+                    StringBuilder errorDesc = new StringBuilder();
+
+                    for (String str = br.readLine(); str != null; str = br
+                            .readLine())
+                    {
+                        errorDesc.append(str);
+                    }
+                    log.error("execute shell " + shellFile + " failed: "
+                            + errorDesc);
+                    //zkf35483 新增关闭流操作
+                    br.close();
+                }
+                else
+                {
+                    return true;
+                }
+            }
+            catch (IOException e)
+            {
+                log.error("IOException:", e);
+            }
+            finally
+            {
+                process.getErrorStream().close();
+                process.getInputStream().close();
+                process.getOutputStream().close();
+            }
+
+        }
+        catch (Exception e)
+        {
+            log.error("Execute " + shellFile + " exception:", e);
+        }
+        return false;
+    }
+
+    public String run(String shellFile){
+        try {
+            Process ps = Runtime.getRuntime().exec(shellFile);
+            ps.waitFor();
+
+            BufferedReader br = new BufferedReader(new InputStreamReader(ps.getInputStream()));
+            StringBuffer sb = new StringBuffer();
+            String line;
+            while ((line = br.readLine()) != null) {
+                sb.append(line).append("\n");
+            }
+            String result = sb.toString();
+//            System.out.println(result);
+            return result;
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+}

+ 36 - 0
huimv-farm-device/huimv-farm-netip/src/main/java/com/huimv/huimvfarmnetip/utils/TextUtil.java

@@ -0,0 +1,36 @@
+package com.huimv.huimvfarmnetip.utils;
+
+import org.springframework.stereotype.Component;
+
+import java.io.UnsupportedEncodingException;
+import java.util.Base64;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.biosafety.uface.controller
+ * @Description : TODO
+ * @Version : 1.0
+ * @Author : ZhuoNing
+ * @Create : 2020-12-25
+ **/
+@Component
+public class TextUtil {
+
+    //转义符处理
+    public String translateSymbol(String data) throws UnsupportedEncodingException {
+        return decode(data.replace("data=","").replace("%3D","="));
+    }
+
+    //base64编码
+    public String encode(String text) throws UnsupportedEncodingException {
+        final Base64.Encoder encoder = Base64.getEncoder();
+        final byte[] textByte = text.replaceAll(" ", "").getBytes("UTF-8");
+        return encoder.encodeToString(textByte);
+    }
+
+    //base64解码
+    public String decode(String encodedText) throws UnsupportedEncodingException {
+        final Base64.Decoder decoder = Base64.getDecoder();
+        return new String(decoder.decode(encodedText.toString().replace("\r\n", "")), "UTF-8");
+    }
+}

+ 32 - 0
huimv-farm-device/huimv-farm-netip/src/main/resources/application-dev.yml

@@ -0,0 +1,32 @@
+server:
+  port: 8099
+#spring:
+#  application:
+#    name: pigfarm-local-device
+#  #------DataSource-----
+#  datasource:
+#    url: jdbc:mysql://192.168.1.7:3306/huimv-farm-device?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+#    username: root
+#    password: hm123456
+#    driver-class-name: com.mysql.cj.jdbc.Driver
+##    driver-class-name: com.mysql.jdbc.Driver
+#  jpa:
+#    hibernate:
+#      ddl-auto: update
+#    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+
+# Socket配置
+#socket:
+  # 监听端口 9001
+#  listen:
+#    #ip: 192.168.16.3
+#    ip: 192.168.1.49
+#    port: 10020
+  # 线程池 - 保持线程数 20
+  #pool-keep: 20
+  # 线程池 - 核心线程数 10
+  #pool-core: 10
+  # 线程池 - 最大线程数 20
+  #pool-max: 30
+  # 线程队列容量 10
+  #pool-queue-init: 10

+ 12 - 0
huimv-farm-device/huimv-farm-netip/src/main/resources/application.properties

@@ -0,0 +1,12 @@
+spring.profiles.active=dev
+
+# 数据中心数据推送地址
+dataCenter.ipAddr=http://115.238.57.190
+dataCenter.port=:8098
+# 更新ip服务
+dataCenter.service.netIp=/ip/updateNetIp
+#dataCenter.service.netIp=/receiver/receiver/farm/ip/updateNetIp
+# 部署牧场ID(base_farm.id)
+local.farmID=12
+local.shellFile=/opt/ip2/netIp.sh
+local.relay.port=:9080

+ 13 - 0
huimv-farm-device/huimv-farm-netip/src/test/java/com/huimv/huimvfarmnetip/HuimvFarmNetipApplicationTests.java

@@ -0,0 +1,13 @@
+package com.huimv.huimvfarmnetip;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class HuimvFarmNetipApplicationTests {
+
+    @Test
+    void contextLoads() {
+    }
+
+}