Browse Source

first commit

zhoucg 6 months ago
commit
97579545ec
100 changed files with 22998 additions and 0 deletions
  1. 73 0
      .gitignore
  2. 30 0
      00base/01yvan-ext.groovy
  3. 101 0
      00base/01yvan-ext.sh
  4. 30 0
      00base/02yvan-ext-mobile.groovy
  5. 101 0
      00base/02yvan-ext-mobile.sh
  6. 81 0
      00base/03xxljob.sh
  7. 64 0
      00base/04elasticsearch.sh
  8. 63 0
      00base/05kibana.sh
  9. 2863 0
      00base/06k8s-install-centos.sh
  10. 834 0
      00base/07env-install-centos.sh
  11. 502 0
      00base/08jenkins-agent-install-centos.sh
  12. 172 0
      00base/09api-gateway.sh
  13. 101 0
      00base/11yvan-vue.sh
  14. 101 0
      00base/12yvan-vue-mobile.sh
  15. 28 0
      00base/CI-CD/.dockerignore
  16. 4 0
      00base/CI-CD/Dockerfile
  17. 73 0
      00base/CI-CD/Jenkinsfile.groovy
  18. 187 0
      00base/CI-CD/wms-gateway.yml
  19. 70 0
      00base/tmp.sh
  20. 233 0
      01dongying_guokang/01wms8-test.sh
  21. 133 0
      01dongying_guokang/02pda-test.sh
  22. 232 0
      01dongying_guokang/03wms8-prod.bak.sh
  23. 224 0
      01dongying_guokang/03wms8-prod.sh
  24. 142 0
      01dongying_guokang/04pda-prod.sh
  25. 81 0
      01dongying_guokang/05xxljob-prod.sh
  26. 232 0
      01dongying_guokang/06wms8-test2.sh
  27. 232 0
      01dongying_guokang/07wms8-test3.bak.sh
  28. 224 0
      01dongying_guokang/07wms8-test3.sh
  29. 142 0
      01dongying_guokang/08pda-test3.sh
  30. 81 0
      01dongying_guokang/09xxljob-test3.sh
  31. 229 0
      02zhongtongfu/01wms8-test.sh
  32. 79 0
      02zhongtongfu/02nacos-consul-adapter.sh
  33. 182 0
      02zhongtongfu/03message-center-test.sh
  34. 70 0
      02zhongtongfu/04wms-ztf-pad-prod.sh
  35. 678 0
      02zhongtongfu/test/01env-install-centos.sh
  36. 2860 0
      02zhongtongfu/test/02k8s-install-centos.sh
  37. 15 0
      03qingdaozhongche/01wms8.bat
  38. 230 0
      04hua_an_tang/01wms8-test.sh
  39. 175 0
      04hua_an_tang/02api-test.sh
  40. 229 0
      04hua_an_tang/03wms8-prod.sh
  41. 174 0
      04hua_an_tang/04api-prod.sh
  42. 81 0
      04hua_an_tang/05xxljob-prod.sh
  43. 142 0
      04hua_an_tang/06pda-prod.sh
  44. 238 0
      05shengke/01wms83-test.sh
  45. 175 0
      05shengke/02api-test.sh
  46. 81 0
      05shengke/03xxljob-prod.sh
  47. 35 0
      05shengke/03xxljob.groovy
  48. 33 0
      05shengke/04wms83-prod.groovy
  49. 235 0
      05shengke/04wms83-prod.sh
  50. 32 0
      05shengke/05api-prod.groovy
  51. 190 0
      05shengke/05api-prod.sh
  52. 171 0
      05shengke/06api-gateway.sh
  53. 214 0
      06zhanhui/01wms8-prod.sh
  54. 224 0
      07shuyu_benxi/02wms8-prod.sh
  55. 143 0
      07shuyu_benxi/03pda-prod.sh
  56. 224 0
      07shuyu_fujian/02wms8-prod.sh
  57. 143 0
      07shuyu_fujian/03pda-prod.sh
  58. 224 0
      07shuyu_haerbing/02wms8-prod.sh
  59. 143 0
      07shuyu_haerbing/03pda-prod.sh
  60. 81 0
      07shuyu_qingdao/01xxljob-prod.sh
  61. 232 0
      07shuyu_qingdao/02wms8-prod.bak.sh
  62. 224 0
      07shuyu_qingdao/02wms8-prod.sh
  63. 142 0
      07shuyu_qingdao/03pda-prod.sh
  64. 224 0
      07shuyu_qingdao/04wms8-online-dev.sh
  65. 230 0
      08luolai/01wms-hwy-test.sh
  66. 175 0
      08luolai/02api-hwy-test.sh
  67. 172 0
      08luolai/03api-hwy-gateway.sh
  68. 81 0
      08luolai/04xxljob-prod.sh
  69. 234 0
      08luolai/05wms83-prod.sh
  70. 189 0
      08luolai/06api-prod.sh
  71. 171 0
      08luolai/07api-gateway-prod.sh
  72. 234 0
      08luolai/08wms83-test.sh
  73. 189 0
      08luolai/09api-test.sh
  74. 171 0
      08luolai/10api-gateway-test.sh
  75. 288 0
      90yvan/01deploy.sh
  76. 265 0
      build.sh
  77. 127 0
      deploy.sh
  78. 208 0
      dsl/001sync_code.sh
  79. 204 0
      dsl/build-mega.sh
  80. 204 0
      dsl/build.sh
  81. 198 0
      dsl/dashenlin-naning-prd_build.sh
  82. 199 0
      dsl/dashenlin-naning-test_build.sh
  83. 205 0
      dsl/haerbing-prd_build.sh
  84. 206 0
      dsl/haerbing-test_build.sh
  85. 200 0
      dsl/nantong-prod_build.sh
  86. 199 0
      dsl/nantong-test_build.sh
  87. 198 0
      dsl/nantong-tmp_build.sh
  88. 213 0
      dsl/shunde-test_build.sh
  89. 81 0
      hua_wei_yun/01xxljob.sh
  90. 233 0
      hua_wei_yun/02test-deploy-wms8-pg.sh
  91. 237 0
      hua_wei_yun/03wms84-test.sh
  92. 206 0
      hua_wei_yun/04wms-ztf-api-test.sh
  93. 300 0
      hua_wei_yun/05wms-ztf-test.sh
  94. 206 0
      hua_wei_yun/06wms-ztf-filemanager-test.sh
  95. 206 0
      hua_wei_yun/07wms-ztf-print-test.sh
  96. 253 0
      hua_wei_yun/08wms-ztf-config-center-test.sh
  97. 84 0
      hua_wei_yun/09wms-ztf-pad-test.sh
  98. 224 0
      hua_wei_yun/10wms86-test.sh
  99. 222 0
      hua_wei_yun/11kpi-admin.sh
  100. 0 0
      hua_wei_yun/12wms86-sd-test.sh

+ 73 - 0
.gitignore

@@ -0,0 +1,73 @@
+# Compiled class file
+*.class
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.nar
+*.ear
+*.zip
+*.tar.gz
+*.rar
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+# STS
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+bin/
+!**/src/main/**/bin/
+!**/src/test/**/bin/
+
+# IntelliJ IDEA
+.idea
+*.iws
+*.iml
+*.ipr
+out/
+!**/src/main/**/out/
+!**/src/test/**/out/
+
+# NetBeans
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+
+# VS Code
+.vscode/
+
+# gradle
+!gradle/wrapper/gradle-wrapper.jar
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+# 设置不需要提交的文件
+.flattened-pom.xml
+*.eml
+*.lock
+*.log.*
+.gradle
+.vscode
+.DS_Store
+target
+pom.xml.versionsBackup
+build/
+node_modules
+lib

+ 30 - 0
00base/01yvan-ext.groovy

@@ -0,0 +1,30 @@
+//file:noinspection ALL
+pipeline {
+    agent any
+
+    environment {
+        projectName = 'yvan-ext'
+    }
+
+    stages {
+        stage('#检查环境') {
+            steps {
+                sh """
+                    node -v
+                    npm -v
+                    yarn -v
+                """
+            }
+        }
+
+        stage('#编译项目') {
+            steps {
+                sh """
+                    wget -N http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh
+                    chmod +x 01yvan-ext.sh
+                    ./01yvan-ext.sh deploy
+                """
+            }
+        }
+    }
+}

+ 101 - 0
00base/01yvan-ext.sh

@@ -0,0 +1,101 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/yvan-ext
+gitUrlArr=(
+  "http://git.yvanui.com/jztd/yvan-ext.git"
+)
+
+branchArr=(
+  "master"
+)
+positionArr=(
+  "."
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+isChange="1"
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 yvan-ext
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath $echoSuffix"
+    cd "$codePath"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-ext 文件未变化"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+cmd=$1
+if [ "$cmd" == "deploy" ];then
+  deployPull
+  buildCode
+elif [ "$cmd" == "pull" ];then
+  deployPull
+else
+  echo "输入操作参数: pull deploy"
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) [cmd]

+ 30 - 0
00base/02yvan-ext-mobile.groovy

@@ -0,0 +1,30 @@
+//file:noinspection ALL
+pipeline {
+    agent any
+
+    environment {
+        projectName = 'yvan-ext-mobile'
+    }
+
+    stages {
+        stage('#检查环境') {
+            steps {
+                sh """
+                    node -v
+                    npm -v
+                    yarn -v
+                """
+            }
+        }
+
+        stage('#编译项目') {
+            steps {
+                sh """
+                    wget -N http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh
+                    chmod +x 02yvan-ext-mobile.sh
+                    ./02yvan-ext-mobile.sh deploy
+                """
+            }
+        }
+    }
+}

+ 101 - 0
00base/02yvan-ext-mobile.sh

@@ -0,0 +1,101 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/yvan-ext-mobile
+gitUrlArr=(
+  "http://git.yvanui.com/jztd/yvan-ext-mobile.git"
+)
+
+branchArr=(
+  "master"
+)
+positionArr=(
+  "."
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+isChange="1"
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 yvan-ext-mobile
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath $echoSuffix"
+    cd "$codePath"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-ext-mobile 文件未变化"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+cmd=$1
+if [ "$cmd" == "deploy" ];then
+  deployPull
+  buildCode
+elif [ "$cmd" == "pull" ];then
+  deployPull
+else
+  echo "输入操作参数: pull deploy"
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) [cmd]

+ 81 - 0
00base/03xxljob.sh

@@ -0,0 +1,81 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/xxl-job
+gitUrlArr=(
+  "http://git.yvanui.com/lizhiwei/xxl-job.git"
+)
+
+branchArr=(
+  "master"
+)
+positionArr=(
+  "."
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+isChange="1"
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+cmd=$1
+if [ "$cmd" == "pull" ];then
+  deployPull
+else
+  echo "输入操作参数: pull"
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/03xxljob.sh) [cmd]

+ 64 - 0
00base/04elasticsearch.sh

@@ -0,0 +1,64 @@
+#!/bin/bash
+#set -x
+set -e
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+installPath=/opt/elasticsearch/elasticsearch-7.17.5
+serverName=test_elasticsearch
+cmd=$1
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $installPath/bin $echoSuffix"
+    cd $installPath/bin
+    echo -e "$echoPrefix nohup ./elasticsearch >>/dev/null 2>&1 & $echoSuffix"
+    nohup ./elasticsearch >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "日志目录: cd $installPath/logs"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: restart start stop kill
+if [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: restart start stop kill"
+    echo "日志目录: cd $installPath/logs"
+  else
+    echo "输入操作参数: restart start stop kill"
+    echo "pid=$pid | $serverName 正在运行... | 日志目录: cd $installPath/logs"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/04elasticsearch.sh) [cmd]

+ 63 - 0
00base/05kibana.sh

@@ -0,0 +1,63 @@
+#!/bin/bash
+#set -x
+set -e
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+installPath=/home/opt/kibana/kibana-7.17.5-linux-x86_64
+serverName=test_kibana
+cmd=$1
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $installPath/bin $echoSuffix"
+    cd $installPath/bin
+    echo -e "$echoPrefix nohup ./kibana >>/dev/null 2>&1 & $echoSuffix"
+    nohup ./kibana >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep './../node/bin/node ./../src/cli/dist' | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "./../node/bin/node ./../src/cli/dist" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+pid=`ps -ef | grep "./../node/bin/node ./../src/cli/dist" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: restart start stop kill
+if [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: restart start stop kill"
+    echo "日志目录: cd $installPath/logs"
+  else
+    echo "输入操作参数: restart start stop kill"
+    echo "pid=$pid | $serverName 正在运行... | 日志目录: cd $installPath/logs"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/05kibana.sh) [cmd]

File diff suppressed because it is too large
+ 2863 - 0
00base/06k8s-install-centos.sh


+ 834 - 0
00base/07env-install-centos.sh

@@ -0,0 +1,834 @@
+#!/usr/bin/env bash
+
+#-----------------------------------------------------------------------------------------------------
+# Nodejs 下载地址
+#   镜像1: https://nodejs.org/dist/ (https://nodejs.org/dist/v16.18.0/node-v16.18.0-linux-x64.tar.gz)
+# OracleJDK 下载地址
+#   镜像1: https://www.injdk.cn/ (https://d6.injdk.cn/oraclejdk/11/jdk-11.0.16.1_linux-x64_bin.tar.gz) (https://d6.injdk.cn/oraclejdk/8/jdk-8u341-linux-x64.tar.gz)
+#   镜像2: http://www.codebaoku.com/jdk/jdk-index.html (https://114-233-56-217.d.cjjd09.com:30443/123-511/85b2a0b8/1661483-0/85b2a0b8c16863b3ad55e742ac2ba9ff?v=3&t=1667188559&s=f2df45083bb69864446f801bf25b725c&i=dde8a980&filename=jdk-11.0.15.1_linux-x64_bin.tar.gz&d=6ee52da1)
+#-----------------------------------------------------------------------------------------------------
+
+# 配置
+ADD_USER_NAME="www"
+ADD_USER_PASSWORD="MoXF2Zi6u7f7lqZu"
+BASE_DIR="/opt"
+
+# 软件
+YUM_REPOS="http://mirrors.aliyun.com/repo/Centos-7.repo"
+#--- jdk(安装)
+JDK_URL="http://all.msvc.top:30005/public/app-pkgs/raw/branch/main/OracleJDK/jdk-8u202-linux-x64.tar.gz"
+JDK_FILE_NAME="jdk-8u202-linux-x64.tar.gz"
+JDK_DIR_NAME="jdk1.8.0_202"
+#--- jdk8(参考)
+JDK8_URL="http://all.msvc.top:30005/public/app-pkgs/raw/branch/main/OracleJDK/jdk-8u411-linux-x64.tar.gz"
+JDK8_FILE_NAME="jdk-8u411-linux-x64.tar.gz"
+JDK8_DIR_NAME="jdk1.8.0_411"
+#--- jdk11(参考)
+JDK11_URL="http://all.msvc.top:30005/public/app-pkgs/raw/branch/main/OracleJDK/jdk-11.0.23_linux-x64_bin.tar.gz"
+JDK11_FILE_NAME="jdk-11.0.23_linux-x64_bin.tar.gz"
+JDK11_DIR_NAME="jdk-11.0.23"
+#--- gradle (6.8.3 | 6.9.3 | 7.4.2 | 7.5.1)
+GRADLE_URL="http://all.msvc.top:30005/public/app-pkgs/raw/branch/main/Gradle/gradle-6.8.3-bin.zip"
+GRADLE_FILE_NAME="gradle-6.8.3-bin.zip"
+GRADLE_DIR_NAME="gradle-6.8.3"
+#--- maven (3.8.6 | 3.6.3 | 3.5.4 | 3.3.9)
+MAVEN_URL="https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz"
+MAVEN_FILE_NAME="apache-maven-3.8.6-bin.tar.gz"
+MAVEN_DIR_NAME="apache-maven-3.8.6"
+#--- jenkins (http://mirrors.jenkins.io/war-stable/latest/)
+JENKINS_URL="https://ftp-nyc.osuosl.org/pub/jenkins/war-stable/latest/jenkins.war"
+JENKINS_FILE_NAME="jenkins.war"
+JENKINS_JAVA_URL="https://d6.injdk.cn/oraclejdk/11/jdk-11.0.16.1_linux-x64_bin.tar.gz"
+JENKINS_JAVA_FILE_NAME="jdk-11.0.16.1_linux-x64_bin.tar.gz"
+JENKINS_JAVA_DIR_NAME="jdk-11.0.16.1"
+#--- redis Latest Stable
+REDIS_URL="https://download.redis.io/redis-stable.tar.gz"
+REDIS_FILE_NAME="redis-stable.tar.gz"
+REDIS_DIR_NAME="redis-stable"
+
+# 安装标识
+#--- SSH用户
+SSH_OPTIONS="-o ConnectTimeout=600 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
+SSH_USER=""
+SSH_PASSWORD=""
+SSH_PRIVATE_KEY=""
+SSH_PORT=""
+#--- SUDO用户
+SUDO_TAG="0"
+SUDO_USER=""
+SUDO_PASSWORD=""
+#--- 指令
+INIT_TAG="0"
+#--- 指令参数
+UPDATE_YUM_REPOS="0"
+CONFIG_TAG="0"
+ADD_USER_TAG="0"
+GIT_TAG="0"
+DSTAT_TAG="0"
+HTOP_TAG="0"
+NGINX_TAG="0"
+NODEJS_TAG="0"
+JAVA_TAG="0"
+GRADLE_TAG="0"
+MAVEN_TAG="0"
+JENKINS_TAG="0"
+REDIS_TAG="0"
+
+# 脚本设置
+TMP_DIR="$(rm -rf /tmp/env-install* && mktemp -d -t env-install.XXXXXXXXXX)"
+LOG_FILE="${TMP_DIR}/env-install.log"
+ERROR_INFO="\n\033[31mERROR Summary: \033[0m\n  "
+ACCESS_INFO="\n\033[32mACCESS Summary: \033[0m\n  "
+SCRIPT_PARAMETER="$*"
+COMMAND_OUTPUT=""
+
+######################################################################################################
+# 通用函数
+######################################################################################################
+# 信号处理
+function trap::info() {
+  [[ ${#ERROR_INFO} -gt 37 ]] && echo -e "$ERROR_INFO"
+  [[ ${#ACCESS_INFO} -gt 38 ]] && echo -e "$ACCESS_INFO"
+  [ -f "$LOG_FILE" ] && echo -e "\n\n  See detailed log >>> cat $LOG_FILE \n\n"
+  trap '' EXIT
+  exit
+}
+
+# 错误日志
+function log::error() {
+  local item; item="[$(date +'%Y-%m-%dT%H:%M:%S.%N%z')]: \033[31mERROR:   \033[0m$*"
+  ERROR_INFO="${ERROR_INFO}${item}\n  "
+  echo -e "${item}" | tee -a "$LOG_FILE"
+}
+
+# 基础日志
+function log::info() {
+  printf "[%s]: \033[32mINFO:    \033[0m%s\n" "$(date +'%Y-%m-%dT%H:%M:%S.%N%z')" "$*" | tee -a "$LOG_FILE"
+}
+
+# 警告日志
+function log::warning() {
+  printf "[%s]: \033[33mWARNING: \033[0m%s\n" "$(date +'%Y-%m-%dT%H:%M:%S.%N%z')" "$*" | tee -a "$LOG_FILE"
+}
+
+# 访问信息
+function log::access() {
+  ACCESS_INFO="${ACCESS_INFO}$*\n  "
+  printf "[%s]: \033[32mINFO:    \033[0m%s\n" "$(date +'%Y-%m-%dT%H:%M:%S.%N%z')" "$*" | tee -a "$LOG_FILE"
+}
+
+# 执行日志
+function log::exec() {
+  printf "[%s]: \033[34mEXEC:    \033[0m%s\n" "$(date +'%Y-%m-%dT%H:%M:%S.%N%z')" "$*" >> "$LOG_FILE"
+}
+
+# 检查返回码
+function check::exit_code() {
+  local code=${1:-}
+  local app=${2:-}
+  local desc=${3:-}
+  local exit_script=${4:-}
+  if [[ "${code}" == "0" ]]; then
+    log::info "[${app}]" "${desc} succeeded."
+  else
+    log::error "[${app}]" "${desc} failed."
+    [[ "$exit_script" == "exit" ]] && exit "$code"
+  fi
+}
+
+# 重试
+function utils::retry() {
+  local retries=$1
+  shift
+  local count=0
+  until eval "$*"; do
+    exit=$?
+    wait=$((2 ** count))
+    count=$((count + 1))
+    if [ "$count" -lt "$retries" ]; then
+      echo "Retry $count/$retries exited $exit, retrying in $wait seconds..."
+      sleep $wait
+    else
+      echo "Retry $count/$retries exited $exit, no more retries left."
+      return $exit
+    fi
+  done
+  return 0
+}
+
+# 转义引号
+function utils::quote() {
+  # shellcheck disable=SC2046
+  if [ $(echo "$*" | tr -d "\n" | wc -c) -eq 0 ]; then
+    echo "''"
+  elif [ $(echo "$*" | tr -d "[a-z][A-Z][0-9]:,.=~_/\n-" | wc -c) -gt 0 ]; then
+    printf "%s" "$*" | sed -e "1h;2,\$H;\$!d;g" -e "s/'/\'\"\'\"\'/g" | sed -e "1h;2,\$H;\$!d;g" -e "s/^/'/g" -e "s/$/'/g"
+  else
+    echo "$*"
+  fi
+}
+
+# 检查命令是否存在
+function check::command_exists() {
+  local cmd=${1}
+  local package=${2}
+  if command -V "$cmd" > /dev/null 2>&1; then
+    log::info "[check]" "$cmd command exists."
+  else
+    log::warning "[check]" "I require $cmd but it's not installed."
+    log::warning "[check]" "install $package package."
+    command::exec "127.0.0.1" "yum install -y ${package}"
+    check::exit_code "$?" "check" "$package install" "exit"
+  fi
+}
+
+# 执行命令
+function command::exec() {
+  local host=${1:-"127.0.0.1"}
+  shift
+  local command="$*"
+  if [[ "${SUDO_TAG:-}" == "1" ]]; then
+    sudo_options="sudo -H -n -u ${SUDO_USER}"
+    if [[ "${SUDO_PASSWORD:-}" != "" ]]; then
+       sudo_options="${sudo_options// -n/} -p \"\" -S <<< \"${SUDO_PASSWORD}\""
+    fi
+    command="$sudo_options bash -c $(utils::quote "$command")"
+  fi
+  command="$(utils::quote "$command")"
+  if [[ "${host}" == "127.0.0.1" ]]; then
+    # 本地执行
+    log::exec "[command]" "bash -c $(printf "%s" "${command//${SUDO_PASSWORD:-}/zzzzzz}")"
+    # shellcheck disable=SC2094
+    COMMAND_OUTPUT=$(eval bash -c "${command}" 2>> "$LOG_FILE" | tee -a "$LOG_FILE")
+    local status=$?
+  else
+    # 远程执行
+    local ssh_cmd="ssh"
+    if [[ "${SSH_PASSWORD}" != "" ]]; then
+      ssh_cmd="sshpass -p \"${SSH_PASSWORD}\" ${ssh_cmd}"
+    elif [[ "$SSH_PRIVATE_KEY" != "" ]]; then
+      [ -f "${SSH_PRIVATE_KEY}" ] || { log::error "[exec]" "ssh private_key:${SSH_PRIVATE_KEY} not found."; exit 1; }
+      ssh_cmd="${ssh_cmd} -i $SSH_PRIVATE_KEY"
+    fi
+    log::exec "[command]" "${ssh_cmd//${SSH_PASSWORD:-}/zzzzzz} ${SSH_OPTIONS} ${SSH_USER}@${host} -p ${SSH_PORT} bash -c $(printf "%s" "${command//${SUDO_PASSWORD:-}/zzzzzz}")"
+    # shellcheck disable=SC2094
+    COMMAND_OUTPUT=$(eval "${ssh_cmd} ${SSH_OPTIONS} ${SSH_USER}@${host} -p ${SSH_PORT}" bash -c '"${command}"' 2>> "$LOG_FILE" | tee -a "$LOG_FILE")
+    local status=$?
+  fi
+  return $status
+}
+
+######################################################################################################
+# 安装函数
+######################################################################################################
+# 检查用到的命令
+function check::command() {
+  check::command_exists ssh openssh-clients
+  check::command_exists tar tar
+  check::command_exists wget wget
+  check::command_exists unzip unzip
+}
+
+# 更新yum源
+function init:update_yum_repos() {
+  log::info "[update-yum-repos]" "更新yum源..."
+  local host="127.0.0.1"
+  local repo="/etc/yum.repos.d/CentOS-Base.repo"
+  local repo_bak="/etc/yum.repos.d/CentOS-Base.repo_bak"
+  command::exec "${host}" "
+    if [ ! -f "$repo_bak" ]; then
+      mv $repo $repo_bak
+      wget --timeout=10 --waitretry=3 --tries=5 --retry-connrefused --no-check-certificate ${YUM_REPOS} -O $repo
+      yum clean all
+      yum makecache
+      yum -y install epel-release
+    fi
+  "
+  check::exit_code "$?" "update-yum-repos" "$host 更新yum源" "exit"
+  log::info "[update-yum-repos]" "yum源更新成功!"
+}
+
+# 系统配置
+function init:config() {
+  log::info "[config]" "关闭系统防火墙..."
+  local host="127.0.0.1"
+  command::exec "${host}" "
+    # 停止防火墙
+    systemctl stop firewalld
+    # 彻底关闭防火墙
+    systemctl disable firewalld
+  "
+  log::info "[config]" "系统防火墙关闭成功!"
+}
+
+# 新增用户
+function init:add_user() {
+  log::info "[add-user]" "新增用户[${ADD_USER_NAME}]..."
+  local host="127.0.0.1"
+  local add_sudoers="${ADD_USER_NAME}    ALL=(ALL)       NOPASSWD:ALL"
+  command::exec "${host}" "
+  id -u ${ADD_USER_NAME} >/dev/null 2>&1
+  if [ \$? -ne '0' ]; then
+    # 创建用户
+    adduser ${ADD_USER_NAME}
+    # 设置密码
+    echo ${ADD_USER_NAME}:${ADD_USER_PASSWORD} | chpasswd
+    # 禁止远程登录
+    echo DenyUsers ${ADD_USER_NAME} >> /etc/ssh/sshd_config
+  fi
+  if [ \`grep -c '$add_sudoers' '/etc/sudoers'\` == '0' ];then
+    # 新增修改权限
+    chmod -v u+w /etc/sudoers
+    echo -e '$add_sudoers' >> /etc/sudoers
+    # 收回修改权限
+    chmod -v u-w /etc/sudoers
+  fi
+  "
+  check::exit_code "$?" "add-user" "$host 新增用户[${ADD_USER_NAME}]" "exit"
+  log::info "[add-user]" "新增用户[${ADD_USER_NAME}]成功!"
+}
+
+# 安装git环境
+function init:git() {
+  log::info "[git]" "安装git环境..."
+  local host="127.0.0.1"
+  local exc_cmd="git config --global credential.helper store"
+  command::exec "${host}" "
+    yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm
+    yum -y install git
+    git --version
+    $exc_cmd
+  "
+  check::exit_code "$?" "git" "$host 安装git环境" "exit"
+  log::info "[git]" "git环境安装成功!"
+  if [[ "${ADD_USER_TAG:-}" == "1" ]]; then
+    command::exec "${host}" "
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c '$exc_cmd'
+    "
+    check::exit_code "$?" "git" "$host git配置" "exit"
+    log::info "[git]" "git配置成功!"
+  fi
+}
+
+# 安装dstat
+function init:dstat() {
+  log::info "[dstat]" "安装dstat..."
+  local host="127.0.0.1"
+  command::exec "${host}" "
+    yum -y install dstat
+    dstat -V
+  "
+  check::exit_code "$?" "dstat" "$host 安装dstat" "exit"
+  log::info "[dstat]" "dstat安装成功!"
+}
+
+# 安装htop
+function init:htop() {
+  log::info "[htop]" "安装htop..."
+  local host="127.0.0.1"
+  command::exec "${host}" "
+    yum -y install htop
+    htop -v
+  "
+  check::exit_code "$?" "htop" "$host 安装htop" "exit"
+  log::info "[htop]" "htop安装成功!"
+}
+
+# 安装nginx
+function init:nginx() {
+  log::info "[nginx]" "安装nginx..."
+  local host="127.0.0.1"
+  command::exec "${host}" "
+    yum -y install nginx
+    nginx -v
+  "
+  check::exit_code "$?" "nginx" "$host 安装nginx" "exit"
+  log::info "[nginx]" "nginx安装成功!"
+  log::info "[nginx]" "配置文件路径: /etc/nginx"
+  log::info "[nginx]" "设置开机启动: sudo systemctl enable nginx"
+  log::info "[nginx]" "启动/停止/重启: sudo service nginx start/stop/restart"
+  log::info "[nginx]" "检查nginx配置: sudo nginx -t"
+  log::info "[nginx]" "加载nginx配置: sudo nginx -s reload"
+}
+
+# 安装nodejs环境
+function init:nodejs() {
+  log::info "[nodejs]" "安装nodejs环境..."
+  local host="127.0.0.1"
+  command::exec "${host}" "
+    curl -fsSL https://rpm.nodesource.com/setup_16.x | sudo bash -
+    yum -y install nodejs
+    yum -y install npm
+    npm install --global yarn
+    # 配置npm源
+    npm config set registry https://registry.npm.taobao.org
+    npm config set disturl https://npm.taobao.org/dist
+    npm config set electron_mirror https://npm.taobao.org/mirrors/electron/
+    npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
+    npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/
+    # 配置yarn源
+    yarn config set registry https://registry.npm.taobao.org -g
+    yarn config set disturl https://npm.taobao.org/dist -g
+    yarn config set electron_mirror https://npm.taobao.org/mirrors/electron/ -g
+    yarn config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ -g
+    yarn config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/ -g
+    yarn config set chromedriver_cdnurl https://cdn.npm.taobao.org/dist/chromedriver -g
+    yarn config set operadriver_cdnurl https://cdn.npm.taobao.org/dist/operadriver -g
+    yarn config set fse_binary_host_mirror https://npm.taobao.org/mirrors/fsevents -g
+    # 验证
+    node -v
+    npm -v
+    yarn -v
+  "
+  check::exit_code "$?" "nodejs" "$host 安装nodejs环境" "exit"
+  if [[ "${ADD_USER_TAG:-}" == "1" ]]; then
+    command::exec "${host}" "
+      # 配置npm源
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'npm config set registry https://registry.npm.taobao.org'
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'npm config set disturl https://npm.taobao.org/dist'
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'npm config set electron_mirror https://npm.taobao.org/mirrors/electron/'
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/'
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/'
+      # 配置yarn源
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'yarn config set registry https://registry.npm.taobao.org -g'
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'yarn config set disturl https://npm.taobao.org/dist -g'
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'yarn config set electron_mirror https://npm.taobao.org/mirrors/electron/ -g'
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'yarn config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ -g'
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'yarn config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/ -g'
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'yarn config set chromedriver_cdnurl https://cdn.npm.taobao.org/dist/chromedriver -g'
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'yarn config set operadriver_cdnurl https://cdn.npm.taobao.org/dist/operadriver -g'
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'yarn config set fse_binary_host_mirror https://npm.taobao.org/mirrors/fsevents -g'
+    "
+    check::exit_code "$?" "nodejs" "$host nodejs配置" "exit"
+    log::info "[nodejs]" "nodejs配置成功!"
+  fi
+  log::info "[nodejs]" "安装nodejs环境成功!"
+}
+
+# 安装java环境
+function init:java() {
+  log::info "[java]" "安装java环境..."
+  local host="127.0.0.1"
+  local java_path="${BASE_DIR}/java/${JDK_DIR_NAME}"
+  local line="\n"
+  local add_profile=`echo -e "${line}JAVA_HOME=${java_path}${line}PATH=\\\$JAVA_HOME/bin:\\\$PATH${line}export JAVA_HOME PATH"`
+  command::exec "${host}" "
+    yum -y remove *openjdk*
+    if [ ! -d "$java_path" ]; then
+      mkdir -p ${BASE_DIR}/java
+      wget --timeout=10 --waitretry=3 --tries=5 --retry-connrefused --no-check-certificate ${JDK_URL} -O ${BASE_DIR}/java/${JDK_FILE_NAME}
+      cd ${BASE_DIR}/java
+      tar -zxvf ${JDK_FILE_NAME}
+      echo '$add_profile' >> /etc/profile
+      source /etc/profile
+    fi
+    java -version
+  "
+  check::exit_code "$?" "java" "$host 安装java环境" "exit"
+  if [[ "${ADD_USER_TAG:-}" == "1" ]]; then
+    command::exec "${host}" "
+      sudo chown -R \$(id -u ${ADD_USER_NAME}):\$(id -g ${ADD_USER_NAME}) ${BASE_DIR}/java
+    "
+  fi
+  log::info "[java]" "java环境安装成功!"
+}
+
+# 安装gradle环境
+function init:gradle() {
+  log::info "[gradle]" "安装gradle环境..."
+  local host="127.0.0.1"
+  local gradle_path="${BASE_DIR}/gradle/${GRADLE_DIR_NAME}"
+  local line="\n"
+  local add_profile=`echo -e "${line}GRADLE_HOME=${gradle_path}${line}PATH=\\\$GRADLE_HOME/bin:\\\$PATH${line}export GRADLE_HOME PATH"`
+  command::exec "${host}" "
+    if [ ! -d "$gradle_path" ]; then
+      mkdir -p ${BASE_DIR}/gradle
+      wget --timeout=10 --waitretry=3 --tries=5 --retry-connrefused --no-check-certificate ${GRADLE_URL} -O ${BASE_DIR}/gradle/${GRADLE_FILE_NAME}
+      cd ${BASE_DIR}/gradle
+      unzip ${GRADLE_FILE_NAME}
+      echo '$add_profile' >> /etc/profile
+      source /etc/profile
+    fi
+    gradle -v
+  "
+  check::exit_code "$?" "gradle" "$host 安装gradle环境" "exit"
+  if [[ "${ADD_USER_TAG:-}" == "1" ]]; then
+    command::exec "${host}" "
+      sudo chown -R \$(id -u ${ADD_USER_NAME}):\$(id -g ${ADD_USER_NAME}) ${BASE_DIR}/gradle
+    "
+  fi
+  log::info "[gradle]" "gradle环境安装成功!"
+}
+
+# 安装maven环境
+function init:maven() {
+  log::info "[maven]" "安装maven环境..."
+  local host="127.0.0.1"
+  local maven_path="${BASE_DIR}/maven/${MAVEN_DIR_NAME}"
+  local line="\n"
+  local add_profile=`echo -e "${line}MAVEN_HOME=${maven_path}${line}PATH=\\\$MAVEN_HOME/bin:\\\$PATH${line}export MAVEN_HOME PATH"`
+  command::exec "${host}" "
+    if [ ! -d "$maven_path" ]; then
+      mkdir -p ${BASE_DIR}/maven
+      wget --timeout=10 --waitretry=3 --tries=5 --retry-connrefused --no-check-certificate ${MAVEN_URL} -O ${BASE_DIR}/maven/${MAVEN_FILE_NAME}
+      cd ${BASE_DIR}/maven
+      tar -zxvf ${MAVEN_FILE_NAME}
+      echo '$add_profile' >> /etc/profile
+      source /etc/profile
+    fi
+    mvn -v
+  "
+  check::exit_code "$?" "maven" "$host 安装maven环境" "exit"
+  if [[ "${ADD_USER_TAG:-}" == "1" ]]; then
+    command::exec "${host}" "
+      sudo chown -R \$(id -u ${ADD_USER_NAME}):\$(id -g ${ADD_USER_NAME}) ${BASE_DIR}/maven
+    "
+  fi
+  log::info "[maven]" "maven环境安装成功!"
+}
+
+# 安装jenkins环境
+function init:jenkins() {
+  log::info "[jenkins]" "安装jenkins环境..."
+  local host="127.0.0.1"
+  local java_path="${BASE_DIR}/jenkins/${JENKINS_JAVA_DIR_NAME}"
+  local jenkins_file="${BASE_DIR}/jenkins/${JENKINS_FILE_NAME}"
+  local java_mem_opts=" -DappName=jenkins -server -Xmx1g"
+  local database_opts=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+  local java_opts_ext=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai -Duser.language=C.UTF-8"
+  command::exec "${host}" "
+    if [ ! -d "$java_path" ]; then
+      mkdir -p ${BASE_DIR}/jenkins
+      wget --timeout=10 --waitretry=3 --tries=5 --retry-connrefused --no-check-certificate ${JENKINS_JAVA_URL} -O ${BASE_DIR}/jenkins/${JENKINS_JAVA_FILE_NAME}
+      cd ${BASE_DIR}/jenkins
+      tar -zxvf ${JENKINS_JAVA_FILE_NAME}
+      $java_path/bin/java -version
+    fi
+    if [ ! -f "$jenkins_file" ]; then
+      mkdir -p ${BASE_DIR}/jenkins
+      wget --timeout=10 --waitretry=3 --tries=5 --retry-connrefused --no-check-certificate ${JENKINS_URL} -O ${BASE_DIR}/jenkins/${JENKINS_FILE_NAME}
+      cd ${BASE_DIR}/jenkins
+    fi
+    # 写文件start.sh文件
+    cat << EOF > ${BASE_DIR}/jenkins/start.sh
+#!/bin/bash
+
+httpPort=\\\${1:-'30003'}
+
+#-------------------------------------------------------------------
+java='$java_path/bin/java'
+jar_file='${BASE_DIR}/jenkins/jenkins.war'
+java_mem_opts=' -DappName=jenkins $java_mem_opts'
+database_opts='$database_opts'
+java_opts_ext='$java_opts_ext'
+#-------------------------------------------------------------------
+
+pid=\\\`ps -ef | grep 'DappName=jenkins ' | grep -v 'grep' | awk '{print \\\$2}'\\\`
+if [ -z \\\$pid ];then
+  nohup \\\$java \\\$java_mem_opts \\\$database_opts \\\$java_opts_ext -jar \\\$jar_file --httpPort=\\\$httpPort >${BASE_DIR}/jenkins/logs.log 2>&1 &
+  echo 'jenkins启动成功!'
+else
+  echo 'jenkins正在运行...'
+fi
+echo '查看日志:  tail -F ${BASE_DIR}/jenkins/logs.log -n 100'
+EOF
+    # 写文件kill.sh文件
+    cat << EOF > ${BASE_DIR}/jenkins/kill.sh
+#!/bin/bash
+
+pid=\\\`ps -ef | grep 'DappName=jenkins ' | grep -v 'grep' | awk '{print \\\$2}'\\\`
+if [ -z \\\$pid ];then
+  echo 'jenkins未运行'
+else
+  ps -ef | grep 'DappName=jenkins ' | grep -v 'grep' | awk '{print \\\$2}' | xargs kill
+  echo 'jenkins已停止!'
+fi
+EOF
+  chmod +x ${BASE_DIR}/jenkins/start.sh
+  chmod +x ${BASE_DIR}/jenkins/kill.sh
+  "
+  check::exit_code "$?" "jenkins" "$host 安装jenkins环境" "exit"
+  if [[ "${ADD_USER_TAG:-}" == "1" ]]; then
+    command::exec "${host}" "
+      sudo chown -R \$(id -u ${ADD_USER_NAME}):\$(id -g ${ADD_USER_NAME}) ${BASE_DIR}/jenkins
+    "
+  fi
+  log::info "[jenkins]" "jenkins环境安装成功!"
+  log::info "[jenkins]" "启动jenkins: ${BASE_DIR}/jenkins/start.sh 30003"
+  log::info "[jenkins]" "停止jenkins: ${BASE_DIR}/jenkins/kill.sh"
+}
+
+# 安装redis环境
+function init:redis() {
+  log::info "[redis]" "安装redis环境..."
+  local host="127.0.0.1"
+  local redis_path="${BASE_DIR}/redis/${REDIS_DIR_NAME}"
+  local redis_install_path="${BASE_DIR}/redis/${REDIS_DIR_NAME}-install"
+  command::exec "${host}" "
+    if [ ! -d "$redis_path" ]; then
+      mkdir -p ${BASE_DIR}/redis
+      wget --timeout=10 --waitretry=3 --tries=5 --retry-connrefused --no-check-certificate ${REDIS_URL} -O ${BASE_DIR}/redis/${REDIS_FILE_NAME}
+      cd ${BASE_DIR}/redis
+      tar -zxvf ${REDIS_FILE_NAME}
+      cd $redis_path
+      yum -y install gcc
+      yum -y install centos-release-scl
+      yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
+      echo 'source /opt/rh/devtoolset-9/enable' >> /etc/profile
+      source /etc/profile
+      gcc -v
+      mkdir -p $redis_install_path
+      cd $redis_path
+      make install PREFIX=$redis_install_path
+      # 写文件start.sh文件
+      cat << EOF > $redis_install_path/redis.conf
+# bind 127.0.0.1
+protected-mode yes
+port 6379
+tcp-backlog 511
+timeout 300
+tcp-keepalive 300
+daemonize yes
+supervised auto
+pidfile $redis_install_path/redis.pid
+loglevel notice
+logfile $redis_install_path/redis.log
+databases 16
+always-show-logo yes
+save 900 1
+save 300 10
+save 60 10000
+stop-writes-on-bgsave-error yes
+rdbcompression yes
+rdbchecksum yes
+dbfilename dump.rdb
+rdb-del-sync-files no
+dir $redis_install_path/
+replica-serve-stale-data yes
+replica-read-only yes
+repl-diskless-sync no
+repl-diskless-sync-delay 5
+repl-diskless-load disabled
+repl-disable-tcp-nodelay no
+replica-priority 100
+acllog-max-len 128
+requirepass admin123456
+# 限制内存4GB = 4294967296 bytes
+maxmemory 4294967296
+maxmemory-policy allkeys-lfu
+lazyfree-lazy-eviction no
+lazyfree-lazy-expire no
+lazyfree-lazy-server-del no
+replica-lazy-flush no
+lazyfree-lazy-user-del no
+oom-score-adj no
+oom-score-adj-values 0 200 800
+appendonly no
+appendfilename \"appendonly.aof\"
+appendfsync everysec
+no-appendfsync-on-rewrite no
+auto-aof-rewrite-percentage 100
+auto-aof-rewrite-min-size 64mb
+aof-load-truncated yes
+aof-use-rdb-preamble yes
+lua-time-limit 5000
+slowlog-log-slower-than 10000
+slowlog-max-len 128
+latency-monitor-threshold 0
+notify-keyspace-events \"\"
+hash-max-ziplist-entries 512
+hash-max-ziplist-value 64
+list-max-ziplist-size -2
+list-compress-depth 0
+set-max-intset-entries 512
+zset-max-ziplist-entries 128
+zset-max-ziplist-value 64
+hll-sparse-max-bytes 3000
+stream-node-max-bytes 4096
+stream-node-max-entries 100
+activerehashing yes
+client-output-buffer-limit normal 0 0 0
+client-output-buffer-limit replica 256mb 64mb 60
+client-output-buffer-limit pubsub 32mb 8mb 60
+hz 10
+dynamic-hz yes
+aof-rewrite-incremental-fsync yes
+rdb-save-incremental-fsync yes
+jemalloc-bg-thread yes
+EOF
+      cat << EOF > $redis_install_path/start.sh
+#!/bin/bash
+#set -x
+set -e
+
+pid=\\\`ps -ef | grep '$redis_install_path/bin/redis-server' | grep -v 'grep' | awk '{print \\\$2}'\\\`
+cd $redis_install_path
+if [ -z \\\$pid ];then
+  $redis_install_path/bin/redis-server $redis_install_path/redis.conf
+  echo 'redis启动成功!'
+else
+  echo 'redis正在运行...'
+fi
+echo '查看日志:  tail -F $redis_install_path/redis.log -n 100'
+EOF
+      # 写文件kill.sh文件
+      cat << EOF > $redis_install_path/kill.sh
+#!/bin/bash
+#set -x
+set -e
+pid=\\\`ps -ef | grep '$redis_install_path/bin/redis-server' | grep -v 'grep' | awk '{print \\\$2}'\\\`
+if [ -z \\\$pid ];then
+  echo 'redis未运行'
+else
+  ps -ef | grep '$redis_install_path/bin/redis-server' | grep -v 'grep' | awk '{print \\\$2}' | xargs kill
+  echo 'redis已停止!'
+fi
+EOF
+      chmod +x $redis_install_path/start.sh
+      chmod +x $redis_install_path/kill.sh
+    fi
+  "
+  check::exit_code "$?" "redis" "$host 安装redis环境" "exit"
+  if [[ "${ADD_USER_TAG:-}" == "1" ]]; then
+    command::exec "${host}" "
+      sudo chown -R \$(id -u ${ADD_USER_NAME}):\$(id -g ${ADD_USER_NAME}) ${BASE_DIR}/redis
+    "
+  fi
+  log::info "[redis]" "redis环境安装成功!"
+  log::info "[redis]" "启动redis: $redis_install_path/start.sh"
+  log::info "[redis]" "停止redis: $redis_install_path/kill.sh"
+}
+
+######################################################################################################
+# 主调用逻辑
+######################################################################################################
+trap trap::info 1 2 3 15 EXIT
+
+# 使用帮助
+function help::usage() {
+  cat << EOF
+Usage:
+  env-install-centos.sh [command]
+
+Available Commands:
+  init                初始化系统
+Flag:
+  -update-yum-repos   是否更新yum源, 默认: '1'
+  -config             配置系统, 默认: '1'
+  -add-user           是否新增用户, 默认: '1'
+  -user-name          新增用户名, 默认: 'www'
+  -base-dir           新增用户名, 默认: '/opt'
+  -git                是否安装git环境, 默认: '1'
+  -dstat              是否安装dstat, 默认: '1'
+  -htop               是否安装htop, 默认: '1'
+  -nginx              是否安装nginx, 默认: '1'
+  -nodejs             是否安装nodejs环境, 默认: '1'
+  -java               是否安装java环境, 默认: '1'
+  -gradle             是否安装gradle环境, 默认: '1'
+  -maven              是否安装maven环境, 默认: '1'
+  -jenkins            是否安装jenkins环境, 默认: '1'
+  -redis              是否安装redis环境, 默认: '1'
+
+Example:
+  env-install-centos.sh init \\
+    -update-yum-repos 0 \\
+    -config 1 \\
+    -add-user 1 \\
+    -user-name www \\
+    -git 1 \\
+    -dstat 0 \\
+    -htop 0 \\
+    -nginx 0 \\
+    -nodejs 0 \\
+    -java 1 \\
+    -gradle 0 \\
+    -maven 0 \\
+    -jenkins 0 \\
+    -redis 0
+
+EOF
+  exit 1
+}
+
+# 参数处理
+[ "$#" == "0" ] && help::usage
+while [ "${1:-}" != "" ]; do
+  case $1 in
+    # -------------------------------------------------------------- 指令
+    init  )                 INIT_TAG="1"
+                            ;;
+    # -------------------------------------------------------------- 指令参数
+    -update-yum-repos )     shift
+                            UPDATE_YUM_REPOS=${1:-UPDATE_YUM_REPOS}
+                            ;;
+    -config )               shift
+                            CONFIG_TAG=${1:-CONFIG_TAG}
+                            ;;
+    -add-user )             shift
+                            ADD_USER_TAG=${1:-ADD_USER_TAG}
+                            ;;
+    -user-name )            shift
+                            ADD_USER_NAME=${1:-ADD_USER_NAME}
+                            ;;
+    -base-dir )             shift
+                            BASE_DIR=${1:-BASE_DIR}
+                            ;;
+    -git )                  shift
+                            GIT_TAG=${1:-GIT_TAG}
+                            ;;
+    -dstat )                shift
+                            DSTAT_TAG=${1:-DSTAT_TAG}
+                            ;;
+    -htop )                 shift
+                            HTOP_TAG=${1:-HTOP_TAG}
+                            ;;
+    -nginx )                shift
+                            NGINX_TAG=${1:-NGINX_TAG}
+                            ;;
+    -nodejs )               shift
+                            NODEJS_TAG=${1:-NODEJS_TAG}
+                            ;;
+    -java )                 shift
+                            JAVA_TAG=${1:-JAVA_TAG}
+                            ;;
+    -gradle )               shift
+                            GRADLE_TAG=${1:-GRADLE_TAG}
+                            ;;
+    -maven )                shift
+                            MAVEN_TAG=${1:-MAVEN_TAG}
+                            ;;
+    -jenkins )              shift
+                            JENKINS_TAG=${1:-JENKINS_TAG}
+                            ;;
+    -redis )                shift
+                            REDIS_TAG=${1:-REDIS_TAG}
+                            ;;
+    * )                     help::usage
+                            exit 1
+  esac
+  shift
+done
+
+# 开始
+log::info "[start]" "bash $0 ${SCRIPT_PARAMETER}"
+# 动作
+if [[ "${INIT_TAG:-}" == "1" ]]; then
+  check::command
+  [[ "${UPDATE_YUM_REPOS:-}" == "1" ]] && { init:update_yum_repos; }
+  [[ "${CONFIG_TAG:-}" == "1" ]] && { init:config; }
+  [[ "${ADD_USER_TAG:-}" == "1" ]] && { init:add_user; }
+  [[ "${GIT_TAG:-}" == "1" ]] && { init:git; }
+  [[ "${DSTAT_TAG:-}" == "1" ]] && { init:dstat; }
+  [[ "${HTOP_TAG:-}" == "1" ]] && { init:htop; }
+  [[ "${NGINX_TAG:-}" == "1" ]] && { init:nginx; }
+  [[ "${NODEJS_TAG:-}" == "1" ]] && { init:nodejs; }
+  [[ "${JAVA_TAG:-}" == "1" ]] && { init:java; }
+  [[ "${GRADLE_TAG:-}" == "1" ]] && { init:gradle; }
+  [[ "${MAVEN_TAG:-}" == "1" ]] && { init:maven; }
+  [[ "${JENKINS_TAG:-}" == "1" ]] && { init:jenkins; }
+  [[ "${REDIS_TAG:-}" == "1" ]] && { init:redis; }
+else
+  help::usage
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/07env-install-centos.sh) [cmd]

+ 502 - 0
00base/08jenkins-agent-install-centos.sh

@@ -0,0 +1,502 @@
+#!/usr/bin/env bash
+
+#-----------------------------------------------------------------------------------------------------
+# Nodejs 下载地址
+#   镜像1: https://nodejs.org/dist/ (https://nodejs.org/dist/v16.18.0/node-v16.18.0-linux-x64.tar.gz)
+# OracleJDK 下载地址
+#   镜像1: https://www.injdk.cn/ (https://d6.injdk.cn/oraclejdk/11/jdk-11.0.16.1_linux-x64_bin.tar.gz) (https://d6.injdk.cn/oraclejdk/8/jdk-8u341-linux-x64.tar.gz)
+#   镜像2: http://www.codebaoku.com/jdk/jdk-index.html (https://114-233-56-217.d.cjjd09.com:30443/123-511/85b2a0b8/1661483-0/85b2a0b8c16863b3ad55e742ac2ba9ff?v=3&t=1667188559&s=f2df45083bb69864446f801bf25b725c&i=dde8a980&filename=jdk-11.0.15.1_linux-x64_bin.tar.gz&d=6ee52da1)
+#-----------------------------------------------------------------------------------------------------
+
+# 配置
+BASE_DIR="/data/jenkins-agent"
+
+# 软件
+#--- jdk8
+JDK8_URL="https://d6.injdk.cn/oraclejdk/8/jdk-8u341-linux-x64.tar.gz"
+JDK8_FILE_NAME="jdk-8u341-linux-x64.tar.gz"
+JDK8_DIR_NAME="jdk1.8.0_341"
+#--- jdk11
+JDK11_URL="https://d6.injdk.cn/oraclejdk/11/jdk-11.0.16.1_linux-x64_bin.tar.gz"
+JDK11_FILE_NAME="jdk-11.0.16.1_linux-x64_bin.tar.gz"
+JDK11_DIR_NAME="jdk-11.0.16.1"
+#--- jdk17
+JDK17_URL="https://d6.injdk.cn/oraclejdk/17/jdk-17_linux-x64_bin.tar.gz"
+JDK17_FILE_NAME="jdk-17_linux-x64_bin.tar.gz"
+JDK17_DIR_NAME="jdk-17.0.4.1"
+#--- gradle (6.8.3 | 6.9.3 | 7.4.2 | 7.5.1)
+#GRADLE_VERSION="6.8.3"
+#--- maven (3.8.6 | 3.6.3 | 3.5.4 | 3.3.9)
+#MAVEN_VERSION="3.8.6"
+#--- nodejs (12.22.9 | 14.20.1 | 16.18.0 | 18.9.1)
+#NODEJS_VERSION="16.18.0"
+
+# 安装标识
+#--- SSH用户
+SSH_OPTIONS="-o ConnectTimeout=600 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
+SSH_USER=""
+SSH_PASSWORD=""
+SSH_PRIVATE_KEY=""
+SSH_PORT=""
+#--- SUDO用户
+SUDO_TAG="0"
+SUDO_USER=""
+SUDO_PASSWORD=""
+#--- 指令
+INIT_TAG="0"
+#--- 指令参数
+JENKINS_AGENT=""
+JENKINS_AGENT_JNLP_URL=""
+JENKINS_AGENT_SECRET=""
+GIT_TAG="1"
+JAVA_TAG="1"
+GRADLE_VERSION="6.8.3"
+MAVEN_VERSION="3.8.6"
+NODEJS_VERSION="16.18.0"
+
+# 脚本设置
+TMP_DIR="$(rm -rf /tmp/jenkins-agent-install* && mktemp -d -t jenkins-agent-install.XXXXXXXXXX)"
+LOG_FILE="${TMP_DIR}/jenkins-agent-install.log"
+ERROR_INFO="\n\033[31mERROR Summary: \033[0m\n  "
+ACCESS_INFO="\n\033[32mACCESS Summary: \033[0m\n  "
+SCRIPT_PARAMETER="$*"
+COMMAND_OUTPUT=""
+
+######################################################################################################
+# 通用函数
+######################################################################################################
+# 信号处理
+function trap::info() {
+  [[ ${#ERROR_INFO} -gt 37 ]] && echo -e "$ERROR_INFO"
+  [[ ${#ACCESS_INFO} -gt 38 ]] && echo -e "$ACCESS_INFO"
+  [ -f "$LOG_FILE" ] && echo -e "\n\n  See detailed log >>> cat $LOG_FILE \n\n"
+  trap '' EXIT
+  exit
+}
+
+# 错误日志
+function log::error() {
+  local item; item="[$(date +'%Y-%m-%dT%H:%M:%S.%N%z')]: \033[31mERROR:   \033[0m$*"
+  ERROR_INFO="${ERROR_INFO}${item}\n  "
+  echo -e "${item}" | tee -a "$LOG_FILE"
+}
+
+# 基础日志
+function log::info() {
+  printf "[%s]: \033[32mINFO:    \033[0m%s\n" "$(date +'%Y-%m-%dT%H:%M:%S.%N%z')" "$*" | tee -a "$LOG_FILE"
+}
+
+# 警告日志
+function log::warning() {
+  printf "[%s]: \033[33mWARNING: \033[0m%s\n" "$(date +'%Y-%m-%dT%H:%M:%S.%N%z')" "$*" | tee -a "$LOG_FILE"
+}
+
+# 访问信息
+function log::access() {
+  ACCESS_INFO="${ACCESS_INFO}$*\n  "
+  printf "[%s]: \033[32mINFO:    \033[0m%s\n" "$(date +'%Y-%m-%dT%H:%M:%S.%N%z')" "$*" | tee -a "$LOG_FILE"
+}
+
+# 执行日志
+function log::exec() {
+  printf "[%s]: \033[34mEXEC:    \033[0m%s\n" "$(date +'%Y-%m-%dT%H:%M:%S.%N%z')" "$*" >> "$LOG_FILE"
+}
+
+# 检查返回码
+function check::exit_code() {
+  local code=${1:-}
+  local app=${2:-}
+  local desc=${3:-}
+  local exit_script=${4:-}
+  if [[ "${code}" == "0" ]]; then
+    log::info "[${app}]" "${desc} succeeded."
+  else
+    log::error "[${app}]" "${desc} failed."
+    [[ "$exit_script" == "exit" ]] && exit "$code"
+  fi
+}
+
+# 重试
+function utils::retry() {
+  local retries=$1
+  shift
+  local count=0
+  until eval "$*"; do
+    exit=$?
+    wait=$((2 ** count))
+    count=$((count + 1))
+    if [ "$count" -lt "$retries" ]; then
+      echo "Retry $count/$retries exited $exit, retrying in $wait seconds..."
+      sleep $wait
+    else
+      echo "Retry $count/$retries exited $exit, no more retries left."
+      return $exit
+    fi
+  done
+  return 0
+}
+
+# 转义引号
+function utils::quote() {
+  # shellcheck disable=SC2046
+  if [ $(echo "$*" | tr -d "\n" | wc -c) -eq 0 ]; then
+    echo "''"
+  elif [ $(echo "$*" | tr -d "[a-z][A-Z][0-9]:,.=~_/\n-" | wc -c) -gt 0 ]; then
+    printf "%s" "$*" | sed -e "1h;2,\$H;\$!d;g" -e "s/'/\'\"\'\"\'/g" | sed -e "1h;2,\$H;\$!d;g" -e "s/^/'/g" -e "s/$/'/g"
+  else
+    echo "$*"
+  fi
+}
+
+# 检查命令是否存在
+function check::command_exists() {
+  local cmd=${1}
+  local package=${2}
+  if command -V "$cmd" > /dev/null 2>&1; then
+    log::info "[check]" "$cmd command exists."
+  else
+    log::warning "[check]" "I require $cmd but it's not installed."
+    log::warning "[check]" "install $package package."
+    command::exec "127.0.0.1" "yum install -y ${package}"
+    check::exit_code "$?" "check" "$package install" "exit"
+  fi
+}
+
+# 执行命令
+function command::exec() {
+  local host=${1:-"127.0.0.1"}
+  shift
+  local command="$*"
+  if [[ "${SUDO_TAG:-}" == "1" ]]; then
+    sudo_options="sudo -H -n -u ${SUDO_USER}"
+    if [[ "${SUDO_PASSWORD:-}" != "" ]]; then
+       sudo_options="${sudo_options// -n/} -p \"\" -S <<< \"${SUDO_PASSWORD}\""
+    fi
+    command="$sudo_options bash -c $(utils::quote "$command")"
+  fi
+  command="$(utils::quote "$command")"
+  if [[ "${host}" == "127.0.0.1" ]]; then
+    # 本地执行
+    log::exec "[command]" "bash -c $(printf "%s" "${command//${SUDO_PASSWORD:-}/zzzzzz}")"
+    # shellcheck disable=SC2094
+    COMMAND_OUTPUT=$(eval bash -c "${command}" 2>> "$LOG_FILE" | tee -a "$LOG_FILE")
+    local status=$?
+  else
+    # 远程执行
+    local ssh_cmd="ssh"
+    if [[ "${SSH_PASSWORD}" != "" ]]; then
+      ssh_cmd="sshpass -p \"${SSH_PASSWORD}\" ${ssh_cmd}"
+    elif [[ "$SSH_PRIVATE_KEY" != "" ]]; then
+      [ -f "${SSH_PRIVATE_KEY}" ] || { log::error "[exec]" "ssh private_key:${SSH_PRIVATE_KEY} not found."; exit 1; }
+      ssh_cmd="${ssh_cmd} -i $SSH_PRIVATE_KEY"
+    fi
+    log::exec "[command]" "${ssh_cmd//${SSH_PASSWORD:-}/zzzzzz} ${SSH_OPTIONS} ${SSH_USER}@${host} -p ${SSH_PORT} bash -c $(printf "%s" "${command//${SUDO_PASSWORD:-}/zzzzzz}")"
+    # shellcheck disable=SC2094
+    COMMAND_OUTPUT=$(eval "${ssh_cmd} ${SSH_OPTIONS} ${SSH_USER}@${host} -p ${SSH_PORT}" bash -c '"${command}"' 2>> "$LOG_FILE" | tee -a "$LOG_FILE")
+    local status=$?
+  fi
+  return $status
+}
+
+######################################################################################################
+# 安装函数
+######################################################################################################
+# 检查用到的命令
+function check::command() {
+  check::command_exists ssh openssh-clients
+  check::command_exists tar tar
+  check::command_exists wget wget
+  check::command_exists unzip unzip
+}
+
+# 创建文件夹
+function init:mkdir() {
+  log::info "[mkdir]" "创建目录..."
+  local host="127.0.0.1"
+  command::exec "${host}" "
+    sudo mkdir -p ${BASE_DIR}
+    sudo chown -R \$(id -u):\$(id -g) ${BASE_DIR}
+  "
+  check::exit_code "$?" "git" "$host 创建目录:${BASE_DIR}" "exit"
+  log::info "[mkdir]" "创建目录成功!"
+}
+
+# 下载
+function init:jenkins_agent() {
+  log::info "[jenkins-agent]" "下载jenkins-agent..."
+  local host="127.0.0.1"
+  local agent_dir=``
+  local agent_file="${BASE_DIR}/agent.jar"
+  local java_mem_opts='-server -Xmx1g'
+  local database_opts=' -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false'
+  local java_opts_ext=' -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai'
+  command::exec "${host}" "
+    if [ ! -f "$agent_file" ]; then
+      mkdir -p ${BASE_DIR}/workspace
+      wget --timeout=10 --no-check-certificate ${JENKINS_AGENT} -O $agent_file
+      cd ${BASE_DIR}
+
+      # 写文件start.sh文件
+      cat << EOF > ${BASE_DIR}/start.sh
+#!/bin/bash
+
+jnlpUrl='${JENKINS_AGENT_JNLP_URL}'
+secret='${JENKINS_AGENT_SECRET}'
+workDir='${BASE_DIR}/workspace'
+
+#-------------------------------------------------------------------
+java='${BASE_DIR}/env/java/${JDK11_DIR_NAME}/bin/java'
+agent_file='$agent_file'
+java_mem_opts=' -DappName=jenkins-agent $java_mem_opts'
+database_opts='$database_opts'
+java_opts_ext='$java_opts_ext'
+#-------------------------------------------------------------------
+
+pid=\\\`ps -ef | grep 'DappName=jenkins-agent ' | grep -v 'grep' | awk '{print \\\$2}'\\\`
+if [ -z \\\$pid ];then
+  nohup \\\$java \\\$java_mem_opts \\\$database_opts \\\$java_opts_ext -jar \\\$agent_file -jnlpUrl \\\$jnlpUrl -secret \\\$secret -workDir \\\$workDir >${BASE_DIR}/agent-logs.log 2>&1 &
+  echo 'jenkins-agent启动成功!'
+else
+  echo 'jenkins-agent正在运行...'
+fi
+echo '查看日志:  tail -F ${BASE_DIR}/agent-logs.log -n 100'
+EOF
+      # 写文件kill.sh文件
+      cat << EOF > ${BASE_DIR}/kill.sh
+#!/bin/bash
+
+pid=\\\`ps -ef | grep 'DappName=jenkins-agent ' | grep -v 'grep' | awk '{print \\\$2}'\\\`
+if [ -z \\\$pid ];then
+  echo 'jenkins-agent未运行'
+else
+  ps -ef | grep 'DappName=jenkins-agent ' | grep -v 'grep' | awk '{print \\\$2}' | xargs kill
+  echo 'jenkins-agent已停止!'
+fi
+EOF
+      chmod +x ${BASE_DIR}/start.sh
+      chmod +x ${BASE_DIR}/kill.sh
+      sudo chown -R \$(id -u):\$(id -g) ${BASE_DIR}
+    fi
+  "
+  check::exit_code "$?" "jenkins-agent" "$host 下载jenkins-agent" "exit"
+  log::info "[jenkins-agent]" "jenkins-agent下载成功!"
+}
+
+# 安装git
+function init:git() {
+  log::info "[git]" "安装git..."
+  local host="127.0.0.1"
+  command::exec "${host}" "
+    sudo yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm
+    sudo yum -y install git
+    git --version
+    git config --global credential.helper store
+  "
+  check::exit_code "$?" "git" "$host 安装git" "exit"
+  log::info "[git]" "git安装成功!"
+}
+
+# 安装java
+function init:java() {
+  log::info "[java]" "安装java..."
+  local host="127.0.0.1"
+  # jdk8
+  local java8_path="${BASE_DIR}/env/java/${JDK8_DIR_NAME}"
+  command::exec "${host}" "
+    if [ ! -d "$java8_path" ]; then
+      mkdir -p ${BASE_DIR}/env/java
+      wget --timeout=10 --waitretry=3 --tries=5 --retry-connrefused --no-check-certificate ${JDK8_URL} -O ${BASE_DIR}/env/java/${JDK8_FILE_NAME}
+      cd ${BASE_DIR}/env/java
+      tar -zxvf ${JDK8_FILE_NAME}
+      sudo chown -R \$(id -u):\$(id -g) ${BASE_DIR}/env/java
+    fi
+  "
+  check::exit_code "$?" "java" "$host 安装java8" "exit"
+  # jdk11
+  local java11_path="${BASE_DIR}/env/java/${JDK11_DIR_NAME}"
+  command::exec "${host}" "
+    if [ ! -d "$java11_path" ]; then
+      mkdir -p ${BASE_DIR}/env/java
+      wget --timeout=10 --waitretry=3 --tries=5 --retry-connrefused --no-check-certificate ${JDK11_URL} -O ${BASE_DIR}/env/java/${JDK11_FILE_NAME}
+      cd ${BASE_DIR}/env/java
+      tar -zxvf ${JDK11_FILE_NAME}
+      sudo chown -R \$(id -u):\$(id -g) ${BASE_DIR}/env/java
+    fi
+  "
+  check::exit_code "$?" "java" "$host 安装java11" "exit"
+  # jdk17
+  local java17_path="${BASE_DIR}/env/java/${JDK17_DIR_NAME}"
+  command::exec "${host}" "
+    if [ ! -d "$java17_path" ]; then
+      mkdir -p ${BASE_DIR}/env/java
+      wget --timeout=10 --waitretry=3 --tries=5 --retry-connrefused --no-check-certificate ${JDK17_URL} -O ${BASE_DIR}/env/java/${JDK17_FILE_NAME}
+      cd ${BASE_DIR}/env/java
+      tar -zxvf ${JDK17_FILE_NAME}
+      sudo chown -R \$(id -u):\$(id -g) ${BASE_DIR}/env/java
+    fi
+  "
+  check::exit_code "$?" "java" "$host 安装java17" "exit"
+  log::info "[java]" "java安装成功!"
+}
+
+# 安装gradle
+function init:gradle() {
+  log::info "[gradle]" "安装gradle..."
+  local host="127.0.0.1"
+  local gradle_url="https://downloads.gradle-dn.com/distributions/gradle-${GRADLE_VERSION}-bin.zip"
+  local gradle_file_name="gradle-${GRADLE_VERSION}-bin.zip"
+  local gradle_dir_name="gradle-${GRADLE_VERSION}"
+  local gradle_path="${BASE_DIR}/env/gradle/$gradle_dir_name"
+  command::exec "${host}" "
+    if [ ! -d "$gradle_path" ]; then
+      mkdir -p ${BASE_DIR}/env/gradle
+      wget --timeout=10 --waitretry=3 --tries=5 --retry-connrefused --no-check-certificate $gradle_url -O ${BASE_DIR}/env/gradle/$gradle_file_name
+      cd ${BASE_DIR}/env/gradle
+      unzip $gradle_file_name
+      sudo chown -R \$(id -u):\$(id -g) ${BASE_DIR}/env/gradle
+    fi
+  "
+  check::exit_code "$?" "gradle" "$host 安装gradle(${GRADLE_VERSION})" "exit"
+  log::info "[gradle]" "gradle安装成功!"
+}
+
+# 安装maven
+function init:maven() {
+  log::info "[maven]" "安装maven..."
+  local host="127.0.0.1"
+  local maven_url="https://dlcdn.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz"
+  local maven_file_name="apache-maven-${MAVEN_VERSION}-bin.tar.gz"
+  local maven_dir_name="apache-maven-${MAVEN_VERSION}"
+  local maven_path="${BASE_DIR}/env/maven/$maven_dir_name"
+  command::exec "${host}" "
+    if [ ! -d "$maven_path" ]; then
+      mkdir -p ${BASE_DIR}/env/maven
+      wget --timeout=10 --waitretry=3 --tries=5 --retry-connrefused --no-check-certificate $maven_url -O ${BASE_DIR}/env/maven/$maven_file_name
+      cd ${BASE_DIR}/env/maven
+      tar -zxvf $maven_file_name
+      sudo chown -R \$(id -u):\$(id -g) ${BASE_DIR}/env/maven
+    fi
+  "
+  check::exit_code "$?" "maven" "$host 安装maven(${MAVEN_VERSION})" "exit"
+  log::info "[maven]" "maven安装成功!"
+}
+
+# 安装nodejs
+function init:nodejs() {
+  log::info "[nodejs]" "安装nodejs..."
+  local host="127.0.0.1"
+  local nodejs_url="https://nodejs.org/dist/v${NODEJS_VERSION}/node-v${NODEJS_VERSION}-linux-x64.tar.gz"
+  local nodejs_file_name="node-v${NODEJS_VERSION}-linux-x64.tar.gz"
+  local nodejs_dir_name="node-v${NODEJS_VERSION}-linux-x64"
+  local nodejs_path="${BASE_DIR}/env/nodejs/$nodejs_dir_name"
+  command::exec "${host}" "
+    if [ ! -d "$nodejs_path" ]; then
+      mkdir -p ${BASE_DIR}/env/nodejs
+      wget --timeout=10 --waitretry=3 --tries=5 --retry-connrefused --no-check-certificate $nodejs_url -O ${BASE_DIR}/env/nodejs/$nodejs_file_name
+      cd ${BASE_DIR}/env/nodejs
+      tar -zxvf $nodejs_file_name
+      sudo chown -R \$(id -u):\$(id -g) ${BASE_DIR}/env/nodejs
+    fi
+  "
+  check::exit_code "$?" "nodejs" "$host 安装nodejs(${NODEJS_VERSION})" "exit"
+  log::info "[nodejs]" "安装nodejs成功!"
+}
+
+######################################################################################################
+# 主调用逻辑
+######################################################################################################
+trap trap::info 1 2 3 15 EXIT
+
+# 使用帮助
+function help::usage() {
+  cat << EOF
+Usage:
+  jenkins-agent-install-centos.sh [command]
+
+Available Commands:
+  init                初始化系统
+Flag:
+  -base-dir           新增用户名, 默认: '/data/jenkins-agent'
+  -agent              jenkins-agent下载地址(\${JENKINS_URL}/jnlpJars/agent.jar), 默认: ''
+  -jnlpUrl            jenkins-agent的jnlpUrl参数(\${JENKINS_URL}/computer/\${AGENT_NAME}/jenkins-agent.jnlp), 默认: ''
+  -secret             jenkins-agent的secret参数, 默认: ''
+  -git                是否安装git, 默认: '1'
+  -java               是否安装java(8, 11, 17), 默认: '1'
+  -gradle             安装gradle版本(6.8.3 | 6.9.3 | 7.4.2 | 7.5.1), 默认: '6.8.3'
+  -maven              安装maven版本(3.8.6 | 3.6.3 | 3.5.4 | 3.3.9), 默认: '3.8.6'
+  -nodejs             安装nodejs版本(12.22.9 | 14.20.1 | 16.18.0 | 18.9.1), 默认: '16.18.0'
+
+Example:
+  jenkins-agent-install-centos.sh init \\
+    -base-dir '/data/jenkins-agent' \\
+    -agent '' \\
+    -jnlpUrl '' \\
+    -secret '' \\
+    -git 0 \\
+    -java 0 \\
+    -gradle '6.8.3' \\
+    -maven '3.8.6' \\
+    -nodejs '16.18.0'
+
+EOF
+  exit 1
+}
+
+# 参数处理
+[ "$#" == "0" ] && help::usage
+while [ "${1:-}" != "" ]; do
+  case $1 in
+    # -------------------------------------------------------------- 指令
+    init  )                 INIT_TAG="1"
+                            ;;
+    # -------------------------------------------------------------- 指令参数
+    -base-dir )             shift
+                            BASE_DIR=${1:-BASE_DIR}
+                            ;;
+    -agent )                shift
+                            JENKINS_AGENT=${1:-JENKINS_AGENT}
+                            ;;
+    -jnlpUrl )              shift
+                            JENKINS_AGENT_JNLP_URL=${1:-JENKINS_AGENT_JNLP_URL}
+                            ;;
+    -secret )               shift
+                            JENKINS_AGENT_SECRET=${1:-JENKINS_AGENT_SECRET}
+                            ;;
+    -git )                  shift
+                            GIT_TAG=${1:-GIT_TAG}
+                            ;;
+    -java )                 shift
+                            JAVA_TAG=${1:-JAVA_TAG}
+                            ;;
+    -gradle )               shift
+                            GRADLE_VERSION=${1:-GRADLE_VERSION}
+                            ;;
+    -maven )                shift
+                            MAVEN_VERSION=${1:-MAVEN_VERSION}
+                            ;;
+    -nodejs )               shift
+                            NODEJS_VERSION=${1:-NODEJS_VERSION}
+                            ;;
+    * )                     help::usage
+                            exit 1
+  esac
+  shift
+done
+
+# 开始
+log::info "[start]" "bash $0 ${SCRIPT_PARAMETER}"
+# 动作
+if [[ "${INIT_TAG:-}" == "1" ]]; then
+  check::command
+  init:mkdir
+  [[ -n "${JENKINS_AGENT:-}" ]] && { init:jenkins_agent; }
+  [[ "${GIT_TAG:-}" == "1" ]] && { init:git; }
+  [[ "${JAVA_TAG:-}" == "1" ]] && { init:java; }
+  [[ -n "${GRADLE_VERSION:-}" ]] && { init:gradle; }
+  [[ -n "${MAVEN_VERSION:-}" ]] && { init:maven; }
+  [[ -n "${NODEJS_VERSION:-}" ]] && { init:nodejs; }
+else
+  help::usage
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/08jenkins-agent-install-centos.sh) [cmd]

+ 172 - 0
00base/09api-gateway.sh

@@ -0,0 +1,172 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/api_gateway
+gitUrlArr=(
+  "www@git.yvanui.com:lizhiwei/api-gateway.git"
+  #"http://git.yvanui.com/lizhiwei/api-gateway.git"
+)
+
+branchArr=(
+  "master"
+)
+positionArr=(
+  "."
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix chmod +x gradlew $echoSuffix"
+  chmod +x gradlew
+  echo -e "$echoPrefix ./gradlew build -x test $echoSuffix"
+  ./gradlew build -x test
+  echo ""
+}
+
+logPath=/home/www/logs/api_gateway/api_gateway.log
+dirPath=/home/www/deploy/api_gateway/api-gateway-server/build/libs/
+serverName=api_gateway
+
+cmd=$1
+profiles=${2:-"hwy-test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx1g -Xms1g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./api-gateway-server-0.0.1-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8111 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./api-gateway-server-0.0.1-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8111 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: deploy restart start stop kill log logs
+if [ "$cmd" == "deploy" ];then
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/09api-gateway.sh) [cmd profiles]

+ 101 - 0
00base/11yvan-vue.sh

@@ -0,0 +1,101 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/yvan-vue
+gitUrlArr=(
+  "http://git.yvanui.com/jztd/yvan-vue.git"
+)
+
+branchArr=(
+  "master"
+)
+positionArr=(
+  "."
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+isChange="1"
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 yvan-vue
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath $echoSuffix"
+    cd "$codePath"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-vue 文件未变化"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+cmd=$1
+if [ "$cmd" == "deploy" ];then
+  deployPull
+  buildCode
+elif [ "$cmd" == "pull" ];then
+  deployPull
+else
+  echo "输入操作参数: pull deploy"
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/11yvan-vue.sh) [cmd]

+ 101 - 0
00base/12yvan-vue-mobile.sh

@@ -0,0 +1,101 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/yvan-vue-mobile
+gitUrlArr=(
+  "http://git.yvanui.com/jztd/yvan-vue-mobile.git"
+)
+
+branchArr=(
+  "master"
+)
+positionArr=(
+  "."
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+isChange="1"
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 yvan-vue-mobile
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath $echoSuffix"
+    cd "$codePath"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-vue-mobile 文件未变化"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+cmd=$1
+if [ "$cmd" == "deploy" ];then
+  deployPull
+  buildCode
+elif [ "$cmd" == "pull" ];then
+  deployPull
+else
+  echo "输入操作参数: pull deploy"
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/12yvan-vue-mobile.sh) [cmd]

+ 28 - 0
00base/CI-CD/.dockerignore

@@ -0,0 +1,28 @@
+# IDEA 默认排除的
+*.class
+*.log
+*.ctxt
+.mtj.tmp/
+hs_err_pid*
+
+# 常见的包文件
+*.zip
+*.tar.gz
+*.rar
+*.ear
+*.war
+
+# 自定义排除的文件
+*.java
+*.xml
+*.iml
+*.properties
+
+# 自定义排除的文件夹
+.git
+.idea
+classes
+generated-sources
+maven-archiver
+maven-status
+gateway-Gemini.jar

+ 4 - 0
00base/CI-CD/Dockerfile

@@ -0,0 +1,4 @@
+FROM 10.100.166.50:15001/library/jdk:1.8.0_341 as dev
+ADD gateway-Gemini-exec.jar app.jar
+ENTRYPOINT ["java", "-server", "-jar", "app.jar", "--spring.profiles.active=global", "--server.port=8080"]
+EXPOSE 8080

+ 73 - 0
00base/CI-CD/Jenkinsfile.groovy

@@ -0,0 +1,73 @@
+String Dockerfile = """
+FROM 10.100.166.50:15001/library/jdk:1.8.0_341 as dev
+ADD gateway-Gemini-exec.jar app.jar
+ENTRYPOINT ["java", "-server", "-jar", "app.jar", "--spring.profiles.active=global", "--server.port=8080"]
+EXPOSE 8080
+""".trim()
+
+pipeline {
+    agent any
+
+    environment {
+        // 源码配置
+        git = 'http://git.galaxis.yvanui.com/thinking/thinkingframework.git'
+        gitCredentials = 'lizw(git.galaxis.yvanui.com)'
+        // 构建配置
+        target = "${WORKSPACE}/cloud/gateway/target"
+        dockerImgTag = "wms-gateway:v$BUILD_NUMBER"
+        // harbor配置
+        harbor = 'http://10.100.166.50:15001'
+        harborCredentials = credentials('admin(10.100.166.50:15001)')
+        harborRepositorie = 'wms'
+        // 自定义环境变量
+        JAVA_HOME = '/home/www/jenkins/jdk1.8.0_341'
+        MAVEN_HOME = '/home/www/jenkins/apache-maven-3.8.6'
+        NODE_HOME = '/home/www/jenkins/node-v16.17.0-linux-x64'
+        PATH = "$JAVA_HOME/bin:$MAVEN_HOME/bin:$NODE_HOME/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin"
+    }
+
+    stages {
+        stage('#检查环境') {
+            steps {
+                sh 'java -version'
+                sh 'mvn --version'
+            }
+        }
+
+        stage('#拉去代码') {
+            steps {
+                checkout([
+                        $class           : 'GitSCM',
+                        branches         : [[name: '*/develop']],
+                        userRemoteConfigs: [[url: "${git}", credentialsId: "${gitCredentials}"]],
+                        extensions       : [],
+                ])
+            }
+        }
+
+        stage('#编译项目') {
+            steps {
+                sh 'mvn clean package -Dmaven.test.skip=true'
+            }
+        }
+
+        stage('#构建镜像') {
+            steps {
+                sh """
+                    cd $target
+                    pwd
+                    echo '$Dockerfile' > Dockerfile
+                    sudo docker build --target dev -t $dockerImgTag $target
+                """
+            }
+        }
+
+        stage('#推送镜像') {
+            steps {
+                sh 'sudo docker login --username $harborCredentials_USR --password $harborCredentials_PSW $harbor'
+                sh "sudo docker tag $dockerImgTag ${harbor.replaceAll('https?://', '')}/$harborRepositorie/$dockerImgTag"
+                sh "sudo docker push ${harbor.replaceAll('https?://', '')}/$harborRepositorie/$dockerImgTag"
+            }
+        }
+    }
+}

+ 187 - 0
00base/CI-CD/wms-gateway.yml

@@ -0,0 +1,187 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  annotations:
+    deployment.kubernetes.io/revision: "1"
+    field.cattle.io/creatorId: user-6fxhv
+    field.cattle.io/publicEndpoints: '[{"addresses":["10.100.166.50"],"port":30188,"protocol":"TCP","serviceName":"wms:wms-gateway-nodeport","allNodes":true}]'
+  creationTimestamp: "2022-09-23T05:49:52Z"
+  generation: 2
+  labels:
+    cattle.io/creator: norman
+    workload.user.cattle.io/workloadselector: deployment-wms-wms-gateway
+  managedFields:
+    - apiVersion: apps/v1
+      fieldsType: FieldsV1
+      fieldsV1:
+        f:metadata:
+          f:annotations:
+            f:field.cattle.io/publicEndpoints: {}
+      manager: agent
+      operation: Update
+      time: "2022-09-23T05:49:52Z"
+    - apiVersion: apps/v1
+      fieldsType: FieldsV1
+      fieldsV1:
+        f:metadata:
+          f:annotations:
+            f:deployment.kubernetes.io/revision: {}
+        f:status:
+          f:conditions:
+            .: {}
+            k:{"type":"Available"}:
+              .: {}
+              f:lastTransitionTime: {}
+              f:lastUpdateTime: {}
+              f:message: {}
+              f:reason: {}
+              f:status: {}
+              f:type: {}
+            k:{"type":"Progressing"}:
+              .: {}
+              f:lastTransitionTime: {}
+              f:lastUpdateTime: {}
+              f:message: {}
+              f:reason: {}
+              f:status: {}
+              f:type: {}
+          f:observedGeneration: {}
+          f:replicas: {}
+          f:unavailableReplicas: {}
+          f:updatedReplicas: {}
+      manager: kube-controller-manager
+      operation: Update
+      subresource: status
+      time: "2022-09-23T05:49:52Z"
+    - apiVersion: apps/v1
+      fieldsType: FieldsV1
+      fieldsV1:
+        f:metadata:
+          f:annotations:
+            .: {}
+            f:field.cattle.io/creatorId: {}
+          f:labels:
+            .: {}
+            f:cattle.io/creator: {}
+            f:workload.user.cattle.io/workloadselector: {}
+        f:spec:
+          f:progressDeadlineSeconds: {}
+          f:replicas: {}
+          f:revisionHistoryLimit: {}
+          f:selector: {}
+          f:strategy:
+            f:rollingUpdate:
+              .: {}
+              f:maxSurge: {}
+              f:maxUnavailable: {}
+            f:type: {}
+          f:template:
+            f:metadata:
+              f:annotations:
+                .: {}
+                f:cattle.io/timestamp: {}
+                f:field.cattle.io/ports: {}
+              f:labels:
+                .: {}
+                f:workload.user.cattle.io/workloadselector: {}
+            f:spec:
+              f:containers:
+                k:{"name":"wms-gateway"}:
+                  .: {}
+                  f:image: {}
+                  f:imagePullPolicy: {}
+                  f:name: {}
+                  f:ports:
+                    .: {}
+                    k:{"containerPort":8080,"protocol":"TCP"}:
+                      .: {}
+                      f:containerPort: {}
+                      f:name: {}
+                      f:protocol: {}
+                  f:resources: {}
+                  f:securityContext:
+                    .: {}
+                    f:allowPrivilegeEscalation: {}
+                    f:capabilities: {}
+                    f:privileged: {}
+                    f:readOnlyRootFilesystem: {}
+                    f:runAsNonRoot: {}
+                  f:stdin: {}
+                  f:terminationMessagePath: {}
+                  f:terminationMessagePolicy: {}
+                  f:tty: {}
+              f:dnsPolicy: {}
+              f:restartPolicy: {}
+              f:schedulerName: {}
+              f:securityContext: {}
+              f:terminationGracePeriodSeconds: {}
+      manager: rancher
+      operation: Update
+      time: "2022-09-23T05:49:52Z"
+  name: wms-gateway
+  namespace: wms
+  resourceVersion: "77237"
+  uid: 0a3900e8-060c-4b63-83c0-88bdaca4fd84
+spec:
+  progressDeadlineSeconds: 600
+  replicas: 1
+  revisionHistoryLimit: 10
+  selector:
+    matchLabels:
+      workload.user.cattle.io/workloadselector: deployment-wms-wms-gateway
+  strategy:
+    rollingUpdate:
+      maxSurge: 1
+      maxUnavailable: 0
+    type: RollingUpdate
+  template:
+    metadata:
+      annotations:
+        cattle.io/timestamp: "2022-09-23T05:49:51Z"
+        field.cattle.io/ports: '[[{"containerPort":8080,"dnsName":"wms-gateway-nodeport","hostPort":0,"kind":"NodePort","name":"8080tcp01","protocol":"TCP","sourcePort":0}]]'
+      creationTimestamp: null
+      labels:
+        workload.user.cattle.io/workloadselector: deployment-wms-wms-gateway
+    spec:
+      containers:
+        - image: 10.100.166.50:15001/wms/wms-gateway@sha256:6e8c061d45420800a12ea0335e9ecd4c9c2154fd84d2d6554740716255772a45
+          imagePullPolicy: Always
+          name: wms-gateway
+          ports:
+            - containerPort: 8080
+              name: 8080tcp01
+              protocol: TCP
+          resources: {}
+          securityContext:
+            allowPrivilegeEscalation: false
+            capabilities: {}
+            privileged: false
+            readOnlyRootFilesystem: false
+            runAsNonRoot: false
+          stdin: true
+          terminationMessagePath: /dev/termination-log
+          terminationMessagePolicy: File
+          tty: true
+      dnsPolicy: ClusterFirst
+      restartPolicy: Always
+      schedulerName: default-scheduler
+      securityContext: {}
+      terminationGracePeriodSeconds: 30
+status:
+  conditions:
+    - lastTransitionTime: "2022-09-23T05:49:52Z"
+      lastUpdateTime: "2022-09-23T05:49:52Z"
+      message: Deployment does not have minimum availability.
+      reason: MinimumReplicasUnavailable
+      status: "False"
+      type: Available
+    - lastTransitionTime: "2022-09-23T05:49:52Z"
+      lastUpdateTime: "2022-09-23T05:49:52Z"
+      message: ReplicaSet "wms-gateway-5f8f6fd8c6" is progressing.
+      reason: ReplicaSetUpdated
+      status: "True"
+      type: Progressing
+  observedGeneration: 2
+  replicas: 1
+  unavailableReplicas: 1
+  updatedReplicas: 1

+ 70 - 0
00base/tmp.sh

@@ -0,0 +1,70 @@
+
+userdel www
+echo www:www | chpasswd
+
+
+
+
+# 创建用户
+adduser www
+
+# 修改权限
+chmod -v u+w /etc/sudoers
+vim /etc/sudoers
+# 加一行
+www    ALL=(ALL)       NOPASSWD:ALL
+# 写权限收回
+chmod -v u-w /etc/sudoers
+
+# 设置密码
+passwd www
+
+# 卸载openjdk
+[root@WMS-APP ~]# rpm -qa | grep java
+tzdata-java-2017b-1.el7.noarch
+java-1.8.0-openjdk-headless-1.8.0.131-11.b12.el7.x86_64
+javapackages-tools-3.4.1-11.el7.noarch
+java-1.8.0-openjdk-1.8.0.131-11.b12.el7.x86_64
+python-javapackages-3.4.1-11.el7.noarch
+
+[root@WMS-APP ~]# rpm -e --nodeps tzdata-java-2017b-1.el7.noarch
+[root@WMS-APP ~]# rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.131-11.b12.el7.x86_64
+[root@WMS-APP ~]# rpm -e --nodeps javapackages-tools-3.4.1-11.el7.noarch
+[root@WMS-APP ~]# rpm -e --nodeps java-1.8.0-openjdk-1.8.0.131-11.b12.el7.x86_64
+
+# 安装 jdk-8u321-linux-x64.tar.gz
+复制文件到 /opt/java/
+cd /opt/java/
+sudo tar -zxvf jdk-8u321-linux-x64.tar.gz
+
+# 配置环境变量
+vim /etc/profile
+
+JAVA_HOME=/opt/java/jdk1.8.0_321
+PATH=$JAVA_HOME/bin:$PATH
+export JAVA_HOME PATH
+
+source /etc/profile
+
+# 验证jdk
+[www@WMS-APP bin]$ java -version
+java version "1.8.0_321"
+Java(TM) SE Runtime Environment (build 1.8.0_321-b07)
+Java HotSpot(TM) 64-Bit Server VM (build 25.321-b07, mixed mode)
+
+bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/07env-install-centos.sh) init \
+-update-yum-repos 0 \
+-config 1 \
+-add-user 1 \
+-user-name www \
+-git 0 \
+-dstat 0 \
+-htop 0 \
+-nginx 0 \
+-nodejs 0 \
+-java 0 \
+-gradle 0 \
+-maven 0 \
+-jenkins 1
+
+

+ 233 - 0
01dongying_guokang/01wms8-test.sh

@@ -0,0 +1,233 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_dygk
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/wms8/wms8-bench.git"
+  "http://git.galaxis.yvanui.com/wms8/wms-core.git"
+  "www@git.yvanui.com:lizhiwei/yvan-framework.git"
+  ## "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "dongying_guokang"
+  "dongying_guokang"
+  "master"
+)
+positionArr=(
+  "."
+  "wms-core"
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-biz/bundle
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/bundle $echoSuffix"
+    cd "$codePath/wms-biz/bundle"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/bundle 文件未变化"
+  fi
+
+  # 构建 wms-biz/pda-client
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/pda-client $echoSuffix"
+    cd "$codePath/wms-biz/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_dygk/wms8_dygk.log
+dirPath=/home/www/deploy/wms8_dygk/wms-biz/servo/build/libs/
+serverName=wms8_dygk
+
+cmd=$1
+profiles=${2:-"test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8096 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8096 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) pull
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/01dongying_guokang/01wms8-test.sh) [cmd profiles]

+ 133 - 0
01dongying_guokang/02pda-test.sh

@@ -0,0 +1,133 @@
+#!/bin/bash
+#set -x
+set -e
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+codePath=/home/www/deploy/wms8_dygk
+serverUrl=http://122.9.140.63:8096
+
+# 更新代码
+echo -e "$echoPrefix cd $codePath $echoSuffix"
+cd $codePath
+echo -e "$echoPrefix git checkout . $echoSuffix"
+git checkout .
+echo -e "$echoPrefix git pull $echoSuffix"
+git pull
+
+# 读取版本号
+major='1'
+minor=$(date +%Y%m%d)
+patch=$(date +1%H%M%S | sed -e 's/^[[:space:]]*//')
+version="$major.$minor.$patch"
+echo -e "$echoPrefix sed -i 's/__WebAppVersion__/$version/g' $codePath/wms-biz/pda-client/src/app.js $echoSuffix"
+sed -i "s/__WebAppVersion__/$version/g" $codePath/wms-biz/pda-client/src/app.js
+echo -e "$echoPrefix 版本号信息: version=$version, major=$major, minor=$minor, patch=$patch $echoSuffix"
+
+echo "###--代码更新完成--------------------------------------------------------------------------###"
+echo ""
+
+# 编译
+bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+
+echo -e "$echoPrefix cd $codePath/wms-biz/pda-client/ $echoSuffix"
+cd $codePath/wms-biz/pda-client/
+echo -e "$echoPrefix yarn build $echoSuffix"
+yarn build
+
+echo "###--编译完成-----------------------------------------------------------------------------###"
+echo ""
+
+# 创建打包文件夹
+echo -e "$echoPrefix rm -rf $codePath/tmp $echoSuffix"
+rm -rf $codePath/tmp
+
+echo -e "$echoPrefix mkdir -p $codePath/tmp/web/static $echoSuffix"
+mkdir -p $codePath/tmp/web/static
+
+echo -e "$echoPrefix mkdir -p $codePath/tmp/web/node_modules/tslib $echoSuffix"
+mkdir -p $codePath/tmp/web/node_modules/tslib
+
+echo -e "$echoPrefix mkdir -p $codePath/tmp/web/m_node_modules/yvan-ext-mobile $echoSuffix"
+mkdir -p $codePath/tmp/web/m_node_modules/yvan-ext-mobile
+
+echo -e "$echoPrefix mkdir -p $codePath/tmp/web/mobile-assets $echoSuffix"
+mkdir -p $codePath/tmp/web/mobile-assets
+
+echo -e "$echoPrefix cp -r $codePath/dist_pda/ $codePath/tmp/web/dist_pda $echoSuffix"
+cp -r $codePath/dist_pda/ $codePath/tmp/web/dist_pda
+
+echo -e "$echoPrefix cp -r $codePath/public/static/require.js $codePath/tmp/web/static/require.js $echoSuffix"
+cp -r $codePath/public/static/require.js $codePath/tmp/web/static/require.js
+
+echo -e "$echoPrefix cp -r $codePath/public/m_require_config.js $codePath/tmp/web/m_require_config.js $echoSuffix"
+cp -r $codePath/public/m_require_config.js $codePath/tmp/web/m_require_config.js
+
+echo -e "$echoPrefix cp -r $codePath/public/m_common.css $codePath/tmp/web/m_common.css $echoSuffix"
+cp -r $codePath/public/m_common.css $codePath/tmp/web/m_common.css
+
+echo -e "$echoPrefix cp -r $codePath/public/m.html $codePath/tmp/web/index.html $echoSuffix"
+cp -r $codePath/public/m.html $codePath/tmp/web/index.html
+
+echo -e "$echoPrefix cp -r $codePath/public/static/require-css $codePath/tmp/web/static/require-css $echoSuffix"
+cp -r $codePath/public/static/require-css $codePath/tmp/web/static/require-css
+
+echo -e "$echoPrefix cp -r $codePath/public/static/polyfill $codePath/tmp/web/static/polyfill $echoSuffix"
+cp -r $codePath/public/static/polyfill $codePath/tmp/web/static/polyfill
+
+echo -e "$echoPrefix cp -r $codePath/public/static/jquery $codePath/tmp/web/static/jquery $echoSuffix"
+cp -r $codePath/public/static/jquery $codePath/tmp/web/static/jquery
+
+echo -e "$echoPrefix cp -r $codePath/public/static/font-awesome $codePath/tmp/web/static/font-awesome $echoSuffix"
+cp -r $codePath/public/static/font-awesome $codePath/tmp/web/static/font-awesome
+
+echo -e "$echoPrefix cp -r $codePath/public/static/iconfont $codePath/tmp/web/static/iconfont $echoSuffix"
+cp -r $codePath/public/static/iconfont $codePath/tmp/web/static/iconfont
+
+echo -e "$echoPrefix cp -r $codePath/public/static/bootstrap $codePath/tmp/web/static/bootstrap $echoSuffix"
+cp -r $codePath/public/static/bootstrap $codePath/tmp/web/static/bootstrap
+
+echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/tslib/tslib.js $codePath/tmp/web/node_modules/tslib/tslib.js $echoSuffix"
+cp -r $codePath/wms-biz/pda-client/node_modules/tslib/tslib.js $codePath/tmp/web/node_modules/tslib/tslib.js
+
+echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/dist $codePath/tmp/web/m_node_modules/yvan-ext-mobile/dist $echoSuffix"
+cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/dist $codePath/tmp/web/m_node_modules/yvan-ext-mobile/dist
+
+echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/packages $codePath/tmp/web/mobile-assets/packages $echoSuffix"
+cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/packages $codePath/tmp/web/mobile-assets/packages
+
+echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/modern $codePath/tmp/web/mobile-assets/modern $echoSuffix"
+cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/modern $codePath/tmp/web/mobile-assets/modern
+
+echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/ext-modern-all-debug.js $codePath/tmp/web/mobile-assets/ext-modern-all-debug.js $echoSuffix"
+cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/ext-modern-all-debug.js $codePath/tmp/web/mobile-assets/ext-modern-all-debug.js
+
+echo -e "$echoPrefix cd $codePath/tmp $echoSuffix"
+cd $codePath/tmp
+echo -e "$echoPrefix zip -r web.zip web $echoSuffix"
+zip -r web.zip web
+
+echo "###--打包完成-----------------------------------------------------------------------------###"
+echo ""
+
+# 上传文件
+echo -e "$echoPrefix curl -X POST -F 'file=@$codePath/tmp/web.zip' $serverUrl/file/upload $echoSuffix"
+res_json=$(curl -X POST -F 'file=@'$codePath'/tmp/web.zip' $serverUrl/file/upload)
+filePath=$(echo $res_json | awk -F '"' '{print $10}')
+
+req_json='{"args":[{"app_code":"PDA_WEB","app_name":"PDA_WEB","major":'$major',"minor":'$minor',"patch":'$patch',"file_path":"'$filePath'","app_version":"'$$version'"}]}'
+res_json=$(curl -H "Content-type: application/json" -X POST -d "$req_json" $serverUrl/api/com/galaxis/wms/sys/app_version/AppVersion@newAppVersion)
+
+echo -e "$echoPrefix $res_json $echoSuffix"
+echo ""
+
+# 还原文件
+echo -e "$echoPrefix cd $codePath $echoSuffix"
+cd $codePath
+echo -e "$echoPrefix git checkout . $echoSuffix"
+git checkout .
+echo -e "$echoPrefix 版本号信息: version=$version, major=$major, minor=$minor, patch=$patch $echoSuffix"
+echo ""
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/01dongying_guokang/02pda-test.sh) [cmd profiles]

+ 232 - 0
01dongying_guokang/03wms8-prod.bak.sh

@@ -0,0 +1,232 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_prod
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/wms8/wms8-bench.git"
+  "http://git.galaxis.yvanui.com/wms8/wms-core.git"
+  "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "dongying_guokang"
+  "dongying_guokang"
+  "master"
+)
+positionArr=(
+  "."
+  "wms-core"
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-biz/bundle
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/bundle $echoSuffix"
+    cd "$codePath/wms-biz/bundle"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/bundle 文件未变化"
+  fi
+
+  # 构建 wms-biz/pda-client
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/pda-client $echoSuffix"
+    cd "$codePath/wms-biz/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_prod/wms8_prod.log
+dirPath=/home/www/deploy/wms8_prod/wms-biz/servo/build/libs/
+serverName=wms8_prod
+
+cmd=$1
+profiles=${2:-"prod"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8082 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8082 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) pull
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/01dongying_guokang/03wms8-prod.sh) [cmd profiles]

+ 224 - 0
01dongying_guokang/03wms8-prod.sh

@@ -0,0 +1,224 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_dongying
+gitUrlArr=(
+  "https://wms-gitlab.sypm.cn:7878/kaileshi/wms8-bench-dongying.git"
+)
+
+branchArr=(
+  "main"
+)
+positionArr=(
+  "."
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-biz/bundle
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/bundle $echoSuffix"
+    cd "$codePath/wms-biz/bundle"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/bundle 文件未变化"
+  fi
+
+  # 构建 wms-biz/pda-client
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/pda-client $echoSuffix"
+    cd "$codePath/wms-biz/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_dongying/wms8_dongying.log
+dirPath=/home/www/deploy/wms8_dongying/wms-biz/servo/build/libs/
+serverName=2wms8_dongying
+
+cmd=$1
+profiles=${2:-"prod"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8082 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8082 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) pull
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/01dongying_guokang/03wms8-prod.sh) [cmd profiles]

+ 142 - 0
01dongying_guokang/04pda-prod.sh

@@ -0,0 +1,142 @@
+#!/bin/bash
+#set -x
+set -e
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+codePath=/home/www/deploy/wms8_prod
+serverUrl=http://127.0.0.1:8082
+
+deploy() {
+  # 更新代码
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  git pull
+
+  # 读取版本号
+  major='1'
+  minor=$(date +%Y%m%d)
+  patch=$(date +1%H%M%S | sed -e 's/^[[:space:]]*//')
+  version="$major.$minor.$patch"
+  echo -e "$echoPrefix sed -i 's/__WebAppVersion__/$version/g' $codePath/wms-biz/pda-client/src/app.js $echoSuffix"
+  sed -i "s/__WebAppVersion__/$version/g" $codePath/wms-biz/pda-client/src/app.js
+  echo -e "$echoPrefix 版本号信息: version=$version, major=$major, minor=$minor, patch=$patch $echoSuffix"
+
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+
+  # 编译
+  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+
+  echo -e "$echoPrefix cd $codePath/wms-biz/pda-client/ $echoSuffix"
+  cd $codePath/wms-biz/pda-client/
+  echo -e "$echoPrefix yarn build $echoSuffix"
+  yarn build
+
+  echo "###--编译完成-----------------------------------------------------------------------------###"
+  echo ""
+
+  # 创建打包文件夹
+  echo -e "$echoPrefix rm -rf $codePath/tmp $echoSuffix"
+  rm -rf $codePath/tmp
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/static $echoSuffix"
+  mkdir -p $codePath/tmp/web/static
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/node_modules/tslib $echoSuffix"
+  mkdir -p $codePath/tmp/web/node_modules/tslib
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/m_node_modules/yvan-ext-mobile $echoSuffix"
+  mkdir -p $codePath/tmp/web/m_node_modules/yvan-ext-mobile
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/mobile-assets $echoSuffix"
+  mkdir -p $codePath/tmp/web/mobile-assets
+
+  echo -e "$echoPrefix cp -r $codePath/dist_pda/ $codePath/tmp/web/dist_pda $echoSuffix"
+  cp -r $codePath/dist_pda/ $codePath/tmp/web/dist_pda
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/require.js $codePath/tmp/web/static/require.js $echoSuffix"
+  cp -r $codePath/public/static/require.js $codePath/tmp/web/static/require.js
+
+  echo -e "$echoPrefix cp -r $codePath/public/m_require_config.js $codePath/tmp/web/m_require_config.js $echoSuffix"
+  cp -r $codePath/public/m_require_config.js $codePath/tmp/web/m_require_config.js
+
+  echo -e "$echoPrefix cp -r $codePath/public/m_common.css $codePath/tmp/web/m_common.css $echoSuffix"
+  cp -r $codePath/public/m_common.css $codePath/tmp/web/m_common.css
+
+  echo -e "$echoPrefix cp -r $codePath/public/m.html $codePath/tmp/web/index.html $echoSuffix"
+  cp -r $codePath/public/m.html $codePath/tmp/web/index.html
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/require-css $codePath/tmp/web/static/require-css $echoSuffix"
+  cp -r $codePath/public/static/require-css $codePath/tmp/web/static/require-css
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/polyfill $codePath/tmp/web/static/polyfill $echoSuffix"
+  cp -r $codePath/public/static/polyfill $codePath/tmp/web/static/polyfill
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/jquery $codePath/tmp/web/static/jquery $echoSuffix"
+  cp -r $codePath/public/static/jquery $codePath/tmp/web/static/jquery
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/font-awesome $codePath/tmp/web/static/font-awesome $echoSuffix"
+  cp -r $codePath/public/static/font-awesome $codePath/tmp/web/static/font-awesome
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/iconfont $codePath/tmp/web/static/iconfont $echoSuffix"
+  cp -r $codePath/public/static/iconfont $codePath/tmp/web/static/iconfont
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/bootstrap $codePath/tmp/web/static/bootstrap $echoSuffix"
+  cp -r $codePath/public/static/bootstrap $codePath/tmp/web/static/bootstrap
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/tslib/tslib.js $codePath/tmp/web/node_modules/tslib/tslib.js $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/tslib/tslib.js $codePath/tmp/web/node_modules/tslib/tslib.js
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/dist $codePath/tmp/web/m_node_modules/yvan-ext-mobile/dist $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/dist $codePath/tmp/web/m_node_modules/yvan-ext-mobile/dist
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/packages $codePath/tmp/web/mobile-assets/packages $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/packages $codePath/tmp/web/mobile-assets/packages
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/modern $codePath/tmp/web/mobile-assets/modern $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/modern $codePath/tmp/web/mobile-assets/modern
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/ext-modern-all-debug.js $codePath/tmp/web/mobile-assets/ext-modern-all-debug.js $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/ext-modern-all-debug.js $codePath/tmp/web/mobile-assets/ext-modern-all-debug.js
+
+  echo -e "$echoPrefix cd $codePath/tmp $echoSuffix"
+  cd $codePath/tmp
+  echo -e "$echoPrefix zip -r web.zip web $echoSuffix"
+  zip -r web.zip web
+
+  echo "###--打包完成-----------------------------------------------------------------------------###"
+  echo ""
+
+  # 上传文件
+  echo -e "$echoPrefix curl -X POST -F 'file=@$codePath/tmp/web.zip' $serverUrl/file/upload $echoSuffix"
+  res_json=$(curl -X POST -F 'file=@'$codePath'/tmp/web.zip' $serverUrl/file/upload)
+  filePath=$(echo $res_json | awk -F '"' '{print $10}')
+
+  req_json='{"args":[{"app_code":"PDA_WEB","app_name":"PDA_WEB","major":'$major',"minor":'$minor',"patch":'$patch',"file_path":"'$filePath'","app_version":"'$$version'"}]}'
+  res_json=$(curl -H "Content-type: application/json" -X POST -d "$req_json" $serverUrl/api/com/galaxis/wms/sys/app_version/AppVersion@newAppVersion)
+
+  echo -e "$echoPrefix $res_json $echoSuffix"
+  echo ""
+
+  # 还原文件
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix 版本号信息: version=$version, major=$major, minor=$minor, patch=$patch $echoSuffix"
+  echo ""
+}
+
+cmd=$1
+if [ "$cmd" == "deploy" ];then
+  deploy
+else
+  echo "使用 deploy 命名打包pda"
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/01dongying_guokang/04pda-prod.sh) [cmd]

+ 81 - 0
01dongying_guokang/05xxljob-prod.sh

@@ -0,0 +1,81 @@
+#!/bin/bash
+#set -x
+set -e
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+logPath=/data/logs/xxl-job/xxl-job.log
+dirPath=/home/www/deploy/xxl-job/
+serverName=xxl_job_prod
+
+cmd=$1
+profiles=${2:-"dongying_guokang-prod"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx1g -Xms1g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar bin/xxl-job-admin-mysql-2.3.0.jar --spring.config.location=conf/ --spring.profiles.active=global,$profiles --server.port=8000 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar bin/xxl-job-admin-mysql-2.3.0.jar --spring.config.location=conf/ --spring.profiles.active=global,$profiles --server.port=8000 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: deploy restart start stop kill log logs
+if [ "$cmd" == "deploy" ];then
+  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/03xxljob.sh) pull
+  restartServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/01dongying_guokang/05xxljob-prod.sh) [cmd profiles]

+ 232 - 0
01dongying_guokang/06wms8-test2.sh

@@ -0,0 +1,232 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_dygk
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/wms8/wms8-bench.git"
+  "http://git.galaxis.yvanui.com/wms8/wms-core.git"
+  "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "dongying_guokang"
+  "dongying_guokang"
+  "master"
+)
+positionArr=(
+  "."
+  "wms-core"
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-biz/bundle
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/bundle $echoSuffix"
+    cd "$codePath/wms-biz/bundle"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/bundle 文件未变化"
+  fi
+
+  # 构建 wms-biz/pda-client
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/pda-client $echoSuffix"
+    cd "$codePath/wms-biz/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_dygk/wms8_dygk.log
+dirPath=/home/www/deploy/wms8_dygk/wms-biz/servo/build/libs/
+serverName=wms8_dygk
+
+cmd=$1
+profiles=${2:-"test2"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8096 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8096 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) pull
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/01dongying_guokang/06wms8-test2.sh) [cmd profiles]

+ 232 - 0
01dongying_guokang/07wms8-test3.bak.sh

@@ -0,0 +1,232 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_dygk
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/wms8/wms8-bench.git"
+  "http://git.galaxis.yvanui.com/wms8/wms-core.git"
+  "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "shuyu_qingdao"
+  "shuyu_qingdao"
+  "master"
+)
+positionArr=(
+  "."
+  "wms-core"
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-biz/bundle
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/bundle $echoSuffix"
+    cd "$codePath/wms-biz/bundle"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/bundle 文件未变化"
+  fi
+
+  # 构建 wms-biz/pda-client
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/pda-client $echoSuffix"
+    cd "$codePath/wms-biz/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_dygk/wms8_dygk.log
+dirPath=/home/www/deploy/wms8_dygk/wms-biz/servo/build/libs/
+serverName=wms8_dygk
+
+cmd=$1
+profiles=${2:-"test3"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8096 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8096 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) pull
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/01dongying_guokang/07wms8-test3.bak.sh) [cmd profiles]

+ 224 - 0
01dongying_guokang/07wms8-test3.sh

@@ -0,0 +1,224 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_shuyu_qingdao
+gitUrlArr=(
+  "https://wms-gitlab.sypm.cn:7878/kaileshi/wms8-bench.git"
+)
+
+branchArr=(
+  "main"
+)
+positionArr=(
+  "."
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-biz/bundle
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/bundle $echoSuffix"
+    cd "$codePath/wms-biz/bundle"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/bundle 文件未变化"
+  fi
+
+  # 构建 wms-biz/pda-client
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/pda-client $echoSuffix"
+    cd "$codePath/wms-biz/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_test/wms8_test.log
+dirPath=/home/www/deploy/wms8_shuyu_qingdao/wms-biz/servo/build/libs/
+serverName=wms8_shuyu_qingdao
+
+cmd=$1
+profiles=${2:-"test3"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8096 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8096 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) pull
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# shuyu_qingdao
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/01dongying_guokang/07wms8-test3.sh) [cmd profiles]

+ 142 - 0
01dongying_guokang/08pda-test3.sh

@@ -0,0 +1,142 @@
+#!/bin/bash
+#set -x
+set -e
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+codePath=/home/www/deploy/wms8_dygk
+serverUrl=http://127.0.0.1:8096
+
+deploy() {
+  # 更新代码
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  git pull
+
+  # 读取版本号
+  major='1'
+  minor=$(date +%Y%m%d)
+  patch=$(date +1%H%M%S | sed -e 's/^[[:space:]]*//')
+  version="$major.$minor.$patch"
+  echo -e "$echoPrefix sed -i 's/__WebAppVersion__/$version/g' $codePath/wms-biz/pda-client/src/app.js $echoSuffix"
+  sed -i "s/__WebAppVersion__/$version/g" $codePath/wms-biz/pda-client/src/app.js
+  echo -e "$echoPrefix 版本号信息: version=$version, major=$major, minor=$minor, patch=$patch $echoSuffix"
+
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+
+  # 编译
+  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+
+  echo -e "$echoPrefix cd $codePath/wms-biz/pda-client/ $echoSuffix"
+  cd $codePath/wms-biz/pda-client/
+  echo -e "$echoPrefix yarn build $echoSuffix"
+  yarn build
+
+  echo "###--编译完成-----------------------------------------------------------------------------###"
+  echo ""
+
+  # 创建打包文件夹
+  echo -e "$echoPrefix rm -rf $codePath/tmp $echoSuffix"
+  rm -rf $codePath/tmp
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/static $echoSuffix"
+  mkdir -p $codePath/tmp/web/static
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/node_modules/tslib $echoSuffix"
+  mkdir -p $codePath/tmp/web/node_modules/tslib
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/m_node_modules/yvan-ext-mobile $echoSuffix"
+  mkdir -p $codePath/tmp/web/m_node_modules/yvan-ext-mobile
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/mobile-assets $echoSuffix"
+  mkdir -p $codePath/tmp/web/mobile-assets
+
+  echo -e "$echoPrefix cp -r $codePath/dist_pda/ $codePath/tmp/web/dist_pda $echoSuffix"
+  cp -r $codePath/dist_pda/ $codePath/tmp/web/dist_pda
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/require.js $codePath/tmp/web/static/require.js $echoSuffix"
+  cp -r $codePath/public/static/require.js $codePath/tmp/web/static/require.js
+
+  echo -e "$echoPrefix cp -r $codePath/public/m_require_config.js $codePath/tmp/web/m_require_config.js $echoSuffix"
+  cp -r $codePath/public/m_require_config.js $codePath/tmp/web/m_require_config.js
+
+  echo -e "$echoPrefix cp -r $codePath/public/m_common.css $codePath/tmp/web/m_common.css $echoSuffix"
+  cp -r $codePath/public/m_common.css $codePath/tmp/web/m_common.css
+
+  echo -e "$echoPrefix cp -r $codePath/public/m.html $codePath/tmp/web/index.html $echoSuffix"
+  cp -r $codePath/public/m.html $codePath/tmp/web/index.html
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/require-css $codePath/tmp/web/static/require-css $echoSuffix"
+  cp -r $codePath/public/static/require-css $codePath/tmp/web/static/require-css
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/polyfill $codePath/tmp/web/static/polyfill $echoSuffix"
+  cp -r $codePath/public/static/polyfill $codePath/tmp/web/static/polyfill
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/jquery $codePath/tmp/web/static/jquery $echoSuffix"
+  cp -r $codePath/public/static/jquery $codePath/tmp/web/static/jquery
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/font-awesome $codePath/tmp/web/static/font-awesome $echoSuffix"
+  cp -r $codePath/public/static/font-awesome $codePath/tmp/web/static/font-awesome
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/iconfont $codePath/tmp/web/static/iconfont $echoSuffix"
+  cp -r $codePath/public/static/iconfont $codePath/tmp/web/static/iconfont
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/bootstrap $codePath/tmp/web/static/bootstrap $echoSuffix"
+  cp -r $codePath/public/static/bootstrap $codePath/tmp/web/static/bootstrap
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/tslib/tslib.js $codePath/tmp/web/node_modules/tslib/tslib.js $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/tslib/tslib.js $codePath/tmp/web/node_modules/tslib/tslib.js
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/dist $codePath/tmp/web/m_node_modules/yvan-ext-mobile/dist $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/dist $codePath/tmp/web/m_node_modules/yvan-ext-mobile/dist
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/packages $codePath/tmp/web/mobile-assets/packages $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/packages $codePath/tmp/web/mobile-assets/packages
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/modern $codePath/tmp/web/mobile-assets/modern $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/modern $codePath/tmp/web/mobile-assets/modern
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/ext-modern-all-debug.js $codePath/tmp/web/mobile-assets/ext-modern-all-debug.js $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/ext-modern-all-debug.js $codePath/tmp/web/mobile-assets/ext-modern-all-debug.js
+
+  echo -e "$echoPrefix cd $codePath/tmp $echoSuffix"
+  cd $codePath/tmp
+  echo -e "$echoPrefix zip -r web.zip web $echoSuffix"
+  zip -r web.zip web
+
+  echo "###--打包完成-----------------------------------------------------------------------------###"
+  echo ""
+
+  # 上传文件
+  echo -e "$echoPrefix curl -X POST -F 'file=@$codePath/tmp/web.zip' $serverUrl/file/upload $echoSuffix"
+  res_json=$(curl -X POST -F 'file=@'$codePath'/tmp/web.zip' $serverUrl/file/upload)
+  filePath=$(echo $res_json | awk -F '"' '{print $10}')
+
+  req_json='{"args":[{"app_code":"PDA_WEB","app_name":"PDA_WEB","major":'$major',"minor":'$minor',"patch":'$patch',"file_path":"'$filePath'","app_version":"'$$version'"}]}'
+  res_json=$(curl -H "Content-type: application/json" -X POST -d "$req_json" $serverUrl/api/com/galaxis/wms/sys/app_version/AppVersion@newAppVersion)
+
+  echo -e "$echoPrefix $res_json $echoSuffix"
+  echo ""
+
+  # 还原文件
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix 版本号信息: version=$version, major=$major, minor=$minor, patch=$patch $echoSuffix"
+  echo ""
+}
+
+cmd=$1
+if [ "$cmd" == "deploy" ];then
+  deploy
+else
+  echo "使用 deploy 命名打包pda"
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/01dongying_guokang/08pda-test3.sh) [cmd]

+ 81 - 0
01dongying_guokang/09xxljob-test3.sh

@@ -0,0 +1,81 @@
+#!/bin/bash
+#set -x
+set -e
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+logPath=/data/logs/xxl-job/xxl-job.log
+dirPath=/home/www/deploy/xxl-job/
+serverName=xxl_job_test
+
+cmd=$1
+profiles=${2:-"shuyu_qingdao_test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx1g -Xms1g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar bin/xxl-job-admin-mysql-2.3.0.jar --spring.config.location=conf/ --spring.profiles.active=global,$profiles --server.port=8000 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar bin/xxl-job-admin-mysql-2.3.0.jar --spring.config.location=conf/ --spring.profiles.active=global,$profiles --server.port=8000 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: deploy restart start stop kill log logs
+if [ "$cmd" == "deploy" ];then
+  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/03xxljob.sh) pull
+  restartServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/01dongying_guokang/09xxljob-test3.sh) [cmd profiles]

+ 229 - 0
02zhongtongfu/01wms8-test.sh

@@ -0,0 +1,229 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_ztf
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/wms8/wms83.git"
+  "www@git.yvanui.com:lizhiwei/yvan-framework.git"
+  ## "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "master"
+  "8.3"
+)
+positionArr=(
+  "."
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-biz/bundle
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/bundle $echoSuffix"
+    cd "$codePath/wms-biz/bundle"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/bundle 文件未变化"
+  fi
+
+#  # 构建 wms-biz/pda-client
+#  if [ "${needBuild[0]}" != "0" ]; then
+#    echo -e "$echoPrefix cd $codePath/wms-biz/pda-client $echoSuffix"
+#    cd "$codePath/wms-biz/pda-client"
+#    echo -e "$echoPrefix yarn $echoSuffix"
+#    yarn
+#    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+#    yarn link yvan-ext-mobile
+#    echo -e "$echoPrefix yarn build $echoSuffix"
+#    yarn build
+#    echo ""
+#  else
+#    echo "wms-biz/pda-client 文件未变化"
+#  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_ztf/wms8_ztf.log
+dirPath=/home/www/deploy/wms8_ztf/wms-biz/servo/build/libs/
+serverName=wms8_ztf
+
+cmd=$1
+profiles=${2:-"test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8083 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8083 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) pull
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/02zhongtongfu/01wms8-test.sh) [cmd profiles]

+ 79 - 0
02zhongtongfu/02nacos-consul-adapter.sh

@@ -0,0 +1,79 @@
+#!/bin/bash
+#set -x
+set -e
+
+
+logPath=/data/logs/nacos-consul-adapter/nacos-consul-adapter.log
+dirPath=/home/www/deploy/nacos-consul-adapter
+serverName=nacos_consul_adapter
+
+cmd=$1
+profiles=${2:-"adapter"}
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx256m -Xms256m"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./message-center-server-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=9009 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./message-center-server-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=9009 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: restart start stop kill log logs
+if [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: restart start stop kill log logs"
+  else
+    echo "输入操作参数: restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/02zhongtongfu/02nacos-consul-adapter.sh) [cmd profiles]

+ 182 - 0
02zhongtongfu/03message-center-test.sh

@@ -0,0 +1,182 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/message-center
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/wms8/message-center.git"
+)
+
+branchArr=(
+  "master"
+)
+positionArr=(
+  "."
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/message-center/message-center.log
+dirPath=/home/www/deploy/message-center/message-center-server/build/libs/
+serverName=message_center
+
+cmd=$1
+profiles=${2:-"test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx1g -Xms1g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./message-center-server-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=9011 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./message-center-server-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=9011 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/02zhongtongfu/03message-center-test.sh) [cmd profiles]

+ 70 - 0
02zhongtongfu/04wms-ztf-pad-prod.sh

@@ -0,0 +1,70 @@
+#!/bin/bash
+#set -x
+set -e
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+codePath=/home/admin/.jenkins/workspace/wms-ui-mobile-prod
+
+deploy() {
+  # 更新代码
+  echo -e "$echoPrefix cd $codePath/wms-ui-mobile $echoSuffix"
+  cd $codePath/wms-ui-mobile
+  # 版本号
+  major='1'
+  minor=$(date +%Y%m%d)
+  patch=$(date +1%H%M%S | sed -e 's/^[[:space:]]*//')
+  version="$major.$minor.$patch"
+  echo -e "$echoPrefix 'export const version = '$version'' > src/version.ts $echoSuffix"
+  echo "export const version = '$version'" > src/version.ts
+
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+
+  # 编译
+  echo -e "$echoPrefix yarn run build $echoSuffix"
+  yarn run init
+  yarn run build
+  echo "###--编译完成-----------------------------------------------------------------------------###"
+  echo ""
+
+  # 创建打包文件夹
+  echo -e "$echoPrefix rm -rf ./tmp $echoSuffix"
+  rm -rf ./tmp
+
+  echo -e "$echoPrefix mkdir -p ./tmp/web/wms_mobile $echoSuffix"
+  mkdir -p ./tmp/web/wms_mobile
+
+  echo -e "$echoPrefix cp -r ./dist/* ./tmp/web/wms_mobile/ $echoSuffix"
+  cp -r ./dist/* ./tmp/web/wms_mobile/
+
+  echo -e "$echoPrefix cd ./tmp $echoSuffix"
+  cd ./tmp
+  echo -e "$echoPrefix zip -r web.zip web $echoSuffix"
+  zip -r web.zip web
+  echo '{"major":"'$major'","minor":"'$minor'","patch":"'$patch'"}' > version.json
+
+  echo "###--打包完成-----------------------------------------------------------------------------###"
+  echo ""
+
+  # 还原文件
+  # echo -e "$echoPrefix rm -rf ./tmp $echoSuffix"
+  # rm -rf ./tmp
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix 版本号信息: version=$version, major=$major, minor=$minor, patch=$patch $echoSuffix"
+  echo ""
+}
+
+cmd=$1
+if [ "$cmd" == "deploy" ];then
+  deploy
+else
+  echo "使用 deploy 命名打包pda"
+fi
+
+# 中通服 PDA
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/02zhongtongfu/04wms-ztf-pad-prod.sh) [cmd]

+ 678 - 0
02zhongtongfu/test/01env-install-centos.sh

@@ -0,0 +1,678 @@
+#!/usr/bin/env bash
+
+#-----------------------------------------------------------------------------------------------------
+# Nodejs 下载地址
+#   镜像1: https://nodejs.org/dist/ (https://nodejs.org/dist/v16.18.0/node-v16.18.0-linux-x64.tar.gz)
+# OracleJDK 下载地址
+#   镜像1: https://www.injdk.cn/ (https://d6.injdk.cn/oraclejdk/11/jdk-11.0.16.1_linux-x64_bin.tar.gz) (https://d6.injdk.cn/oraclejdk/8/jdk-8u341-linux-x64.tar.gz)
+#   镜像2: http://www.codebaoku.com/jdk/jdk-index.html (https://114-233-56-217.d.cjjd09.com:30443/123-511/85b2a0b8/1661483-0/85b2a0b8c16863b3ad55e742ac2ba9ff?v=3&t=1667188559&s=f2df45083bb69864446f801bf25b725c&i=dde8a980&filename=jdk-11.0.15.1_linux-x64_bin.tar.gz&d=6ee52da1)
+#-----------------------------------------------------------------------------------------------------
+
+# 配置
+ADD_USER_NAME="gyldev"
+ADD_USER_PASSWORD="ztfgyl@1202"
+BASE_DIR="/opt"
+
+# 软件
+YUM_REPOS="http://mirrors.aliyun.com/repo/Centos-7.repo"
+#--- jdk(安装)
+JDK_URL="https://d6.injdk.cn/oraclejdk/8/jdk-8u341-linux-x64.tar.gz"
+JDK_FILE_NAME="jdk-8u341-linux-x64.tar.gz"
+JDK_DIR_NAME="jdk1.8.0_341"
+#--- jdk8(参考)
+JDK8_URL="https://d6.injdk.cn/oraclejdk/8/jdk-8u341-linux-x64.tar.gz"
+JDK8_FILE_NAME="jdk-8u341-linux-x64.tar.gz"
+JDK8_DIR_NAME="jdk1.8.0_341"
+#--- jdk11(参考)
+JDK11_URL="https://d6.injdk.cn/oraclejdk/11/jdk-11.0.16.1_linux-x64_bin.tar.gz"
+JDK11_FILE_NAME="jdk-11.0.16.1_linux-x64_bin.tar.gz"
+JDK11_DIR_NAME="jdk-11.0.16.1"
+#--- gradle (6.8.3 | 6.9.3 | 7.4.2 | 7.5.1)
+GRADLE_URL="https://downloads.gradle-dn.com/distributions/gradle-6.8.3-bin.zip"
+GRADLE_FILE_NAME="gradle-6.8.3-bin.zip"
+GRADLE_DIR_NAME="gradle-6.8.3"
+#--- maven (3.8.6 | 3.6.3 | 3.5.4 | 3.3.9)
+MAVEN_URL="https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz"
+MAVEN_FILE_NAME="apache-maven-3.8.6-bin.tar.gz"
+MAVEN_DIR_NAME="apache-maven-3.8.6"
+#--- jenkins (http://mirrors.jenkins.io/war-stable/latest/)
+JENKINS_URL="https://ftp-nyc.osuosl.org/pub/jenkins/war-stable/2.361.1/jenkins.war"
+JENKINS_FILE_NAME="jenkins.war"
+JENKINS_JAVA_URL="https://d6.injdk.cn/oraclejdk/11/jdk-11.0.16.1_linux-x64_bin.tar.gz"
+JENKINS_JAVA_FILE_NAME="jdk-11.0.16.1_linux-x64_bin.tar.gz"
+JENKINS_JAVA_DIR_NAME="jdk-11.0.16.1"
+
+# 安装标识
+#--- SSH用户
+SSH_OPTIONS="-o ConnectTimeout=600 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
+SSH_USER=""
+SSH_PASSWORD=""
+SSH_PRIVATE_KEY=""
+SSH_PORT=""
+#--- SUDO用户
+SUDO_TAG="0"
+SUDO_USER=""
+SUDO_PASSWORD=""
+#--- 指令
+INIT_TAG="0"
+#--- 指令参数
+UPDATE_YUM_REPOS="1"
+CONFIG_TAG="0"
+ADD_USER_TAG="0"
+GIT_TAG="0"
+DSTAT_TAG="0"
+HTOP_TAG="0"
+NGINX_TAG="0"
+NODEJS_TAG="0"
+JAVA_TAG="0"
+GRADLE_TAG="0"
+MAVEN_TAG="0"
+JENKINS_TAG="0"
+
+# 脚本设置
+TMP_DIR="$(rm -rf /tmp/env-install* && mktemp -d -t env-install.XXXXXXXXXX)"
+LOG_FILE="${TMP_DIR}/env-install.log"
+ERROR_INFO="\n\033[31mERROR Summary: \033[0m\n  "
+ACCESS_INFO="\n\033[32mACCESS Summary: \033[0m\n  "
+SCRIPT_PARAMETER="$*"
+COMMAND_OUTPUT=""
+
+######################################################################################################
+# 通用函数
+######################################################################################################
+# 信号处理
+function trap::info() {
+  [[ ${#ERROR_INFO} -gt 37 ]] && echo -e "$ERROR_INFO"
+  [[ ${#ACCESS_INFO} -gt 38 ]] && echo -e "$ACCESS_INFO"
+  [ -f "$LOG_FILE" ] && echo -e "\n\n  See detailed log >>> cat $LOG_FILE \n\n"
+  trap '' EXIT
+  exit
+}
+
+# 错误日志
+function log::error() {
+  local item; item="[$(date +'%Y-%m-%dT%H:%M:%S.%N%z')]: \033[31mERROR:   \033[0m$*"
+  ERROR_INFO="${ERROR_INFO}${item}\n  "
+  echo -e "${item}" | tee -a "$LOG_FILE"
+}
+
+# 基础日志
+function log::info() {
+  printf "[%s]: \033[32mINFO:    \033[0m%s\n" "$(date +'%Y-%m-%dT%H:%M:%S.%N%z')" "$*" | tee -a "$LOG_FILE"
+}
+
+# 警告日志
+function log::warning() {
+  printf "[%s]: \033[33mWARNING: \033[0m%s\n" "$(date +'%Y-%m-%dT%H:%M:%S.%N%z')" "$*" | tee -a "$LOG_FILE"
+}
+
+# 访问信息
+function log::access() {
+  ACCESS_INFO="${ACCESS_INFO}$*\n  "
+  printf "[%s]: \033[32mINFO:    \033[0m%s\n" "$(date +'%Y-%m-%dT%H:%M:%S.%N%z')" "$*" | tee -a "$LOG_FILE"
+}
+
+# 执行日志
+function log::exec() {
+  printf "[%s]: \033[34mEXEC:    \033[0m%s\n" "$(date +'%Y-%m-%dT%H:%M:%S.%N%z')" "$*" >> "$LOG_FILE"
+}
+
+# 检查返回码
+function check::exit_code() {
+  local code=${1:-}
+  local app=${2:-}
+  local desc=${3:-}
+  local exit_script=${4:-}
+  if [[ "${code}" == "0" ]]; then
+    log::info "[${app}]" "${desc} succeeded."
+  else
+    log::error "[${app}]" "${desc} failed."
+    [[ "$exit_script" == "exit" ]] && exit "$code"
+  fi
+}
+
+# 重试
+function utils::retry() {
+  local retries=$1
+  shift
+  local count=0
+  until eval "$*"; do
+    exit=$?
+    wait=$((2 ** count))
+    count=$((count + 1))
+    if [ "$count" -lt "$retries" ]; then
+      echo "Retry $count/$retries exited $exit, retrying in $wait seconds..."
+      sleep $wait
+    else
+      echo "Retry $count/$retries exited $exit, no more retries left."
+      return $exit
+    fi
+  done
+  return 0
+}
+
+# 转义引号
+function utils::quote() {
+  # shellcheck disable=SC2046
+  if [ $(echo "$*" | tr -d "\n" | wc -c) -eq 0 ]; then
+    echo "''"
+  elif [ $(echo "$*" | tr -d "[a-z][A-Z][0-9]:,.=~_/\n-" | wc -c) -gt 0 ]; then
+    printf "%s" "$*" | sed -e "1h;2,\$H;\$!d;g" -e "s/'/\'\"\'\"\'/g" | sed -e "1h;2,\$H;\$!d;g" -e "s/^/'/g" -e "s/$/'/g"
+  else
+    echo "$*"
+  fi
+}
+
+# 检查命令是否存在
+function check::command_exists() {
+  local cmd=${1}
+  local package=${2}
+  if command -V "$cmd" > /dev/null 2>&1; then
+    log::info "[check]" "$cmd command exists."
+  else
+    log::warning "[check]" "I require $cmd but it's not installed."
+    log::warning "[check]" "install $package package."
+    command::exec "127.0.0.1" "yum install -y ${package}"
+    check::exit_code "$?" "check" "$package install" "exit"
+  fi
+}
+
+# 执行命令
+function command::exec() {
+  local host=${1:-"127.0.0.1"}
+  shift
+  local command="$*"
+  if [[ "${SUDO_TAG:-}" == "1" ]]; then
+    sudo_options="sudo -H -n -u ${SUDO_USER}"
+    if [[ "${SUDO_PASSWORD:-}" != "" ]]; then
+       sudo_options="${sudo_options// -n/} -p \"\" -S <<< \"${SUDO_PASSWORD}\""
+    fi
+    command="$sudo_options bash -c $(utils::quote "$command")"
+  fi
+  command="$(utils::quote "$command")"
+  if [[ "${host}" == "127.0.0.1" ]]; then
+    # 本地执行
+    log::exec "[command]" "bash -c $(printf "%s" "${command//${SUDO_PASSWORD:-}/zzzzzz}")"
+    # shellcheck disable=SC2094
+    COMMAND_OUTPUT=$(eval bash -c "${command}" 2>> "$LOG_FILE" | tee -a "$LOG_FILE")
+    local status=$?
+  else
+    # 远程执行
+    local ssh_cmd="ssh"
+    if [[ "${SSH_PASSWORD}" != "" ]]; then
+      ssh_cmd="sshpass -p \"${SSH_PASSWORD}\" ${ssh_cmd}"
+    elif [[ "$SSH_PRIVATE_KEY" != "" ]]; then
+      [ -f "${SSH_PRIVATE_KEY}" ] || { log::error "[exec]" "ssh private_key:${SSH_PRIVATE_KEY} not found."; exit 1; }
+      ssh_cmd="${ssh_cmd} -i $SSH_PRIVATE_KEY"
+    fi
+    log::exec "[command]" "${ssh_cmd//${SSH_PASSWORD:-}/zzzzzz} ${SSH_OPTIONS} ${SSH_USER}@${host} -p ${SSH_PORT} bash -c $(printf "%s" "${command//${SUDO_PASSWORD:-}/zzzzzz}")"
+    # shellcheck disable=SC2094
+    COMMAND_OUTPUT=$(eval "${ssh_cmd} ${SSH_OPTIONS} ${SSH_USER}@${host} -p ${SSH_PORT}" bash -c '"${command}"' 2>> "$LOG_FILE" | tee -a "$LOG_FILE")
+    local status=$?
+  fi
+  return $status
+}
+
+######################################################################################################
+# 安装函数
+######################################################################################################
+# 检查用到的命令
+function check::command() {
+  check::command_exists ssh openssh-clients
+  check::command_exists tar tar
+  check::command_exists wget wget
+  check::command_exists unzip unzip
+}
+
+# 更新yum源
+function init:update_yum_repos() {
+  log::info "[update-yum-repos]" "更新yum源..."
+  local host="127.0.0.1"
+  local repo="/etc/yum.repos.d/CentOS-Base.repo"
+  local repo_bak="/etc/yum.repos.d/CentOS-Base.repo_bak"
+  command::exec "${host}" "
+    if [ ! -f "$repo_bak" ]; then
+      mv $repo $repo_bak
+      wget --timeout=10 --waitretry=3 --tries=5 --retry-connrefused --no-check-certificate ${YUM_REPOS} -O $repo
+      yum clean all
+      yum makecache
+      yum -y install epel-release
+    fi
+  "
+  check::exit_code "$?" "update-yum-repos" "$host 更新yum源" "exit"
+  log::info "[update-yum-repos]" "yum源更新成功!"
+}
+
+# 系统配置
+function init:config() {
+  log::info "[config]" "关闭系统防火墙..."
+  local host="127.0.0.1"
+  command::exec "${host}" "
+    # 停止防火墙
+    systemctl stop firewalld
+    # 彻底关闭防火墙
+    systemctl disable firewalld
+  "
+  log::info "[config]" "系统防火墙关闭成功!"
+}
+
+# 新增用户
+function init:add_user() {
+  log::info "[add-user]" "新增用户[${ADD_USER_NAME}]..."
+  local host="127.0.0.1"
+  local add_sudoers="${ADD_USER_NAME}    ALL=(ALL)       NOPASSWD:ALL"
+  command::exec "${host}" "
+  id -u ${ADD_USER_NAME} >/dev/null 2>&1
+  if [ \$? -ne '0' ]; then
+    # 创建用户
+    adduser ${ADD_USER_NAME}
+    # 设置密码
+    echo ${ADD_USER_NAME}:${ADD_USER_PASSWORD} | chpasswd
+  fi
+  if [ \`grep -c '$add_sudoers' '/etc/sudoers'\` == '0' ];then
+    # 新增修改权限
+    chmod -v u+w /etc/sudoers
+    echo -e '$add_sudoers' >> /etc/sudoers
+    # 收回修改权限
+    chmod -v u-w /etc/sudoers
+  fi
+  "
+  check::exit_code "$?" "add-user" "$host 新增用户[${ADD_USER_NAME}]" "exit"
+  log::info "[add-user]" "新增用户[${ADD_USER_NAME}]成功!"
+}
+
+# 安装git环境
+function init:git() {
+  log::info "[git]" "安装git环境..."
+  local host="127.0.0.1"
+  local exc_cmd="git config --global credential.helper store"
+  command::exec "${host}" "
+    yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm
+    yum -y install git
+    git --version
+    $exc_cmd
+  "
+  check::exit_code "$?" "git" "$host 安装git环境" "exit"
+  log::info "[git]" "git环境安装成功!"
+  if [[ "${ADD_USER_TAG:-}" == "1" ]]; then
+    command::exec "${host}" "
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c '$exc_cmd'
+    "
+    check::exit_code "$?" "git" "$host git配置" "exit"
+    log::info "[git]" "git配置成功!"
+  fi
+}
+
+# 安装dstat
+function init:dstat() {
+  log::info "[dstat]" "安装dstat..."
+  local host="127.0.0.1"
+  command::exec "${host}" "
+    yum -y install dstat
+    dstat -V
+  "
+  check::exit_code "$?" "dstat" "$host 安装dstat" "exit"
+  log::info "[dstat]" "dstat安装成功!"
+}
+
+# 安装htop
+function init:htop() {
+  log::info "[htop]" "安装htop..."
+  local host="127.0.0.1"
+  command::exec "${host}" "
+    yum -y install htop
+    htop -v
+  "
+  check::exit_code "$?" "htop" "$host 安装htop" "exit"
+  log::info "[htop]" "htop安装成功!"
+}
+
+# 安装nginx
+function init:nginx() {
+  log::info "[nginx]" "安装nginx..."
+  local host="127.0.0.1"
+  command::exec "${host}" "
+    yum -y install nginx
+    nginx -v
+  "
+  check::exit_code "$?" "nginx" "$host 安装nginx" "exit"
+  log::info "[nginx]" "nginx安装成功!"
+  log::info "[nginx]" "配置文件路径: /etc/nginx"
+  log::info "[nginx]" "设置开机启动: sudo systemctl enable nginx"
+  log::info "[nginx]" "启动/停止/重启: sudo service nginx start/stop/restart"
+  log::info "[nginx]" "检查nginx配置: sudo nginx -t"
+  log::info "[nginx]" "加载nginx配置: sudo nginx -s reload"
+}
+
+# 安装nodejs环境
+function init:nodejs() {
+  log::info "[nodejs]" "安装nodejs环境..."
+  local host="127.0.0.1"
+  command::exec "${host}" "
+    curl -fsSL https://rpm.nodesource.com/setup_16.x | sudo bash -
+    yum -y install nodejs
+    yum -y install npm
+    npm install --global yarn
+    # 配置npm源
+    npm config set registry https://registry.npm.taobao.org
+    npm config set disturl https://npm.taobao.org/dist
+    npm config set electron_mirror https://npm.taobao.org/mirrors/electron/
+    npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
+    npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/
+    # 配置yarn源
+    yarn config set registry https://registry.npm.taobao.org -g
+    yarn config set disturl https://npm.taobao.org/dist -g
+    yarn config set electron_mirror https://npm.taobao.org/mirrors/electron/ -g
+    yarn config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ -g
+    yarn config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/ -g
+    yarn config set chromedriver_cdnurl https://cdn.npm.taobao.org/dist/chromedriver -g
+    yarn config set operadriver_cdnurl https://cdn.npm.taobao.org/dist/operadriver -g
+    yarn config set fse_binary_host_mirror https://npm.taobao.org/mirrors/fsevents -g
+    # 验证
+    node -v
+    npm -v
+    yarn -v
+  "
+  check::exit_code "$?" "nodejs" "$host 安装nodejs环境" "exit"
+  if [[ "${ADD_USER_TAG:-}" == "1" ]]; then
+    command::exec "${host}" "
+      # 配置npm源
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'npm config set registry https://registry.npm.taobao.org'
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'npm config set disturl https://npm.taobao.org/dist'
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'npm config set electron_mirror https://npm.taobao.org/mirrors/electron/'
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/'
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/'
+      # 配置yarn源
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'yarn config set registry https://registry.npm.taobao.org -g'
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'yarn config set disturl https://npm.taobao.org/dist -g'
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'yarn config set electron_mirror https://npm.taobao.org/mirrors/electron/ -g'
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'yarn config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ -g'
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'yarn config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/ -g'
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'yarn config set chromedriver_cdnurl https://cdn.npm.taobao.org/dist/chromedriver -g'
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'yarn config set operadriver_cdnurl https://cdn.npm.taobao.org/dist/operadriver -g'
+      echo '${ADD_USER_PASSWORD}' | su - ${ADD_USER_NAME} -c 'yarn config set fse_binary_host_mirror https://npm.taobao.org/mirrors/fsevents -g'
+    "
+    check::exit_code "$?" "nodejs" "$host nodejs配置" "exit"
+    log::info "[nodejs]" "nodejs配置成功!"
+  fi
+  log::info "[nodejs]" "安装nodejs环境成功!"
+}
+
+# 安装java环境
+function init:java() {
+  log::info "[java]" "安装java环境..."
+  local host="127.0.0.1"
+  local java_path="${BASE_DIR}/java/${JDK_DIR_NAME}"
+  local line="\n"
+  local add_profile=`echo -e "${line}JAVA_HOME=${java_path}${line}PATH=\\\$JAVA_HOME/bin:\\\$PATH${line}export JAVA_HOME PATH"`
+  command::exec "${host}" "
+    yum -y remove *openjdk*
+    if [ ! -d "$java_path" ]; then
+      mkdir -p ${BASE_DIR}/java
+      wget --timeout=10 --waitretry=3 --tries=5 --retry-connrefused --no-check-certificate ${JDK_URL} -O ${BASE_DIR}/java/${JDK_FILE_NAME}
+      cd ${BASE_DIR}/java
+      tar -zxvf ${JDK_FILE_NAME}
+      echo '$add_profile' >> /etc/profile
+      source /etc/profile
+    fi
+    java -version
+  "
+  check::exit_code "$?" "java" "$host 安装java环境" "exit"
+  if [[ "${ADD_USER_TAG:-}" == "1" ]]; then
+    command::exec "${host}" "
+      sudo chown -R \$(id -u ${ADD_USER_NAME}):\$(id -g ${ADD_USER_NAME}) ${BASE_DIR}/java
+    "
+  fi
+  log::info "[java]" "java环境安装成功!"
+}
+
+# 安装gradle环境
+function init:gradle() {
+  log::info "[gradle]" "安装gradle环境..."
+  local host="127.0.0.1"
+  local gradle_path="${BASE_DIR}/gradle/${GRADLE_DIR_NAME}"
+  local line="\n"
+  local add_profile=`echo -e "${line}GRADLE_HOME=${gradle_path}${line}PATH=\\\$GRADLE_HOME/bin:\\\$PATH${line}export GRADLE_HOME PATH"`
+  command::exec "${host}" "
+    if [ ! -d "$gradle_path" ]; then
+      mkdir -p ${BASE_DIR}/gradle
+      wget --timeout=10 --waitretry=3 --tries=5 --retry-connrefused --no-check-certificate ${GRADLE_URL} -O ${BASE_DIR}/gradle/${GRADLE_FILE_NAME}
+      cd ${BASE_DIR}/gradle
+      unzip ${GRADLE_FILE_NAME}
+      echo '$add_profile' >> /etc/profile
+      source /etc/profile
+    fi
+    gradle -v
+  "
+  check::exit_code "$?" "gradle" "$host 安装gradle环境" "exit"
+  if [[ "${ADD_USER_TAG:-}" == "1" ]]; then
+    command::exec "${host}" "
+      sudo chown -R \$(id -u ${ADD_USER_NAME}):\$(id -g ${ADD_USER_NAME}) ${BASE_DIR}/gradle
+    "
+  fi
+  log::info "[gradle]" "gradle环境安装成功!"
+}
+
+# 安装maven环境
+function init:maven() {
+  log::info "[maven]" "安装maven环境..."
+  local host="127.0.0.1"
+  local maven_path="${BASE_DIR}/maven/${MAVEN_DIR_NAME}"
+  local line="\n"
+  local add_profile=`echo -e "${line}MAVEN_HOME=${maven_path}${line}PATH=\\\$MAVEN_HOME/bin:\\\$PATH${line}export MAVEN_HOME PATH"`
+  command::exec "${host}" "
+    if [ ! -d "$maven_path" ]; then
+      mkdir -p ${BASE_DIR}/maven
+      wget --timeout=10 --waitretry=3 --tries=5 --retry-connrefused --no-check-certificate ${MAVEN_URL} -O ${BASE_DIR}/maven/${MAVEN_FILE_NAME}
+      cd ${BASE_DIR}/maven
+      tar -zxvf ${MAVEN_FILE_NAME}
+      echo '$add_profile' >> /etc/profile
+      source /etc/profile
+    fi
+    mvn -v
+  "
+  check::exit_code "$?" "maven" "$host 安装maven环境" "exit"
+  if [[ "${ADD_USER_TAG:-}" == "1" ]]; then
+    command::exec "${host}" "
+      sudo chown -R \$(id -u ${ADD_USER_NAME}):\$(id -g ${ADD_USER_NAME}) ${BASE_DIR}/maven
+    "
+  fi
+  log::info "[maven]" "maven环境安装成功!"
+}
+
+# 安装jenkins环境
+function init:jenkins() {
+  log::info "[jenkins]" "安装jenkins环境..."
+  local host="127.0.0.1"
+  local java_path="${BASE_DIR}/jenkins/${JENKINS_JAVA_DIR_NAME}"
+  local jenkins_file="${BASE_DIR}/jenkins/${JENKINS_FILE_NAME}"
+  local java_mem_opts=" -DappName=jenkins -server -Xmx1g"
+  local database_opts=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+  local java_opts_ext=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+  command::exec "${host}" "
+    if [ ! -d "$java_path" ]; then
+      mkdir -p ${BASE_DIR}/jenkins
+      wget --timeout=10 --waitretry=3 --tries=5 --retry-connrefused --no-check-certificate ${JENKINS_JAVA_URL} -O ${BASE_DIR}/jenkins/${JENKINS_JAVA_FILE_NAME}
+      cd ${BASE_DIR}/jenkins
+      tar -zxvf ${JENKINS_JAVA_FILE_NAME}
+      $java_path/bin/java -version
+    fi
+    if [ ! -f "$jenkins_file" ]; then
+      mkdir -p ${BASE_DIR}/jenkins
+      wget --timeout=10 --waitretry=3 --tries=5 --retry-connrefused --no-check-certificate ${JENKINS_URL} -O ${BASE_DIR}/jenkins/${JENKINS_FILE_NAME}
+      cd ${BASE_DIR}/jenkins
+    fi
+    # 写文件start.sh文件
+    cat << EOF > ${BASE_DIR}/jenkins/start.sh
+#!/bin/bash
+
+httpPort=\\\${1:-'30003'}
+
+#-------------------------------------------------------------------
+java='$java_path/bin/java'
+jar_file='${BASE_DIR}/jenkins/jenkins.war'
+java_mem_opts=' -DappName=jenkins $java_opts_ext'
+database_opts='$database_opts'
+java_opts_ext='$java_opts_ext'
+#-------------------------------------------------------------------
+
+pid=\\\`ps -ef | grep 'DappName=jenkins ' | grep -v 'grep' | awk '{print \\\$2}'\\\`
+if [ -z \\\$pid ];then
+  nohup \\\$java \\\$java_mem_opts \\\$database_opts \\\$java_opts_ext -jar \\\$jar_file --httpPort=\\\$httpPort >${BASE_DIR}/jenkins/logs.log 2>&1 &
+  echo 'jenkins启动成功!'
+else
+  echo 'jenkins正在运行...'
+fi
+echo '查看日志:  tail -F ${BASE_DIR}/jenkins/logs.log -n 100'
+EOF
+    # 写文件kill.sh文件
+    cat << EOF > ${BASE_DIR}/jenkins/kill.sh
+#!/bin/bash
+
+pid=\\\`ps -ef | grep 'DappName=jenkins ' | grep -v 'grep' | awk '{print \\\$2}'\\\`
+if [ -z \\\$pid ];then
+  echo 'jenkins未运行'
+else
+  ps -ef | grep 'DappName=jenkins ' | grep -v 'grep' | awk '{print \\\$2}' | xargs kill
+  echo 'jenkins已停止!'
+fi
+EOF
+  chmod +x ${BASE_DIR}/jenkins/start.sh
+  chmod +x ${BASE_DIR}/jenkins/kill.sh
+  "
+  check::exit_code "$?" "jenkins" "$host 安装jenkins环境" "exit"
+  if [[ "${ADD_USER_TAG:-}" == "1" ]]; then
+    command::exec "${host}" "
+      sudo chown -R \$(id -u ${ADD_USER_NAME}):\$(id -g ${ADD_USER_NAME}) ${BASE_DIR}/jenkins
+    "
+  fi
+  log::info "[jenkins]" "jenkins环境安装成功!"
+  log::info "[jenkins]" "启动jenkins: ${BASE_DIR}/jenkins/start.sh 30003"
+  log::info "[jenkins]" "停止jenkins: ${BASE_DIR}/jenkins/kill.sh"
+}
+
+######################################################################################################
+# 主调用逻辑
+######################################################################################################
+trap trap::info 1 2 3 15 EXIT
+
+# 使用帮助
+function help::usage() {
+  cat << EOF
+Usage:
+  env-install-centos.sh [command]
+
+Available Commands:
+  init                初始化系统
+Flag:
+  -update-yum-repos   是否更新yum源, 默认: '1'
+  -config             配置系统, 默认: '1'
+  -add-user           是否新增用户, 默认: '1'
+  -user-name          新增用户名, 默认: 'www'
+  -base-dir           新增用户名, 默认: '/opt'
+  -git                是否安装git环境, 默认: '1'
+  -dstat              是否安装dstat, 默认: '1'
+  -htop               是否安装htop, 默认: '1'
+  -nginx              是否安装nginx, 默认: '1'
+  -nodejs             是否安装nodejs环境, 默认: '1'
+  -java               是否安装java环境, 默认: '1'
+  -gradle             是否安装gradle环境, 默认: '1'
+  -maven              是否安装maven环境, 默认: '1'
+  -jenkins            是否安装jenkins环境, 默认: '1'
+
+Example:
+  env-install-centos.sh init \\
+    -update-yum-repos 0 \\
+    -config 1 \\
+    -add-user 1 \\
+    -user-name www \\
+    -git 1 \\
+    -dstat 0 \\
+    -htop 0 \\
+    -nginx 0 \\
+    -nodejs 0 \\
+    -java 1 \\
+    -gradle 0 \\
+    -maven 0 \\
+    -jenkins 0
+
+EOF
+  exit 1
+}
+
+# 参数处理
+[ "$#" == "0" ] && help::usage
+while [ "${1:-}" != "" ]; do
+  case $1 in
+    # -------------------------------------------------------------- 指令
+    init  )                 INIT_TAG="1"
+                            ;;
+    # -------------------------------------------------------------- 指令参数
+    -update-yum-repos )     shift
+                            UPDATE_YUM_REPOS=${1:-UPDATE_YUM_REPOS}
+                            ;;
+    -config )               shift
+                            CONFIG_TAG=${1:-CONFIG_TAG}
+                            ;;
+    -add-user )             shift
+                            ADD_USER_TAG=${1:-ADD_USER_TAG}
+                            ;;
+    -user-name )            shift
+                            ADD_USER_NAME=${1:-ADD_USER_NAME}
+                            ;;
+    -base-dir )             shift
+                            BASE_DIR=${1:-BASE_DIR}
+                            ;;
+    -git )                  shift
+                            GIT_TAG=${1:-GIT_TAG}
+                            ;;
+    -dstat )                shift
+                            DSTAT_TAG=${1:-DSTAT_TAG}
+                            ;;
+    -htop )                 shift
+                            HTOP_TAG=${1:-HTOP_TAG}
+                            ;;
+    -nginx )                shift
+                            NGINX_TAG=${1:-NGINX_TAG}
+                            ;;
+    -nodejs )               shift
+                            NODEJS_TAG=${1:-NODEJS_TAG}
+                            ;;
+    -java )                 shift
+                            JAVA_TAG=${1:-JAVA_TAG}
+                            ;;
+    -gradle )               shift
+                            GRADLE_TAG=${1:-GRADLE_TAG}
+                            ;;
+    -maven )                shift
+                            MAVEN_TAG=${1:-MAVEN_TAG}
+                            ;;
+    -jenkins )              shift
+                            JENKINS_TAG=${1:-JENKINS_TAG}
+                            ;;
+    * )                     help::usage
+                            exit 1
+  esac
+  shift
+done
+
+# 开始
+log::info "[start]" "bash $0 ${SCRIPT_PARAMETER}"
+# 动作
+if [[ "${INIT_TAG:-}" == "1" ]]; then
+  check::command
+  [[ "${UPDATE_YUM_REPOS:-}" == "1" ]] && { init:update_yum_repos; }
+  [[ "${CONFIG_TAG:-}" == "1" ]] && { init:config; }
+  [[ "${ADD_USER_TAG:-}" == "1" ]] && { init:add_user; }
+  [[ "${GIT_TAG:-}" == "1" ]] && { init:git; }
+  [[ "${DSTAT_TAG:-}" == "1" ]] && { init:dstat; }
+  [[ "${HTOP_TAG:-}" == "1" ]] && { init:htop; }
+  [[ "${NGINX_TAG:-}" == "1" ]] && { init:nginx; }
+  [[ "${NODEJS_TAG:-}" == "1" ]] && { init:nodejs; }
+  [[ "${JAVA_TAG:-}" == "1" ]] && { init:java; }
+  [[ "${GRADLE_TAG:-}" == "1" ]] && { init:gradle; }
+  [[ "${MAVEN_TAG:-}" == "1" ]] && { init:maven; }
+  [[ "${JENKINS_TAG:-}" == "1" ]] && { init:jenkins; }
+else
+  help::usage
+fi

File diff suppressed because it is too large
+ 2860 - 0
02zhongtongfu/test/02k8s-install-centos.sh


+ 15 - 0
03qingdaozhongche/01wms8.bat

@@ -0,0 +1,15 @@
+@rem @if "%DEBUG%" == "" @echo off
+if "%OS%"=="Windows_NT" setlocal
+
+set dirPath="D:\SourceCode\jztd\wms83\wms-biz\servo\build\libs"
+set profiles="dev"
+set serverName="wms8"
+
+@rem #-------------------------------------------------------------------
+set JAVA_MEM_OPTS="-DappName=%serverName% -server -Xmx4g -Xms4g"
+set DATABASE_OPTS="-Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+set JAVA_OPTS_EXT="-Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+@rem #-------------------------------------------------------------------
+
+cd %dirPath%
+java %JAVA_MEM_OPTS% %DATABASE_OPTS% %JAVA_OPTS_EXT% -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,%profiles% --server.port=8096

+ 230 - 0
04hua_an_tang/01wms8-test.sh

@@ -0,0 +1,230 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_hua_an_tang
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/wms8/wms83.git"
+  "www@git.yvanui.com:lizhiwei/yvan-framework.git"
+  ## "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "hua_an_tang"
+  "8.3"
+)
+positionArr=(
+  "."
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-biz/bundle
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/bundle $echoSuffix"
+    cd "$codePath/wms-biz/bundle"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/bundle 文件未变化"
+  fi
+
+  # 构建 wms-biz/pda-client
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/pda-client $echoSuffix"
+    cd "$codePath/wms-biz/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_hua_an_tang/wms8_hua_an_tang.log
+dirPath=/home/www/deploy/wms8_hua_an_tang/wms-biz/servo/build/libs/
+serverName=wms8_hua_an_tang
+
+cmd=$1
+profiles=${2:-"test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8098 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8098 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) pull
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# 花安堂
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/04hua_an_tang/01wms8-test.sh) [cmd profiles]

+ 175 - 0
04hua_an_tang/02api-test.sh

@@ -0,0 +1,175 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_api_hua_an_tang
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/wms8/wms83.git"
+  "www@git.yvanui.com:lizhiwei/yvan-framework.git"
+  ## "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "hua_an_tang"
+  "8.3"
+)
+positionArr=(
+  "."
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_api_hua_an_tang/wms8_api_hua_an_tang.log
+dirPath=/home/www/deploy/wms8_api_hua_an_tang/wms-biz/wms8-api/build/libs/
+serverName=wms8_api_hua_an_tang
+
+cmd=$1
+profiles=${2:-"test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai -Duser.name=user"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms8-api-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8099 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms8-api-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8099 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: deploy restart start stop kill log logs
+if [ "$cmd" == "deploy" ];then
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# 花安堂 api
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/04hua_an_tang/02api-test.sh) [cmd profiles]

+ 229 - 0
04hua_an_tang/03wms8-prod.sh

@@ -0,0 +1,229 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_hua_an_tang
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/wms8/wms83.git"
+  "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "hua_an_tang"
+  "8.3"
+)
+positionArr=(
+  "."
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-biz/bundle
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/bundle $echoSuffix"
+    cd "$codePath/wms-biz/bundle"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/bundle 文件未变化"
+  fi
+
+  # 构建 wms-biz/pda-client
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/pda-client $echoSuffix"
+    cd "$codePath/wms-biz/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_hua_an_tang/wms8_hua_an_tang.log
+dirPath=/home/www/deploy/wms8_hua_an_tang/wms-biz/servo/build/libs/
+serverName=wms8_hua_an_tang
+
+cmd=$1
+profiles=${2:-"prod"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx4g -Xms4g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8095 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8095 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) pull
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# 花安堂
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/04hua_an_tang/03wms8-prod.sh) [cmd profiles]

+ 174 - 0
04hua_an_tang/04api-prod.sh

@@ -0,0 +1,174 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_api_hua_an_tang
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/wms8/wms83.git"
+  "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "hua_an_tang"
+  "8.3"
+)
+positionArr=(
+  "."
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_api_hua_an_tang/wms8_api_hua_an_tang.log
+dirPath=/home/www/deploy/wms8_api_hua_an_tang/wms-biz/wms8-api/build/libs/
+serverName=wms8_api_hua_an_tang
+
+cmd=$1
+profiles=${2:-"prod"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai -Duser.name=user"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms8-api-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8099 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms8-api-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8099 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: deploy restart start stop kill log logs
+if [ "$cmd" == "deploy" ];then
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# 花安堂 api
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/04hua_an_tang/04api-prod.sh) [cmd profiles]

+ 81 - 0
04hua_an_tang/05xxljob-prod.sh

@@ -0,0 +1,81 @@
+#!/bin/bash
+#set -x
+set -e
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+logPath=/data/logs/xxl-job/xxl-job.log
+dirPath=/home/www/deploy/xxl-job/
+serverName=xxl_job_prod
+
+cmd=$1
+profiles=${2:-"hua_an_tang-prod"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx1g -Xms1g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar bin/xxl-job-admin-postgres-2.3.0.jar --spring.config.location=conf/ --spring.profiles.active=global,$profiles --server.port=8000 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar bin/xxl-job-admin-postgres-2.3.0.jar --spring.config.location=conf/ --spring.profiles.active=global,$profiles --server.port=8000 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: deploy restart start stop kill log logs
+if [ "$cmd" == "deploy" ];then
+  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/03xxljob.sh) pull
+  restartServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/04hua_an_tang/05xxljob-prod.sh) [cmd profiles]

+ 142 - 0
04hua_an_tang/06pda-prod.sh

@@ -0,0 +1,142 @@
+#!/bin/bash
+#set -x
+set -e
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+codePath=/home/www/deploy/wms8_hua_an_tang
+serverUrl=http://127.0.0.1:8095
+
+deploy() {
+  # 更新代码
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  git pull
+
+  # 读取版本号
+  major='1'
+  minor=$(date +%Y%m%d)
+  patch=$(date +1%H%M%S | sed -e 's/^[[:space:]]*//')
+  version="$major.$minor.$patch"
+  echo -e "$echoPrefix sed -i 's/__WebAppVersion__/$version/g' $codePath/wms-biz/pda-client/src/app.js $echoSuffix"
+  sed -i "s/__WebAppVersion__/$version/g" $codePath/wms-biz/pda-client/src/app.js
+  echo -e "$echoPrefix 版本号信息: version=$version, major=$major, minor=$minor, patch=$patch $echoSuffix"
+
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+
+  # 编译
+  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+
+  echo -e "$echoPrefix cd $codePath/wms-biz/pda-client/ $echoSuffix"
+  cd $codePath/wms-biz/pda-client/
+  echo -e "$echoPrefix yarn build $echoSuffix"
+  yarn build
+
+  echo "###--编译完成-----------------------------------------------------------------------------###"
+  echo ""
+
+  # 创建打包文件夹
+  echo -e "$echoPrefix rm -rf $codePath/tmp $echoSuffix"
+  rm -rf $codePath/tmp
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/static $echoSuffix"
+  mkdir -p $codePath/tmp/web/static
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/node_modules/tslib $echoSuffix"
+  mkdir -p $codePath/tmp/web/node_modules/tslib
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/m_node_modules/yvan-ext-mobile $echoSuffix"
+  mkdir -p $codePath/tmp/web/m_node_modules/yvan-ext-mobile
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/mobile-assets $echoSuffix"
+  mkdir -p $codePath/tmp/web/mobile-assets
+
+  echo -e "$echoPrefix cp -r $codePath/dist_pda/ $codePath/tmp/web/dist_pda $echoSuffix"
+  cp -r $codePath/dist_pda/ $codePath/tmp/web/dist_pda
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/require.js $codePath/tmp/web/static/require.js $echoSuffix"
+  cp -r $codePath/public/static/require.js $codePath/tmp/web/static/require.js
+
+  echo -e "$echoPrefix cp -r $codePath/public/m_require_config.js $codePath/tmp/web/m_require_config.js $echoSuffix"
+  cp -r $codePath/public/m_require_config.js $codePath/tmp/web/m_require_config.js
+
+  echo -e "$echoPrefix cp -r $codePath/public/m_common.css $codePath/tmp/web/m_common.css $echoSuffix"
+  cp -r $codePath/public/m_common.css $codePath/tmp/web/m_common.css
+
+  echo -e "$echoPrefix cp -r $codePath/public/m.html $codePath/tmp/web/index.html $echoSuffix"
+  cp -r $codePath/public/m.html $codePath/tmp/web/index.html
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/require-css $codePath/tmp/web/static/require-css $echoSuffix"
+  cp -r $codePath/public/static/require-css $codePath/tmp/web/static/require-css
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/polyfill $codePath/tmp/web/static/polyfill $echoSuffix"
+  cp -r $codePath/public/static/polyfill $codePath/tmp/web/static/polyfill
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/jquery $codePath/tmp/web/static/jquery $echoSuffix"
+  cp -r $codePath/public/static/jquery $codePath/tmp/web/static/jquery
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/font-awesome $codePath/tmp/web/static/font-awesome $echoSuffix"
+  cp -r $codePath/public/static/font-awesome $codePath/tmp/web/static/font-awesome
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/iconfont $codePath/tmp/web/static/iconfont $echoSuffix"
+  cp -r $codePath/public/static/iconfont $codePath/tmp/web/static/iconfont
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/bootstrap $codePath/tmp/web/static/bootstrap $echoSuffix"
+  cp -r $codePath/public/static/bootstrap $codePath/tmp/web/static/bootstrap
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/tslib/tslib.js $codePath/tmp/web/node_modules/tslib/tslib.js $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/tslib/tslib.js $codePath/tmp/web/node_modules/tslib/tslib.js
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/dist $codePath/tmp/web/m_node_modules/yvan-ext-mobile/dist $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/dist $codePath/tmp/web/m_node_modules/yvan-ext-mobile/dist
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/packages $codePath/tmp/web/mobile-assets/packages $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/packages $codePath/tmp/web/mobile-assets/packages
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/modern $codePath/tmp/web/mobile-assets/modern $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/modern $codePath/tmp/web/mobile-assets/modern
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/ext-modern-all-debug.js $codePath/tmp/web/mobile-assets/ext-modern-all-debug.js $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/ext-modern-all-debug.js $codePath/tmp/web/mobile-assets/ext-modern-all-debug.js
+
+  echo -e "$echoPrefix cd $codePath/tmp $echoSuffix"
+  cd $codePath/tmp
+  echo -e "$echoPrefix zip -r web.zip web $echoSuffix"
+  zip -r web.zip web
+
+  echo "###--打包完成-----------------------------------------------------------------------------###"
+  echo ""
+
+  # 上传文件
+  echo -e "$echoPrefix curl -X POST -F 'file=@$codePath/tmp/web.zip' $serverUrl/file/upload $echoSuffix"
+  res_json=$(curl -X POST -F 'file=@'$codePath'/tmp/web.zip' $serverUrl/file/upload)
+  filePath=$(echo $res_json | awk -F '"' '{print $10}')
+
+  req_json='{"args":[{"app_code":"PDA_WEB","app_name":"PDA_WEB","major":'$major',"minor":'$minor',"patch":'$patch',"file_path":"'$filePath'","app_version":"'$$version'"}]}'
+  res_json=$(curl -H "Content-type: application/json" -X POST -d "$req_json" $serverUrl/api/com/galaxis/wms/sys/app_version/AppVersion@newAppVersion)
+
+  echo -e "$echoPrefix $res_json $echoSuffix"
+  echo ""
+
+  # 还原文件
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix 版本号信息: version=$version, major=$major, minor=$minor, patch=$patch $echoSuffix"
+  echo ""
+}
+
+cmd=$1
+if [ "$cmd" == "deploy" ];then
+  deploy
+else
+  echo "使用 deploy 命名打包pda"
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/04hua_an_tang/06pda-prod.sh) [cmd]

+ 238 - 0
05shengke/01wms83-test.sh

@@ -0,0 +1,238 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_shengke
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/wms8/wms83.git"
+  "www@git.yvanui.com:lizhiwei/yvan-framework.git"
+  ## "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "master"
+  "8.3"
+)
+positionArr=(
+  "."
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-biz/bundle
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/bundle $echoSuffix"
+    cd "$codePath/wms-biz/bundle"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/bundle 文件未变化"
+  fi
+
+  # 构建 wms-biz/pda-client
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/pda-client $echoSuffix"
+    cd "$codePath/wms-biz/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_shengke/wms8_shengke.log
+dirPath=/home/www/deploy/wms8_shengke/wms-biz/servo/build/libs/
+serverName=wms8_shengke
+
+cmd=$1
+profiles=${2:-"test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8101 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8101 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  start=$2
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 停止服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  # 启动服务
+  if [ "$start" == "start" ];then
+    startServer
+  fi
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) pull
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull build deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull build deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "build" ];then
+  deployYvanUI
+  deployServer "$pid" "no_start"
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer "$pid" "start"
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull build deploy restart start stop kill log logs"
+    echo "查看日志: tail -F $logPath -n 100"
+  else
+    echo "输入操作参数: pull build deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# 云南圣科
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/05shengke/01wms83-test.sh) [cmd profiles]

+ 175 - 0
05shengke/02api-test.sh

@@ -0,0 +1,175 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_api_shengke
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/wms8/wms83.git"
+  "www@git.yvanui.com:lizhiwei/yvan-framework.git"
+  ## "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "master"
+  "8.3"
+)
+positionArr=(
+  "."
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_api_shengke/wms8_api_shengke.log
+dirPath=/home/www/deploy/wms8_api_shengke/wms-biz/wms8-api/build/libs/
+serverName=wms8_api_shengke
+
+cmd=$1
+profiles=${2:-"test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx1g -Xms1g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai -Duser.name=user"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms8-api-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8094 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms8-api-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8094 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: deploy restart start stop kill log logs
+if [ "$cmd" == "deploy" ];then
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# 云南圣科 api
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/05shengke/02api-test.sh) [cmd profiles]

+ 81 - 0
05shengke/03xxljob-prod.sh

@@ -0,0 +1,81 @@
+#!/bin/bash
+#set -x
+set -e
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+logPath=/data/logs/xxl-job/xxl-job.log
+dirPath=/home/www/deploy/xxl-job/
+serverName=xxl_job_prod
+
+cmd=$1
+profiles=${2:-"shengke-prod"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx1g -Xms1g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar bin/xxl-job-admin-postgres-2.3.0.jar --spring.config.location=conf/ --spring.profiles.active=global,$profiles --server.port=8000 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar bin/xxl-job-admin-postgres-2.3.0.jar --spring.config.location=conf/ --spring.profiles.active=global,$profiles --server.port=8000 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: deploy restart start stop kill log logs
+if [ "$cmd" == "deploy" ];then
+  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/03xxljob.sh) pull
+  restartServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/05shengke/03xxljob-prod.sh) [cmd profiles]

+ 35 - 0
05shengke/03xxljob.groovy

@@ -0,0 +1,35 @@
+//file:noinspection ALL
+pipeline {
+    agent any
+
+    environment {
+        projectName = 'xxl-job'
+    }
+
+    stages {
+        stage('#检查环境') {
+            steps {
+                sh """
+                    java -version
+                """
+            }
+        }
+
+        stage('#编译项目') {
+            steps {
+                sh """
+                    wget -N http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/03xxljob.sh
+                    chmod +x 03xxljob.sh
+                    wget -N http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/05shengke/03xxljob-prod.sh
+                    chmod +x 03xxljob-prod.sh
+                    ./03xxljob-prod.sh stop
+                    ./03xxljob.sh pull
+                """
+                sh """
+                    sleep 3s
+                    JENKINS_NODE_COOKIE=dontKillMe nohup ./03xxljob-prod.sh start > /dev/null 2>&1 &
+                """
+            }
+        }
+    }
+}

+ 33 - 0
05shengke/04wms83-prod.groovy

@@ -0,0 +1,33 @@
+//file:noinspection ALL
+pipeline {
+    agent any
+
+    environment {
+        projectName = 'wms8'
+    }
+
+    stages {
+        stage('#检查环境') {
+            steps {
+                sh """
+                    java -version
+                    gradle -v
+                """
+            }
+        }
+
+        stage('#编译项目') {
+            steps {
+                sh """
+                    wget -N http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/05shengke/04wms83-prod.sh
+                    chmod +x ./04wms83-prod.sh
+                    ./04wms83-prod.sh deploy
+                """
+                sh """
+                    sleep 3s
+                    JENKINS_NODE_COOKIE=dontKillMe nohup ./04wms83-prod.sh restart > /dev/null 2>&1 &
+                """
+            }
+        }
+    }
+}

+ 235 - 0
05shengke/04wms83-prod.sh

@@ -0,0 +1,235 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_shengke
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/wms8/wms83.git"
+  "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "master"
+  "8.3"
+)
+positionArr=(
+  "."
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-biz/bundle
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/bundle $echoSuffix"
+    cd "$codePath/wms-biz/bundle"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/bundle 文件未变化"
+  fi
+
+  # 构建 wms-biz/pda-client
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/pda-client $echoSuffix"
+    cd "$codePath/wms-biz/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_shengke/wms8_shengke.log
+dirPath=/home/www/deploy/wms8_shengke/wms-biz/servo/build/libs/
+serverName=wms8_shengke
+
+cmd=$1
+profiles=${2:-"prod"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8101 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8101 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) pull
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull build deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull build deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "build" ];then
+  deployYvanUI
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull build deploy restart start stop kill log logs"
+    echo "查看日志: tail -F $logPath -n 100"
+  else
+    echo "输入操作参数: pull build deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# 云南圣科
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/05shengke/04wms83-prod.sh) [cmd profiles]

+ 32 - 0
05shengke/05api-prod.groovy

@@ -0,0 +1,32 @@
+//file:noinspection ALL
+pipeline {
+    agent any
+
+    environment {
+        projectName = 'wms8-api'
+    }
+
+    stages {
+        stage('#检查环境') {
+            steps {
+                sh """
+                    java -version
+                    gradle -v
+                """
+            }
+        }
+
+        stage('#编译项目') {
+            steps {
+                sh """
+                    wget -N http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/05shengke/05api-prod.sh
+                    chmod +x ./05api-prod.sh
+                    ./05api-prod.sh build
+                """
+                sh """
+                    JENKINS_NODE_COOKIE=dontKillMe nohup ./05api-prod.sh restart > /dev/null 2>&1 &
+                """
+            }
+        }
+    }
+}

+ 190 - 0
05shengke/05api-prod.sh

@@ -0,0 +1,190 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_api_shengke
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/wms8/wms83.git"
+  "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "master"
+  "8.3"
+)
+positionArr=(
+  "."
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_api_shengke/wms8_api_shengke.log
+dirPath=/home/www/deploy/wms8_api_shengke/wms-biz/wms8-api/build/libs/
+serverName=wms8_api_shengke
+
+cmd=$1
+profiles=${2:-"prod"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai -Duser.name=user"
+#-------------------------------------------------------------------
+
+moveBuildFile() {
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+}
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms8-api-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8094 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms8-api-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8094 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  moveBuildFile
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  moveBuildFile
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: build deploy restart start stop kill log logs
+if [ "$cmd" == "build" ];then
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+elif [ "$cmd" == "deploy" ];then
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: build deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: build deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# 云南圣科 api
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/05shengke/05api-prod.sh) [cmd profiles]

+ 171 - 0
05shengke/06api-gateway.sh

@@ -0,0 +1,171 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/api_gateway
+gitUrlArr=(
+  "http://git.yvanui.com/lizhiwei/api-gateway.git"
+)
+
+branchArr=(
+  "master"
+)
+positionArr=(
+  "."
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix chmod +x gradlew $echoSuffix"
+  chmod +x gradlew
+  echo -e "$echoPrefix ./gradlew build -x test $echoSuffix"
+  ./gradlew build -x test
+  echo ""
+}
+
+logPath=/data/logs/api_gateway/api_gateway.log
+dirPath=/home/www/deploy/api_gateway/api-gateway-server/build/libs/
+serverName=api_gateway
+
+cmd=$1
+profiles=${2:-"shengke-prod"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx1g -Xms1g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./api-gateway-server-0.0.1-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=9094 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./api-gateway-server-0.0.1-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=9094 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: deploy restart start stop kill log logs
+if [ "$cmd" == "deploy" ];then
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/05shengke/06api-gateway.sh) [cmd profiles]

+ 214 - 0
06zhanhui/01wms8-prod.sh

@@ -0,0 +1,214 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_zhanhui
+gitUrlArr=(
+  "http://git.yvanui.com/yuliang/cemat.git"
+  "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "master"
+  "master"
+)
+positionArr=(
+  "."
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-biz/bundle
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/bundle $echoSuffix"
+    cd "$codePath/wms-biz/bundle"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/bundle 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_zhanhui/wms8_zhanhui.log
+dirPath=/home/www/deploy/wms8_zhanhui/wms-biz/servo/build/libs/
+serverName=wms8_zhanhui
+
+cmd=$1
+profiles=${2:-"prod"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) pull
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# 展会项目
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/06zhanhui/01wms8-prod.sh) [cmd profiles]

+ 224 - 0
07shuyu_benxi/02wms8-prod.sh

@@ -0,0 +1,224 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_benxi
+gitUrlArr=(
+  "https://wms-gitlab.sypm.cn:7878/kaileshi/wms8-bench.git"
+)
+
+branchArr=(
+  "main"
+)
+positionArr=(
+  "."
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-biz/bundle
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/bundle $echoSuffix"
+    cd "$codePath/wms-biz/bundle"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/bundle 文件未变化"
+  fi
+
+  # 构建 wms-biz/pda-client
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/pda-client $echoSuffix"
+    cd "$codePath/wms-biz/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_benxi/wms8_benxi.log
+dirPath=/home/www/deploy/wms8_benxi/wms-biz/servo/build/libs/
+serverName=3wms8_sybx
+
+cmd=$1
+profiles=${2:-"prod-benxi"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8098 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8098 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) pull
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# 本溪
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/07shuyu_benxi/02wms8-prod.sh) [cmd profiles]

+ 143 - 0
07shuyu_benxi/03pda-prod.sh

@@ -0,0 +1,143 @@
+#!/bin/bash
+#set -x
+set -e
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+codePath=/home/www/deploy/wms8_benxi
+serverUrl=http://127.0.0.1:8098
+
+deploy() {
+  # 更新代码
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  git pull
+
+  # 读取版本号
+  major='1'
+  minor=$(date +%Y%m%d)
+  patch=$(date +1%H%M%S | sed -e 's/^[[:space:]]*//')
+  version="$major.$minor.$patch"
+  echo -e "$echoPrefix sed -i 's/__WebAppVersion__/$version/g' $codePath/wms-biz/pda-client/src/app.js $echoSuffix"
+  sed -i "s/__WebAppVersion__/$version/g" $codePath/wms-biz/pda-client/src/app.js
+  echo -e "$echoPrefix 版本号信息: version=$version, major=$major, minor=$minor, patch=$patch $echoSuffix"
+
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+
+  # 编译
+  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+
+  echo -e "$echoPrefix cd $codePath/wms-biz/pda-client/ $echoSuffix"
+  cd $codePath/wms-biz/pda-client/
+  echo -e "$echoPrefix yarn build $echoSuffix"
+  yarn build
+
+  echo "###--编译完成-----------------------------------------------------------------------------###"
+  echo ""
+
+  # 创建打包文件夹
+  echo -e "$echoPrefix rm -rf $codePath/tmp $echoSuffix"
+  rm -rf $codePath/tmp
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/static $echoSuffix"
+  mkdir -p $codePath/tmp/web/static
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/node_modules/tslib $echoSuffix"
+  mkdir -p $codePath/tmp/web/node_modules/tslib
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/m_node_modules/yvan-ext-mobile $echoSuffix"
+  mkdir -p $codePath/tmp/web/m_node_modules/yvan-ext-mobile
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/mobile-assets $echoSuffix"
+  mkdir -p $codePath/tmp/web/mobile-assets
+
+  echo -e "$echoPrefix cp -r $codePath/dist_pda/ $codePath/tmp/web/dist_pda $echoSuffix"
+  cp -r $codePath/dist_pda/ $codePath/tmp/web/dist_pda
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/require.js $codePath/tmp/web/static/require.js $echoSuffix"
+  cp -r $codePath/public/static/require.js $codePath/tmp/web/static/require.js
+
+  echo -e "$echoPrefix cp -r $codePath/public/m_require_config.js $codePath/tmp/web/m_require_config.js $echoSuffix"
+  cp -r $codePath/public/m_require_config.js $codePath/tmp/web/m_require_config.js
+
+  echo -e "$echoPrefix cp -r $codePath/public/m_common.css $codePath/tmp/web/m_common.css $echoSuffix"
+  cp -r $codePath/public/m_common.css $codePath/tmp/web/m_common.css
+
+  echo -e "$echoPrefix cp -r $codePath/public/m.html $codePath/tmp/web/index.html $echoSuffix"
+  cp -r $codePath/public/m.html $codePath/tmp/web/index.html
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/require-css $codePath/tmp/web/static/require-css $echoSuffix"
+  cp -r $codePath/public/static/require-css $codePath/tmp/web/static/require-css
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/polyfill $codePath/tmp/web/static/polyfill $echoSuffix"
+  cp -r $codePath/public/static/polyfill $codePath/tmp/web/static/polyfill
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/jquery $codePath/tmp/web/static/jquery $echoSuffix"
+  cp -r $codePath/public/static/jquery $codePath/tmp/web/static/jquery
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/font-awesome $codePath/tmp/web/static/font-awesome $echoSuffix"
+  cp -r $codePath/public/static/font-awesome $codePath/tmp/web/static/font-awesome
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/iconfont $codePath/tmp/web/static/iconfont $echoSuffix"
+  cp -r $codePath/public/static/iconfont $codePath/tmp/web/static/iconfont
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/bootstrap $codePath/tmp/web/static/bootstrap $echoSuffix"
+  cp -r $codePath/public/static/bootstrap $codePath/tmp/web/static/bootstrap
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/tslib/tslib.js $codePath/tmp/web/node_modules/tslib/tslib.js $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/tslib/tslib.js $codePath/tmp/web/node_modules/tslib/tslib.js
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/dist $codePath/tmp/web/m_node_modules/yvan-ext-mobile/dist $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/dist $codePath/tmp/web/m_node_modules/yvan-ext-mobile/dist
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/packages $codePath/tmp/web/mobile-assets/packages $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/packages $codePath/tmp/web/mobile-assets/packages
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/modern $codePath/tmp/web/mobile-assets/modern $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/modern $codePath/tmp/web/mobile-assets/modern
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/ext-modern-all-debug.js $codePath/tmp/web/mobile-assets/ext-modern-all-debug.js $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/ext-modern-all-debug.js $codePath/tmp/web/mobile-assets/ext-modern-all-debug.js
+
+  echo -e "$echoPrefix cd $codePath/tmp $echoSuffix"
+  cd $codePath/tmp
+  echo -e "$echoPrefix zip -r web.zip web $echoSuffix"
+  zip -r web.zip web
+
+  echo "###--打包完成-----------------------------------------------------------------------------###"
+  echo ""
+
+  # 上传文件
+  echo -e "$echoPrefix curl -X POST -F 'file=@$codePath/tmp/web.zip' $serverUrl/file/upload $echoSuffix"
+  res_json=$(curl -X POST -F 'file=@'$codePath'/tmp/web.zip' $serverUrl/file/upload)
+  filePath=$(echo $res_json | awk -F '"' '{print $10}')
+
+  req_json='{"args":[{"app_code":"PDA_WEB","app_name":"PDA_WEB","major":'$major',"minor":'$minor',"patch":'$patch',"file_path":"'$filePath'","app_version":"'$$version'"}]}'
+  res_json=$(curl -H "Content-type: application/json" -X POST -d "$req_json" $serverUrl/api/com/galaxis/wms/sys/app_version/AppVersion@newAppVersion)
+
+  echo -e "$echoPrefix $res_json $echoSuffix"
+  echo ""
+
+  # 还原文件
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix 版本号信息: version=$version, major=$major, minor=$minor, patch=$patch $echoSuffix"
+  echo ""
+}
+
+cmd=$1
+if [ "$cmd" == "deploy" ];then
+  deploy
+else
+  echo "使用 deploy 命名打包pda"
+fi
+
+# 本溪
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/07shuyu_benxi/03pda-prod.sh) [cmd]

+ 224 - 0
07shuyu_fujian/02wms8-prod.sh

@@ -0,0 +1,224 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_fujian
+gitUrlArr=(
+  "https://wms-gitlab.sypm.cn:7878/kaileshi/wms8-bench.git"
+)
+
+branchArr=(
+  "main"
+)
+positionArr=(
+  "."
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-biz/bundle
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/bundle $echoSuffix"
+    cd "$codePath/wms-biz/bundle"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/bundle 文件未变化"
+  fi
+
+  # 构建 wms-biz/pda-client
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/pda-client $echoSuffix"
+    cd "$codePath/wms-biz/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_fujian/wms8_fujian.log
+dirPath=/home/www/deploy/wms8_fujian/wms-biz/servo/build/libs/
+serverName=4wms8_fujian
+
+cmd=$1
+profiles=${2:-"prod-fujian"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8099 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8099 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) pull
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# 福建
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/07shuyu_fujian/02wms8-prod.sh) [cmd profiles]

+ 143 - 0
07shuyu_fujian/03pda-prod.sh

@@ -0,0 +1,143 @@
+#!/bin/bash
+#set -x
+set -e
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+codePath=/home/www/deploy/wms8_fujian
+serverUrl=http://127.0.0.1:8099
+
+deploy() {
+  # 更新代码
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  git pull
+
+  # 读取版本号
+  major='1'
+  minor=$(date +%Y%m%d)
+  patch=$(date +1%H%M%S | sed -e 's/^[[:space:]]*//')
+  version="$major.$minor.$patch"
+  echo -e "$echoPrefix sed -i 's/__WebAppVersion__/$version/g' $codePath/wms-biz/pda-client/src/app.js $echoSuffix"
+  sed -i "s/__WebAppVersion__/$version/g" $codePath/wms-biz/pda-client/src/app.js
+  echo -e "$echoPrefix 版本号信息: version=$version, major=$major, minor=$minor, patch=$patch $echoSuffix"
+
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+
+  # 编译
+  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+
+  echo -e "$echoPrefix cd $codePath/wms-biz/pda-client/ $echoSuffix"
+  cd $codePath/wms-biz/pda-client/
+  echo -e "$echoPrefix yarn build $echoSuffix"
+  yarn build
+
+  echo "###--编译完成-----------------------------------------------------------------------------###"
+  echo ""
+
+  # 创建打包文件夹
+  echo -e "$echoPrefix rm -rf $codePath/tmp $echoSuffix"
+  rm -rf $codePath/tmp
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/static $echoSuffix"
+  mkdir -p $codePath/tmp/web/static
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/node_modules/tslib $echoSuffix"
+  mkdir -p $codePath/tmp/web/node_modules/tslib
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/m_node_modules/yvan-ext-mobile $echoSuffix"
+  mkdir -p $codePath/tmp/web/m_node_modules/yvan-ext-mobile
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/mobile-assets $echoSuffix"
+  mkdir -p $codePath/tmp/web/mobile-assets
+
+  echo -e "$echoPrefix cp -r $codePath/dist_pda/ $codePath/tmp/web/dist_pda $echoSuffix"
+  cp -r $codePath/dist_pda/ $codePath/tmp/web/dist_pda
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/require.js $codePath/tmp/web/static/require.js $echoSuffix"
+  cp -r $codePath/public/static/require.js $codePath/tmp/web/static/require.js
+
+  echo -e "$echoPrefix cp -r $codePath/public/m_require_config.js $codePath/tmp/web/m_require_config.js $echoSuffix"
+  cp -r $codePath/public/m_require_config.js $codePath/tmp/web/m_require_config.js
+
+  echo -e "$echoPrefix cp -r $codePath/public/m_common.css $codePath/tmp/web/m_common.css $echoSuffix"
+  cp -r $codePath/public/m_common.css $codePath/tmp/web/m_common.css
+
+  echo -e "$echoPrefix cp -r $codePath/public/m.html $codePath/tmp/web/index.html $echoSuffix"
+  cp -r $codePath/public/m.html $codePath/tmp/web/index.html
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/require-css $codePath/tmp/web/static/require-css $echoSuffix"
+  cp -r $codePath/public/static/require-css $codePath/tmp/web/static/require-css
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/polyfill $codePath/tmp/web/static/polyfill $echoSuffix"
+  cp -r $codePath/public/static/polyfill $codePath/tmp/web/static/polyfill
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/jquery $codePath/tmp/web/static/jquery $echoSuffix"
+  cp -r $codePath/public/static/jquery $codePath/tmp/web/static/jquery
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/font-awesome $codePath/tmp/web/static/font-awesome $echoSuffix"
+  cp -r $codePath/public/static/font-awesome $codePath/tmp/web/static/font-awesome
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/iconfont $codePath/tmp/web/static/iconfont $echoSuffix"
+  cp -r $codePath/public/static/iconfont $codePath/tmp/web/static/iconfont
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/bootstrap $codePath/tmp/web/static/bootstrap $echoSuffix"
+  cp -r $codePath/public/static/bootstrap $codePath/tmp/web/static/bootstrap
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/tslib/tslib.js $codePath/tmp/web/node_modules/tslib/tslib.js $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/tslib/tslib.js $codePath/tmp/web/node_modules/tslib/tslib.js
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/dist $codePath/tmp/web/m_node_modules/yvan-ext-mobile/dist $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/dist $codePath/tmp/web/m_node_modules/yvan-ext-mobile/dist
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/packages $codePath/tmp/web/mobile-assets/packages $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/packages $codePath/tmp/web/mobile-assets/packages
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/modern $codePath/tmp/web/mobile-assets/modern $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/modern $codePath/tmp/web/mobile-assets/modern
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/ext-modern-all-debug.js $codePath/tmp/web/mobile-assets/ext-modern-all-debug.js $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/ext-modern-all-debug.js $codePath/tmp/web/mobile-assets/ext-modern-all-debug.js
+
+  echo -e "$echoPrefix cd $codePath/tmp $echoSuffix"
+  cd $codePath/tmp
+  echo -e "$echoPrefix zip -r web.zip web $echoSuffix"
+  zip -r web.zip web
+
+  echo "###--打包完成-----------------------------------------------------------------------------###"
+  echo ""
+
+  # 上传文件
+  echo -e "$echoPrefix curl -X POST -F 'file=@$codePath/tmp/web.zip' $serverUrl/file/upload $echoSuffix"
+  res_json=$(curl -X POST -F 'file=@'$codePath'/tmp/web.zip' $serverUrl/file/upload)
+  filePath=$(echo $res_json | awk -F '"' '{print $10}')
+
+  req_json='{"args":[{"app_code":"PDA_WEB","app_name":"PDA_WEB","major":'$major',"minor":'$minor',"patch":'$patch',"file_path":"'$filePath'","app_version":"'$$version'"}]}'
+  res_json=$(curl -H "Content-type: application/json" -X POST -d "$req_json" $serverUrl/api/com/galaxis/wms/sys/app_version/AppVersion@newAppVersion)
+
+  echo -e "$echoPrefix $res_json $echoSuffix"
+  echo ""
+
+  # 还原文件
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix 版本号信息: version=$version, major=$major, minor=$minor, patch=$patch $echoSuffix"
+  echo ""
+}
+
+cmd=$1
+if [ "$cmd" == "deploy" ];then
+  deploy
+else
+  echo "使用 deploy 命名打包pda"
+fi
+
+# 福建
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/07shuyu_fujian/03pda-prod.sh) [cmd]

+ 224 - 0
07shuyu_haerbing/02wms8-prod.sh

@@ -0,0 +1,224 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_haerbing
+gitUrlArr=(
+  "https://wms-gitlab.sypm.cn:7878/kaileshi/wms8-bench.git"
+)
+
+branchArr=(
+  "main"
+)
+positionArr=(
+  "."
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-biz/bundle
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/bundle $echoSuffix"
+    cd "$codePath/wms-biz/bundle"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/bundle 文件未变化"
+  fi
+
+  # 构建 wms-biz/pda-client
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/pda-client $echoSuffix"
+    cd "$codePath/wms-biz/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_haerbing/wms8_haerbing.log
+dirPath=/home/www/deploy/wms8_haerbing/wms-biz/servo/build/libs/
+serverName=2wms8_syheb
+
+cmd=$1
+profiles=${2:-"prod-haerbing"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8097 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8097 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) pull
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# 哈尔滨
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/07shuyu_haerbing/02wms8-prod.sh) [cmd profiles]

+ 143 - 0
07shuyu_haerbing/03pda-prod.sh

@@ -0,0 +1,143 @@
+#!/bin/bash
+#set -x
+set -e
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+codePath=/home/www/deploy/wms8_haerbing
+serverUrl=http://127.0.0.1:8097
+
+deploy() {
+  # 更新代码
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  git pull
+
+  # 读取版本号
+  major='1'
+  minor=$(date +%Y%m%d)
+  patch=$(date +1%H%M%S | sed -e 's/^[[:space:]]*//')
+  version="$major.$minor.$patch"
+  echo -e "$echoPrefix sed -i 's/__WebAppVersion__/$version/g' $codePath/wms-biz/pda-client/src/app.js $echoSuffix"
+  sed -i "s/__WebAppVersion__/$version/g" $codePath/wms-biz/pda-client/src/app.js
+  echo -e "$echoPrefix 版本号信息: version=$version, major=$major, minor=$minor, patch=$patch $echoSuffix"
+
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+
+  # 编译
+  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+
+  echo -e "$echoPrefix cd $codePath/wms-biz/pda-client/ $echoSuffix"
+  cd $codePath/wms-biz/pda-client/
+  echo -e "$echoPrefix yarn build $echoSuffix"
+  yarn build
+
+  echo "###--编译完成-----------------------------------------------------------------------------###"
+  echo ""
+
+  # 创建打包文件夹
+  echo -e "$echoPrefix rm -rf $codePath/tmp $echoSuffix"
+  rm -rf $codePath/tmp
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/static $echoSuffix"
+  mkdir -p $codePath/tmp/web/static
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/node_modules/tslib $echoSuffix"
+  mkdir -p $codePath/tmp/web/node_modules/tslib
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/m_node_modules/yvan-ext-mobile $echoSuffix"
+  mkdir -p $codePath/tmp/web/m_node_modules/yvan-ext-mobile
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/mobile-assets $echoSuffix"
+  mkdir -p $codePath/tmp/web/mobile-assets
+
+  echo -e "$echoPrefix cp -r $codePath/dist_pda/ $codePath/tmp/web/dist_pda $echoSuffix"
+  cp -r $codePath/dist_pda/ $codePath/tmp/web/dist_pda
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/require.js $codePath/tmp/web/static/require.js $echoSuffix"
+  cp -r $codePath/public/static/require.js $codePath/tmp/web/static/require.js
+
+  echo -e "$echoPrefix cp -r $codePath/public/m_require_config.js $codePath/tmp/web/m_require_config.js $echoSuffix"
+  cp -r $codePath/public/m_require_config.js $codePath/tmp/web/m_require_config.js
+
+  echo -e "$echoPrefix cp -r $codePath/public/m_common.css $codePath/tmp/web/m_common.css $echoSuffix"
+  cp -r $codePath/public/m_common.css $codePath/tmp/web/m_common.css
+
+  echo -e "$echoPrefix cp -r $codePath/public/m.html $codePath/tmp/web/index.html $echoSuffix"
+  cp -r $codePath/public/m.html $codePath/tmp/web/index.html
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/require-css $codePath/tmp/web/static/require-css $echoSuffix"
+  cp -r $codePath/public/static/require-css $codePath/tmp/web/static/require-css
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/polyfill $codePath/tmp/web/static/polyfill $echoSuffix"
+  cp -r $codePath/public/static/polyfill $codePath/tmp/web/static/polyfill
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/jquery $codePath/tmp/web/static/jquery $echoSuffix"
+  cp -r $codePath/public/static/jquery $codePath/tmp/web/static/jquery
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/font-awesome $codePath/tmp/web/static/font-awesome $echoSuffix"
+  cp -r $codePath/public/static/font-awesome $codePath/tmp/web/static/font-awesome
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/iconfont $codePath/tmp/web/static/iconfont $echoSuffix"
+  cp -r $codePath/public/static/iconfont $codePath/tmp/web/static/iconfont
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/bootstrap $codePath/tmp/web/static/bootstrap $echoSuffix"
+  cp -r $codePath/public/static/bootstrap $codePath/tmp/web/static/bootstrap
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/tslib/tslib.js $codePath/tmp/web/node_modules/tslib/tslib.js $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/tslib/tslib.js $codePath/tmp/web/node_modules/tslib/tslib.js
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/dist $codePath/tmp/web/m_node_modules/yvan-ext-mobile/dist $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/dist $codePath/tmp/web/m_node_modules/yvan-ext-mobile/dist
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/packages $codePath/tmp/web/mobile-assets/packages $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/packages $codePath/tmp/web/mobile-assets/packages
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/modern $codePath/tmp/web/mobile-assets/modern $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/modern $codePath/tmp/web/mobile-assets/modern
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/ext-modern-all-debug.js $codePath/tmp/web/mobile-assets/ext-modern-all-debug.js $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/ext-modern-all-debug.js $codePath/tmp/web/mobile-assets/ext-modern-all-debug.js
+
+  echo -e "$echoPrefix cd $codePath/tmp $echoSuffix"
+  cd $codePath/tmp
+  echo -e "$echoPrefix zip -r web.zip web $echoSuffix"
+  zip -r web.zip web
+
+  echo "###--打包完成-----------------------------------------------------------------------------###"
+  echo ""
+
+  # 上传文件
+  echo -e "$echoPrefix curl -X POST -F 'file=@$codePath/tmp/web.zip' $serverUrl/file/upload $echoSuffix"
+  res_json=$(curl -X POST -F 'file=@'$codePath'/tmp/web.zip' $serverUrl/file/upload)
+  filePath=$(echo $res_json | awk -F '"' '{print $10}')
+
+  req_json='{"args":[{"app_code":"PDA_WEB","app_name":"PDA_WEB","major":'$major',"minor":'$minor',"patch":'$patch',"file_path":"'$filePath'","app_version":"'$$version'"}]}'
+  res_json=$(curl -H "Content-type: application/json" -X POST -d "$req_json" $serverUrl/api/com/galaxis/wms/sys/app_version/AppVersion@newAppVersion)
+
+  echo -e "$echoPrefix $res_json $echoSuffix"
+  echo ""
+
+  # 还原文件
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix 版本号信息: version=$version, major=$major, minor=$minor, patch=$patch $echoSuffix"
+  echo ""
+}
+
+cmd=$1
+if [ "$cmd" == "deploy" ];then
+  deploy
+else
+  echo "使用 deploy 命名打包pda"
+fi
+
+# 哈尔滨
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/07shuyu_haerbing/03pda-prod.sh) [cmd]

+ 81 - 0
07shuyu_qingdao/01xxljob-prod.sh

@@ -0,0 +1,81 @@
+#!/bin/bash
+#set -x
+set -e
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+logPath=/data/logs/xxl-job/xxl-job.log
+dirPath=/home/www/deploy/xxl-job/
+serverName=xxl_job
+
+cmd=$1
+profiles=${2:-"shuyu_qingdao_prod"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx1g -Xms1g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar bin/xxl-job-admin-mysql-2.3.0.jar --spring.config.location=conf/ --spring.profiles.active=global,$profiles --server.port=8000 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar bin/xxl-job-admin-mysql-2.3.0.jar --spring.config.location=conf/ --spring.profiles.active=global,$profiles --server.port=8000 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: deploy restart start stop kill log logs
+if [ "$cmd" == "deploy" ];then
+  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/03xxljob.sh) pull
+  restartServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/07shuyu_qingdao/01xxljob-prod.sh) [cmd profiles]

+ 232 - 0
07shuyu_qingdao/02wms8-prod.bak.sh

@@ -0,0 +1,232 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/wms8/wms8-bench.git"
+  "http://git.galaxis.yvanui.com/wms8/wms-core.git"
+  "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "shuyu_qingdao"
+  "shuyu_qingdao"
+  "master"
+)
+positionArr=(
+  "."
+  "wms-core"
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-biz/bundle
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/bundle $echoSuffix"
+    cd "$codePath/wms-biz/bundle"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/bundle 文件未变化"
+  fi
+
+  # 构建 wms-biz/pda-client
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/pda-client $echoSuffix"
+    cd "$codePath/wms-biz/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8/wms8.log
+dirPath=/home/www/deploy/wms8/wms-biz/servo/build/libs/
+serverName=wms8_syqd
+
+cmd=$1
+profiles=${2:-"prod"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx4g -Xms4g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8096 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8096 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) pull
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/07shuyu_qingdao/02wms8-prod.sh) [cmd profiles]

+ 224 - 0
07shuyu_qingdao/02wms8-prod.sh

@@ -0,0 +1,224 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_qingdao
+gitUrlArr=(
+  "https://wms-gitlab.sypm.cn:7878/kaileshi/wms8-bench-qingdao.git"
+)
+
+branchArr=(
+  "main"
+)
+positionArr=(
+  "."
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-biz/bundle
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/bundle $echoSuffix"
+    cd "$codePath/wms-biz/bundle"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/bundle 文件未变化"
+  fi
+
+  # 构建 wms-biz/pda-client
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/pda-client $echoSuffix"
+    cd "$codePath/wms-biz/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_qingdao/wms8_qingdao.log
+dirPath=/home/www/deploy/wms8_qingdao/wms-biz/servo/build/libs/
+serverName=2wms8_qingdao
+
+cmd=$1
+profiles=${2:-"prod"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx4g -Xms4g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8096 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8096 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) pull
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/07shuyu_qingdao/02wms8-prod.sh) [cmd profiles]

+ 142 - 0
07shuyu_qingdao/03pda-prod.sh

@@ -0,0 +1,142 @@
+#!/bin/bash
+#set -x
+set -e
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+codePath=/home/www/deploy/wms8_qingdao
+serverUrl=http://127.0.0.1:8096
+
+deploy() {
+  # 更新代码
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  git pull
+
+  # 读取版本号
+  major='1'
+  minor=$(date +%Y%m%d)
+  patch=$(date +1%H%M%S | sed -e 's/^[[:space:]]*//')
+  version="$major.$minor.$patch"
+  echo -e "$echoPrefix sed -i 's/__WebAppVersion__/$version/g' $codePath/wms-biz/pda-client/src/app.js $echoSuffix"
+  sed -i "s/__WebAppVersion__/$version/g" $codePath/wms-biz/pda-client/src/app.js
+  echo -e "$echoPrefix 版本号信息: version=$version, major=$major, minor=$minor, patch=$patch $echoSuffix"
+
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+
+  # 编译
+  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+
+  echo -e "$echoPrefix cd $codePath/wms-biz/pda-client/ $echoSuffix"
+  cd $codePath/wms-biz/pda-client/
+  echo -e "$echoPrefix yarn build $echoSuffix"
+  yarn build
+
+  echo "###--编译完成-----------------------------------------------------------------------------###"
+  echo ""
+
+  # 创建打包文件夹
+  echo -e "$echoPrefix rm -rf $codePath/tmp $echoSuffix"
+  rm -rf $codePath/tmp
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/static $echoSuffix"
+  mkdir -p $codePath/tmp/web/static
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/node_modules/tslib $echoSuffix"
+  mkdir -p $codePath/tmp/web/node_modules/tslib
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/m_node_modules/yvan-ext-mobile $echoSuffix"
+  mkdir -p $codePath/tmp/web/m_node_modules/yvan-ext-mobile
+
+  echo -e "$echoPrefix mkdir -p $codePath/tmp/web/mobile-assets $echoSuffix"
+  mkdir -p $codePath/tmp/web/mobile-assets
+
+  echo -e "$echoPrefix cp -r $codePath/dist_pda/ $codePath/tmp/web/dist_pda $echoSuffix"
+  cp -r $codePath/dist_pda/ $codePath/tmp/web/dist_pda
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/require.js $codePath/tmp/web/static/require.js $echoSuffix"
+  cp -r $codePath/public/static/require.js $codePath/tmp/web/static/require.js
+
+  echo -e "$echoPrefix cp -r $codePath/public/m_require_config.js $codePath/tmp/web/m_require_config.js $echoSuffix"
+  cp -r $codePath/public/m_require_config.js $codePath/tmp/web/m_require_config.js
+
+  echo -e "$echoPrefix cp -r $codePath/public/m_common.css $codePath/tmp/web/m_common.css $echoSuffix"
+  cp -r $codePath/public/m_common.css $codePath/tmp/web/m_common.css
+
+  echo -e "$echoPrefix cp -r $codePath/public/m.html $codePath/tmp/web/index.html $echoSuffix"
+  cp -r $codePath/public/m.html $codePath/tmp/web/index.html
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/require-css $codePath/tmp/web/static/require-css $echoSuffix"
+  cp -r $codePath/public/static/require-css $codePath/tmp/web/static/require-css
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/polyfill $codePath/tmp/web/static/polyfill $echoSuffix"
+  cp -r $codePath/public/static/polyfill $codePath/tmp/web/static/polyfill
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/jquery $codePath/tmp/web/static/jquery $echoSuffix"
+  cp -r $codePath/public/static/jquery $codePath/tmp/web/static/jquery
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/font-awesome $codePath/tmp/web/static/font-awesome $echoSuffix"
+  cp -r $codePath/public/static/font-awesome $codePath/tmp/web/static/font-awesome
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/iconfont $codePath/tmp/web/static/iconfont $echoSuffix"
+  cp -r $codePath/public/static/iconfont $codePath/tmp/web/static/iconfont
+
+  echo -e "$echoPrefix cp -r $codePath/public/static/bootstrap $codePath/tmp/web/static/bootstrap $echoSuffix"
+  cp -r $codePath/public/static/bootstrap $codePath/tmp/web/static/bootstrap
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/tslib/tslib.js $codePath/tmp/web/node_modules/tslib/tslib.js $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/tslib/tslib.js $codePath/tmp/web/node_modules/tslib/tslib.js
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/dist $codePath/tmp/web/m_node_modules/yvan-ext-mobile/dist $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/dist $codePath/tmp/web/m_node_modules/yvan-ext-mobile/dist
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/packages $codePath/tmp/web/mobile-assets/packages $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/packages $codePath/tmp/web/mobile-assets/packages
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/modern $codePath/tmp/web/mobile-assets/modern $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/modern $codePath/tmp/web/mobile-assets/modern
+
+  echo -e "$echoPrefix cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/ext-modern-all-debug.js $codePath/tmp/web/mobile-assets/ext-modern-all-debug.js $echoSuffix"
+  cp -r $codePath/wms-biz/pda-client/node_modules/yvan-ext-mobile/assets/ext-7.4/ext-modern-all-debug.js $codePath/tmp/web/mobile-assets/ext-modern-all-debug.js
+
+  echo -e "$echoPrefix cd $codePath/tmp $echoSuffix"
+  cd $codePath/tmp
+  echo -e "$echoPrefix zip -r web.zip web $echoSuffix"
+  zip -r web.zip web
+
+  echo "###--打包完成-----------------------------------------------------------------------------###"
+  echo ""
+
+  # 上传文件
+  echo -e "$echoPrefix curl -X POST -F 'file=@$codePath/tmp/web.zip' $serverUrl/file/upload $echoSuffix"
+  res_json=$(curl -X POST -F 'file=@'$codePath'/tmp/web.zip' $serverUrl/file/upload)
+  filePath=$(echo $res_json | awk -F '"' '{print $10}')
+
+  req_json='{"args":[{"app_code":"PDA_WEB","app_name":"PDA_WEB","major":'$major',"minor":'$minor',"patch":'$patch',"file_path":"'$filePath'","app_version":"'$$version'"}]}'
+  res_json=$(curl -H "Content-type: application/json" -X POST -d "$req_json" $serverUrl/api/com/galaxis/wms/sys/app_version/AppVersion@newAppVersion)
+
+  echo -e "$echoPrefix $res_json $echoSuffix"
+  echo ""
+
+  # 还原文件
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix 版本号信息: version=$version, major=$major, minor=$minor, patch=$patch $echoSuffix"
+  echo ""
+}
+
+cmd=$1
+if [ "$cmd" == "deploy" ];then
+  deploy
+else
+  echo "使用 deploy 命名打包pda"
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/07shuyu_qingdao/03pda-prod.sh) [cmd]

+ 224 - 0
07shuyu_qingdao/04wms8-online-dev.sh

@@ -0,0 +1,224 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8
+gitUrlArr=(
+  "http://36.134.42.215:3000/wms-dev/wms8-bench.git"
+)
+
+branchArr=(
+  "shuyu_qingdao"
+)
+positionArr=(
+  "."
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-biz/bundle
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/bundle $echoSuffix"
+    cd "$codePath/wms-biz/bundle"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/bundle 文件未变化"
+  fi
+
+  # 构建 wms-biz/pda-client
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/pda-client $echoSuffix"
+    cd "$codePath/wms-biz/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_online_dev/wms8_online_dev.log
+dirPath=/home/www/deploy/wms8/wms-biz/servo/build/libs/
+serverName=wms8_online_dev
+
+cmd=$1
+profiles=${2:-"online-dev"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8096 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8096 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) pull
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/07shuyu_qingdao/04wms8-online-dev.sh) [cmd profiles]

+ 230 - 0
08luolai/01wms-hwy-test.sh

@@ -0,0 +1,230 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_luolai
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/wms8/wms83.git"
+  "www@git.yvanui.com:lizhiwei/yvan-framework.git"
+  ## "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "luolai"
+  "8.3"
+)
+positionArr=(
+  "."
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-biz/bundle
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/bundle $echoSuffix"
+    cd "$codePath/wms-biz/bundle"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/bundle 文件未变化"
+  fi
+
+  # 构建 wms-biz/pda-client
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/pda-client $echoSuffix"
+    cd "$codePath/wms-biz/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_luolai/wms8_luolai.log
+dirPath=/home/www/deploy/wms8_luolai/wms-biz/servo/build/libs/
+serverName=wms8_luolai
+
+cmd=$1
+profiles=${2:-"hwy-test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=9005 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=9005 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) pull
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# 罗莱-华为云
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/08luolai/01wms-hwy-test.sh) [cmd profiles]

+ 175 - 0
08luolai/02api-hwy-test.sh

@@ -0,0 +1,175 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_api_luolai
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/wms8/wms83.git"
+  "www@git.yvanui.com:lizhiwei/yvan-framework.git"
+  ## "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "luolai"
+  "8.3"
+)
+positionArr=(
+  "."
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_api_luolai/wms8_api_luolai.log
+dirPath=/home/www/deploy/wms8_api_luolai/wms-biz/wms8-api/build/libs/
+serverName=wms8_api_luolai
+
+cmd=$1
+profiles=${2:-"hwy-test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx1g -Xms1g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai -Duser.name=user"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms8-api-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=9009 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms8-api-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=9009 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: deploy restart start stop kill log logs
+if [ "$cmd" == "deploy" ];then
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# 罗莱-华为云 api
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/08luolai/02api-hwy-test.sh) [cmd profiles]

+ 172 - 0
08luolai/03api-hwy-gateway.sh

@@ -0,0 +1,172 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/api_luolai_gateway
+gitUrlArr=(
+  "www@git.yvanui.com:lizhiwei/api-gateway.git"
+  #"http://git.yvanui.com/lizhiwei/api-gateway.git"
+)
+
+branchArr=(
+  "master"
+)
+positionArr=(
+  "."
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix chmod +x gradlew $echoSuffix"
+  chmod +x gradlew
+  echo -e "$echoPrefix ./gradlew build -x test $echoSuffix"
+  ./gradlew build -x test
+  echo ""
+}
+
+logPath=/data/logs/api_luolai_gateway/api_luolai_gateway.log
+dirPath=/home/www/deploy/api_luolai_gateway/api-gateway-server/build/libs/
+serverName=api_luolai_gateway
+
+cmd=$1
+profiles=${2:-"hwy-test-luolai"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx1g -Xms1g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./api-gateway-server-0.0.1-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=9010 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./api-gateway-server-0.0.1-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=9010 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: deploy restart start stop kill log logs
+if [ "$cmd" == "deploy" ];then
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/08luolai/03api-hwy-gateway.sh) [cmd profiles]

+ 81 - 0
08luolai/04xxljob-prod.sh

@@ -0,0 +1,81 @@
+#!/bin/bash
+#set -x
+set -e
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+logPath=/home/www/data/logs/xxl-job/xxl-job.log
+dirPath=/home/www/deploy/xxl-job/
+serverName=xxl_job_prod
+
+cmd=$1
+profiles=${2:-"luolai-prod"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx1g -Xms1g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar bin/xxl-job-admin-postgres-2.3.0.jar --spring.config.location=conf/ --spring.profiles.active=global,$profiles --server.port=8000 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar bin/xxl-job-admin-postgres-2.3.0.jar --spring.config.location=conf/ --spring.profiles.active=global,$profiles --server.port=8000 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: deploy restart start stop kill log logs
+if [ "$cmd" == "deploy" ];then
+  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/03xxljob.sh) pull
+  restartServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/08luolai/04xxljob-prod.sh) [cmd profiles]

+ 234 - 0
08luolai/05wms83-prod.sh

@@ -0,0 +1,234 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/wms8/wms83.git"
+  "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "luolai"
+  "8.3"
+)
+positionArr=(
+  "."
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"luolai"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-biz/bundle
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/bundle $echoSuffix"
+    cd "$codePath/wms-biz/bundle"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/bundle 文件未变化"
+  fi
+
+  # 构建 wms-biz/pda-client
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/pda-client $echoSuffix"
+    cd "$codePath/wms-biz/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/home/www/data/logs/wms8/wms8.log
+dirPath=/home/www/deploy/wms8/wms-biz/servo/build/libs/
+serverName=wms8
+
+cmd=$1
+profiles=${2:-"prod"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8101 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8101 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) pull
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull build deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull build deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "build" ];then
+  deployYvanUI
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull build deploy restart start stop kill log logs"
+    echo "查看日志: tail -F $logPath -n 100"
+  else
+    echo "输入操作参数: pull build deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/08luolai/05wms83-prod.sh) [cmd profiles]

+ 189 - 0
08luolai/06api-prod.sh

@@ -0,0 +1,189 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_api
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/wms8/wms83.git"
+  "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "luolai"
+  "8.3"
+)
+positionArr=(
+  "."
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"luolai"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/home/www/data/logs/wms8_api/wms8_api.log
+dirPath=/home/www/deploy/wms8_api/wms-biz/wms8-api/build/libs/
+serverName=wms8_api
+
+cmd=$1
+profiles=${2:-"prod"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai -Duser.name=user"
+#-------------------------------------------------------------------
+
+moveBuildFile() {
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+}
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms8-api-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8094 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms8-api-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8094 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  moveBuildFile
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  moveBuildFile
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: build deploy restart start stop kill log logs
+if [ "$cmd" == "build" ];then
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+elif [ "$cmd" == "deploy" ];then
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: build deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: build deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/08luolai/06api-prod.sh) [cmd profiles]

+ 171 - 0
08luolai/07api-gateway-prod.sh

@@ -0,0 +1,171 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/api_gateway
+gitUrlArr=(
+  "http://git.yvanui.com/arch/api-gateway.git"
+)
+
+branchArr=(
+  "master"
+)
+positionArr=(
+  "."
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix chmod +x gradlew $echoSuffix"
+  chmod +x gradlew
+  echo -e "$echoPrefix ./gradlew build -x test $echoSuffix"
+  ./gradlew build -x test
+  echo ""
+}
+
+logPath=/home/www/data/logs/api_gateway/api_gateway.log
+dirPath=/home/www/deploy/api_gateway/api-gateway-server/build/libs/
+serverName=api_gateway
+
+cmd=$1
+profiles=${2:-"luolai-prod"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx1g -Xms1g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./api-gateway-server-0.0.1-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=9010 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./api-gateway-server-0.0.1-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=9010 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: deploy restart start stop kill log logs
+if [ "$cmd" == "deploy" ];then
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/08luolai/07api-gateway-prod.sh) [cmd profiles]

+ 234 - 0
08luolai/08wms83-test.sh

@@ -0,0 +1,234 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_test
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/wms8/wms83.git"
+  "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "luolai"
+  "8.3"
+)
+positionArr=(
+  "."
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"luolai"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-biz/bundle
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/bundle $echoSuffix"
+    cd "$codePath/wms-biz/bundle"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/bundle 文件未变化"
+  fi
+
+  # 构建 wms-biz/pda-client
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/pda-client $echoSuffix"
+    cd "$codePath/wms-biz/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/home/www/data/logs/wms8_test/wms8_test.log
+dirPath=/home/www/deploy/wms8_test/wms-biz/servo/build/libs/
+serverName=wms8_test
+
+cmd=$1
+profiles=${2:-"luolai-test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8102 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8102 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) pull
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull build deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull build deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "build" ];then
+  deployYvanUI
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull build deploy restart start stop kill log logs"
+    echo "查看日志: tail -F $logPath -n 100"
+  else
+    echo "输入操作参数: pull build deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/08luolai/08wms83-test.sh) [cmd profiles]

+ 189 - 0
08luolai/09api-test.sh

@@ -0,0 +1,189 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_api_test
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/wms8/wms83.git"
+  "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "luolai"
+  "8.3"
+)
+positionArr=(
+  "."
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"luolai"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/home/www/data/logs/wms8_api_test/wms8_api_test.log
+dirPath=/home/www/deploy/wms8_api_test/wms-biz/wms8-api/build/libs/
+serverName=wms8_api_test
+
+cmd=$1
+profiles=${2:-"luolai-test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai -Duser.name=user"
+#-------------------------------------------------------------------
+
+moveBuildFile() {
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+}
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms8-api-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8095 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms8-api-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8095 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  moveBuildFile
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  moveBuildFile
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: build deploy restart start stop kill log logs
+if [ "$cmd" == "build" ];then
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+elif [ "$cmd" == "deploy" ];then
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: build deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: build deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/08luolai/09api-test.sh) [cmd profiles]

+ 171 - 0
08luolai/10api-gateway-test.sh

@@ -0,0 +1,171 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/api_gateway_test
+gitUrlArr=(
+  "http://git.yvanui.com/arch/api-gateway.git"
+)
+
+branchArr=(
+  "master"
+)
+positionArr=(
+  "."
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix chmod +x gradlew $echoSuffix"
+  chmod +x gradlew
+  echo -e "$echoPrefix ./gradlew build -x test $echoSuffix"
+  ./gradlew build -x test
+  echo ""
+}
+
+logPath=/home/www/data/logs/api_gateway_test/api_gateway_test.log
+dirPath=/home/www/deploy/api_gateway_test/api-gateway-server/build/libs/
+serverName=api_gateway_test
+
+cmd=$1
+profiles=${2:-"luolai-test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx1g -Xms1g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./api-gateway-server-0.0.1-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=9011 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./api-gateway-server-0.0.1-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=9011 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: deploy restart start stop kill log logs
+if [ "$cmd" == "deploy" ];then
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/08luolai/10api-gateway-test.sh) [cmd profiles]

+ 288 - 0
90yvan/01deploy.sh

@@ -0,0 +1,288 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/yvan-vue-demo
+gitUrlArr=(
+  "http://git.yvanui.com/luoyifan/yvan-vue-demo.git"
+)
+
+branchArr=(
+  "master"
+)
+positionArr=(
+  "."
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 ui-pc
+  if [ "${needBuild[1]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/ui-pc $echoSuffix"
+    cd "$codePath/ui-pc"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-vue $echoSuffix"
+    yarn link yvan-vue
+    echo ""
+  else
+    echo "ui-pc 文件未变化"
+  fi
+
+  # 构建 ui-mobile
+  if [ "${needBuild[2]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/ui-mobile $echoSuffix"
+    cd "$codePath/ui-mobile"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-vue-mobile $echoSuffix"
+    yarn link yvan-vue-mobile
+    echo ""
+  else
+    echo "ui-mobile 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/yvan-vue-demo/server.log
+dirPath=/home/www/deploy/yvan-vue-demo/servo/build/libs/
+serverName=yvan-vue-demo
+
+cmd=$1
+profiles=${2:-"dev-postgresql"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx4g -Xms4g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+moveBuildFile() {
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+}
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8085 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8085 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  # version=$(date +_%Y_%m_%d_%H_%M_%S)
+  # echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  # sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  # 移动编译后的文件
+  moveBuildFile
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  moveBuildFile
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/11yvan-vue.sh) deploy
+  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/12yvan-vue-mobile.sh) deploy
+}
+
+startPcUi() {
+  pid=`ps -ef | grep "${codePath}/ui-pc/node_modules/.bin/vite" | grep -v 'grep' | awk '{print $2}'`
+  if [ -z $pid ];then
+    echo "ui-pc 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "${codePath}/ui-pc/node_modules/.bin/vite" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "${codePath}/ui-pc/node_modules/.bin/vite" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "ui-pc 已停止!"
+    sleep 3s
+  fi
+  echo -e "$echoPrefix cd $codePath/ui-pc $echoSuffix"
+  cd "$codePath/ui-pc"
+  echo -e "$echoPrefix nohup yarn run dev >>/dev/null 2>&1 & $echoSuffix"
+  nohup yarn run dev >>/dev/null 2>&1 &
+}
+
+#startMobileUi() {
+#  pid=`ps -ef | grep "${codePath}/ui-mobile/node_modules/.bin/vite" | grep -v 'grep' | awk '{print $2}'`
+#  if [ -z $pid ];then
+#    echo "ui-mobile 未运行"
+#  else
+#    echo -e "$echoPrefix ps -ef | grep "${codePath}/ui-mobile/node_modules/.bin/vite" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+#    ps -ef | grep "${codePath}/ui-mobile/node_modules/.bin/vite" | grep -v 'grep' | awk '{print $2}' | xargs kill
+#    echo "ui-mobile 已停止!"
+#    sleep 3s
+#  fi
+#  echo -e "$echoPrefix cd $codePath/ui-mobile $echoSuffix"
+#  cd "$codePath/ui-mobile"
+#  echo -e "$echoPrefix nohup yarn run dev >>/dev/null 2>&1 & $echoSuffix"
+#  nohup yarn run dev >>/dev/null 2>&1 &
+#}
+
+startMobileUi() {
+  pid=`ps -ef | grep 'node server.js -P 8091' | grep -v 'grep' | awk '{print $2}'`
+  if [ -z $pid ];then
+    echo "ui-mobile 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep 'node server.js -P 8091' | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep 'node server.js -P 8091' | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "ui-mobile 已停止!"
+    sleep 3s
+  fi
+  echo -e "$echoPrefix cd $codePath/ui-mobile $echoSuffix"
+  cd "$codePath/ui-mobile"
+  echo -e "$echoPrefix yarn build $echoSuffix"
+  yarn build
+  echo -e "$echoPrefix nohup node server.js -P 8091 >>/dev/null 2>&1 & $echoSuffix"
+  nohup node server.js -P 8091 >>/dev/null 2>&1 &
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull build deploy restart start stop kill log logs startPc startMobile
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull build deploy restart start stop kill log logs startPc startMobile"
+  fi
+elif [ "$cmd" == "build" ];then
+  deployYvanUI
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+  startPcUi
+  startMobileUi
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+elif [ "$cmd" == "startPc" ];then
+  startPcUi
+elif [ "$cmd" == "startMobile" ];then
+  startMobileUi
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull build deploy restart start stop kill log logs startPc startMobile"
+    echo "查看日志: tail -F $logPath -n 100"
+  else
+    echo "输入操作参数: pull build deploy restart start stop kill log logs startPc startMobile"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# 测试
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/90yvan/01deploy.sh) [cmd profiles]

+ 265 - 0
build.sh

@@ -0,0 +1,265 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=~/ws/yxt_lmis
+pushPath=~/build/yxt_lmis
+pushGitUrl=ssh://www@122.9.140.63:3022/bot_yxt/yxt_lmis.git
+pushPath_2=~/build/yxt_lmis_report
+pushGitUrl_2=ssh://www@122.9.140.63:3022/bot_yxt/yxt_lmis_report.git
+gitUrlArr=(
+  "www@git.yvanui.com:yvan-private/yvan-framework.git"
+  "www@git.yvanui.com:jztd/wms-core.git"
+  "www@git.yvanui.com:jztd/yvan-ext.git"
+  "www@git.yvanui.com:jztd/wms8.git"
+  "www@git.yvanui.com:jztd/yvan-studio.git"
+  "www@git.yvanui.com:jztd/lmis-report-system.git"
+)
+branchArr=(
+  "master"
+  "branch-2022-3-30"
+  "master"
+  "master"
+  "master"
+  "master"
+)
+positionArr=(
+  "."
+  "lmis"
+  "yvan-ext"
+  "wms8"
+  "yvan-studio"
+  "lmis-report-system"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+buildCode() {
+  # 构建 yvan-ext
+  if [ "${needBuild[3]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-ext $echoSuffix"
+    cd "$codePath/yvan-ext"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-ext 文件未变化"
+  fi
+
+  # 构建 lmis/client
+  if [ "${needBuild[2]}" != "0" ]; then
+    echo -e "$echoPrefix cd lmis/client $echoSuffix"
+    cd "$codePath/lmis/client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "lmis 文件未变化"
+  fi
+
+  # 构建 lmis-report-system/client
+  if [ "${needBuild[6]}" != "0" ]; then
+    echo -e "$echoPrefix cd lmis-report-system/client $echoSuffix"
+    cd "$codePath/lmis-report-system/client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "lmis-report-system 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+deployPush() {
+  # 更新push git
+  pullCode $pushPath $pushGitUrl "master" "."
+
+  # 同步 lmis/ent/build/libs
+  echo -e "$echoPrefix rsync -av --delete --exclude '.git/' --exclude 'client/' --exclude 'dist/' --exclude '*-javadoc.jar' --exclude '*-sources.jar' $codePath/lmis/ent/build/libs/ $pushPath/ $echoSuffix"
+  rsync -av --delete --exclude '.git/' --exclude 'client/' --exclude 'dist/' --exclude '*-javadoc.jar' --exclude '*-sources.jar' "$codePath/lmis/ent/build/libs/" "$pushPath/"
+  echo ""
+
+  # 同步 lmis/client/tsconfig.json
+  echo -e "$echoPrefix rsync -av --delete --include 'tsconfig.json' --exclude '/*' $codePath/lmis/client/ $pushPath/client/ $echoSuffix"
+  rsync -av --delete --include 'tsconfig.json' --exclude '/*' "$codePath/lmis/client/" "$pushPath/client/"
+  echo ""
+
+  # 同步 lmis/client/node_modules
+  echo -e "$echoPrefix rsync -av --delete --exclude 'yvan-ext/' $codePath/lmis/client/node_modules/ $pushPath/client/node_modules/ $echoSuffix"
+  rsync -av --delete --exclude 'yvan-ext' "$codePath/lmis/client/node_modules/" "$pushPath/client/node_modules/"
+  echo ""
+
+  # 同步 lmis/client/public
+  echo -e "$echoPrefix rsync -av --delete $codePath/lmis/client/public/ $pushPath/client/public/ $echoSuffix"
+  rsync -av --delete "$codePath/lmis/client/public/" "$pushPath/client/public/"
+  echo ""
+
+  # 同步 yvan-ext
+  echo -e "$echoPrefix rsync -av --delete --include 'assets/' --include 'build/' --include 'dist/' --exclude '/*' $codePath/yvan-ext/ $pushPath/client/node_modules/yvan-ext/ $echoSuffix"
+  rsync -av --delete --include 'assets/' --include 'build/' --include 'dist/' --exclude '/*' "$codePath/yvan-ext/" "$pushPath/client/node_modules/yvan-ext/"
+  echo ""
+
+  # 同步 lmis/dist
+  echo -e "$echoPrefix rsync -av --delete $codePath/lmis/dist/ $pushPath/dist/ $echoSuffix"
+  rsync -av --delete "$codePath/lmis/dist/" "$pushPath/dist/"
+  echo ""
+
+  # 提交文件
+  echo -e "$echoPrefix cd $pushPath $echoSuffix"
+  cd "$pushPath"
+  if [ -n "$(git config user.name)" ]; then
+      echo -e "$echoPrefix git config user.name 'bot' $echoSuffix"
+      git config user.name 'bot'
+      echo -e "$echoPrefix git config user.email 'bot@git.com' $echoSuffix"
+      git config user.email 'bot@git.com'
+  fi
+  echo -e "$echoPrefix git add -A $echoSuffix"
+  git add -A
+  if [ -n "$(git status -s)" ]; then
+    echo -e "$echoPrefix git commit -am 自动deploy提交 $echoSuffix"
+    git commit -am "自动deploy提交"
+    echo -e "$echoPrefix git push origin master $echoSuffix"
+    git push origin master
+  else
+    echo "文件未变化不需要push"
+  fi
+  echo ""
+
+  #---------------------------------------------------------------------------------------------------------------------
+
+  # 更新push git
+  pullCode $pushPath_2 $pushGitUrl_2 "master" "."
+
+  # 同步 lmis-report-system/app/build/libs
+  echo -e "$echoPrefix rsync -av --delete --exclude '.git/' --exclude 'client/' --exclude 'dist/' --exclude '*-javadoc.jar' --exclude '*-sources.jar' $codePath/lmis-report-system/app/build/libs/ $pushPath_2/ $echoSuffix"
+  rsync -av --delete --exclude '.git/' --exclude 'client/' --exclude 'dist/' --exclude '*-javadoc.jar' --exclude '*-sources.jar' "$codePath/lmis-report-system/app/build/libs/" "$pushPath_2/"
+  echo ""
+
+  # 同步 lmis-report-system/client/tsconfig.json
+  echo -e "$echoPrefix rsync -av --delete --include 'tsconfig.json' --exclude '/*' $codePath/lmis-report-system/client/ $pushPath_2/client/ $echoSuffix"
+  rsync -av --delete --include 'tsconfig.json' --exclude '/*' "$codePath/lmis-report-system/client/" "$pushPath_2/client/"
+  echo ""
+
+  # 同步 lmis-report-system/client/node_modules
+  echo -e "$echoPrefix rsync -av --delete --exclude 'yvan-ext/' $codePath/lmis-report-system/client/node_modules/ $pushPath_2/client/node_modules/ $echoSuffix"
+  rsync -av --delete --exclude 'yvan-ext' "$codePath/lmis-report-system/client/node_modules/" "$pushPath_2/client/node_modules/"
+  echo ""
+
+  # 同步 lmis-report-system/client/public
+  echo -e "$echoPrefix rsync -av --delete $codePath/lmis-report-system/client/public/ $pushPath_2/client/public/ $echoSuffix"
+  rsync -av --delete "$codePath/lmis-report-system/client/public/" "$pushPath_2/client/public/"
+  echo ""
+
+  # 同步 yvan-ext
+  echo -e "$echoPrefix rsync -av --delete --include 'assets/' --include 'build/' --include 'dist/' --exclude '/*' $codePath/yvan-ext/ $pushPath_2/client/node_modules/yvan-ext/ $echoSuffix"
+  rsync -av --delete --include 'assets/' --include 'build/' --include 'dist/' --exclude '/*' "$codePath/yvan-ext/" "$pushPath_2/client/node_modules/yvan-ext/"
+  echo ""
+
+  # 同步 lmis-report-system/dist
+  echo -e "$echoPrefix rsync -av --delete $codePath/lmis-report-system/dist/ $pushPath_2/dist/ $echoSuffix"
+  rsync -av --delete "$codePath/lmis-report-system/dist/" "$pushPath_2/dist/"
+  echo ""
+
+  # 提交文件
+  echo -e "$echoPrefix cd $pushPath_2 $echoSuffix"
+  cd "$pushPath_2"
+  if [ -n "$(git config user.name)" ]; then
+      echo -e "$echoPrefix git config user.name 'bot' $echoSuffix"
+      git config user.name 'bot'
+      echo -e "$echoPrefix git config user.email 'bot@git.com' $echoSuffix"
+      git config user.email 'bot@git.com'
+  fi
+  echo -e "$echoPrefix git add -A $echoSuffix"
+  git add -A
+  if [ -n "$(git status -s)" ]; then
+    echo -e "$echoPrefix git commit -am 自动deploy提交 $echoSuffix"
+    git commit -am "自动deploy提交"
+    echo -e "$echoPrefix git push origin master $echoSuffix"
+    git push origin master
+  else
+    echo "文件未变化不需要push"
+  fi
+  echo ""
+}
+
+isChange="1"                # 仓库是否发生变化,0未:变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix mkdir -p $path $echoSuffix"
+    mkdir -p $path
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == 1 ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+  pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+  if [ "${needBuild[idx]}" == "-1" ]; then
+    needBuild[idx]=$isChange
+  fi
+done
+echo "###--代码更新完成--------------------------------------------------------------------------###"
+echo ""
+
+buildCode
+echo "###--代码构建完成--------------------------------------------------------------------------###"
+echo ""
+
+deployPush
+echo "###--文件推送完成--------------------------------------------------------------------------###"
+echo ""

+ 127 - 0
deploy.sh

@@ -0,0 +1,127 @@
+#!/bin/bash
+#time=`date +%Y-%m-%d.%H-%M`
+#set -x
+set -e
+
+gitUrl=ssh://www@122.9.140.63:3022/bot_yxt/yxt_lmis.git
+dirPath=~/deploy/yxt_lmis
+serverName=yxt_lmis
+logPath=~/logs/yxt_lmis_nohup.log
+
+cmd=$1
+profiles=${2:-"hwy"}
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx4g -Xms4g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+isChange="1"                # 仓库是否发生变化,0未:变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == 1 ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./ent-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8082 >$logPath 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./ent-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8082 >$logPath 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  pid=$1
+  if [ -z $pid ];then
+    pullCode $dirPath $gitUrl "master" "."
+  else
+    echo "$serverName 正在运行,必须先stop,再pull"
+  fi
+}
+
+deployServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  deployPull
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployPull $pid
+elif [ "$cmd" == "deploy" ];then
+  deployServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+

+ 208 - 0
dsl/001sync_code.sh

@@ -0,0 +1,208 @@
+#!/bin/bash
+#set -x
+set -e
+
+source_path=/home/www/sync_code/sd_dsl/wms85std
+source_git=(
+  "www@git.yvanui.com:jztd/wms85std.git"
+  "www@git.yvanui.com:lizhiwei/yvan-framework.git"
+  "www@git.yvanui.com:luoyifan/yvan-ui.git"
+)
+source_branch=(
+  "sd_dsl2"
+  "8.6"
+  "master"
+)
+source_position=(
+  "."
+  "yvan-framework"
+  "yvan-ui"
+)
+
+target_path=/home/www/sync_code/sd_dsl/wms85std-sd
+target_git=www@git.yvanui.com:lizhiwei/wms85std-sd.git
+target_branch=main
+target_position=.
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ]; then
+    echo ""
+  fi
+  echo ""
+}
+
+source_pull() {
+  for ((idx=0; idx<${#source_git[@]}; idx++)); do
+    pullCode $source_path ${source_git[idx]} ${source_branch[idx]} ${source_position[idx]}
+  done
+}
+
+source_build() {
+  # 构建 java
+  echo -e "$echoPrefix cd $source_path $echoSuffix"
+  cd $source_path
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+
+  # 构建 yvan-ui
+  echo -e "$echoPrefix cd $source_path/yvan-ui $echoSuffix"
+  cd $source_path/yvan-ui
+  echo -e "$echoPrefix yarn install $echoSuffix"
+  yarn install
+  echo -e "$echoPrefix yarn run build_only $echoSuffix"
+  yarn run build_only
+}
+
+target_pull() {
+  pullCode $target_path ${target_git} ${target_branch} ${target_position}
+}
+
+target_build() {
+  # 构建 java
+  echo -e "$echoPrefix cd $target_path $echoSuffix"
+  cd $target_path
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+sync_files() {
+  echo -e "$echoPrefix 开始同步: $source_path $echoSuffix"
+  rsync -azr --progress --delete \
+    --exclude '.git/' \
+    --exclude '.gradle/' \
+    --exclude '.httpCache/' \
+    --exclude '.idea/' \
+    --exclude 'logs/' \
+    --exclude 'build/' \
+    --exclude 'out/' \
+    --exclude 'libs/' \
+    --exclude 'node_modules/' \
+    --exclude 'yvan-framework/' \
+    --exclude 'yvan-ui/' \
+    --exclude 'yvan-ui-dist/' \
+    --exclude 'build.gradle' \
+    --exclude 'settings.gradle' \
+    --exclude 'application*' \
+    --exclude 'bootstrap*' \
+    --exclude 'wms-print/' \
+    --exclude 'generated/' \
+    --exclude 'generated_tests/' \
+    --exclude '*.bpmn' \
+    --exclude 'wms-modules/yvan-studio/' \
+    --exclude 'gradle.properties' \
+    --exclude 'gradle-wrapper.properties' \
+    --exclude 'Dockerfile*' \
+    $source_path/ $target_path
+  echo -e "$echoPrefix 同步完成 $echoSuffix"
+
+  echo -e "$echoPrefix 开始同步 $source_path/yvan-framework/yvan-studio $echoSuffix"
+  rsync -azr --progress --delete \
+    --exclude '.git/' \
+    --exclude '.gradle/' \
+    --exclude '.httpCache/' \
+    --exclude '.idea/' \
+    --exclude 'logs/' \
+    --exclude 'build/' \
+    --exclude 'out/' \
+    --exclude 'libs/' \
+    --exclude 'node_modules/' \
+    --exclude 'yvan-framework/' \
+    --exclude 'src/main/java/' \
+    --exclude 'src/main/resources/' \
+    --exclude 'src/test/' \
+    --exclude 'yvan-ui/' \
+    --exclude 'build.gradle' \
+    --exclude 'settings.gradle' \
+    --exclude 'application*' \
+    --exclude 'bootstrap*' \
+    --exclude 'generated/' \
+    --exclude 'generated_tests/' \
+    --exclude '*.bpmn' \
+    --exclude 'gradle.properties' \
+    --exclude 'gradle-wrapper.properties' \
+    --exclude 'Dockerfile*' \
+    $source_path/yvan-framework/yvan-studio $target_path/wms-modules
+  echo -e "$echoPrefix 同步完成 $echoSuffix"
+
+  echo -e "$echoPrefix 开始同步 lib $echoSuffix"
+  rsync -azr --progress \
+    --include '/yvan-*' \
+    --include '/wms-core-*' \
+    --include '/wms-api-*' \
+    --exclude='*' \
+    $source_path/wms-modules/wms-system/build/libs/lib/ $target_path/libs
+  echo -e "$echoPrefix 同步完成 $echoSuffix"
+
+  echo -e "$echoPrefix 开始同步 yvan-ui $echoSuffix"
+  rsync -azr --progress --delete $source_path/yvan-ui/dist/ $target_path/yvan-ui-dist/dist
+  echo -e "$echoPrefix 同步完成 $echoSuffix"
+
+  echo -e "$echoPrefix 处理前端资源缓存 $echoSuffix"
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $target_path/wms-ui/index.html $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $target_path/wms-ui/index.html
+  echo -e "$echoPrefix sed -i 's|/yvan-ui.mjs|/yvan-ui.mjs?v=$version|g' $target_path/wms-ui/index.html $echoSuffix"
+  sed -i "s|/yvan-ui.mjs|/yvan-ui.mjs?v=$version|g" $target_path/wms-ui/index.html
+  echo -e "$echoPrefix sed -i 's|/yvan-ui.mjs|/yvan-ui.mjs?v=$version|g' $target_path/yvan-ui-dist/dist/js/*.js $echoSuffix"
+  sed -i "s|/yvan-ui.mjs|/yvan-ui.mjs?v=$version|g" $target_path/yvan-ui-dist/dist/js/*.js
+  echo -e "$echoPrefix 处理前端资源缓存-完成 $echoSuffix"
+}
+
+commit_target() {
+  echo -e "$echoPrefix cd $target_path $echoSuffix"
+  cd $target_path
+  echo -e "$echoPrefix git add --all . $echoSuffix"
+  git add --all .
+  echo -e "$echoPrefix git commit -m '代码同步' $echoSuffix"
+  git commit -m '代码同步'
+  echo -e "$echoPrefix git push origin $target_branch $echoSuffix"
+  git push origin $target_branch
+}
+
+source_pull
+target_pull
+source_build
+target_pull
+sync_files
+target_build
+commit_target
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/dsl/001sync_code.sh)
+
+
+

+ 204 - 0
dsl/build-mega.sh

@@ -0,0 +1,204 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/data3/thinkingwms-ui2
+gitUrlArr=(
+  "http://git.yvanui.com/jztd/thinkingwms-ui.git"
+  "http://git.yvanui.com/jztd/yvan-ext.git"
+  "http://git.yvanui.com/jztd/yvan-ext-mobile.git"
+)
+branchArr=(
+  "mega"
+  "master"
+  "master"
+)
+positionArr=(
+  "."
+  "yvan-ext"
+  "yvan-ext-mobile"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+  pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+  if [ "${needBuild[idx]}" == "-1" ]; then
+    needBuild[idx]=$isChange
+  fi
+done
+echo -e "$echoPrefix sed -i 's/10\.100\.166\.15:8770/139\.9\.249\.180:8770/g' $codePath/client/public/login.html $echoSuffix"
+sed -i "s/10\.100\.166\.15:8770/139\.9\.249\.180:8770/g" $codePath/client/public/login.html
+echo -e "$echoPrefix sed -i 's/10\.100\.166\.15:8770/139\.9\.249\.180:8770/g' $codePath/client/src/ApiConvert.js $echoSuffix"
+sed -i "s/10\.100\.166\.15:8770/139\.9\.249\.180:8770/g" $codePath/client/src/ApiConvert.js
+echo "###--代码更新完成--------------------------------------------------------------------------###"
+echo ""
+
+buildCode() {
+  # 构建 yvan-ext
+  if [ "${needBuild[1]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-ext $echoSuffix"
+    cd "$codePath/yvan-ext"
+    # echo -e "$echoPrefix git reset --hard 22f18ac82221b4c6889696d500bfeb2981a2f3e1 $echoSuffix"
+    # git reset --hard 22f18ac82221b4c6889696d500bfeb2981a2f3e1
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-ext 文件未变化"
+  fi
+
+  # 构建 yvan-ext-mobile
+  if [ "${needBuild[1]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-ext-mobile $echoSuffix"
+    cd "$codePath/yvan-ext-mobile"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-ext-mobile 文件未变化"
+  fi
+
+  # 构建 thinkingwms-ui/client
+  if [ "${needBuild[2]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/client $echoSuffix"
+    cd "$codePath/client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "thinkingwms-ui/client 文件未变化"
+  fi
+
+  # 构建 thinkingwms-ui/pda-client
+  if [ "${needBuild[2]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/pda-client $echoSuffix"
+    cd "$codePath/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "thinkingwms-ui/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+buildCode
+echo "###--代码构建完成--------------------------------------------------------------------------###"
+echo ""
+
+logPath=/data3/thinkingwms_nohup2.log
+dirPath=/data3/thinkingwms-ui2/thinkingwms-backend/build/libs/
+serverName=2dsl_thinkingwms_ui
+
+cmd=$1
+profiles=${2:-"test_hwy"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./thinkingwms-backend-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=3300 >$logPath 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./thinkingwms-backend-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=3300 >$logPath 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill -9 $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill -9
+    echo "$serverName 已停止!"
+  fi
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+if [ ! -z $pid ];then
+  stopServer $pid
+  sleep 3s
+fi
+startServer
+
+#  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/dsl/build-mega.sh)
+

+ 204 - 0
dsl/build.sh

@@ -0,0 +1,204 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/data3/thinkingwms-ui
+gitUrlArr=(
+  "http://git.yvanui.com/jztd/thinkingwms-ui.git"
+  "http://git.yvanui.com/jztd/yvan-ext.git"
+  "http://git.yvanui.com/jztd/yvan-ext-mobile.git"
+)
+branchArr=(
+  "develop"
+  "master"
+  "master"
+)
+positionArr=(
+  "."
+  "yvan-ext"
+  "yvan-ext-mobile"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+  pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+  if [ "${needBuild[idx]}" == "-1" ]; then
+    needBuild[idx]=$isChange
+  fi
+done
+echo -e "$echoPrefix sed -i 's/10\.100\.166\.15:8770/139\.9\.249\.180:8770/g' $codePath/client/public/login.html $echoSuffix"
+sed -i "s/10\.100\.166\.15:8770/139\.9\.249\.180:8770/g" $codePath/client/public/login.html
+echo -e "$echoPrefix sed -i 's/10\.100\.166\.15:8770/139\.9\.249\.180:8770/g' $codePath/client/src/ApiConvert.js $echoSuffix"
+sed -i "s/10\.100\.166\.15:8770/139\.9\.249\.180:8770/g" $codePath/client/src/ApiConvert.js
+echo "###--代码更新完成--------------------------------------------------------------------------###"
+echo ""
+
+buildCode() {
+  # 构建 yvan-ext
+  if [ "${needBuild[1]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-ext $echoSuffix"
+    cd "$codePath/yvan-ext"
+    # echo -e "$echoPrefix git reset --hard 22f18ac82221b4c6889696d500bfeb2981a2f3e1 $echoSuffix"
+    # git reset --hard 22f18ac82221b4c6889696d500bfeb2981a2f3e1
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-ext 文件未变化"
+  fi
+
+  # 构建 yvan-ext-mobile
+  if [ "${needBuild[1]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-ext-mobile $echoSuffix"
+    cd "$codePath/yvan-ext-mobile"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-ext-mobile 文件未变化"
+  fi
+
+  # 构建 thinkingwms-ui/client
+  if [ "${needBuild[2]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/client $echoSuffix"
+    cd "$codePath/client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "thinkingwms-ui/client 文件未变化"
+  fi
+
+  # 构建 thinkingwms-ui/pda-client
+  if [ "${needBuild[2]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/pda-client $echoSuffix"
+    cd "$codePath/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "thinkingwms-ui/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+buildCode
+echo "###--代码构建完成--------------------------------------------------------------------------###"
+echo ""
+
+logPath=/data3/thinkingwms_nohup.log
+dirPath=/data3/thinkingwms-ui/thinkingwms-backend/build/libs/
+serverName=dsl_thinkingwms_ui
+
+cmd=$1
+profiles=${2:-"test_hwy"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./thinkingwms-backend-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles >$logPath 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./thinkingwms-backend-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles >$logPath 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill -9 $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill -9
+    echo "$serverName 已停止!"
+  fi
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+if [ ! -z $pid ];then
+  stopServer $pid
+  sleep 3s
+fi
+startServer
+
+#  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/dsl/build.sh)
+

+ 198 - 0
dsl/dashenlin-naning-prd_build.sh

@@ -0,0 +1,198 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/data3/thinkingwms-ui_dashenlin-naning-prd
+gitUrlArr=(
+  "http://git.yvanui.com/jztd/thinkingwms-ui.git"
+  "http://git.yvanui.com/jztd/yvan-ext.git"
+  "http://git.yvanui.com/jztd/yvan-ext-mobile.git"
+)
+branchArr=(
+  "dashenlin-naning-prd"
+  "master"
+  "master"
+)
+positionArr=(
+  "."
+  "yvan-ext"
+  "yvan-ext-mobile"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+  pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+  if [ "${needBuild[idx]}" == "-1" ]; then
+    needBuild[idx]=$isChange
+  fi
+done
+echo "###--代码更新完成--------------------------------------------------------------------------###"
+echo ""
+
+buildCode() {
+  # 构建 yvan-ext
+  if [ "${needBuild[1]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-ext $echoSuffix"
+    cd "$codePath/yvan-ext"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-ext 文件未变化"
+  fi
+
+  # 构建 yvan-ext-mobile
+  if [ "${needBuild[1]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-ext-mobile $echoSuffix"
+    cd "$codePath/yvan-ext-mobile"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-ext-mobile 文件未变化"
+  fi
+
+  # 构建 thinkingwms-ui/client
+  if [ "${needBuild[2]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/client $echoSuffix"
+    cd "$codePath/client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "thinkingwms-ui/client 文件未变化"
+  fi
+
+  # 构建 thinkingwms-ui/pda-client
+  if [ "${needBuild[2]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/pda-client $echoSuffix"
+    cd "$codePath/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "thinkingwms-ui/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+buildCode
+echo "###--代码构建完成--------------------------------------------------------------------------###"
+echo ""
+
+logPath=/data3/thinkingwms_nohup.log
+dirPath=/data3/thinkingwms-ui_dashenlin-naning-prd/thinkingwms-backend/build/libs/
+serverName=dsl_dashenlin_naning_prd_thinkingwms_ui
+
+cmd=$1
+profiles=${2:-"test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx16g -Xms16g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./thinkingwms-backend-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles >$logPath 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./thinkingwms-backend-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles >$logPath 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill -9 $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill -9
+    echo "$serverName 已停止!"
+  fi
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+if [ ! -z $pid ];then
+  stopServer $pid
+  sleep 3s
+fi
+startServer
+
+#  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/dsl/dashenlin-naning-prd_build.sh)
+

+ 199 - 0
dsl/dashenlin-naning-test_build.sh

@@ -0,0 +1,199 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/data3/thinkingwms-ui_dashenlin-naning-test
+gitUrlArr=(
+  #"http://git.yvanui.com/jztd/thinkingwms-ui.git"
+  "https://dsl-third-gitlab.dslyy.com/kls/wms/thinkingwms-ui.git"
+  "http://git.yvanui.com/jztd/yvan-ext.git"
+  "http://git.yvanui.com/jztd/yvan-ext-mobile.git"
+)
+branchArr=(
+  "nanning-test"
+  "master"
+  "master"
+)
+positionArr=(
+  "."
+  "yvan-ext"
+  "yvan-ext-mobile"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+  pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+  if [ "${needBuild[idx]}" == "-1" ]; then
+    needBuild[idx]=$isChange
+  fi
+done
+echo "###--代码更新完成--------------------------------------------------------------------------###"
+echo ""
+
+buildCode() {
+  # 构建 yvan-ext
+  if [ "${needBuild[1]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-ext $echoSuffix"
+    cd "$codePath/yvan-ext"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-ext 文件未变化"
+  fi
+
+  # 构建 yvan-ext-mobile
+  if [ "${needBuild[1]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-ext-mobile $echoSuffix"
+    cd "$codePath/yvan-ext-mobile"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-ext-mobile 文件未变化"
+  fi
+
+  # 构建 thinkingwms-ui/client
+  if [ "${needBuild[2]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/client $echoSuffix"
+    cd "$codePath/client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "thinkingwms-ui/client 文件未变化"
+  fi
+
+  # 构建 thinkingwms-ui/pda-client
+  if [ "${needBuild[2]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/pda-client $echoSuffix"
+    cd "$codePath/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "thinkingwms-ui/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+buildCode
+echo "###--代码构建完成--------------------------------------------------------------------------###"
+echo ""
+
+logPath=/data3/thinkingwms_test_nohup.log
+dirPath=/data3/thinkingwms-ui_dashenlin-naning-test/thinkingwms-backend/build/libs/
+serverName=dsl_dashenlin_naning_test_thinkingwms_ui
+
+cmd=$1
+profiles=${2:-"test2"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./thinkingwms-backend-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8802 >$logPath 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./thinkingwms-backend-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8802 >$logPath 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill -9 $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill -9
+    echo "$serverName 已停止!"
+  fi
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+if [ ! -z $pid ];then
+  stopServer $pid
+  sleep 3s
+fi
+startServer
+
+#  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/dsl/dashenlin-naning-test_build.sh)
+

+ 205 - 0
dsl/haerbing-prd_build.sh

@@ -0,0 +1,205 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/data3/thinkingwms-ui_haerbing-prd
+gitUrlArr=(
+  "http://git.yvanui.com/jztd/thinkingwms-ui.git"
+  "http://git.yvanui.com/jztd/yvan-ext.git"
+  "http://git.yvanui.com/jztd/yvan-ext-mobile.git"
+)
+branchArr=(
+  "haerbing"
+  "master"
+  "master"
+)
+positionArr=(
+  "."
+  "yvan-ext"
+  "yvan-ext-mobile"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+  pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+  if [ "${needBuild[idx]}" == "-1" ]; then
+    needBuild[idx]=$isChange
+  fi
+done
+echo "###--代码更新完成--------------------------------------------------------------------------###"
+echo ""
+echo -e "$echoPrefix sed -i 's/10\.100\.166\.15:8770/10\.100\.186\.15:8770/g' $codePath/client/public/login.html $echoSuffix"
+sed -i "s/10\.100\.166\.15:8770/10\.100\.186\.15:8770/g" $codePath/client/public/login.html
+echo -e "$echoPrefix sed -i 's/10\.100\.166\.15:8770/10\.100\.186\.15:8770/g' $codePath/client/src/ApiConvert.js $echoSuffix"
+sed -i "s/10\.100\.166\.15:8770/10\.100\.186\.15:8770/g" $codePath/client/src/ApiConvert.js
+echo "###--代码更新完成--------------------------------------------------------------------------###"
+echo ""
+
+
+buildCode() {
+  # 构建 yvan-ext
+  if [ "${needBuild[1]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-ext $echoSuffix"
+    cd "$codePath/yvan-ext"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-ext 文件未变化"
+  fi
+
+  # 构建 yvan-ext-mobile
+  if [ "${needBuild[1]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-ext-mobile $echoSuffix"
+    cd "$codePath/yvan-ext-mobile"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-ext-mobile 文件未变化"
+  fi
+
+  # 构建 thinkingwms-ui/client
+  if [ "${needBuild[2]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/client $echoSuffix"
+    cd "$codePath/client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "thinkingwms-ui/client 文件未变化"
+  fi
+
+  # 构建 thinkingwms-ui/pda-client
+  if [ "${needBuild[2]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/pda-client $echoSuffix"
+    cd "$codePath/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "thinkingwms-ui/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+buildCode
+echo "###--代码构建完成--------------------------------------------------------------------------###"
+echo ""
+
+logPath=/data3/thinkingwms_nohup.log
+dirPath=/data3/thinkingwms-ui_haerbing-prd/thinkingwms-backend/build/libs/
+serverName=dsl_dashenlin_haerbing_prd_thinkingwms_ui
+
+cmd=$1
+profiles=${2:-"test_haerbing"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./thinkingwms-backend-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles >$logPath 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./thinkingwms-backend-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles >$logPath 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill -9 $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill -9
+    echo "$serverName 已停止!"
+  fi
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+if [ ! -z $pid ];then
+  stopServer $pid
+  sleep 3s
+fi
+startServer
+
+#  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/dsl/haerbing-prd_build.sh)
+

+ 206 - 0
dsl/haerbing-test_build.sh

@@ -0,0 +1,206 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/data3/thinkingwms-ui_haerbing-test
+gitUrlArr=(
+  #"http://git.yvanui.com/jztd/thinkingwms-ui.git"
+  "https://dsl-third-gitlab.dslyy.com/kls/wms/thinkingwms-ui.git"
+  "http://git.yvanui.com/jztd/yvan-ext.git"
+  "http://git.yvanui.com/jztd/yvan-ext-mobile.git"
+)
+branchArr=(
+  "harb-bck"
+  "master"
+  "master"
+)
+positionArr=(
+  "."
+  "yvan-ext"
+  "yvan-ext-mobile"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+  pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+  if [ "${needBuild[idx]}" == "-1" ]; then
+    needBuild[idx]=$isChange
+  fi
+done
+echo "###--代码更新完成--------------------------------------------------------------------------###"
+echo ""
+echo -e "$echoPrefix sed -i 's/10\.100\.166\.15:8770/10\.100\.186\.50:8770/g' $codePath/client/public/login.html $echoSuffix"
+sed -i "s/10\.100\.166\.15:8770/10\.100\.186\.50:8770/g" $codePath/client/public/login.html
+echo -e "$echoPrefix sed -i 's/10\.100\.166\.15:8770/10\.100\.186\.50:8770/g' $codePath/client/src/ApiConvert.js $echoSuffix"
+sed -i "s/10\.100\.166\.15:8770/10\.100\.186\.50:8770/g" $codePath/client/src/ApiConvert.js
+echo "###--代码更新完成--------------------------------------------------------------------------###"
+echo ""
+
+
+buildCode() {
+  # 构建 yvan-ext
+  if [ "${needBuild[1]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-ext $echoSuffix"
+    cd "$codePath/yvan-ext"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-ext 文件未变化"
+  fi
+
+  # 构建 yvan-ext-mobile
+  if [ "${needBuild[1]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-ext-mobile $echoSuffix"
+    cd "$codePath/yvan-ext-mobile"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-ext-mobile 文件未变化"
+  fi
+
+  # 构建 thinkingwms-ui/client
+  if [ "${needBuild[2]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/client $echoSuffix"
+    cd "$codePath/client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "thinkingwms-ui/client 文件未变化"
+  fi
+
+  # 构建 thinkingwms-ui/pda-client
+  if [ "${needBuild[2]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/pda-client $echoSuffix"
+    cd "$codePath/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "thinkingwms-ui/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+buildCode
+echo "###--代码构建完成--------------------------------------------------------------------------###"
+echo ""
+
+logPath=/data3/thinkingwms_nohup.log
+dirPath=/data3/thinkingwms-ui_haerbing-test/thinkingwms-backend/build/libs/
+serverName=dsl_dashenlin_haerbing_test_thinkingwms_ui
+
+cmd=$1
+profiles=${2:-"test_haerbing2"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./thinkingwms-backend-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles >$logPath 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./thinkingwms-backend-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles >$logPath 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill -9 $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill -9
+    echo "$serverName 已停止!"
+  fi
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+if [ ! -z $pid ];then
+  stopServer $pid
+  sleep 3s
+fi
+startServer
+
+#  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/dsl/haerbing-test_build.sh)
+

+ 200 - 0
dsl/nantong-prod_build.sh

@@ -0,0 +1,200 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/data/thinkingwms-ui_nantong_prod
+gitUrlArr=(
+  #"http://git.yvanui.com/jztd/thinkingwms-ui.git"
+  "https://dsl-third-gitlab.dslyy.com/kls/wms/thinkingwms-ui.git"
+  "http://git.yvanui.com/jztd/yvan-ext.git"
+  "http://git.yvanui.com/jztd/yvan-ext-mobile.git"
+)
+branchArr=(
+  "nantong_prod"
+  "master"
+  "master"
+)
+positionArr=(
+  "."
+  "yvan-ext"
+  "yvan-ext-mobile"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+  pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+  if [ "${needBuild[idx]}" == "-1" ]; then
+    needBuild[idx]=$isChange
+  fi
+done
+echo "###--代码更新完成--------------------------------------------------------------------------###"
+echo ""
+
+buildCode() {
+  # 构建 yvan-ext
+  if [ "${needBuild[1]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-ext $echoSuffix"
+    cd "$codePath/yvan-ext"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-ext 文件未变化"
+  fi
+
+  # 构建 yvan-ext-mobile
+  if [ "${needBuild[1]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-ext-mobile $echoSuffix"
+    cd "$codePath/yvan-ext-mobile"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-ext-mobile 文件未变化"
+  fi
+
+  # 构建 thinkingwms-ui/client
+  if [ "${needBuild[2]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/client $echoSuffix"
+    cd "$codePath/client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "thinkingwms-ui/client 文件未变化"
+  fi
+
+  # 构建 thinkingwms-ui/pda-client
+  if [ "${needBuild[2]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/pda-client $echoSuffix"
+    cd "$codePath/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "thinkingwms-ui/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+buildCode
+echo "###--代码构建完成--------------------------------------------------------------------------###"
+echo ""
+
+logPath=/data/thinkingwms-ui-nantong_prod.log
+dirPath=/data/thinkingwms-ui_nantong_prod/thinkingwms-backend/build/libs/
+serverName=thinkingwms_ui_nantong_prod
+
+cmd=$1
+profiles=${2:-"prod"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./thinkingwms-backend-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8802 >$logPath 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./thinkingwms-backend-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8802 >$logPath 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill -9 $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill -9
+    echo "$serverName 已停止!"
+  fi
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+if [ ! -z $pid ];then
+  stopServer $pid
+  sleep 3s
+fi
+startServer
+
+# 南通-生产
+#  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/dsl/nantong-prod_build.sh)
+

+ 199 - 0
dsl/nantong-test_build.sh

@@ -0,0 +1,199 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/data/thinkingwms-ui_nantong_test
+gitUrlArr=(
+  #"http://git.yvanui.com/jztd/thinkingwms-ui.git"
+  "https://dsl-third-gitlab.dslyy.com/kls/wms/thinkingwms-ui.git"
+  "http://git.yvanui.com/jztd/yvan-ext.git"
+  "http://git.yvanui.com/jztd/yvan-ext-mobile.git"
+)
+branchArr=(
+  "develop"
+  "master"
+  "master"
+)
+positionArr=(
+  "."
+  "yvan-ext"
+  "yvan-ext-mobile"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+  pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+  if [ "${needBuild[idx]}" == "-1" ]; then
+    needBuild[idx]=$isChange
+  fi
+done
+echo "###--代码更新完成--------------------------------------------------------------------------###"
+echo ""
+
+buildCode() {
+  # 构建 yvan-ext
+  if [ "${needBuild[1]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-ext $echoSuffix"
+    cd "$codePath/yvan-ext"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-ext 文件未变化"
+  fi
+
+  # 构建 yvan-ext-mobile
+  if [ "${needBuild[1]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-ext-mobile $echoSuffix"
+    cd "$codePath/yvan-ext-mobile"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-ext-mobile 文件未变化"
+  fi
+
+  # 构建 thinkingwms-ui/client
+  if [ "${needBuild[2]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/client $echoSuffix"
+    cd "$codePath/client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "thinkingwms-ui/client 文件未变化"
+  fi
+
+  # 构建 thinkingwms-ui/pda-client
+  if [ "${needBuild[2]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/pda-client $echoSuffix"
+    cd "$codePath/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "thinkingwms-ui/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+buildCode
+echo "###--代码构建完成--------------------------------------------------------------------------###"
+echo ""
+
+logPath=/data/thinkingwms-ui-nantong_test.log
+dirPath=/data/thinkingwms-ui_nantong_test/thinkingwms-backend/build/libs/
+serverName=thinkingwms_ui_nantong_test
+
+cmd=$1
+profiles=${2:-"test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./thinkingwms-backend-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8802 >$logPath 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./thinkingwms-backend-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8802 >$logPath 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill -9 $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill -9
+    echo "$serverName 已停止!"
+  fi
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+if [ ! -z $pid ];then
+  stopServer $pid
+  sleep 3s
+fi
+startServer
+
+#  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/dsl/nantong-test_build.sh)
+

+ 198 - 0
dsl/nantong-tmp_build.sh

@@ -0,0 +1,198 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/data/thinkingwms-ui_nantong_tmp
+gitUrlArr=(
+  "http://git.yvanui.com/jztd/thinkingwms-ui.git"
+  "http://git.yvanui.com/jztd/yvan-ext.git"
+  "http://git.yvanui.com/jztd/yvan-ext-mobile.git"
+)
+branchArr=(
+  "develop"
+  "master"
+  "master"
+)
+positionArr=(
+  "."
+  "yvan-ext"
+  "yvan-ext-mobile"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+  pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+  if [ "${needBuild[idx]}" == "-1" ]; then
+    needBuild[idx]=$isChange
+  fi
+done
+echo "###--代码更新完成--------------------------------------------------------------------------###"
+echo ""
+
+buildCode() {
+  # 构建 yvan-ext
+  if [ "${needBuild[1]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-ext $echoSuffix"
+    cd "$codePath/yvan-ext"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-ext 文件未变化"
+  fi
+
+  # 构建 yvan-ext-mobile
+  if [ "${needBuild[1]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-ext-mobile $echoSuffix"
+    cd "$codePath/yvan-ext-mobile"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "yvan-ext-mobile 文件未变化"
+  fi
+
+  # 构建 thinkingwms-ui/client
+  if [ "${needBuild[2]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/client $echoSuffix"
+    cd "$codePath/client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "thinkingwms-ui/client 文件未变化"
+  fi
+
+  # 构建 thinkingwms-ui/pda-client
+  if [ "${needBuild[2]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/pda-client $echoSuffix"
+    cd "$codePath/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "thinkingwms-ui/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+buildCode
+echo "###--代码构建完成--------------------------------------------------------------------------###"
+echo ""
+
+logPath=/data/thinkingwms-ui-nantong_tmp.log
+dirPath=/data/thinkingwms-ui_nantong_tmp/thinkingwms-backend/build/libs/
+serverName=thinkingwms_ui_nantong_tmp
+
+cmd=$1
+profiles=${2:-"tmp_nantong"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./thinkingwms-backend-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8802 >$logPath 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./thinkingwms-backend-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8802 >$logPath 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill -9 $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill -9
+    echo "$serverName 已停止!"
+  fi
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+if [ ! -z $pid ];then
+  stopServer $pid
+  sleep 3s
+fi
+startServer
+
+#  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/dsl/nantong-tmp_build.sh)
+

+ 213 - 0
dsl/shunde-test_build.sh

@@ -0,0 +1,213 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/data/wms85std_shunde_test
+gitUrlArr=(
+  "http://git.yvanui.com/jztd/wms85std.git"
+  "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+  "http://git.yvanui.com/luoyifan/yvan-ui.git"
+)
+
+branchArr=(
+  "master"
+  "8.6"
+  "master"
+)
+positionArr=(
+  "."
+  "yvan-framework"
+  "yvan-ui"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 yvan-ui
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-ui $echoSuffix"
+    cd "$codePath/yvan-ui"
+    echo -e "$echoPrefix yarn run init $echoSuffix"
+    yarn run init
+    echo ""
+  else
+    echo "yvan-ui 文件未变化"
+  fi
+  # 构建 wms-ui
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-ui $echoSuffix"
+    cd "$codePath/wms-ui"
+    #echo -e "$echoPrefix yarn $echoSuffix"
+    #yarn
+    echo -e "$echoPrefix yarn link yvan-ui $echoSuffix"
+    yarn link yvan-ui
+    echo ""
+  else
+    echo "yvan-ui 文件未变化"
+  fi
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms85std_shunde_test/server.log
+dirPath=/data/wms85std_shunde_test/wms-modules/wms-system/build/libs/
+serverName=wms85std_shunde_test
+
+cmd=$1
+profiles=${2:-"shunde-test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx4g -Xms4g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms-system-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8005 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms-system-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8005 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# 顺德-test
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/dsl/shunde-test_build.sh) [cmd profiles]

+ 81 - 0
hua_wei_yun/01xxljob.sh

@@ -0,0 +1,81 @@
+#!/bin/bash
+#set -x
+set -e
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+logPath=/data/logs/xxl-job/xxl-job.log
+dirPath=/home/www/deploy/xxl-job/
+serverName=xxl_job_test
+
+cmd=$1
+profiles=${2:-"hwy-test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx1g -Xms1g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath $echoSuffix"
+    cd $dirPath
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar bin/xxl-job-admin-mysql-2.3.0.jar --spring.config.location=conf/ --spring.profiles.active=global,$profiles --server.port=8001 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar bin/xxl-job-admin-mysql-2.3.0.jar --spring.config.location=conf/ --spring.profiles.active=global,$profiles --server.port=8001 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: deploy restart start stop kill log logs
+if [ "$cmd" == "deploy" ];then
+  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/03xxljob.sh) pull
+  restartServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/hua_wei_yun/01xxljob.sh) [cmd profiles]

+ 233 - 0
hua_wei_yun/02test-deploy-wms8-pg.sh

@@ -0,0 +1,233 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_bench_pgsql
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/wms8/wms8-bench.git"
+  "http://git.galaxis.yvanui.com/wms8/wms-core.git"
+  "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "pgsql"
+  "pgsql"
+  "master"
+)
+positionArr=(
+  "."
+  "wms-core"
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-biz/bundle
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/bundle $echoSuffix"
+    cd "$codePath/wms-biz/bundle"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext $echoSuffix"
+    yarn link yvan-ext
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/bundle 文件未变化"
+  fi
+
+  # 构建 wms-biz/pda-client
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-biz/pda-client $echoSuffix"
+    cd "$codePath/wms-biz/pda-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-ext-mobile $echoSuffix"
+    yarn link yvan-ext-mobile
+    echo -e "$echoPrefix yarn build $echoSuffix"
+    yarn build
+    echo ""
+  else
+    echo "wms-biz/pda-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_bench_pgsql/wms8_bench_pgsql.log
+dirPath=/home/www/deploy/wms8_bench_pgsql/wms-biz/servo/build/libs/
+serverName=wms8_bench_pgsql
+
+cmd=$1
+profiles=${2:-"test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8103 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8103 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  version=$(date +_%Y_%m_%d_%H_%M_%S)
+  echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/01yvan-ext.sh) pull
+    bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/02yvan-ext-mobile.sh) pull
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# 一心堂WMS8.0 PGSQL
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/hua_wei_yun/02test-deploy-wms8-pg.sh) [cmd profiles]

+ 237 - 0
hua_wei_yun/03wms84-test.sh

@@ -0,0 +1,237 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms84_test
+gitUrlArr=(
+  "http://git.yvanui.com/jztd/wms84.git"
+  "www@git.yvanui.com:lizhiwei/yvan-framework.git"
+  # "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+  "www@git.yvanui.com:jztd/yvan-vue.git"
+  # "http://git.yvanui.com/jztd/yvan-vue.git"
+  "www@git.yvanui.com:jztd/yvan-vue-src.git"
+  # "http://git.yvanui.com/jztd/yvan-vue-src.git"
+)
+
+branchArr=(
+  "master"
+  "8.4"
+  "master"
+  "master"
+)
+positionArr=(
+  "."
+  "yvan-framework"
+  "yvan-vue"
+  "yvan-vue-src"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 yvan-vue-src
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-vue-src $echoSuffix"
+    cd "$codePath/yvan-vue-src"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn run dev2 $echoSuffix"
+    yarn run dev2
+    echo ""
+  else
+    echo "yvan-vue-src 文件未变化"
+  fi
+
+  # 构建 yvan-vue
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-vue $echoSuffix"
+    cd "$codePath/yvan-vue"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link $echoSuffix"
+    yarn link
+    echo ""
+  else
+    echo "yvan-vue 文件未变化"
+  fi
+
+  # pc-client
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/pc-client $echoSuffix"
+    cd "$codePath/pc-client"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-vue $echoSuffix"
+    yarn link yvan-vue
+    echo ""
+  else
+    echo "pc-client 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms84_test/server.log
+dirPath=/home/www/deploy/wms84_test/wms/wms-application/build/libs/
+serverName=wms84_test
+
+cmd=$1
+profiles=${2:-"test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms-application-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8004 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms-application-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8004 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# wms85测试
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/hua_wei_yun/03wms84-test.sh) [cmd profiles]

+ 206 - 0
hua_wei_yun/04wms-ztf-api-test.sh

@@ -0,0 +1,206 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_ztf_api_2
+gitUrlArr=(
+  "http://git.yvanui.com/jztd/wms.git"
+    "http://git.yvanui.com/jztd/wms-ui-pc.git"
+  "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "feature_0912"
+  "feature_0912"
+  "8.4"
+)
+positionArr=(
+  "."
+  "wms-ui-pc"
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_ztf_api_2/server.log
+dirPath=/home/www/deploy/wms8_ztf_api_2/wms-modules/wms-api-servo/build/libs/
+serverName=2_wms8_ztf_api_2
+
+cmd=$1
+profiles=${2:-"test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+moveBuildFile() {
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+}
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms-api-servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8084 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms-api-servo-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=9084 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  # version=$(date +_%Y_%m_%d_%H_%M_%S)
+  # echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  # sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  # 移动编译后的文件
+  moveBuildFile
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  moveBuildFile
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull build deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull build deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "build" ];then
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+elif [ "$cmd" == "deploy" ];then
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull build deploy restart start stop kill log logs"
+    echo "查看日志: tail -F $logPath -n 100"
+  else
+    echo "输入操作参数: pull build deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# 中通服API-华为云-测试
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/hua_wei_yun/04wms-ztf-api-test.sh) [cmd profiles]

+ 300 - 0
hua_wei_yun/05wms-ztf-test.sh

@@ -0,0 +1,300 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_ztf_2
+gitUrlArr=(
+  "http://git.yvanui.com/jztd/wms.git"
+  "http://git.yvanui.com/jztd/wms-ui-pc.git"
+  "http://git.yvanui.com/jztd/wms-ui-mobile.git"
+  "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "feature_dev"
+  "feature_dev"
+  "feature_dev"
+  "8.4"
+)
+positionArr=(
+  "."
+  "wms-ui-pc"
+  "wms-ui-mobile"
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-ui-pc
+  if [ "${needBuild[1]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-ui-pc $echoSuffix"
+    cd "$codePath/wms-ui-pc"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-vue $echoSuffix"
+    yarn link yvan-vue
+    echo ""
+  else
+    echo "wms-ui-pc 文件未变化"
+  fi
+
+  # 构建 wms-ui-mobile
+  if [ "${needBuild[2]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-ui-mobile $echoSuffix"
+    cd "$codePath/wms-ui-mobile"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-vue-mobile $echoSuffix"
+    yarn link yvan-vue-mobile
+    echo ""
+  else
+    echo "wms-ui-mobile 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_ztf_2/server.log
+dirPath=/home/www/deploy/wms8_ztf_2/wms-modules/wms-system/build/libs/
+serverName=2_wms8_ztf_2
+
+cmd=$1
+profiles=${2:-"test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+moveBuildFile() {
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+}
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms-system-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8084 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms-system-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8084 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  # version=$(date +_%Y_%m_%d_%H_%M_%S)
+  # echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  # sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  # 移动编译后的文件
+  moveBuildFile
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  moveBuildFile
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/11yvan-vue.sh) deploy
+  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/12yvan-vue-mobile.sh) deploy
+}
+
+startPcUi() {
+  pid=`ps -ef | grep "${codePath}/wms-ui-pc/node_modules/.bin/vite" | grep -v 'grep' | awk '{print $2}'`
+  if [ -z $pid ];then
+    echo "wms-ui-pc 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "${codePath}/wms-ui-pc/node_modules/.bin/vite" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "${codePath}/wms-ui-pc/node_modules/.bin/vite" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "wms-ui-pc 已停止!"
+    sleep 3s
+  fi
+  echo -e "$echoPrefix cd $codePath/wms-ui-pc $echoSuffix"
+  cd "$codePath/wms-ui-pc"
+  echo -e "$echoPrefix nohup yarn run dev >>/dev/null 2>&1 & $echoSuffix"
+  nohup yarn run dev >>/dev/null 2>&1 &
+}
+
+#startMobileUi() {
+#  pid=`ps -ef | grep "${codePath}/wms-ui-mobile/node_modules/.bin/vite" | grep -v 'grep' | awk '{print $2}'`
+#  if [ -z $pid ];then
+#    echo "wms-ui-mobile 未运行"
+#  else
+#    echo -e "$echoPrefix ps -ef | grep "${codePath}/wms-ui-mobile/node_modules/.bin/vite" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+#    ps -ef | grep "${codePath}/wms-ui-mobile/node_modules/.bin/vite" | grep -v 'grep' | awk '{print $2}' | xargs kill
+#    echo "wms-ui-mobile 已停止!"
+#    sleep 3s
+#  fi
+#  echo -e "$echoPrefix cd $codePath/wms-ui-mobile $echoSuffix"
+#  cd "$codePath/wms-ui-mobile"
+#  echo -e "$echoPrefix nohup yarn run dev >>/dev/null 2>&1 & $echoSuffix"
+#  nohup yarn run dev >>/dev/null 2>&1 &
+#}
+
+startMobileUi() {
+  pid=`ps -ef | grep 'node server.js -P 8091' | grep -v 'grep' | awk '{print $2}'`
+  if [ -z $pid ];then
+    echo "wms-ui-mobile 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep 'node server.js -P 8091' | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep 'node server.js -P 8091' | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "wms-ui-mobile 已停止!"
+    sleep 3s
+  fi
+  echo -e "$echoPrefix cd $codePath/wms-ui-mobile $echoSuffix"
+  cd "$codePath/wms-ui-mobile"
+  echo -e "$echoPrefix yarn build $echoSuffix"
+  yarn build
+  echo -e "$echoPrefix nohup node server.js -P 8091 >>/dev/null 2>&1 & $echoSuffix"
+  nohup node server.js -P 8091 >>/dev/null 2>&1 &
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull build deploy restart start stop kill log logs startPc startMobile
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull build deploy restart start stop kill log logs startPc startMobile"
+  fi
+elif [ "$cmd" == "build" ];then
+  deployYvanUI
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+  startPcUi
+  startMobileUi
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+elif [ "$cmd" == "startPc" ];then
+  startPcUi
+elif [ "$cmd" == "startMobile" ];then
+  startMobileUi
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull build deploy restart start stop kill log logs startPc startMobile"
+    echo "查看日志: tail -F $logPath -n 100"
+  else
+    echo "输入操作参数: pull build deploy restart start stop kill log logs startPc startMobile"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# 中通服-华为云-测试
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/hua_wei_yun/05wms-ztf-test.sh) [cmd profiles]

+ 206 - 0
hua_wei_yun/06wms-ztf-filemanager-test.sh

@@ -0,0 +1,206 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_ztf_filemanager_2
+gitUrlArr=(
+  "http://git.yvanui.com/jztd/wms.git"
+  "http://git.yvanui.com/jztd/wms-ui-pc.git"
+  "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "feature_0912"
+  "feature_0912"
+  "8.4"
+)
+positionArr=(
+  "."
+  "wms-ui-pc"
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_ztf_filemanager_2/server.log
+dirPath=/home/www/deploy/wms8_ztf_filemanager_2/wms-modules/wms-filemanager/build/libs/
+serverName=2_wms8_ztf_filemanager_2
+
+cmd=$1
+profiles=${2:-"test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+moveBuildFile() {
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+}
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms-filemanager-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8084 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms-filemanager-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8086 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  # version=$(date +_%Y_%m_%d_%H_%M_%S)
+  # echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  # sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  # 移动编译后的文件
+  moveBuildFile
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  moveBuildFile
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull build deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull build deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "build" ];then
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+elif [ "$cmd" == "deploy" ];then
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull build deploy restart start stop kill log logs"
+    echo "查看日志: tail -F $logPath -n 100"
+  else
+    echo "输入操作参数: pull build deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# 中通服API-华为云-文件系统测试
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/hua_wei_yun/06wms-ztf-filemanager-test.sh) [cmd profiles]

+ 206 - 0
hua_wei_yun/07wms-ztf-print-test.sh

@@ -0,0 +1,206 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_ztf_print_2
+gitUrlArr=(
+  "http://git.yvanui.com/jztd/wms.git"
+  "http://git.yvanui.com/jztd/wms-ui-pc.git"
+  "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "feature_0912"
+  "feature_0912"
+  "8.4"
+)
+positionArr=(
+  "."
+  "wms-ui-pc"
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms8_ztf_print_2/server.log
+dirPath=/home/www/deploy/wms8_ztf_print_2/wms-modules/wms-print/build/libs/
+serverName=2_wms8_ztf_print_2
+
+cmd=$1
+profiles=${2:-"test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+moveBuildFile() {
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+}
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms-print-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8084 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms-print-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=9085 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  # version=$(date +_%Y_%m_%d_%H_%M_%S)
+  # echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  # sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  # 移动编译后的文件
+  moveBuildFile
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  moveBuildFile
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull build deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull build deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "build" ];then
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+elif [ "$cmd" == "deploy" ];then
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull build deploy restart start stop kill log logs"
+    echo "查看日志: tail -F $logPath -n 100"
+  else
+    echo "输入操作参数: pull build deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# 中通服API-华为云-打印服务测试
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/hua_wei_yun/07wms-ztf-print-test.sh) [cmd profiles]

+ 253 - 0
hua_wei_yun/08wms-ztf-config-center-test.sh

@@ -0,0 +1,253 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms8_ztf_config_center_2
+gitUrlArr=(
+  "http://git.yvanui.com/jztd/wms.git"
+  "http://git.yvanui.com/jztd/wms-ui-pc.git"
+  'http://git.yvanui.com/jztd/wms-config-center.git'
+  "http://git.yvanui.com/jztd/wms-ui-config-center.git"
+  "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+)
+
+branchArr=(
+  "master"
+  "master"
+  "master"
+  "master"
+  "8.4"
+)
+positionArr=(
+  "."
+  "wms-ui-pc"
+  "wms-modules/wms-config-center"
+  "wms-modules/wms-ui-config-center"
+  "yvan-framework"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 wms-ui-config-center
+  if [ "${needBuild[1]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-modules/wms-ui-config-center $echoSuffix"
+    cd "$codePath/wms-modules/wms-ui-config-center"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-vue $echoSuffix"
+    yarn link yvan-vue
+    echo ""
+  else
+    echo "wms-ui-config-center 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/config-center/server.log
+dirPath=/home/www/deploy/wms8_ztf_config_center_2/wms-modules/wms-config-center/build/libs/
+serverName=2_wms8_ztf_config_center_2
+
+cmd=$1
+profiles=${2:-"test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+moveBuildFile() {
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+}
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms-config-center-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8083 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms-config-center-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8083 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  # 设置 require_config.js 前端版本
+  # version=$(date +_%Y_%m_%d_%H_%M_%S)
+  # echo -e "$echoPrefix sed -i 's/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g' $codePath/public/require_config.js $echoSuffix"
+  # sed -i "s/_[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}/$version/g" $codePath/public/require_config.js
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  # 移动编译后的文件
+  moveBuildFile
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  moveBuildFile
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+deployYvanUI() {
+  bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/11yvan-vue.sh) deploy
+}
+
+startPcUi() {
+  pid=`ps -ef | grep "${codePath}/wms-modules/wms-ui-config-center/node_modules/.bin/vite" | grep -v 'grep' | awk '{print $2}'`
+  if [ -z $pid ];then
+    echo "wms-ui-config-center 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "${codePath}/wms-modules/wms-ui-config-center/node_modules/.bin/vite" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "${codePath}/wms-modules/wms-ui-config-center/node_modules/.bin/vite" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "wms-ui-config-center 已停止!"
+    sleep 3s
+  fi
+  echo -e "$echoPrefix cd $codePath/wms-modules/wms-ui-config-center $echoSuffix"
+  cd "$codePath/wms-modules/wms-ui-config-center"
+  echo -e "$echoPrefix nohup yarn run dev3 >>/dev/null 2>&1 & $echoSuffix"
+  nohup yarn run dev3 >>/dev/null 2>&1 &
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull build deploy restart start stop kill log logs startPc
+if [ "$cmd" == "pull" ];then
+  deployYvanUI
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull build deploy restart start stop kill log logs startPc"
+  fi
+elif [ "$cmd" == "build" ];then
+  deployYvanUI
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+elif [ "$cmd" == "deploy" ];then
+  deployYvanUI
+  deployServer $pid
+  startPcUi
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+elif [ "$cmd" == "startPc" ];then
+  startPcUi
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull build deploy restart start stop kill log logs startPc"
+    echo "查看日志: tail -F $logPath -n 100"
+  else
+    echo "输入操作参数: pull build deploy restart start stop kill log logs startPc"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# 中通服-配置中台-华为云-测试
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/hua_wei_yun/08wms-ztf-config-center-test.sh) [cmd profiles]

+ 84 - 0
hua_wei_yun/09wms-ztf-pad-test.sh

@@ -0,0 +1,84 @@
+#!/bin/bash
+#set -x
+set -e
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+codePath=/home/www/deploy/wms8_ztf_2
+serverUrl=http://127.0.0.1:8094
+
+deploy() {
+  # 更新代码
+  echo -e "$echoPrefix cd $codePath/wms-ui-mobile $echoSuffix"
+  cd $codePath/wms-ui-mobile
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  git pull
+  # 版本号
+  major='1'
+  minor=$(date +%Y%m%d)
+  patch=$(date +1%H%M%S | sed -e 's/^[[:space:]]*//')
+  version="$major.$minor.$patch"
+  echo -e "$echoPrefix 'export const version = '$version'' > src/version.ts $echoSuffix"
+  echo "export const version = '$version'" > src/version.ts
+
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+
+  # 编译
+  echo -e "$echoPrefix yarn run build $echoSuffix"
+  yarn run build
+  echo "###--编译完成-----------------------------------------------------------------------------###"
+  echo ""
+
+  # 创建打包文件夹
+  echo -e "$echoPrefix rm -rf ./tmp $echoSuffix"
+  rm -rf ./tmp
+
+  echo -e "$echoPrefix mkdir -p ./tmp/web/wms_mobile $echoSuffix"
+  mkdir -p ./tmp/web/wms_mobile
+
+  echo -e "$echoPrefix cp -r ./dist/* ./tmp/web/wms_mobile/ $echoSuffix"
+  cp -r ./dist/* ./tmp/web/wms_mobile/
+
+  echo -e "$echoPrefix cd ./tmp $echoSuffix"
+  cd ./tmp
+  echo -e "$echoPrefix zip -r web.zip web $echoSuffix"
+  zip -r web.zip web
+
+  echo "###--打包完成-----------------------------------------------------------------------------###"
+  echo ""
+
+  # 上传文件
+  echo -e "$echoPrefix curl -X POST -F 'file=@$codePath/wms-ui-mobile/tmp/web.zip' $serverUrl/wms_api/api/pages/sys/pdaVersion/PdaPackUpload@uploadFile $echoSuffix"
+  res_json=$(curl -X POST -F 'file=@'$codePath'/wms-ui-mobile/tmp/web.zip' -H "deploy: VPitn9zuOizfciiqY53vtuVz9FXCQ0Ddx3tEWMSZIbDDIbPtEJ3nbFnJOfXKbxdT875sRTv1hWUNkRpBsS1pciHB3h8YcI5huX5ViDnO7XAD0uaiSlZJaUW6aym" $serverUrl/wms_api/api/pages/sys/pdaVersion/PdaPackUpload@uploadFile)
+  filePath=$(echo $res_json | awk -F '"' '{print $34}')
+  echo "filePath = $filePath"
+
+  req_json='{"args":[{"app_code":"ZTF_WEB","app_name":null,"major":"'$major'","minor":"'$minor'","patch":"'$patch'","file_path":"'$filePath'"}]}'
+  res_json=$(curl -H "Content-type: application/json" -H "deploy: VPitn9zuOizfciiqY53vtuVz9FXCQ0Ddx3tEWMSZIbDDIbPtEJ3nbFnJOfXKbxdT875sRTv1hWUNkRpBsS1pciHB3h8YcI5huX5ViDnO7XAD0uaiSlZJaUW6aym" -X POST -d "$req_json" $serverUrl/wms_api/api/pages/sys/pdaVersion/PdaPackUpload@savePdaVersion)
+  echo -e "$echoPrefix $res_json $echoSuffix"
+  echo ""
+
+  # 还原文件
+  # echo -e "$echoPrefix rm -rf ./tmp $echoSuffix"
+  # rm -rf ./tmp
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix 版本号信息: version=$version, major=$major, minor=$minor, patch=$patch $echoSuffix"
+  echo ""
+}
+
+cmd=$1
+if [ "$cmd" == "deploy" ];then
+  deploy
+else
+  echo "使用 deploy 命名打包pda"
+fi
+
+# 中通服 PDA
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/hua_wei_yun/09wms-ztf-pad-test.sh) [cmd]

+ 224 - 0
hua_wei_yun/10wms86-test.sh

@@ -0,0 +1,224 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/wms85std_test
+gitUrlArr=(
+  "www@git.yvanui.com:jztd/wms85std.git"
+  # "http://git.yvanui.com/jztd/wms85std.git"
+  "www@git.yvanui.com:lizhiwei/yvan-framework.git"
+  # "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+  "www@git.yvanui.com:luoyifan/yvan-ui.git"
+  # "http://git.yvanui.com/luoyifan/yvan-ui.git"
+)
+
+branchArr=(
+  "master"
+  "8.6"
+  "master"
+)
+positionArr=(
+  "."
+  "yvan-framework"
+  "yvan-ui"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+#  # 构建 yvan-ui
+#  if [ "${needBuild[0]}" != "0" ]; then
+#    echo -e "$echoPrefix cd $codePath/yvan-ui $echoSuffix"
+#    cd "$codePath/yvan-ui"
+#    echo -e "$echoPrefix yarn run init $echoSuffix"
+#    yarn run init
+#    # echo -e "$echoPrefix yarn run dev2 $echoSuffix"
+#    # yarn run dev2
+#    echo ""
+#  else
+#    echo "yvan-ui 文件未变化"
+#  fi
+#
+#  # 构建 wms-ui
+#  if [ "${needBuild[0]}" != "0" ]; then
+#    echo -e "$echoPrefix cd $codePath/wms-ui $echoSuffix"
+#    cd "$codePath/wms-ui"
+#    echo -e "$echoPrefix yarn $echoSuffix"
+#    yarn
+#    echo -e "$echoPrefix yarn link yvan-ui $echoSuffix"
+#    yarn link yvan-ui
+#    echo ""
+#  else
+#    echo "yvan-ui 文件未变化"
+#  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/wms85std_test/server.log
+dirPath=/home/www/deploy/wms85std_test/wms-modules/wms-system/build/libs/
+serverName=wms85std_test
+
+cmd=$1
+profiles=${2:-"test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms-system-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8005 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms-system-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8005 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  echo -e "$echoPrefix cd /home/www/deploy/wms85_sd_test/wms-ui/node_modules/yvan-ui $echoSuffix"
+  cd /home/www/deploy/wms85_sd_test/wms-ui/node_modules/yvan-ui
+  echo -e "$echoPrefix git pull $echoSuffix"
+  git pull
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# wms86测试
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/hua_wei_yun/10wms86-test.sh) [cmd profiles]

+ 222 - 0
hua_wei_yun/11kpi-admin.sh

@@ -0,0 +1,222 @@
+#!/bin/bash
+#set -x
+set -e
+
+codePath=/home/www/deploy/kpi_admin
+gitUrlArr=(
+  "http://git.galaxis.yvanui.com/lizw/kpi-admin.git"
+  # "http://git.galaxis.yvanui.com/lizw/kpi-admin.git"
+  "www@git.yvanui.com:lizhiwei/yvan-framework.git"
+  # "http://git.yvanui.com/lizhiwei/yvan-framework.git"
+  "www@git.yvanui.com:jztd/yvan-vue.git"
+  # "http://git.yvanui.com/jztd/yvan-vue.git"
+)
+
+branchArr=(
+  "master"
+  "8.5"
+  "master"
+)
+positionArr=(
+  "."
+  "yvan-framework"
+  "yvan-vue"
+)
+# 是否需要构建,-1:自动;0:不需要;1:需要
+needBuild=(
+"1"
+"1"
+"1"
+)
+
+echoPrefix="\033[36m+"
+echoSuffix="\033[0m"
+
+# 强制覆盖本地的代码 git fetch --all &&  git reset --hard origin/master
+isChange="1"                # 仓库是否发生变化,0:未变化;非0:变化
+pullCode() {
+  # Usage: pullCode "codePath" "gitUrl" "branch" "position"
+  path=$1                   # 代码保存路径
+  gitUrl=$2                 # git仓库地址
+  branch=${3:-"master"}     # git分支
+  position=${4:-""}         # 使用“.”clone到当前文件夹
+  isChange="1"
+  # 创建文件夹
+  if [ ! -d "$path" ]; then
+    echo -e "$echoPrefix 请检查服务器是否正确,再执行: mkdir -p $path $echoSuffix"
+    exit
+  fi
+
+  # git clone
+  echo -e "$echoPrefix cd $path $echoSuffix"
+  cd $path
+  if [ "`ls -A $path`" == "" ] || [ ! -d "$path/$position" ] || [ "`ls -A $path/$position`" = "" ]; then
+    echo -e "$echoPrefix git clone $gitUrl $position $echoSuffix"
+    git clone $gitUrl $position
+    isChange="2"
+  fi
+
+  # 进入文件夹,切换分支,git pull
+  if [ "$position" != "" ]; then
+    echo -e "$echoPrefix cd $position $echoSuffix"
+    cd $position
+  fi
+  echo -e "$echoPrefix git checkout $branch $echoSuffix"
+  git checkout $branch
+  echo -e "$echoPrefix git checkout . $echoSuffix"
+  git checkout .
+  echo -e "$echoPrefix git pull $echoSuffix"
+  if [ "`git pull`" == "Already up-to-date." ] && [ $isChange == "1" ]; then
+    isChange="0"
+  fi
+  echo ""
+}
+
+buildCode() {
+  # 构建 yvan-vue
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/yvan-vue $echoSuffix"
+    cd "$codePath/yvan-vue"
+    echo -e "$echoPrefix yarn run init $echoSuffix"
+    yarn run init
+    echo ""
+  else
+    echo "yvan-vue 文件未变化"
+  fi
+
+  # 构建 wms-ui-pc
+  if [ "${needBuild[0]}" != "0" ]; then
+    echo -e "$echoPrefix cd $codePath/wms-ui-pc $echoSuffix"
+    cd "$codePath/wms-ui-pc"
+    echo -e "$echoPrefix yarn $echoSuffix"
+    yarn
+    echo -e "$echoPrefix yarn link yvan-vue $echoSuffix"
+    yarn link yvan-vue
+    echo -e "$echoPrefix yarn run build $echoSuffix"
+    yarn run build
+    echo ""
+  else
+    echo "wms-ui-pc 文件未变化"
+  fi
+
+  # 构建 java
+  echo -e "$echoPrefix cd $codePath $echoSuffix"
+  cd $codePath
+  echo -e "$echoPrefix gradle build -x test $echoSuffix"
+  gradle build -x test
+  echo ""
+}
+
+logPath=/data/logs/kpi_admin/server.log
+dirPath=/home/www/deploy/kpi_admin/wms-modules/wms-system/build/libs/
+serverName=kpi_admin
+
+cmd=$1
+profiles=${2:-"test"}
+
+#-------------------------------------------------------------------
+JAVA_MEM_OPTS=" -DappName=${serverName} -server -Xmx2g -Xms2g"
+DATABASE_OPTS=" -Ddatabase.codeset=ISO-8859-1 -Ddatabase.logging=false"
+JAVA_OPTS_EXT=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
+#-------------------------------------------------------------------
+
+
+startServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo -e "$echoPrefix cd $dirPath../runtime/ $echoSuffix"
+    cd $dirPath../runtime/
+    echo -e "$echoPrefix java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms-system-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8111 >>/dev/null 2>&1 & $echoSuffix"
+    java $JAVA_MEM_OPTS $DATABASE_OPTS $JAVA_OPTS_EXT -jar ./wms-system-0.0.0-SNAPSHOT.jar --spring.profiles.active=global,$profiles --server.port=8111 >>/dev/null 2>&1 &
+    echo "$serverName 启动成功!"
+  else
+    echo "$serverName 正在运行..."
+  fi
+  echo "查看日志:  tail -F $logPath -n 100"
+}
+
+stopServer() {
+  pid=$1
+  if [ -z $pid ];then
+    echo "$serverName 未运行"
+  else
+    echo -e "$echoPrefix ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
+    ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}' | xargs kill
+    echo "$serverName 已停止!"
+  fi
+}
+
+deployPull() {
+  for ((idx=0; idx<${#gitUrlArr[@]}; idx++)); do
+    pullCode $codePath ${gitUrlArr[idx]} ${branchArr[idx]} ${positionArr[idx]}
+    if [ "${needBuild[idx]}" == "-1" ]; then
+      needBuild[idx]=$isChange
+    fi
+  done
+  echo "###--代码更新完成--------------------------------------------------------------------------###"
+  echo ""
+}
+
+deployServer() {
+  pid=$1
+  deployPull
+  buildCode
+  echo "###--代码构建完成--------------------------------------------------------------------------###"
+  # 重启服务
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 8s
+  fi
+  # 移动编译后的文件
+  echo -e "$echoPrefix cd $dirPath $echoSuffix"
+  cd $dirPath
+  echo -e "$echoPrefix rm -rf ../runtime $echoSuffix"
+  rm -rf ../runtime
+  echo -e "$echoPrefix cp -r ./ ../runtime $echoSuffix"
+  cp -r ./ ../runtime
+  echo ""
+  startServer
+}
+
+restartServer() {
+  pid=$1
+  if [ ! -z $pid ];then
+    stopServer $pid
+    sleep 3s
+  fi
+  startServer
+}
+
+logs() {
+  tail -F $logPath -n 100
+}
+
+pid=`ps -ef | grep "DappName=${serverName}" | grep -v 'grep' | awk '{print $2}'`
+# 操作参数: pull deploy restart start stop kill log logs
+if [ "$cmd" == "pull" ];then
+  deployPull
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  fi
+elif [ "$cmd" == "deploy" ];then
+  deployServer $pid
+elif [ "$cmd" == "restart" ];then
+  restartServer $pid
+elif [ "$cmd" == "start" ];then
+  startServer $pid
+elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
+  stopServer $pid
+elif [ "$cmd" == "log" ] || [ "$cmd" == "logs" ];then
+  logs
+else
+  if [ -z $pid ];then
+    echo "$serverName 未运行 | 输入操作参数: pull deploy restart start stop kill log logs"
+  else
+    echo "输入操作参数: pull deploy restart start stop kill log logs"
+    echo "pid=$pid | $serverName 正在运行... | 查看日志: tail -F $logPath -n 100"
+  fi
+fi
+
+# kpi-admin测试
+# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/hua_wei_yun/11kpi-admin.sh) [cmd profiles]
+#nohup node server.js  >>/dev/null 2>&1 &

+ 0 - 0
hua_wei_yun/12wms86-sd-test.sh


Some files were not shown because too many files changed in this diff