Browse Source

修改token有效期单位为分钟

zhangqiankun 3 years ago
parent
commit
ab438fa1e0

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

@@ -178,10 +178,10 @@ public class SaasLoginController {
 	        		throw new BusinessException("该账户未登录,请先登录");
 	    		}
 			}
-			this.redisTemplate.expire(account.getId(), Long.parseLong(this.properties.getTokenExpire()), TimeUnit.HOURS);
+			this.redisTemplate.expire(account.getId(), Long.parseLong(this.properties.getTokenExpire()), TimeUnit.MINUTES);
 		} else {
 			// 加密串MD5加密转为sign,redis:key-账号ID,value-sign(data-MD5加密后)
-	    	sign = this.bouncycastleCipher.encrypt(this.tokenInfo(data), account.getId(), DigestAlgorithm.MD5, Long.parseLong(this.properties.getTokenExpire()), TimeUnit.HOURS);
+	    	sign = this.bouncycastleCipher.encrypt(this.tokenInfo(data), account.getId(), DigestAlgorithm.MD5, Long.parseLong(this.properties.getTokenExpire()), TimeUnit.MINUTES);
 		}
         // token=data.sign
     	String token = data + SaasCommonConstant.POINT_JOIN_SYMBOL + sign;

+ 4 - 3
saas-account/src/main/java/com/persagy/person/controller/SaasRoleController.java

@@ -68,8 +68,8 @@ public class SaasRoleController {
     public ResponseResult querySaasRoleList(@RequestBody @Validated SaasRoleQueryVO queryVO) {
     	LambdaQueryWrapper<SaasRole> queryWrapper = new SaasRole.Builder().createQueryWrapper().idEq(queryVO.getId())
     			.idIn(queryVO.getRoleIds()).roleCodeEq(queryVO.getRoleCode()).roleNameLike(queryVO.getRoleName())
-    			.groupCodeEq(queryVO.getGroupCode()).roleTypeEq(queryVO.getRoleType()).updateUserEq(queryVO.getUpdateUser())
-    			.validEq(queryVO.getValid()).builderQueryWrapper();
+    			.groupCodeEq(queryVO.getGroupCode()).roleTypeEq(queryVO.getRoleType()).roleTypeIn(queryVO.getRoleTypes())
+    			.updateUserEq(queryVO.getUpdateUser()).validEq(queryVO.getValid()).builderQueryWrapper();
     	queryWrapper.orderByDesc(SaasRole::getUpdateTime);		// 默认更新时间降序
     	List<SaasRole> list = this.saasRoleService.list(queryWrapper);
     	if (CollectionUtil.isEmpty(list)) {
@@ -98,7 +98,8 @@ public class SaasRoleController {
     	Page<SaasRole> page = new Page<SaasRole>(pageVO.getPage(), pageVO.getSize());
     	LambdaQueryWrapper<SaasRole> queryWrapper = new SaasRole.Builder().createQueryWrapper().idEq(pageVO.getId())
     			.roleCodeEq(pageVO.getRoleCode()).roleNameLike(pageVO.getRoleName()).roleTypeEq(pageVO.getRoleType())
-    			.groupCodeEq(pageVO.getGroupCode()).updateUserEq(pageVO.getUpdateUser()).validEq(pageVO.getValid()).builderQueryWrapper();
+    			.roleTypeIn(pageVO.getRoleTypes()).groupCodeEq(pageVO.getGroupCode()).updateUserEq(pageVO.getUpdateUser())
+    			.validEq(pageVO.getValid()).builderQueryWrapper();
     	queryWrapper.orderByDesc(SaasRole::getUpdateTime);							// 默认更新时间降序
     	Page<SaasRole> pageList = this.saasRoleService.page(page, queryWrapper);
     	if (pageList == null || CollectionUtil.isEmpty(pageList.getRecords())) {

+ 11 - 0
saas-account/src/main/java/com/persagy/person/pojo/dto/SaasRole.java

@@ -162,6 +162,17 @@ public class SaasRole extends BaseEntity<SaasRole> {
 			}
 			return this;
 		}
+		
+		public Builder roleTypeIn(Set<String> roleTypes) {
+			if (CollectionUtil.isNotEmpty(roleTypes)) {
+				if (updateWrapper != null) {
+					updateWrapper.in(SaasRole::getRoleType, roleTypes);
+				} else {
+					queryWrapper.in(SaasRole::getRoleType, roleTypes);
+				}
+			}
+			return this;
+		}
 
 		public Builder createTimeEq(Date createTime) {
 			if (null != createTime) {

+ 3 - 0
saas-account/src/main/java/com/persagy/person/pojo/vo/role/SaasRoleQueryVO.java

@@ -42,6 +42,9 @@ public class SaasRoleQueryVO extends BaseUserModel {
 
 	@ApiModelProperty(value = "角色类型,0-系统角色,1-业务角色, 2-业务超管默认角色", example = "zhangsan")
 	private String roleType; 	// 角色类型,0-系统角色,1-业务角色, 2-业务超管默认角色
+
+	@ApiModelProperty(value = "角色类型,0-系统角色,1-业务角色, 2-业务超管默认角色", example = "zhangsan")
+	private Set<String> roleTypes; 	// 角色类型,0-系统角色,1-业务角色, 2-业务超管默认角色
 	
 	@ApiModelProperty(value = "最后一次操作者ID", example = "zhangsan")
 	private String updateUser; 	// 最后一次操作者ID

+ 1 - 1
saas-common/src/main/java/com/persagy/common/model/BaseUserModel.java

@@ -25,7 +25,7 @@ public class BaseUserModel {
 	@ApiModelProperty(value = "账号ID", required = true, example = "RY56122123152")
 	private String accountId; 	// 当前账号ID
 
-	@NotBlank(message = "账号归属,不可为空")
+	//@NotBlank(message = "账号归属,不可为空")
 	@ApiModelProperty(value = "账号归属", required = true, example = "0")
 	private String accountBelong; 	// 当前账号归属