zhangqiankun 3 år sedan
förälder
incheckning
5026adbd11
18 ändrade filer med 129 tillägg och 114 borttagningar
  1. 2 1
      saas-account/src/main/java/com/persagy/account/controller/SaasAccountController.java
  2. 8 7
      saas-account/src/main/java/com/persagy/account/controller/SaasAccountProjectController.java
  3. 10 9
      saas-account/src/main/java/com/persagy/account/controller/SaasAreaController.java
  4. 10 9
      saas-account/src/main/java/com/persagy/account/controller/SaasAuthCenterController.java
  5. 2 1
      saas-account/src/main/java/com/persagy/account/controller/SaasCommonController.java
  6. 2 1
      saas-account/src/main/java/com/persagy/account/controller/SaasFunctionController.java
  7. 10 9
      saas-account/src/main/java/com/persagy/account/controller/SaasGroupController.java
  8. 8 8
      saas-account/src/main/java/com/persagy/account/controller/SaasLoginController.java
  9. 11 10
      saas-account/src/main/java/com/persagy/account/controller/SaasProjectController.java
  10. 10 9
      saas-account/src/main/java/com/persagy/account/manage/SaasAuthHandler.java
  11. 9 8
      saas-account/src/main/java/com/persagy/account/manage/SaasGroupProjectHandler.java
  12. 3 2
      saas-account/src/main/java/com/persagy/account/manage/SaasRoleMenuHandler.java
  13. 9 2
      saas-account/src/main/java/com/persagy/account/pojo/dto/SaasProject.java
  14. 9 2
      saas-account/src/main/java/com/persagy/account/pojo/vo/project/SaasProjectCreateVO.java
  15. 5 2
      saas-account/src/main/resources/mapper/SaasProjectMapper.xml
  16. 0 14
      saas-common/src/main/java/com/persagy/common/constant/SaasCommonConstant.java
  17. BIN
      saas-doc/doc/运维平台单点登录授权文档.docx
  18. 21 20
      saas-gateway/src/main/java/com/persagy/gateway/filter/CustomRequestPredicateGlobalFilter.java

+ 2 - 1
saas-account/src/main/java/com/persagy/account/controller/SaasAccountController.java

@@ -35,6 +35,7 @@ import com.persagy.common.model.BaseGroupModel;
 import com.persagy.common.utils.ResponseResult;
 import com.persagy.common.utils.ResponseResultUtil;
 import com.persagy.common.utils.StringUtil;
+import com.persagy.security.constant.CipherConstants;
 import com.persagy.security.util.BouncycastleCipher;
 
 import cn.hutool.core.collection.CollectionUtil;
@@ -194,7 +195,7 @@ public class SaasAccountController {
     @ApiOperation(value = "获取账号信息")
     @RequestMapping(value = "getSaasAccount")
     public ResponseResult getSaasAccount(@RequestBody @Validated SaasCodeVO model) {
-    	String accountId = (String) this.redisTemplate.opsForHash().get(model.getClientId(), SaasCommonConstant.ACCOUNT_ID_REDIS_HASH_KEY);
+    	String accountId = (String) this.redisTemplate.opsForHash().get(model.getClientId(), CipherConstants.ACCOUNT_ID_HASH_KEY);
     	if (StringUtil.isBlank(accountId)) {
     		return ResponseResultUtil.errorResult(ResponseCode.A0201.getCode(), ResponseCode.A0201.getDesc());
 		}

+ 8 - 7
saas-account/src/main/java/com/persagy/account/controller/SaasAccountProjectController.java

@@ -14,11 +14,6 @@ import org.springframework.web.bind.annotation.RestController;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.google.common.collect.Lists;
-import com.persagy.common.constant.SaasCommonConstant;
-import com.persagy.common.enums.ResponseCode;
-import com.persagy.common.utils.ResponseResult;
-import com.persagy.common.utils.ResponseResultUtil;
-import com.persagy.common.utils.StringUtil;
 import com.persagy.account.manage.SaasAuthHandler;
 import com.persagy.account.pojo.dto.SaasAccount;
 import com.persagy.account.pojo.dto.SaasAccountProject;
@@ -32,6 +27,12 @@ import com.persagy.account.service.ISaasAccountProjectService;
 import com.persagy.account.service.ISaasAccountService;
 import com.persagy.account.service.ISaasGroupService;
 import com.persagy.account.service.ISaasProjectService;
+import com.persagy.common.constant.SaasCommonConstant;
+import com.persagy.common.enums.ResponseCode;
+import com.persagy.common.utils.ResponseResult;
+import com.persagy.common.utils.ResponseResultUtil;
+import com.persagy.common.utils.StringUtil;
+import com.persagy.security.constant.CipherConstants;
 
 import cn.hutool.core.collection.CollectionUtil;
 import io.swagger.annotations.Api;
@@ -95,8 +96,8 @@ public class SaasAccountProjectController {
     	
     	// 先判断此账号的权限
     	Map<String, String> authMap = this.saasAuthHandler.validAccountAuth(pageVO.getAccountId(), pageVO.getGroupCode());
-    	if (StringUtil.isNotBlank(authMap.get(SaasCommonConstant.GROUP_CODE))) {
-    		pageVO.setGroupCode(authMap.get(SaasCommonConstant.GROUP_CODE));
+    	if (StringUtil.isNotBlank(authMap.get(CipherConstants.GROUP_CODE))) {
+    		pageVO.setGroupCode(authMap.get(CipherConstants.GROUP_CODE));
 		}
 		String accountType = authMap.get(SaasCommonConstant.ACCOUNT_TYPE);
 		if (SaasCommonConstant.STR_STATUS_0.equals(accountType)) {

+ 10 - 9
saas-account/src/main/java/com/persagy/account/controller/SaasAreaController.java

@@ -13,11 +13,6 @@ import org.springframework.web.bind.annotation.RestController;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.google.common.collect.Lists;
-import com.persagy.common.constant.SaasCommonConstant;
-import com.persagy.common.enums.ResponseCode;
-import com.persagy.common.utils.ResponseResult;
-import com.persagy.common.utils.ResponseResultUtil;
-import com.persagy.common.utils.StringUtil;
 import com.persagy.account.manage.SaasAreaProjectHandler;
 import com.persagy.account.manage.SaasAuthHandler;
 import com.persagy.account.pojo.dto.SaasAccount;
@@ -30,6 +25,12 @@ import com.persagy.account.pojo.vo.area.SaasAreaQueryVO;
 import com.persagy.account.service.ISaasAccountService;
 import com.persagy.account.service.ISaasAreaService;
 import com.persagy.account.service.ISaasProjectService;
+import com.persagy.common.constant.SaasCommonConstant;
+import com.persagy.common.enums.ResponseCode;
+import com.persagy.common.utils.ResponseResult;
+import com.persagy.common.utils.ResponseResultUtil;
+import com.persagy.common.utils.StringUtil;
+import com.persagy.security.constant.CipherConstants;
 
 import cn.hutool.core.collection.CollectionUtil;
 import io.swagger.annotations.Api;
@@ -96,8 +97,8 @@ public class SaasAreaController {
     	if (queryVO.isTotal()) {
     		// 账号数据可见性的权限鉴定
     		Map<String, String> authMap = this.saasAuthHandler.validAccountAuth(queryVO.getAccountId(), queryVO.getGroupCode());
-    		if (StringUtil.isNotBlank(authMap.get(SaasCommonConstant.GROUP_CODE))) {
-    			queryVO.setGroupCode(authMap.get(SaasCommonConstant.GROUP_CODE));
+    		if (StringUtil.isNotBlank(authMap.get(CipherConstants.GROUP_CODE))) {
+    			queryVO.setGroupCode(authMap.get(CipherConstants.GROUP_CODE));
     		}
         	// 添加数据访问控制,账号可见域,0-所有集团项目,1-单集团所有项目(此时,集团编码需存在),2-其他
     		String accountType = authMap.get(SaasCommonConstant.ACCOUNT_TYPE);
@@ -119,8 +120,8 @@ public class SaasAreaController {
     	boolean isAdmin = false;
     	// 账号数据可见性的权限鉴定
 		Map<String, String> authMap = this.saasAuthHandler.validAccountAuth(queryVO.getAccountId(), queryVO.getGroupCode());
-		if (StringUtil.isNotBlank(authMap.get(SaasCommonConstant.GROUP_CODE))) {
-			queryVO.setGroupCode(authMap.get(SaasCommonConstant.GROUP_CODE));
+		if (StringUtil.isNotBlank(authMap.get(CipherConstants.GROUP_CODE))) {
+			queryVO.setGroupCode(authMap.get(CipherConstants.GROUP_CODE));
 		}
     	// 添加数据访问控制,账号可见域,0-所有集团项目,1-单集团所有项目(此时,集团编码需存在),2-其他
 		String accountType = authMap.get(SaasCommonConstant.ACCOUNT_TYPE);

+ 10 - 9
saas-account/src/main/java/com/persagy/account/controller/SaasAuthCenterController.java

@@ -23,6 +23,7 @@ import com.persagy.common.enums.ResponseCode;
 import com.persagy.common.utils.ResponseResult;
 import com.persagy.common.utils.ResponseResultUtil;
 import com.persagy.common.utils.StringUtil;
+import com.persagy.security.constant.CipherConstants;
 import com.persagy.security.util.BouncycastleCipher;
 import com.persagy.security.util.SecureAES;
 
@@ -87,7 +88,7 @@ public class SaasAuthCenterController {
     		return ResponseResultUtil.errorResult(ResponseCode.A0001.getCode(), ResponseCode.A0001.getDesc());
 		}
     	// 验证是否授权码存在
-    	String code = (String) this.redisTemplate.opsForHash().get(model.getClientId(), SaasCommonConstant.CODE_REDIS_HASH_KEY);
+    	String code = (String) this.redisTemplate.opsForHash().get(model.getClientId(), CipherConstants.CODE_HASH_KEY);
     	if (StringUtil.isBlank(code)) {
     		return ResponseResultUtil.errorResult(ResponseCode.A0301.getCode(), ResponseCode.A0301.getDesc());
 		}
@@ -96,7 +97,7 @@ public class SaasAuthCenterController {
 		}
     	// 判断token是否已存在
     	long expire = Long.parseLong(this.properties.getTokenExpire());
-    	String accountId = (String) this.redisTemplate.opsForHash().get(model.getClientId(), SaasCommonConstant.ACCOUNT_ID_REDIS_HASH_KEY);
+    	String accountId = (String) this.redisTemplate.opsForHash().get(model.getClientId(), CipherConstants.ACCOUNT_ID_HASH_KEY);
     	if (StringUtil.isBlank(accountId)) {
     		return ResponseResultUtil.errorResult(ResponseCode.A0201.getCode(), ResponseCode.A0201.getDesc());
 		}
@@ -110,12 +111,12 @@ public class SaasAuthCenterController {
 		}
     	// MD5生成 refreshToken,放进hash存储
     	String refreshToken = md5.digestHex(this.getRefreshToken());
-    	this.redisTemplate.opsForHash().put(model.getClientId(), SaasCommonConstant.REFRESH_TOKEN_REDIS_HASH_KEY, refreshToken);
+    	this.redisTemplate.opsForHash().put(model.getClientId(), CipherConstants.REFRESH_TOKEN_HASH_KEY, refreshToken);
     	
     	// AES加密出账号信息所需字段,组合为token
     	SecureAES aes = new SecureAES(properties.getAesKey(), properties.getAesIv());
     	String tokenPrefix = aes.encrypt(this.getTokenPrefix(model.getClientId(), accountId));
-    	token = tokenPrefix + SaasCommonConstant.POINT_JOIN_SYMBOL + token;
+    	token = tokenPrefix + CipherConstants.POINT_JOIN_SYMBOL + token;
     	
     	Map<String, Object> map = new HashedMap<String, Object>();
     	map.put("refreshToken", refreshToken);
@@ -132,12 +133,12 @@ public class SaasAuthCenterController {
      * @return
      */
     private String getTokenPrefix(String clientId, String accountId) {
-    	String appId = (String) this.redisTemplate.opsForHash().get(clientId, SaasCommonConstant.APP_ID_REDIS_HASH_KEY);
-    	String groupCode = (String) this.redisTemplate.opsForHash().get(clientId, SaasCommonConstant.GROUP_CODE_REDIS_HASH_KEY);
+    	String appId = (String) this.redisTemplate.opsForHash().get(clientId, CipherConstants.APP_ID_HASH_KEY);
+    	String groupCode = (String) this.redisTemplate.opsForHash().get(clientId, CipherConstants.GROUP_CODE_HASH_KEY);
 		JSONObject result = new JSONObject();
-		result.put(SaasCommonConstant.ACCOUNT_ID, accountId);
-		result.put(SaasCommonConstant.GROUP_CODE, groupCode);
-		result.put(SaasCommonConstant.APP_ID, appId);
+		result.put(CipherConstants.ACCOUNT_ID, accountId);
+		result.put(CipherConstants.GROUP_CODE, groupCode);
+		result.put(CipherConstants.APP_ID, appId);
 		return result.toJSONString();
 	}
     

+ 2 - 1
saas-account/src/main/java/com/persagy/account/controller/SaasCommonController.java

@@ -12,6 +12,7 @@ import com.persagy.account.pojo.vo.BaseGroupVO;
 import com.persagy.common.constant.SaasCommonConstant;
 import com.persagy.common.utils.ResponseResult;
 import com.persagy.common.utils.ResponseResultUtil;
+import com.persagy.security.constant.CipherConstants;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -40,7 +41,7 @@ public class SaasCommonController {
     @RequestMapping(value = "test")
     public ResponseResult test(@RequestBody @Validated BaseGroupVO model) {
     	this.redisTemplate.opsForSet().add(SaasCommonConstant.SAAS_CLIENT_ID_REDIS_KEY, "EF4C04481E604506995AF5CF5BF2E395");
-    	this.redisTemplate.opsForHash().put("EF4C04481E604506995AF5CF5BF2E395", SaasCommonConstant.INNER_CLIENT_REDIS_HASH_KEY, true);
+    	this.redisTemplate.opsForHash().put("EF4C04481E604506995AF5CF5BF2E395", CipherConstants.INNER_CLIENT_HASH_KEY, true);
     	return ResponseResultUtil.successResult();
     }
     

+ 2 - 1
saas-account/src/main/java/com/persagy/account/controller/SaasFunctionController.java

@@ -34,6 +34,7 @@ import com.persagy.common.enums.ResponseCode;
 import com.persagy.common.utils.ResponseResult;
 import com.persagy.common.utils.ResponseResultUtil;
 import com.persagy.common.utils.StringUtil;
+import com.persagy.security.constant.CipherConstants;
 
 import cn.hutool.core.collection.CollectionUtil;
 import io.swagger.annotations.Api;
@@ -84,7 +85,7 @@ public class SaasFunctionController {
     	// 判断此账号的权限范围
     	boolean isAdmin = false;
     	Map<String, String> authMap = this.saasAuthHandler.validAccountAuth(model.getAccountId(), model.getGroupCode());
-		String groupCode = authMap.get(SaasCommonConstant.GROUP_CODE);
+		String groupCode = authMap.get(CipherConstants.GROUP_CODE);
 		String accountType = authMap.get(SaasCommonConstant.ACCOUNT_TYPE);
 		if (SaasCommonConstant.STR_STATUS_0.equals(accountType)) {
 			// 超管时

+ 10 - 9
saas-account/src/main/java/com/persagy/account/controller/SaasGroupController.java

@@ -13,11 +13,6 @@ import org.springframework.web.bind.annotation.RestController;
 
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.google.common.collect.Lists;
-import com.persagy.common.constant.SaasCommonConstant;
-import com.persagy.common.enums.ResponseCode;
-import com.persagy.common.utils.ResponseResult;
-import com.persagy.common.utils.ResponseResultUtil;
-import com.persagy.common.utils.StringUtil;
 import com.persagy.account.manage.SaasAuthHandler;
 import com.persagy.account.manage.SaasGroupProjectHandler;
 import com.persagy.account.mq.CommonTopicProducer;
@@ -25,6 +20,12 @@ import com.persagy.account.pojo.dto.SaasGroup;
 import com.persagy.account.pojo.vo.group.SaasGroupCreateVO;
 import com.persagy.account.pojo.vo.group.SaasGroupQueryVO;
 import com.persagy.account.service.ISaasGroupService;
+import com.persagy.common.constant.SaasCommonConstant;
+import com.persagy.common.enums.ResponseCode;
+import com.persagy.common.utils.ResponseResult;
+import com.persagy.common.utils.ResponseResultUtil;
+import com.persagy.common.utils.StringUtil;
+import com.persagy.security.constant.CipherConstants;
 
 import cn.hutool.core.collection.CollectionUtil;
 import io.swagger.annotations.Api;
@@ -63,8 +64,8 @@ public class SaasGroupController {
     public ResponseResult querySaasGroupList(@RequestBody @Validated SaasGroupQueryVO queryVO) {
     	// 账号数据可见性的权限鉴定
 		Map<String, String> authMap = this.saasAuthHandler.validAccountAuth(queryVO.getAccountId(), queryVO.getGroupCode());
-		if (StringUtil.isNotBlank(authMap.get(SaasCommonConstant.GROUP_CODE))) {
-			queryVO.setGroupCode(authMap.get(SaasCommonConstant.GROUP_CODE));
+		if (StringUtil.isNotBlank(authMap.get(CipherConstants.GROUP_CODE))) {
+			queryVO.setGroupCode(authMap.get(CipherConstants.GROUP_CODE));
 		}
     	// 添加数据访问控制,账号可见域,0-所有集团项目,1-单集团所有项目(此时,集团编码需存在),2-其他
 		String accountType = authMap.get(SaasCommonConstant.ACCOUNT_TYPE);
@@ -90,8 +91,8 @@ public class SaasGroupController {
     public ResponseResult queryGroupProjectTree(@RequestBody @Validated SaasGroupQueryVO queryVO) {
     	// 账号数据可见性的权限鉴定
 		Map<String, String> authMap = this.saasAuthHandler.validAccountAuth(queryVO.getAccountId(), queryVO.getGroupCode());
-		if (StringUtil.isNotBlank(authMap.get(SaasCommonConstant.GROUP_CODE))) {
-			queryVO.setGroupCode(authMap.get(SaasCommonConstant.GROUP_CODE));
+		if (StringUtil.isNotBlank(authMap.get(CipherConstants.GROUP_CODE))) {
+			queryVO.setGroupCode(authMap.get(CipherConstants.GROUP_CODE));
 		}
     	// 添加数据访问控制,账号可见域,0-所有集团项目,1-单集团所有项目(此时,集团编码需存在),2-其他
 		String accountType = authMap.get(SaasCommonConstant.ACCOUNT_TYPE);

+ 8 - 8
saas-account/src/main/java/com/persagy/account/controller/SaasLoginController.java

@@ -42,7 +42,7 @@ import com.persagy.common.utils.ResponseResult;
 import com.persagy.common.utils.ResponseResultUtil;
 import com.persagy.common.utils.StringUtil;
 import com.persagy.log.core.util.RequestUtil;
-import com.persagy.security.constant.CipherConstans;
+import com.persagy.security.constant.CipherConstants;
 import com.persagy.security.util.BouncycastleCipher;
 import com.persagy.security.util.SecureAES;
 
@@ -158,7 +158,7 @@ public class SaasLoginController {
 			temp.put("redirectUrl", redirectUrl);
 			return ResponseResultUtil.successResult(temp);
 		}
-    	response.setHeader(CipherConstans.TOKEN_HEADER_TOKEN, token);
+    	response.setHeader(CipherConstants.TOKEN_HEADER, token);
     	return ResponseResultUtil.successResult(account);
     }
     
@@ -183,7 +183,7 @@ public class SaasLoginController {
     		account.setGroupName(saasGroup == null ? null : saasGroup.getGroupName());
 		}
     	String token = this.setRedisToken(account, queryVO.getAppId(), true, true);
-    	response.setHeader(CipherConstans.TOKEN_HEADER_TOKEN, token);
+    	response.setHeader(CipherConstants.TOKEN_HEADER, token);
     	return ResponseResultUtil.successResult(account);
     }
     
@@ -321,7 +321,7 @@ public class SaasLoginController {
 	    	sign = this.bouncycastleCipher.encrypt(this.tokenInfo(data, loginApp), account.getId(), DigestAlgorithm.MD5, Long.parseLong(this.properties.getTokenExpire()), TimeUnit.SECONDS);
 		}
         // token=data.sign
-    	String token = data + SaasCommonConstant.POINT_JOIN_SYMBOL + sign;
+    	String token = data + CipherConstants.POINT_JOIN_SYMBOL + sign;
         return token;
     }
     
@@ -336,9 +336,9 @@ public class SaasLoginController {
     private JSONObject tokenAccountInfo(SaasAccount saasAccount, String loginApp, boolean remember) {
 		JSONObject object = new JSONObject();
 		object.put(SaasCommonConstant.REMEMBER, remember);
-		object.put(SaasCommonConstant.APP_ID, loginApp);
-		object.put(SaasCommonConstant.GROUP_CODE, saasAccount.getGroupCode());
-		object.put(SaasCommonConstant.ACCOUNT_ID, saasAccount.getId());
+		object.put(CipherConstants.APP_ID, loginApp);
+		object.put(CipherConstants.GROUP_CODE, saasAccount.getGroupCode());
+		object.put(CipherConstants.ACCOUNT_ID, saasAccount.getId());
 		return object;
 	}
     
@@ -351,7 +351,7 @@ public class SaasLoginController {
      */
     private String tokenInfo(String content, String loginApp) {
 		JSONObject object = new JSONObject();
-		object.put(SaasCommonConstant.APP_ID, loginApp);
+		object.put(CipherConstants.APP_ID, loginApp);
 		object.put("date", System.currentTimeMillis());
 		object.put("content", content);
 		return object.toJSONString();

+ 11 - 10
saas-account/src/main/java/com/persagy/account/controller/SaasProjectController.java

@@ -24,14 +24,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.google.common.collect.Lists;
-import com.persagy.common.constant.SaasCommonConstant;
-import com.persagy.common.enums.ResponseCode;
-import com.persagy.common.exception.BusinessException;
-import com.persagy.common.model.BaseUserModel;
-import com.persagy.common.utils.ResponseResult;
-import com.persagy.common.utils.ResponseResultUtil;
-import com.persagy.common.utils.StringUtil;
-import com.persagy.log.core.annotation.IgnoreLog;
 import com.persagy.account.manage.SaasAreaProjectHandler;
 import com.persagy.account.manage.SaasAuthHandler;
 import com.persagy.account.manage.SaasGroupProjectHandler;
@@ -52,6 +44,15 @@ import com.persagy.account.service.ISaasAccountProjectService;
 import com.persagy.account.service.ISaasAreaService;
 import com.persagy.account.service.ISaasGroupService;
 import com.persagy.account.service.ISaasProjectService;
+import com.persagy.common.constant.SaasCommonConstant;
+import com.persagy.common.enums.ResponseCode;
+import com.persagy.common.exception.BusinessException;
+import com.persagy.common.model.BaseUserModel;
+import com.persagy.common.utils.ResponseResult;
+import com.persagy.common.utils.ResponseResultUtil;
+import com.persagy.common.utils.StringUtil;
+import com.persagy.log.core.annotation.IgnoreLog;
+import com.persagy.security.constant.CipherConstants;
 
 import cn.hutool.core.collection.CollectionUtil;
 import io.swagger.annotations.Api;
@@ -174,8 +175,8 @@ public class SaasProjectController {
 		}
     	// 账号数据可见性的权限鉴定
 		Map<String, String> authMap = this.saasAuthHandler.validAccountAuth(queryVO.getAccountId(), queryVO.getGroupCode());
-		if (StringUtil.isNotBlank(authMap.get(SaasCommonConstant.GROUP_CODE))) {
-			queryVO.setGroupCode(authMap.get(SaasCommonConstant.GROUP_CODE));
+		if (StringUtil.isNotBlank(authMap.get(CipherConstants.GROUP_CODE))) {
+			queryVO.setGroupCode(authMap.get(CipherConstants.GROUP_CODE));
 		}
     	// 添加数据访问控制,账号可见域,0-所有集团项目,1-单集团所有项目(此时,集团编码需存在),2-其他
 		String accountType = authMap.get(SaasCommonConstant.ACCOUNT_TYPE);

+ 10 - 9
saas-account/src/main/java/com/persagy/account/manage/SaasAuthHandler.java

@@ -20,6 +20,7 @@ import com.persagy.common.constant.SaasCommonConstant;
 import com.persagy.common.enums.ResponseCode;
 import com.persagy.common.exception.BusinessException;
 import com.persagy.common.utils.StringUtil;
+import com.persagy.security.constant.CipherConstants;
 
 import cn.hutool.core.util.BooleanUtil;
 import cn.hutool.crypto.digest.MD5;
@@ -76,7 +77,7 @@ public class SaasAuthHandler {
 			}
 			groupCode = allowGroupCode;
 		}
-		result.put(SaasCommonConstant.GROUP_CODE, groupCode);
+		result.put(CipherConstants.GROUP_CODE, groupCode);
 		result.put(SaasCommonConstant.ACCOUNT_TYPE, accountType);
 		result.put(SaasCommonConstant.ACCOUNT_BELONG, account.getAccountBelong());
 		return result;
@@ -92,7 +93,7 @@ public class SaasAuthHandler {
     public List<SaasGroup> getAllowGroupList(String accountId, String groupCode) {
     	// 获取此账号对应的集团权限
     	Map<String, String> accountAuth = this.validAccountAuth(accountId, groupCode);
-    	groupCode = accountAuth.get(SaasCommonConstant.GROUP_CODE);
+    	groupCode = accountAuth.get(CipherConstants.GROUP_CODE);
     	String accountType = accountAuth.get(SaasCommonConstant.ACCOUNT_TYPE);
 		return this.getAllowGroupList(accountId, groupCode, accountType);
     }
@@ -129,7 +130,7 @@ public class SaasAuthHandler {
     public List<SaasArea> getAllowAreaList(String accountId, String groupCode) {
     	// 获取此账号对应的集团权限
     	Map<String, String> accountAuth = this.validAccountAuth(accountId, groupCode);
-    	groupCode = accountAuth.get(SaasCommonConstant.GROUP_CODE);
+    	groupCode = accountAuth.get(CipherConstants.GROUP_CODE);
     	String accountType = accountAuth.get(SaasCommonConstant.ACCOUNT_TYPE);
 		return this.getAllowAreaList(accountId, groupCode, accountType);
     }
@@ -174,9 +175,9 @@ public class SaasAuthHandler {
     		throw new BusinessException(ResponseCode.A0001.getCode(), "非法客户端");
 		}
     	// 设置账号相关信息
-		this.redisTemplate.opsForHash().put(clientId, SaasCommonConstant.APP_ID_REDIS_HASH_KEY, appId);
-		this.redisTemplate.opsForHash().put(clientId, SaasCommonConstant.ACCOUNT_ID_REDIS_HASH_KEY, accountId);
-		this.redisTemplate.opsForHash().put(clientId, SaasCommonConstant.GROUP_CODE_REDIS_HASH_KEY, groupCode);
+		this.redisTemplate.opsForHash().put(clientId, CipherConstants.APP_ID_HASH_KEY, appId);
+		this.redisTemplate.opsForHash().put(clientId, CipherConstants.ACCOUNT_ID_HASH_KEY, accountId);
+		this.redisTemplate.opsForHash().put(clientId, CipherConstants.GROUP_CODE_HASH_KEY, groupCode);
 		
     	// 生成新的授权码,并验证授权码是否已存在
     	JSONObject temp = new JSONObject();
@@ -184,7 +185,7 @@ public class SaasAuthHandler {
     	temp.put("redirectUrl", redirectUrl);
     	temp.put("clientId", clientId);
     	String code = md5.digestHex(temp.toJSONString());
-    	this.redisTemplate.opsForHash().put(clientId, SaasCommonConstant.CODE_REDIS_HASH_KEY, code);
+    	this.redisTemplate.opsForHash().put(clientId, CipherConstants.CODE_HASH_KEY, code);
     	return code;
     }
     
@@ -200,11 +201,11 @@ public class SaasAuthHandler {
 			return true;
 		}
     	// 判断是否为内部客户端,内部不校验url
-    	Boolean inner = (Boolean)this.redisTemplate.opsForHash().get(clientId, SaasCommonConstant.INNER_CLIENT_REDIS_HASH_KEY);
+    	Boolean inner = (Boolean)this.redisTemplate.opsForHash().get(clientId, CipherConstants.INNER_CLIENT_HASH_KEY);
     	if (BooleanUtil.isTrue(inner)) {
     		return true;
 		}
-		Object object = this.redisTemplate.opsForHash().get(clientId, SaasCommonConstant.REDIRECT_URL_REDIS_HASH_KEY);
+		Object object = this.redisTemplate.opsForHash().get(clientId, CipherConstants.REDIRECT_URL_HASH_KEY);
 		if(object == null) {
 			return false;
 		}

+ 9 - 8
saas-account/src/main/java/com/persagy/account/manage/SaasGroupProjectHandler.java

@@ -10,12 +10,6 @@ import org.springframework.transaction.annotation.Transactional;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.google.common.collect.Lists;
-import com.persagy.common.constant.SaasCommonConstant;
-import com.persagy.common.enums.ResponseCode;
-import com.persagy.common.exception.BusinessException;
-import com.persagy.common.utils.ResponseResult;
-import com.persagy.common.utils.ResponseResultUtil;
-import com.persagy.common.utils.StringUtil;
 import com.persagy.account.mq.CommonTopicProducer;
 import com.persagy.account.pojo.dto.SaasAccount;
 import com.persagy.account.pojo.dto.SaasAccountProject;
@@ -28,6 +22,13 @@ import com.persagy.account.service.ISaasAreaService;
 import com.persagy.account.service.ISaasGroupService;
 import com.persagy.account.service.ISaasProjectService;
 import com.persagy.account.service.ISaasRoleService;
+import com.persagy.common.constant.SaasCommonConstant;
+import com.persagy.common.enums.ResponseCode;
+import com.persagy.common.exception.BusinessException;
+import com.persagy.common.utils.ResponseResult;
+import com.persagy.common.utils.ResponseResultUtil;
+import com.persagy.common.utils.StringUtil;
+import com.persagy.security.constant.CipherConstants;
 
 import cn.hutool.core.collection.CollectionUtil;
 
@@ -168,8 +169,8 @@ public class SaasGroupProjectHandler {
     public Page<SaasProject> querySaasProjectList(SaasProject saasProject, Integer page, Integer size) {
 		// 账号数据可见性的权限鉴定
 		Map<String, String> authMap = this.saasAuthHandler.validAccountAuth(saasProject.getAccountId(), saasProject.getGroupCode());
-		if (StringUtil.isNotBlank(authMap.get(SaasCommonConstant.GROUP_CODE))) {
-			saasProject.setGroupCode(authMap.get(SaasCommonConstant.GROUP_CODE));
+		if (StringUtil.isNotBlank(authMap.get(CipherConstants.GROUP_CODE))) {
+			saasProject.setGroupCode(authMap.get(CipherConstants.GROUP_CODE));
 		}
     	String accountType = authMap.get(SaasCommonConstant.ACCOUNT_TYPE);
     	Page<SaasProject> projectList = null;

+ 3 - 2
saas-account/src/main/java/com/persagy/account/manage/SaasRoleMenuHandler.java

@@ -31,6 +31,7 @@ import com.persagy.account.service.ISaasRoleService;
 import com.persagy.common.constant.SaasCommonConstant;
 import com.persagy.common.exception.BusinessException;
 import com.persagy.common.utils.StringUtil;
+import com.persagy.security.constant.CipherConstants;
 
 import cn.hutool.core.collection.CollectionUtil;
 
@@ -79,8 +80,8 @@ public class SaasRoleMenuHandler {
 	public List<SaasMenu> querySaasMenuTree(SaasMenuQueryVO queryVO) {
 		// 获取此账号对应的菜单范围
     	Map<String, String> menuAuth = this.saasAuthHandler.validAccountAuth(queryVO.getAccountId(), queryVO.getGroupCode());
-    	if (StringUtil.isNotBlank(menuAuth.get(SaasCommonConstant.GROUP_CODE))) {
-    		queryVO.setGroupCode(menuAuth.get(SaasCommonConstant.GROUP_CODE));
+    	if (StringUtil.isNotBlank(menuAuth.get(CipherConstants.GROUP_CODE))) {
+    		queryVO.setGroupCode(menuAuth.get(CipherConstants.GROUP_CODE));
 		}
     	// 添加数据访问控制,账号可见域,0-所有集团项目,1-单集团所有项目(此时,集团编码需存在),2-其他
     	String accountType = menuAuth.get(SaasCommonConstant.ACCOUNT_TYPE);

+ 9 - 2
saas-account/src/main/java/com/persagy/account/pojo/dto/SaasProject.java

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
 import com.persagy.common.annotation.IdGeneratorPrefix;
 import com.persagy.common.constant.SaasCommonConstant;
 import com.persagy.common.model.BaseEntity;
@@ -32,7 +33,7 @@ import lombok.ToString;
 @Setter
 @ToString
 @EqualsAndHashCode(callSuper = false)
-@TableName("saas_project")
+@TableName(value = "saas_project", autoResultMap = true)
 @IdGeneratorPrefix(SaasCommonConstant.SAAS_PROJECT_ID_PREFIX)
 public class SaasProject extends BaseEntity<SaasProject> {
 	private static final long serialVersionUID = -4224325454752727633L;
@@ -73,8 +74,14 @@ public class SaasProject extends BaseEntity<SaasProject> {
 	@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
 	private String projectWeather;	//项目天气
 	
+	@TableField(updateStrategy = FieldStrategy.NOT_EMPTY, typeHandler = FastjsonTypeHandler.class)
+	private Set<String> projectImage;	//项目图标
+	
+	@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+	private String longitude;		//项目经度
+	
 	@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
-	private String projectImage;	//项目图标,多个之间,用逗号分隔
+	private String latitude;		//项目纬度
 	
 	@TableField(fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NOT_EMPTY)
 	private Date createTime; 	// 创建时间

+ 9 - 2
saas-account/src/main/java/com/persagy/account/pojo/vo/project/SaasProjectCreateVO.java

@@ -1,6 +1,7 @@
 package com.persagy.account.pojo.vo.project;
 
 import java.util.Date;
+import java.util.Set;
 
 import javax.validation.constraints.NotBlank;
 
@@ -71,8 +72,14 @@ public class SaasProjectCreateVO extends BaseGroupModel {
 	@ApiModelProperty(value = "项目天气", example = "123456789")
 	private String projectWeather;	//项目天气
 	
-	@ApiModelProperty(value = "项目图标,多个之间,用英文逗号分隔", example = "123456789")
-	private String projectImage;	//项目图标,多个之间,用英文逗号分隔
+	@ApiModelProperty(value = "项目图标", example = "123456789")
+	private Set<String> projectImage;	//项目图标
+	
+	@ApiModelProperty(value = "项目经度", example = "123456789")
+	private String longitude;		//项目经度
+	
+	@ApiModelProperty(value = "项目纬度", example = "123456789")
+	private String latitude;		//项目纬度
 	
 	@ApiModelProperty(value = "备注信息", example = "测试项目")
 	private String remark; // 备注

+ 5 - 2
saas-account/src/main/resources/mapper/SaasProjectMapper.xml

@@ -17,7 +17,10 @@
 		<result column="OPEN_TIME" property="openTime" jdbcType="DATE" />
 		<result column="PROJECT_FUN" property="projectFun" jdbcType="VARCHAR" />
 		<result column="PROJECT_WEATHER" property="projectWeather" jdbcType="VARCHAR" />
-		<result column="PROJECT_IMAGE" property="projectImage" jdbcType="VARCHAR" />
+		<result column="PROJECT_IMAGE" property="projectImage"
+			typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler" />
+		<result column="LONGITUDE" property="longitude" jdbcType="VARCHAR" />
+		<result column="LATITUDE" property="latitude" jdbcType="VARCHAR" />
 		<result column="CREATE_TIME" property="createTime" jdbcType="DATE" />
 		<result column="UPDATE_TIME" property="updateTime" jdbcType="DATE" />
 		<result column="UPDATE_USER" property="updateUser" jdbcType="VARCHAR" />
@@ -28,7 +31,7 @@
 	</resultMap>
 	
 	<sql id="Base_Sql_Column">
-		ID, GROUP_CODE, PROJECT_ID, AREA_ID, PROJECT_LOCAL_ID, PROJECT_NAME, PROVINCE_CODE, CITY_CODE, ZONE_CODE, 
+		ID, GROUP_CODE, PROJECT_ID, AREA_ID, PROJECT_LOCAL_ID, PROJECT_NAME, PROVINCE_CODE, CITY_CODE, ZONE_CODE, LONGITUDE, LATITUDE, 
 		LOCATION, OPEN_TIME, PROJECT_FUN, PROJECT_WEATHER, PROJECT_IMAGE, CREATE_TIME, UPDATE_TIME, UPDATE_USER, REMARK, VALID
 	</sql>
 	

+ 0 - 14
saas-common/src/main/java/com/persagy/common/constant/SaasCommonConstant.java

@@ -29,18 +29,11 @@ public interface SaasCommonConstant {
 	
 	// 账号信息常用字段
 	String REMEMBER = "remember";
-	String GROUP_CODE = "groupCode";
-	String ACCOUNT_ID = "accountId";
-	String APP_ID = "appId";
 	String PROJECT_ID = "projectId";
 	String ACCOUNT_TYPE = "accountType";
 	String ACCOUNT_BELONG = "accountBelong";
 	String ROLE_TYPE = "roleType";
 	
-	// 常用分隔符
-	String POINT_JOIN_SYMBOL = ".";
-	String UNDERLINE_JOIN_SYMBOL = "_";
-	
 	//账号ID前缀
 	String SAAS_ACCOUNT_ID_PREFIX = "AC";
 	
@@ -75,12 +68,5 @@ public interface SaasCommonConstant {
 	String ACCOUNT_SOURCE_PERSAGE = "100";	// 100-saas
 
 	String SAAS_CLIENT_ID_REDIS_KEY = "SAAS_PLATFORM_CLIENT_ID_KEY";
-	String CODE_REDIS_HASH_KEY = "CODE";
-	String APP_ID_REDIS_HASH_KEY = "APP_ID";
-	String GROUP_CODE_REDIS_HASH_KEY = "GROUP_CODE";
-	String ACCOUNT_ID_REDIS_HASH_KEY = "ACCOUNT_ID";
-	String INNER_CLIENT_REDIS_HASH_KEY = "INNER_CLIENT";
-	String REDIRECT_URL_REDIS_HASH_KEY = "REDIRECT_URL";
-	String REFRESH_TOKEN_REDIS_HASH_KEY = "REFRESH_TOKEN";
 	
 }

BIN
saas-doc/doc/运维平台单点登录授权文档.docx


+ 21 - 20
saas-gateway/src/main/java/com/persagy/gateway/filter/CustomRequestPredicateGlobalFilter.java

@@ -1,19 +1,9 @@
 package com.persagy.gateway.filter;
 
-import cn.hutool.core.collection.CollectionUtil;
-import cn.hutool.core.util.BooleanUtil;
-import cn.hutool.core.util.IdUtil;
-import com.alibaba.fastjson.JSONObject;
-import com.persagy.common.constant.SaasCommonConstant;
-import com.persagy.common.enums.ResponseCode;
-import com.persagy.common.utils.StringUtil;
-import com.persagy.common.utils.WebfluxResponseUtil;
-import com.persagy.gateway.utils.ReactiveAddrUtil;
-import com.persagy.log.constant.LogContsant;
-import com.persagy.security.constant.CipherConstans;
-import com.persagy.security.util.BouncycastleCipher;
-import com.persagy.security.util.SecureAES;
-import lombok.extern.slf4j.Slf4j;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.util.Set;
+
 import org.slf4j.MDC;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -26,11 +16,22 @@ import org.springframework.http.server.reactive.ServerHttpRequest;
 import org.springframework.http.server.reactive.ServerHttpResponse;
 import org.springframework.stereotype.Component;
 import org.springframework.web.server.ServerWebExchange;
-import reactor.core.publisher.Mono;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.util.Set;
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.common.enums.ResponseCode;
+import com.persagy.common.utils.StringUtil;
+import com.persagy.common.utils.WebfluxResponseUtil;
+import com.persagy.gateway.utils.ReactiveAddrUtil;
+import com.persagy.log.constant.LogContsant;
+import com.persagy.security.constant.CipherConstants;
+import com.persagy.security.util.BouncycastleCipher;
+import com.persagy.security.util.SecureAES;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.BooleanUtil;
+import cn.hutool.core.util.IdUtil;
+import lombok.extern.slf4j.Slf4j;
+import reactor.core.publisher.Mono;
 
 /**
  * @version
@@ -118,7 +119,7 @@ public class CustomRequestPredicateGlobalFilter implements GlobalFilter, Ordered
 			}
 		}
 		// 获取请求token
-		String auth = httpHeaders.getFirst(CipherConstans.TOKEN_HEADER_TOKEN);
+		String auth = httpHeaders.getFirst(CipherConstants.TOKEN_HEADER);
 		if (StringUtil.isBlank(auth)) {
 			return WebfluxResponseUtil.responseFailed(response, ResponseCode.A0301.getCode(), ResponseCode.A0301.getDesc());
 		}
@@ -140,7 +141,7 @@ public class CustomRequestPredicateGlobalFilter implements GlobalFilter, Ordered
 			}
 			SecureAES aes = new SecureAES(aesKey, aesIv);
 			JSONObject accountInfo = aes.decryptAccount(userInfo);
-			String accountId = accountInfo.getString(SaasCommonConstant.ACCOUNT_ID);
+			String accountId = accountInfo.getString(CipherConstants.ACCOUNT_ID);
 			boolean isEqual = cipher.isEqual(token, accountId);
 			if (isEqual) {
 				return null;