Browse Source

Merge branch 'master' of http://116.63.33.55/git/dt2

yhd 3 years ago
parent
commit
3140e0a3da

+ 5 - 1
spring-cloud/configer/src/main/resources/config/dev/basic-dev.yml

@@ -27,4 +27,8 @@ mybatis:
 
 web:
   file: D:/files
-  rootPath: uploadFiles
+  rootPath: uploadFiles
+
+contrl:
+  # 设置连接超时,单位:毫秒
+  connection-timeout: 5000

+ 4 - 3
spring-cloud/configer/src/main/resources/config/dev/gateway-dev.yml

@@ -87,7 +87,7 @@ filter:
     /AttackEvent/getAttackEventByInfo,/AttackType/getAttackTypeByMonth,/SystemAttacked/getSystemAttackedByInfo,/businessSystem/getSystemInfoByVoiceKeyword,\
     /safetyInfor/getWebSafetyStatusByOrg,/OfficeVirus/getOfficeSafetyInfo,/GuaranteeGroup/getAllGuaranteeGroup,/monitoringResources/getMonitorListByName,/monitoringResources/creatRelay,\
     /monitoringResources/closeAllRelay,/monitoringResources/getStreamForKaiKang,/SystemRisk/GetSystemRiskList,/SystemRisk/getSysInfoByOffice,/flat/door/personRegister,/flat/sendMessage,/businessSystem/getSystemInfoByShow,\
-    /commandTranscription/insertCommandTranscription"
+    /commandTranscription/insertCommandTranscription,/safetyInfor/analysisWebSafetyInfo,/safetyInfor/analysisSafetyStatus"
 
   # 不需要过参数过滤器的uri
   parameter:
@@ -100,7 +100,8 @@ filter:
     /safetyInfor/getRiskInfoByOrg,/safetyInfor/getSysStatusByOrg,/SystemRisk/getHighStatus,/SystemRisk/getHighStatusByMonth,\
     /AttackEvent/getAttackEventByInfo,/AttackType/getAttackTypeByMonth,/SystemAttacked/getSystemAttackedByInfo,/businessSystem/getSystemInfoByVoiceKeyword,\
     /safetyInfor/getWebSafetyStatusByOrg,/OfficeVirus/getOfficeSafetyInfo,/GuaranteeGroup/getAllGuaranteeGroup,/monitoringResources/getMonitorListByName,/monitoringResources/creatRelay,/monitoringResources/closeAllRelay,\
-    /SystemRisk/GetSystemRiskList,/SystemRisk/getSysInfoByOffice,/monitoringResources/getStreamForKaiKang,/businessSystem/getSystemInfoByShow"
+    /SystemRisk/GetSystemRiskList,/SystemRisk/getSysInfoByOffice,/monitoringResources/getStreamForKaiKang,/businessSystem/getSystemInfoByShow,\
+    /safetyInfor/analysisWebSafetyInfo,/safetyInfor/analysisSafetyStatus"
 
   # 不需要过返回封装过滤器的uri
   response:
@@ -114,7 +115,7 @@ filter:
     /AttackEvent/getAttackEventByInfo,/AttackType/getAttackTypeByMonth,/SystemAttacked/getSystemAttackedByInfo,/businessSystem/getSystemInfoByVoiceKeyword,\
     /safetyInfor/getWebSafetyStatusByOrg,/OfficeVirus/getOfficeSafetyInfo,/GuaranteeGroup/getAllGuaranteeGroup,/monitoringResources/getMonitorListByName,/monitoringResources/creatRelay,/monitoringResources/closeAllRelay,\
     /SystemRisk/GetSystemRiskList,/SystemRisk/getSysInfoByOffice,/monitoringResources/getStreamForKaiKang,/flat/door/personRegister,/flat/sendMessage,/businessSystem/getSystemInfoByShow,\
-    /commandTranscription/insertCommandTranscription"
+    /commandTranscription/insertCommandTranscription,/safetyInfor/analysisWebSafetyInfo,/safetyInfor/analysisSafetyStatus"
 
   # 登录接口
   login:

+ 5 - 1
spring-cloud/configer/src/main/resources/config/prod/basic-prod.yml

@@ -26,4 +26,8 @@ mybatis:
 
 web:
   file: D:/files
-  rootPath: uploadFiles
+  rootPath: uploadFiles
+
+contrl:
+  # 设置连接超时,单位:毫秒
+  connection-timeout: 5000

+ 6 - 3
spring-cloud/configer/src/main/resources/config/prod/gateway-prod.yml

@@ -86,7 +86,8 @@ filter:
     /safetyInfor/getRiskInfoByOrg,/safetyInfor/getSysStatusByOrg,/SystemRisk/getHighStatus,/SystemRisk/getHighStatusByMonth,\
     /AttackEvent/getAttackEventByInfo,/AttackType/getAttackTypeByMonth,/SystemAttacked/getSystemAttackedByInfo,/businessSystem/getSystemInfoByVoiceKeyword,\
     /safetyInfor/getWebSafetyStatusByOrg,/OfficeVirus/getOfficeSafetyInfo,/GuaranteeGroup/getAllGuaranteeGroup,/monitoringResources/getMonitorListByName,/monitoringResources/creatRelay,\
-    /monitoringResources/closeAllRelay,/monitoringResources/getStreamForKaiKang,/SystemRisk/GetSystemRiskList,/SystemRisk/getSysInfoByOffice,/flat/door/personRegister,/flat/sendMessage,/businessSystem/getSystemInfoByShow"
+    /monitoringResources/closeAllRelay,/monitoringResources/getStreamForKaiKang,/SystemRisk/GetSystemRiskList,/SystemRisk/getSysInfoByOffice,/flat/door/personRegister,/flat/sendMessage,/businessSystem/getSystemInfoByShow,\
+    /safetyInfor/analysisWebSafetyInfo,/safetyInfor/analysisSafetyStatus"
 
   # 不需要过参数过滤器的uri
   parameter:
@@ -99,7 +100,8 @@ filter:
     /safetyInfor/getRiskInfoByOrg,/safetyInfor/getSysStatusByOrg,/SystemRisk/getHighStatus,/SystemRisk/getHighStatusByMonth,\
     /AttackEvent/getAttackEventByInfo,/AttackType/getAttackTypeByMonth,/SystemAttacked/getSystemAttackedByInfo,/businessSystem/getSystemInfoByVoiceKeyword,\
     /safetyInfor/getWebSafetyStatusByOrg,/OfficeVirus/getOfficeSafetyInfo,/GuaranteeGroup/getAllGuaranteeGroup,/monitoringResources/getMonitorListByName,/monitoringResources/creatRelay,/monitoringResources/closeAllRelay,\
-    /SystemRisk/GetSystemRiskList,/SystemRisk/getSysInfoByOffice,/monitoringResources/getStreamForKaiKang,/businessSystem/getSystemInfoByShow"
+    /SystemRisk/GetSystemRiskList,/SystemRisk/getSysInfoByOffice,/monitoringResources/getStreamForKaiKang,/businessSystem/getSystemInfoByShow,/safetyInfor/analysisWebSafetyInfo,\
+    /safetyInfor/analysisSafetyStatus"
 
   # 不需要过返回封装过滤器的uri
   response:
@@ -112,7 +114,8 @@ filter:
     /safetyInfor/getRiskInfoByOrg,/safetyInfor/getSysStatusByOrg,/SystemRisk/getHighStatus,/SystemRisk/getHighStatusByMonth,\
     /AttackEvent/getAttackEventByInfo,/AttackType/getAttackTypeByMonth,/SystemAttacked/getSystemAttackedByInfo,/businessSystem/getSystemInfoByVoiceKeyword,\
     /safetyInfor/getWebSafetyStatusByOrg,/OfficeVirus/getOfficeSafetyInfo,/GuaranteeGroup/getAllGuaranteeGroup,/monitoringResources/getMonitorListByName,/monitoringResources/creatRelay,/monitoringResources/closeAllRelay,\
-    /SystemRisk/GetSystemRiskList,/SystemRisk/getSysInfoByOffice,/monitoringResources/getStreamForKaiKang,/flat/door/personRegister,/flat/sendMessage,/businessSystem/getSystemInfoByShow"
+    /SystemRisk/GetSystemRiskList,/SystemRisk/getSysInfoByOffice,/monitoringResources/getStreamForKaiKang,/flat/door/personRegister,/flat/sendMessage,/businessSystem/getSystemInfoByShow,/safetyInfor/analysisWebSafetyInfo,\
+    /safetyInfor/analysisSafetyStatus"
   # 登录接口
   login:
     skip-uri: /user/userLogin,/flat/guide/login

+ 8 - 0
spring-cloud/server-basic/src/main/java/com/jd/controller/SsoUserController.java

@@ -40,4 +40,12 @@ public class SsoUserController {
         return ssoUserService.userLogin(loginAccount, loginPwd, clientId, redirect, oauth2Pwd);
     }
 
+    @PostMapping("getCurrentLoginInfo")
+    public Map<String, Object> getCurrentLoginInfo(String userId) {
+        if (Blank.isEmpty(userId)) {
+            return SendUtil.send(false, ConstString.REQUEST_WRONGPARAMS);
+        }
+        return ssoUserService.getCurrentLoginInfo(userId);
+    }
+
 }

+ 7 - 1
spring-cloud/server-basic/src/main/java/com/jd/service/SsoUserService.java

@@ -8,7 +8,7 @@ import java.util.Map;
 public interface SsoUserService {
 
     /**
-     *
+     * 统一身份认证登录
      * @param loginAccount
      * @param loginPwd
      * @param clientId
@@ -17,4 +17,10 @@ public interface SsoUserService {
      */
     Map<String, Object> userLogin(String loginAccount, String loginPwd, String clientId, String redirect, String oauth2Pwd);
 
+    /**
+     * 查询当前登录用户信息
+     * @param userId
+     * @return
+     */
+    Map<String, Object> getCurrentLoginInfo(String userId);
 }

+ 17 - 9
spring-cloud/server-basic/src/main/java/com/jd/service/impl/SafetyInfoServiceImpl.java

@@ -281,8 +281,10 @@ public class SafetyInfoServiceImpl implements SafetyInfoService {
             }
         }
         ApiUrl apiUrl = new ApiUrl();
-        apiUrl.setUrlApi("https://23.37.0.200/api/security/incident/overview");
-
+        apiUrl.setUrlPrefix("https://23.37.0.200");
+        apiUrl.setUrlApi("/api/security/incident/overview");
+        apiUrl.setUrlMethod("GET");
+        apiUrl.setUrlParamType(1);
         String params = "{\"keyword\":\"\",\"startTime\":\"2022-04-10 17:05:00\"," +
                 "\"endTime\":\"2022-05-10 17:05:00\"}";
         //通过threeAPI调用第三方接口
@@ -292,15 +294,21 @@ public class SafetyInfoServiceImpl implements SafetyInfoService {
 
         Map<String, Object> attackMap = JSONObject.parseObject(parseObj.get("data").toString());
         //风险系数
-        Integer attackHighNum = Convert.toInt(attackMap.get("High").toString());
-        if(attackHighNum < riskFlag_1){
-            riskCoefficient = 1;
-        }else if (attackHighNum > riskFlag_1 && attackHighNum < riskFlag_2){
-            riskCoefficient = 2;
-        }else {
-            riskCoefficient = 3;
+        Integer attackHighNum = 0;
+        if(Blank.isNotEmpty(attackMap)){
+            if(Blank.isNotEmpty(attackMap.get("High"))){
+                attackHighNum = Convert.toInt(attackMap.get("High").toString());
+                if(attackHighNum < riskFlag_1){
+                    riskCoefficient = 1;
+                }else if (attackHighNum > riskFlag_1 && attackHighNum < riskFlag_2){
+                    riskCoefficient = 2;
+                }else {
+                    riskCoefficient = 3;
+                }
+            }
         }
 
+
         resultMap.put("safetyLevel", safetyLevel);
         resultMap.put("riskCoefficient", riskCoefficient);
         resultMap.put("highRiskNumber", highRiskNumber);

+ 14 - 4
spring-cloud/server-basic/src/main/java/com/jd/service/impl/SsoUserServiceImpl.java

@@ -3,6 +3,7 @@ package com.jd.service.impl;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.crypto.SecureUtil;
 import com.jd.client.AuthClient;
+import com.jd.code.ConstString;
 import com.jd.mapper.SsoSystemMapper;
 import com.jd.mapper.SsoUserMapper;
 import com.jd.service.SsoUserService;
@@ -39,10 +40,12 @@ public class SsoUserServiceImpl implements SsoUserService {
 
     @Override
     public Map<String, Object> userLogin(String loginAccount, String loginPwd, String clientId, String redirect, String oauth2Pwd) {
-        // 判断clientId是否存在
-        Map<String, Object> map = ssoSystemMapper.getSsoSystemByClient(clientId);
-        if (Blank.isEmpty(map)) {
-            return SendUtil.send(false, "系统尚未接入统一身份认证平台");
+        if (Blank.isNotEmpty(clientId)) {
+            // 判断clientId是否存在
+            Map<String, Object> map = ssoSystemMapper.getSsoSystemByClient(clientId);
+            if (Blank.isEmpty(map)) {
+                return SendUtil.send(false, "系统尚未接入统一身份认证平台");
+            }
         }
         // 判断登录帐号和密码
         Map<String, Object> user = ssoUserMapper.getSsoUserInfoByAccount(loginAccount);
@@ -77,4 +80,11 @@ public class SsoUserServiceImpl implements SsoUserService {
 
         return SendUtil.send(true, "登录成功", result);
     }
+
+    @Override
+    public Map<String, Object> getCurrentLoginInfo(String userId) {
+
+        Map<String, Object> map = Convert.convert(Map.class, redisTemplate.opsForValue().get(userId));
+        return SendUtil.send(true, ConstString.RESULT_SUCCESS, map);
+    }
 }

+ 1 - 1
spring-cloud/server-page/src/main/resources/static/page/login.html

@@ -110,7 +110,7 @@
 	</style>
 	</head>
 	<script>
-		window.location.href = 'http://192.168.0.235:8888/sso/login.html?clientId=I34U4QF4D&redirect=http://www.cq.gov.cn/';
+		window.location.href = 'http://192.168.0.235:8888/sso/login.html?clientId=I34U4QF4D&redirect=http://192.168.0.235:8888/page/temp.html';
 	</script>
 	<body>
 		<div class="loginBox layui-form">

+ 99 - 0
spring-cloud/server-page/src/main/resources/static/page/temp.html

@@ -0,0 +1,99 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <title>登录</title>
+    <link rel="stylesheet" href="layui/css/layui.css">
+</head>
+<body>
+<script src="layui/layui.js"></script>
+<script src="js/constants.js"></script>
+<script src="js/basic/login.js"></script>
+<script>
+    layui.config({
+        base: 'js/encryption/'
+    }).use(['ajax', 'jquery'], function () {
+        $ = layui.jquery;
+        ly = layui.ajax;
+        layer = layui.layer;
+
+        let userId = GetQueryString('userId');
+
+        let index = layer.load(2);
+        ly.ajax({
+            type: 'POST',
+            url: PAGE_BASIC + '/ssoUser/getCurrentLoginInfo',
+            dataType: 'json',
+            data: {
+                userId: userId
+            },
+            success: function (json) {
+                if (json.result) {
+                    if (json.data.access_token) {
+
+                        ly.ajax({
+                            type: 'GET',
+                            url: PAGE_BASIC + '/user/getUserDetail',
+                            dataType: 'json',
+                            data: {
+                                userId: userId
+                            },
+                            success: function (res) {
+                                layer.close(index);
+                                if (res.result) {
+                                    if (!res.data.role_id) {
+                                        layer.alert("该用户没有角色,请联系管理员");
+                                        layer.close(index);
+                                        return;
+                                    }
+                                    sessionStorage.LOGIN_USERID = json.data.userId;
+                                    sessionStorage.ACCESS_TOKEN = json.data.access_token;
+                                    sessionStorage.REFRESH_TOKEN = json.data.refresh_token;
+                                    sessionStorage.TOKEN_TYPE = json.data.token_type;
+                                    sessionStorage.ROLE_ID = res.data.role_id;
+                                    sessionStorage.ACCOUNT = json.data.account;
+                                    sessionStorage.LOGIN_USERNAME = res.data.user_name;
+                                    sessionStorage.ROLE_TYPE = res.data.userRoleType;
+                                    if (sessionStorage.ROLE_TYPE == 1 || sessionStorage.ROLE_TYPE == 2 || sessionStorage.ROLE_TYPE == 3) {
+                                        // 后台管理员
+                                        window.location = "index.html";
+                                    } else {
+                                        layer.msg('该用户未有登录权限!', {icon: 5});
+                                    }
+                                }
+                            },
+                            error: function (msg) {
+                                layer.close(index);
+                            }
+                        });
+                    } else {
+                        layer.alert("系统错误");
+                    }
+                } else {
+                    if (json.msg) {
+                        layer.msg(json.msg, {
+                            icon: 5
+                        });
+                    } else {
+                        layer.msg('帐号或密码有误!');
+                    }
+                    clearInput();
+                }
+                layer.close(index);
+            },
+            error: function (msg) {
+                layer.close(index);
+            }
+        });
+    });
+
+    function GetQueryString(name) {
+        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
+        var r = window.location.search.substr(1).match(reg);
+        if (r != null) return unescape(r[2]);
+        return null;
+    }
+</script>
+</body>
+
+</html>

+ 5 - 1
spring-cloud/server-page/src/main/resources/static/sso/js/basic/login.js

@@ -80,7 +80,11 @@ function submitLogin() {
                     sessionStorage.LOGIN_USERNAME = json.data.userName;
                     sessionStorage.ROLE_TYPE = json.data.roleType;
                     //SSO管理后台
-                    window.location = redirect;
+                    if (redirect) {
+                        window.location = redirect + '?userId=' + json.data.userId;
+                    } else {
+                        window.location = 'index.html';
+                    }
                 } else {
                     layer.alert("系统错误");
                 }

+ 0 - 1
spring-cloud/server-page/src/main/resources/static/sso/login.html

@@ -4,7 +4,6 @@
 		<meta charset="utf-8">
 		<title>SSO登录</title>
 		<link rel="stylesheet" href="layui/css/layui.css">
-	
 	<style>
 		*{
 			margin: 0;