Quellcode durchsuchen

测试自动部署

wuweihao vor 3 Jahren
Ursprung
Commit
5390eb13d0

+ 2 - 0
gis_admin/src/main/java/com/gis/admin/entity/po/WxUserEntity.java

@@ -1,5 +1,6 @@
 package com.gis.admin.entity.po;
 
+import com.alibaba.fastjson.annotation.JSONField;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.gis.common.base.entity.po.BaseEntity;
@@ -18,6 +19,7 @@ public class WxUserEntity extends BaseEntity implements Serializable {
 
     private static final long serialVersionUID = 6579514266481957242L;
 
+    @JSONField(serialize = false)
     @ApiModelProperty(value = "微信唯一识别码")
     private String openId;
 

+ 9 - 3
gis_application/src/main/resources/application-sit.properties

@@ -70,13 +70,19 @@ swagger.version=1.0
 
 # \u5FAE\u4FE1\u5C0F\u7A0B\u5E8F
 #\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F\u7684appid
-wx.miniapp.configs.appid=wx3047d1704b092c5e
-#\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F\u7684Secret
-wx.miniapp.configs.secret=0173b22d521cfa8b15a68ec795e4c52d
+#wx.miniapp.configs.appid=wx3047d1704b092c5e
+##\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F\u7684Secret
+#wx.miniapp.configs.secret=0173b22d521cfa8b15a68ec795e4c52d
 wx.miniapp.configs.token=\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F\u6D88\u606F\u670D\u52A1\u5668\u914D\u7F6E\u7684token
 wx.miniapp.configs.aesKey=\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F\u6D88\u606F\u670D\u52A1\u5668\u914D\u7F6E\u7684EncodingAESKey
 wx.miniapp.configs.msgDataFormat=JSON
 
+# \u770B\u5C55-\u56DB\u7EF4\u770B\u770B
+#\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F\u7684appid
+wx.miniapp.configs.appid=wxb4c0527aa20a6e9a
+#\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F\u7684Secret
+wx.miniapp.configs.secret=4a1b8439cf38ec2e1a992ff23eb31628
+
 
 
 

BIN
gis_application/src/main/resources/data/律道四期题目内容220411.xlsx


+ 11 - 10
gis_cms/src/main/java/com/gis/cms/service/impl/QuestionServiceImpl.java

@@ -110,6 +110,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, QuestionEnt
 
     /**
      * 解决excel数据并保存数据库
+     * 注意日期格式要在转换成文本
      *
      * @param filePath 相对路径
      * @return
@@ -119,13 +120,15 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, QuestionEnt
         String excelPath = configConstant.serverBasePath + filePath;
         // 读取每一行
         List<List<Object>> rows = ExcelUtils.readExcel(excelPath);
+        int rowSize = rows.size();
+        log.info("共{}题", rowSize);
         QuestionEntity question ;
 
         List<String> standard = Arrays.asList("A", "B", "C", "D");
 
 
         ArrayList<QuestionEntity> result = new ArrayList<>();
-        for (int i = 1; i < rows.size(); i++) {
+        for (int i = 1; i < rowSize; i++) {
             question = new QuestionEntity();
             List<Object> row = rows.get(i);
 
@@ -136,6 +139,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, QuestionEnt
                 log.error(errorMsg);
                 BaseRuntimeException.getExc(null, errorMsg);
             }
+
             JSONObject answerMapper = answerMapper(row, correct);
             // 加密后的正确答案
             String correctStr = answerMapper.getString("correct");
@@ -148,7 +152,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, QuestionEnt
             question.setCorrect(correctStr);
             question.setAnswer(answerMapper.toJSONString());
             result.add(question);
-
+            log.info("执行第 {} 行完成", i);
         }
         log.info("excel数据解析完成");
         return result;
@@ -165,14 +169,11 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, QuestionEnt
         baseMap.put("D",  RandomUtil.randomString(8));
 
         JSONObject answerMap = new JSONObject();
-        String answerA = (String)row.get(4);
-        String answerB = (String)row.get(5);
-        String answerC = (String)row.get(6);
-        String answerD = (String)row.get(7);
-        answerMap.put(baseMap.getString("A"), answerA);
-        answerMap.put(baseMap.getString("B"), answerB);
-        answerMap.put(baseMap.getString("C"), answerC);
-        answerMap.put(baseMap.getString("D"), answerD);
+
+        answerMap.put(baseMap.getString("A"), row.get(4));
+        answerMap.put(baseMap.getString("B"), row.get(5));
+        answerMap.put(baseMap.getString("C"), row.get(6));
+        answerMap.put(baseMap.getString("D"), row.get(7));
         answerMap.put("correct", baseMap.get(correct));
         return answerMap;
     }

+ 72 - 0
run.sh

@@ -0,0 +1,72 @@
+#!/bin/sh
+APP_NAME=wx_lvdao.jar
+APP_PORT=8015
+APP_EVN=$2   #执行环境
+APP_ORDER=$1   #执行方法  start|stop|restart
+APP_OS=linux  # 系统类型 linux|win
+# 获取线程号
+APP_PID=`netstat -ano | grep $APP_PORT | grep LISTENING | awk '{print $5}'`
+
+
+# 启动命令
+startApp(){
+    if [ ${APP_PID} ];
+    then
+    	echo "程序已经在运行了"
+    else
+    	echo "执行 start 方法"
+    	nohup java -Djava.net.preferIPv4Stack=true -jar -Xmx3072M -Xms512M ./$APP_NAME --spring.profiles.active=$APP_EVN --server.port=$APP_PORT & echo $! > tpid
+	echo Start Success!
+fi
+}
+
+# 停止命令
+stopApp(){
+    echo "执行 stop 方法"
+    if [ ${APP_PID} ]; 
+	then
+		echo $APP_NAME "存在,执行 stop 方法"
+		if [ ${APP_OS} == "linux" ];
+		then
+			kill -9 ${APP_PID} && echo 'Linux Kill Process!'
+		else
+			cmd "/C TASKKILL /F /PID $APP_PID"
+			echo 'Win Kill Process!'
+		fi
+	else
+		echo $APP_NAME 没有运行
+    fi
+}
+
+# 重启命令
+restartApp(){
+    echo " 1 执行 restart 方法"
+	stopApp
+	APP_PID=''  #将进程号置空
+	sleep 2
+	echo "进程号:" ${APP_PID} 
+	echo " 2 执行 restart 方法"
+	startApp
+}
+
+# 判断执行命令 取第一个参数
+case $APP_ORDER in
+    "start")
+        startApp
+		exit 0
+        ;;
+    "stop")
+        stopApp
+		exit 1
+        ;;
+	"restart")
+		restartApp
+		exit 2
+	;;
+    *)
+     echo "Unknown inupt!"
+     exit 3
+     ;;
+esac
+
+

+ 0 - 123
startJar.sh

@@ -1,123 +0,0 @@
-APP_NAME=wx_lvdao.jar # 应用名称
-APP_PORT=8015    #应用端口
-
-usage() {
-    echo "case: sh run.sh [start|stop|restart|status]"
-    echo "请类似这样执行 ./*.sh start   or  ./*sh restart"
-    exit 1
-}
-
-checkEnv(){
-      if [ -z "${APP_NAME}" ] || [ -z "${APP_DEBUG}" ]; then #判断pid是否为空
-           if [[ $1 = 'pro' ]];   then
-                        echo "pro start"
-                        #APP_NAME=changeing-prod.jar
-                        #APP_DEBUG=5526
-                      elif  [[ $1 = 'sit' ]] ; then
-                        echo "sit start"
-                        #APP_NAME=changeing-uat.jar
-                        #APP_DEBUG=5520
-                      elif  [[ $1 = 'uat' ]] ; then
-                        echo "uat start"
-                        #APP_NAME=changeing-devuat.jar
-                        #APP_DEBUG=5526
-                      else
-                        echo "没有设置环境"
-            fi
-     # else
-         #    echo "已经设置-${APP_NAME}-${APP_DEBUG}"
-     fi
-}
-
-# 判断当前服务是否已经启动的函数
-is_exist(){
-    checkEnv $1
-    pid=`ps -ef|grep $APP_NAME|grep -v grep|awk '{print $2}' ` #根据ps 命令查询当前服务的进程号 赋值给pid"
-    if [ -z "${pid}" ]; then #判断pid是否为空
-        echo "pid 不存在"
-        return 1
-    else
-        echo "pid 存在"
-        return 0
-    fi
-}
-
-
-start(){
-    checkEnv $1
-    is_exist
-    if [ $? -eq "0" ]; then    # [$? -eq "0"] 说明pid不等于空 说明服务正在运行中,将进程号打印出来
-        echo "${APP_NAME} running. pid=${pid}"
-    else
-        nohup java -jar -Xmx3072M -Xms512M ./$APP_NAME --spring.profiles.active=$1 --server.port=$APP_PORT > logs.log 2>error.log &  # 说明pid为空
-        # 执行java -jar 命令启动服务
-        echo "${APP_NAME} started启动"
-    fi
-}
-
-
-stop(){
-    echo "执行 stop 方法"
-    checkEnv $1
-    is_exist
-    if [ $? -eq "0" ]; then    # [$? -eq "0"] 说明pid不等于空 说明服务正在运行中,将进程号杀死
-        kill -9 $pid
-        echo "${pid} stopped-停止"
-    else
-        echo "${APP_NAME} 没有运行"
-    fi
-}
-
-
-status(){
-    echo "执行 status 方法"
-    checkEnv $1
-    is_exist
-    if [ $? -eq "0" ]; then
-        echo "${APP_NAME} running-启动. Pid is ${pid}"
-    else
-        echo "${APP_NAME} 没有运行"
-    fi
-}
-
-
-# 重启命令其实就是先执行关闭命令 再执行重启命令
-restart(){
-        echo "执行 restart 方法"
-        checkEnv $1
-        is_exist
-        if [ $? -eq "0" ]; then    # [$? -eq "0"] 说明pid不等于空 说明服务正在运行中,将进程号杀死
-            kill -9 $pid
-            echo "${pid} stopped-停止"
-        else
-            echo "${APP_NAME} 没有运行"
-        fi
-        sleep 5
-        is_exist
-        if [ $? -eq "0" ]; then    # [$? -eq "0"] 说明pid不等于空 说明服务正在运行中,将进程号打印出来
-            echo "${APP_NAME} running. pid=${pid}"
-        else
-            nohup java -jar -Xmx3072M -Xms512M ./$APP_NAME --spring.profiles.active=$1 --server.port=$APP_PORT > logs.log 2>error.log &  # 说明pid为空
-            echo "${APP_NAME} started启动"
-        fi
-}
-
-
-# 这里的$1 取的是当前输入命令 的第二个参数 ./start.sh start
-case "$1" in
-    "start")
-        start $2
-        ;;
-    "stop")
-        stop $2
-        ;;
-    "status")
-        status $2
-        ;;
-    "restart")
-        restart $2
-        ;;
-    *)
-    usage
-    ;;
-esac