Bläddra i källkod

fix findRunningLigth bug

xiewenjie 3 år sedan
förälder
incheckning
3aa16c464d

+ 17 - 4
startJar.sh

@@ -31,7 +31,6 @@ checkEnv(){
 
 # 判断当前服务是否已经启动的函数
 is_exist(){
-    echo "执行 is_exist 方法"
     checkEnv $1
     pid=`ps -ef|grep $APP_NAME|grep -v grep|awk '{print $2}' ` #根据ps 命令查询当前服务的进程号 赋值给pid"
     if [ -z "${pid}" ]; then #判断pid是否为空
@@ -83,9 +82,23 @@ status(){
 
 # 重启命令其实就是先执行关闭命令 再执行重启命令
 restart(){
-    stop $1
-    sleep 1s
-    start $1
+        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 -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=${APP_DEBUG} $APP_NAME > logs.log 2>error.log &  # 说明pid为空 执行java -jar 命令启动服务
+            echo "${APP_NAME} started启动"
+        fi
 }
 
 

+ 1 - 0
sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/SceneStyleController.java

@@ -307,6 +307,7 @@ public class SceneStyleController extends BaseController {
         }
         LambdaQueryWrapper<SceneLightEntity> wrapper1 = Wrappers.lambdaQuery();
         wrapper1.eq(SceneLightEntity::getSceneStyleId, sceneStyleEntity.getId())
+                .eq(SceneLightEntity::getStatus, 0)
                 .orderByDesc(SceneLightEntity::getId);
         List<SceneLightEntity> lightEntityList = sceneLightService.list(wrapper1);
         SceneLightEntity sceneLightEntity = null;