From fabd08d87d00bfdf1aacf473fd905fdd3c903ed3 Mon Sep 17 00:00:00 2001
From: songhuangfeng123 <shf18767906695@163.com>
Date: 星期五, 02 九月 2022 10:10:14 +0800
Subject: [PATCH] Merge branches 'genchuang' and 'master' of https://sinanoaq.cn:8888/r/safePlatform-out into genchuang

---
 safePlatfrom-out-web/src/main/resources/config/application-uat.yaml                                                     |    9 ++
 safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/LoginController.java                         |    2 
 incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/schedule/KeepAliveRobot.java |   27 ++++++
 safePlatfrom-out-web/src/main/resources/config/application-dev.yaml                                                     |   11 ++
 safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/RoleController.java                          |    6 
 safePlatfrom-out-web/src/main/resources/config/application-out-dev.yaml                                                 |    9 ++
 safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/MenuController.java                          |    6 
 safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/DepartmentController.java                    |    6 
 safePlatfrom-out-web/src/main/resources/config/application-guotai-uat.yaml                                              |   11 ++
 emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/schedule/KeepAliveRobot.java                  |   27 ++++++
 safePlatfrom-out-web/src/main/resources/config/application-guotai-demo.yaml                                             |   11 ++
 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/schedule/KeepAliveRobot.java                  |   27 ++++++
 safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/DruidConfig.java                               |   16 ++--
 goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/schedule/KeepAliveRobot.java             |   27 ++++++
 safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/UserController.java                          |   14 +-
 safePlatfrom-out-web/src/main/resources/config/application-test.yaml                                                    |    9 ++
 16 files changed, 191 insertions(+), 27 deletions(-)

diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/schedule/KeepAliveRobot.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/schedule/KeepAliveRobot.java
new file mode 100644
index 0000000..dedd0dc
--- /dev/null
+++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/schedule/KeepAliveRobot.java
@@ -0,0 +1,27 @@
+package com.gkhy.safePlatform.emergency.schedule;
+
+import com.gkhy.safePlatform.emergency.service.baseService.EmergencyPlanInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+
+@Component("emergencyKeepAlive")
+@EnableScheduling
+@ConditionalOnProperty(prefix = "threadPool.scheduling", name = "enabled", havingValue = "true")
+public class KeepAliveRobot {
+
+    @Autowired
+    private EmergencyPlanInfoService emergencyPlanInfoService;
+
+    // 30m
+    @Scheduled(cron = "0 0/30 * * * ?")
+    public void keepAlive(){
+        //
+        emergencyPlanInfoService.getById(-1L);
+
+    }
+
+}
diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/schedule/KeepAliveRobot.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/schedule/KeepAliveRobot.java
new file mode 100644
index 0000000..15470e3
--- /dev/null
+++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/schedule/KeepAliveRobot.java
@@ -0,0 +1,27 @@
+package com.gkhy.safePlatform.equipment.schedule;
+
+import com.gkhy.safePlatform.equipment.service.EquipmentInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+
+@Component("equipmentKeepAlive")
+@EnableScheduling
+@ConditionalOnProperty(prefix = "threadPool.scheduling", name = "enabled", havingValue = "true")
+public class KeepAliveRobot {
+
+    @Autowired
+    private EquipmentInfoService equipmentInfoService;
+
+    // 30m
+    @Scheduled(cron = "0 0/30 * * * ?")
+    public void keepAlive(){
+        //
+        equipmentInfoService.getById(-1L);
+
+    }
+
+}
diff --git a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/schedule/KeepAliveRobot.java b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/schedule/KeepAliveRobot.java
new file mode 100644
index 0000000..7e457f0
--- /dev/null
+++ b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/schedule/KeepAliveRobot.java
@@ -0,0 +1,27 @@
+package com.gkhy.safePlatform.targetDuty.schedule;
+
+import com.gkhy.safePlatform.targetDuty.service.TargetTypeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+
+@Component("goalKeepAlive")
+@EnableScheduling
+@ConditionalOnProperty(prefix = "threadPool.scheduling", name = "enabled", havingValue = "true")
+public class KeepAliveRobot {
+
+    @Autowired
+    private TargetTypeService targetTypeService;
+
+    // 30m
+    @Scheduled(cron = "0 0/30 * * * ?")
+    public void keepAlive(){
+        //
+        targetTypeService.getById(-1L);
+
+    }
+
+}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/schedule/KeepAliveRobot.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/schedule/KeepAliveRobot.java
new file mode 100644
index 0000000..8a7f560
--- /dev/null
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/schedule/KeepAliveRobot.java
@@ -0,0 +1,27 @@
+package com.gkhy.safePlatform.incidentManage.schedule;
+
+import com.gkhy.safePlatform.incidentManage.service.baseService.AccidentCaseInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+
+@Component("incidentKeepAlive")
+@EnableScheduling
+@ConditionalOnProperty(prefix = "threadPool.scheduling", name = "enabled", havingValue = "true")
+public class KeepAliveRobot {
+
+    @Autowired
+    private AccidentCaseInfoService accidentCaseInfoService;
+
+    // 30m
+    @Scheduled(cron = "0 0/30 * * * ?")
+    public void keepAlive(){
+        //
+        accidentCaseInfoService.getById(-1L);
+
+    }
+
+}
diff --git a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/DepartmentController.java b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/DepartmentController.java
index b44713c..f045906 100644
--- a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/DepartmentController.java
+++ b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/DepartmentController.java
@@ -37,14 +37,14 @@
     @RequestMapping(value = "/add", method = RequestMethod.POST)
     public ResultVO<String> addDepartment(Authentication authentication, @RequestBody DepAddRPCReqDTO depAddRPCReqDTO) {
         ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
-        return accountDepartmentService.addDep(currentUser.getUid(), depAddRPCReqDTO);
+        return accountDepartmentService.addDep(currentUser, depAddRPCReqDTO);
     }
 
 
     @RequestMapping(value = "/mod", method = RequestMethod.POST)
     public ResultVO<String> addDepartment(Authentication authentication, @RequestBody DepModRPCReqDTO depModRPCReqDTO) {
         ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
-        return accountDepartmentService.modDep(currentUser.getUid(), depModRPCReqDTO);
+        return accountDepartmentService.modDep(currentUser, depModRPCReqDTO);
     }
 
 
@@ -52,7 +52,7 @@
     public ResultVO<String> addDepartment(Authentication authentication, @RequestBody JSONObject json) {
         ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
         Long depId = json.getLong("depId");
-        return accountDepartmentService.delDep(currentUser.getUid(), depId);
+        return accountDepartmentService.delDep(currentUser, depId);
     }
 
 
diff --git a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/LoginController.java b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/LoginController.java
index c7b3ca3..1abbf63 100644
--- a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/LoginController.java
+++ b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/LoginController.java
@@ -34,6 +34,6 @@
     @RequestMapping("/menu")
     public ResultVO<List<MenuRPCRespDTO>> getMenu(Authentication authentication, Long projectId){
         ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
-        return accountAuthService.getMenu(currentUser.getUid(), projectId);
+        return accountAuthService.getMenu(currentUser, projectId);
     }
 }
diff --git a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/MenuController.java b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/MenuController.java
index 4db9b5f..ac7892f 100644
--- a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/MenuController.java
+++ b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/MenuController.java
@@ -30,7 +30,7 @@
     @RequestMapping(value = "/add",method = RequestMethod.POST)
     public ResultVO<String> addMenu(Authentication authentication, @RequestBody MenuAddRPCReqDTO menuAddDto) {
         ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
-        return accountMenuService.addMenu(currentUser.getUid(), menuAddDto);
+        return accountMenuService.addMenu(currentUser, menuAddDto);
     }
 
 
@@ -40,7 +40,7 @@
     @RequestMapping(value = "/mod",method = RequestMethod.POST)
     public ResultVO<String> addMenu(Authentication authentication, @RequestBody MenuModRPCReqDTO menuModDto) {
         ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
-        return accountMenuService.modMenu(currentUser.getUid(), menuModDto);
+        return accountMenuService.modMenu(currentUser, menuModDto);
     }
 
 
@@ -51,7 +51,7 @@
     public ResultVO<String> delMenu(Authentication authentication,@RequestBody JSONObject json ) {
         ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
         Long id = json.getLong("id");
-        return accountMenuService.delMenu(currentUser.getUid(), id);
+        return accountMenuService.delMenu(currentUser, id);
     }
 
 }
diff --git a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/RoleController.java b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/RoleController.java
index 34ff3cd..739e029 100644
--- a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/RoleController.java
+++ b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/RoleController.java
@@ -42,7 +42,7 @@
     @RequestMapping(value = "/add",method = RequestMethod.POST)
     public ResultVO<String> addRole(Authentication authentication, RoleAddRPCReqDTO roleAddRPCReqDTO){
         ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
-        return accountRoleService.addRole(currentUser.getUid(),roleAddRPCReqDTO);
+        return accountRoleService.addRole(currentUser,roleAddRPCReqDTO);
     }
 
 
@@ -50,7 +50,7 @@
     @RequestMapping(value = "/mod",method = RequestMethod.POST)
     public ResultVO<String> modRole(Authentication authentication, RoleModRPCReqDTO roleModRPCReqDTO){
         ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
-        return accountRoleService.modRole(currentUser.getUid(),roleModRPCReqDTO);
+        return accountRoleService.modRole(currentUser,roleModRPCReqDTO);
     }
 
 
@@ -58,6 +58,6 @@
     public ResultVO<String> modRole(Authentication authentication, JSONObject json){
         ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
         Long depId = json.getLong("depId");
-        return accountRoleService.delRole(currentUser.getUid(),depId);
+        return accountRoleService.delRole(currentUser,depId);
     }
 }
diff --git a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/UserController.java b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/UserController.java
index 1573723..af1e7c5 100644
--- a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/UserController.java
+++ b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/UserController.java
@@ -67,7 +67,7 @@
     @PreAuthorize("hasRole('ROLE_admin')")
     public ResultVO<String> addUser(Authentication authentication, @RequestBody AccountAddRPCReqDTO accountAddRPCReqDTO) {
         ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
-        return  accountUserService.addAccount(currentUser.getUid(), accountAddRPCReqDTO);
+        return  accountUserService.addAccount(currentUser, accountAddRPCReqDTO);
     }
 
 
@@ -77,9 +77,9 @@
 
     @RequestMapping(value = "/mod", method = RequestMethod.POST)
     @PreAuthorize("hasRole('ROLE_admin')")
-    public ResultVO<String> modUser(Principal principal, @RequestBody AccountModRPCReqDTO accountModRPCReqDTO) {
-        String userId = principal.getName();
-        return accountUserService.modAccount(Long.valueOf(userId), accountModRPCReqDTO);
+    public ResultVO<String> modUser(Authentication authentication, @RequestBody AccountModRPCReqDTO accountModRPCReqDTO) {
+        ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
+        return accountUserService.modAccount(currentUser, accountModRPCReqDTO);
     }
 
 
@@ -88,9 +88,9 @@
      */
     @RequestMapping(value = "/del", method = RequestMethod.POST)
     @PreAuthorize("hasRole('ROLE_admin')")
-    public ResultVO<String> delUser(Principal principal, @RequestBody JSONObject json) {
+    public ResultVO<String> delUser(Authentication authentication, @RequestBody JSONObject json) {
         Long uid = json.getLong("uid");
-        String userId = principal.getName();
-        return accountUserService.delAccount(Long.valueOf(userId), uid);
+        ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
+        return accountUserService.delAccount(currentUser, uid);
     }
 }
diff --git a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/DruidConfig.java b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/DruidConfig.java
index ddd6d43..4b7e3c5 100644
--- a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/DruidConfig.java
+++ b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/DruidConfig.java
@@ -46,8 +46,8 @@
         ds.setUniqueResourceName("goalmanage");
         ds.setPoolSize(2);
         ds.setXaProperties(prop);
-        ds.setMaxIdleTime(3600000);
-        ds.setMaxLifetime(3000000);
+        ds.setMaxIdleTime(3600);
+        ds.setMaxLifetime(3000);
         return ds;
 
     }
@@ -64,8 +64,8 @@
         ds.setUniqueResourceName("emergency");
         ds.setPoolSize(2);
         ds.setXaProperties(prop);
-        ds.setMaxIdleTime(3600000);
-        ds.setMaxLifetime(3000000);
+        ds.setMaxIdleTime(3600);
+        ds.setMaxLifetime(3000);
         return ds;
     }
 
@@ -80,8 +80,8 @@
         ds.setUniqueResourceName("incidentmanage");
         ds.setPoolSize(2);
         ds.setXaProperties(prop);
-        ds.setMaxIdleTime(3600000);
-        ds.setMaxLifetime(3000000);
+        ds.setMaxIdleTime(3600);
+        ds.setMaxLifetime(3000);
         return ds;
     }
 
@@ -96,8 +96,8 @@
         ds.setUniqueResourceName("equipment");
         ds.setPoolSize(2);
         ds.setXaProperties(prop);
-        ds.setMaxIdleTime(3600000);
-        ds.setMaxLifetime(3000000);
+        ds.setMaxIdleTime(3600);
+        ds.setMaxLifetime(3000);
         return ds;
     }
 
diff --git a/safePlatfrom-out-web/src/main/resources/config/application-dev.yaml b/safePlatfrom-out-web/src/main/resources/config/application-dev.yaml
index f7b67cb..0023719 100644
--- a/safePlatfrom-out-web/src/main/resources/config/application-dev.yaml
+++ b/safePlatfrom-out-web/src/main/resources/config/application-dev.yaml
@@ -88,6 +88,17 @@
     # 取消服务启动检查
     check: false
 
+#线程池配置
+threadPool:
+  corePoolSize: 20
+  maxPoolSize: 20
+  queueCapacity: 10000
+  scheduling:
+    #控制线程是否执行 true:执行;false:不执行
+    enabled: true
+#    enabled: false
+
+
 rocketmq:
   name-server: 192.168.0.52:9876
   producer:
diff --git a/safePlatfrom-out-web/src/main/resources/config/application-guotai-demo.yaml b/safePlatfrom-out-web/src/main/resources/config/application-guotai-demo.yaml
index 5514888..509f3cc 100644
--- a/safePlatfrom-out-web/src/main/resources/config/application-guotai-demo.yaml
+++ b/safePlatfrom-out-web/src/main/resources/config/application-guotai-demo.yaml
@@ -100,6 +100,15 @@
     # 取消服务启动检查
     check: false
 
+threadPool:
+  corePoolSize: 20
+  maxPoolSize: 20
+  queueCapacity: 10000
+  scheduling:
+    #控制线程是否执行 true:执行;false:不执行
+    enabled: true
+#    enabled: false
+
 rocketmq:
   name-server: 192.168.30.107:9876
   producer:
@@ -116,7 +125,7 @@
   accessKey: QR0J7S55SZO8QI1TC2AD
   secretKey: X0oSBT7vRqYWU41Ut21B+FU7G5A87BzPIRdObGjK
   secure: false
-  bucketName: safeplatform-dev
+  bucketName: safeplatform-demo
   urlPrefix: http://121.239.169.27/file
   #用户名 gkhy_team_out_dev
   #密码 12345678
diff --git a/safePlatfrom-out-web/src/main/resources/config/application-guotai-uat.yaml b/safePlatfrom-out-web/src/main/resources/config/application-guotai-uat.yaml
index 67dd53f..ec399cb 100644
--- a/safePlatfrom-out-web/src/main/resources/config/application-guotai-uat.yaml
+++ b/safePlatfrom-out-web/src/main/resources/config/application-guotai-uat.yaml
@@ -100,6 +100,15 @@
     # 取消服务启动检查
     check: false
 
+threadPool:
+  corePoolSize: 20
+  maxPoolSize: 20
+  queueCapacity: 10000
+  scheduling:
+    #控制线程是否执行 true:执行;false:不执行
+    enabled: true
+#    enabled: false
+
 rocketmq:
   name-server: 192.168.30.107:9876
   producer:
@@ -116,7 +125,7 @@
   accessKey: QR0J7S55SZO8QI1TC2AD
   secretKey: X0oSBT7vRqYWU41Ut21B+FU7G5A87BzPIRdObGjK
   secure: false
-  bucketName: safeplatform-dev
+  bucketName: safeplatform-guotai-uat
   urlPrefix: http://121.239.169.27/file
   #用户名 gkhy_team_out_dev
   #密码 12345678
diff --git a/safePlatfrom-out-web/src/main/resources/config/application-out-dev.yaml b/safePlatfrom-out-web/src/main/resources/config/application-out-dev.yaml
index fb29ea5..0774f7e 100644
--- a/safePlatfrom-out-web/src/main/resources/config/application-out-dev.yaml
+++ b/safePlatfrom-out-web/src/main/resources/config/application-out-dev.yaml
@@ -96,6 +96,15 @@
     # 取消服务启动检查
     check: false
 
+threadPool:
+  corePoolSize: 20
+  maxPoolSize: 20
+  queueCapacity: 10000
+  scheduling:
+    #控制线程是否执行 true:执行;false:不执行
+    enabled: true
+#    enabled: false
+
 rocketmq:
   name-server: 192.168.0.52:9876
   producer:
diff --git a/safePlatfrom-out-web/src/main/resources/config/application-test.yaml b/safePlatfrom-out-web/src/main/resources/config/application-test.yaml
index fd584a8..feec198 100644
--- a/safePlatfrom-out-web/src/main/resources/config/application-test.yaml
+++ b/safePlatfrom-out-web/src/main/resources/config/application-test.yaml
@@ -101,6 +101,15 @@
     # 取消服务启动检查
     check: false
 
+threadPool:
+  corePoolSize: 20
+  maxPoolSize: 20
+  queueCapacity: 10000
+  scheduling:
+    #控制线程是否执行 true:执行;false:不执行
+    enabled: true
+#    enabled: false
+
 rocketmq:
   name-server: 192.168.0.52:9876
   producer:
diff --git a/safePlatfrom-out-web/src/main/resources/config/application-uat.yaml b/safePlatfrom-out-web/src/main/resources/config/application-uat.yaml
index 8ff7b40..715fa3b 100644
--- a/safePlatfrom-out-web/src/main/resources/config/application-uat.yaml
+++ b/safePlatfrom-out-web/src/main/resources/config/application-uat.yaml
@@ -101,6 +101,15 @@
     # 取消服务启动检查
     check: false
 
+threadPool:
+  corePoolSize: 20
+  maxPoolSize: 20
+  queueCapacity: 10000
+  scheduling:
+    #控制线程是否执行 true:执行;false:不执行
+    enabled: true
+#    enabled: false
+
 rocketmq:
   name-server: 192.168.0.52:9876
   producer:

--
Gitblit v1.9.2