Browse Source

:tada: 2.7.0.RELEASE,内核全面升级,增加岗位管理,用户导入导出

smallchill 4 years ago
parent
commit
f7fa46462d
28 changed files with 84 additions and 51 deletions
  1. 1 1
      blade-core-boot/pom.xml
  2. 2 2
      blade-core-boot/src/main/resources/bootstrap.yml
  3. 1 1
      blade-core-cloud/pom.xml
  4. 1 1
      blade-core-develop/pom.xml
  5. 2 2
      blade-core-develop/src/main/resources/templates/controller.java.vm
  6. 1 1
      blade-core-launch/pom.xml
  7. 1 1
      blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java
  8. 1 1
      blade-core-log/pom.xml
  9. 1 1
      blade-core-mybatis/pom.xml
  10. 6 2
      blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseEntity.java
  11. 1 1
      blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseService.java
  12. 1 1
      blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseServiceImpl.java
  13. 1 1
      blade-core-oss/pom.xml
  14. 1 1
      blade-core-secure/pom.xml
  15. 1 1
      blade-core-secure/src/main/java/org/springblade/core/secure/BladeUser.java
  16. 18 4
      blade-core-secure/src/main/java/org/springblade/core/secure/utils/SecureUtil.java
  17. 1 1
      blade-core-swagger/pom.xml
  18. 1 1
      blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java
  19. 1 1
      blade-core-test/pom.xml
  20. 1 1
      blade-core-tool/pom.xml
  21. 8 2
      blade-core-tool/src/main/java/org/springblade/core/tool/node/BaseNode.java
  22. 3 1
      blade-core-tool/src/main/java/org/springblade/core/tool/node/ForestNode.java
  23. 4 4
      blade-core-tool/src/main/java/org/springblade/core/tool/node/ForestNodeManager.java
  24. 4 3
      blade-core-tool/src/main/java/org/springblade/core/tool/node/INode.java
  25. 10 10
      blade-core-tool/src/main/java/org/springblade/core/tool/node/NodeTest.java
  26. 8 2
      blade-core-tool/src/main/java/org/springblade/core/tool/node/TreeNode.java
  27. 1 1
      blade-core-transaction/pom.xml
  28. 2 2
      pom.xml

+ 1 - 1
blade-core-boot/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <groupId>org.springblade</groupId>
         <artifactId>blade-tool</artifactId>
-        <version>2.6.2</version>
+        <version>2.7.0</version>
     </parent>
 
     <modelVersion>4.0.0</modelVersion>

+ 2 - 2
blade-core-boot/src/main/resources/bootstrap.yml

@@ -77,7 +77,7 @@ mybatis-plus:
     banner: false
     db-config:
       #主键类型  0:"数据库ID自增", 1:"不操作", 2:"用户输入ID",3:"数字型snowflake", 4:"全局唯一ID UUID", 5:"字符串型snowflake";
-      id-type: auto
+      id-type: assign_id
       #字段策略
       insert-strategy: not_null
       update-strategy: not_null
@@ -97,7 +97,7 @@ mybatis-plus:
 swagger:
   title: SpringBlade 接口文档系统
   description: SpringBlade 接口文档系统
-  version: 2.6.2
+  version: 2.7.0
   license: Powered By SpringBlade
   licenseUrl: https://bladex.vip
   terms-of-service-url: https://bladex.vip

+ 1 - 1
blade-core-cloud/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>blade-tool</artifactId>
         <groupId>org.springblade</groupId>
-        <version>2.6.2</version>
+        <version>2.7.0</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
blade-core-develop/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>blade-tool</artifactId>
         <groupId>org.springblade</groupId>
-        <version>2.6.2</version>
+        <version>2.7.0</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 2 - 2
blade-core-develop/src/main/resources/templates/controller.java.vm

@@ -160,7 +160,7 @@ public class $!{table.controllerName} {
 	@ApiOperationSupport(order = 7)
 	@ApiOperation(value = "逻辑删除", notes = "传入ids")
 	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
-		return R.status($!{table.entityPath}Service.deleteLogic(Func.toIntList(ids)));
+		return R.status($!{table.entityPath}Service.deleteLogic(Func.toLongList(ids)));
 	}
 
 	#else
@@ -172,7 +172,7 @@ public class $!{table.controllerName} {
 	@ApiOperationSupport(order = 8)
 	@ApiOperation(value = "删除", notes = "传入ids")
 	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
-		return R.status($!{table.entityPath}Service.removeByIds(Func.toIntList(ids)));
+		return R.status($!{table.entityPath}Service.removeByIds(Func.toLongList(ids)));
 	}
 
 	#end

+ 1 - 1
blade-core-launch/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>blade-tool</artifactId>
         <groupId>org.springblade</groupId>
-        <version>2.6.2</version>
+        <version>2.7.0</version>
     </parent>
 
     <modelVersion>4.0.0</modelVersion>

+ 1 - 1
blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java

@@ -25,7 +25,7 @@ public interface AppConstant {
 	/**
 	 * 应用版本
 	 */
-	String APPLICATION_VERSION = "2.6.2";
+	String APPLICATION_VERSION = "2.7.0";
 
 	/**
 	 * 基础包

+ 1 - 1
blade-core-log/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>blade-tool</artifactId>
         <groupId>org.springblade</groupId>
-        <version>2.6.2</version>
+        <version>2.7.0</version>
     </parent>
 
     <modelVersion>4.0.0</modelVersion>

+ 1 - 1
blade-core-mybatis/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>blade-tool</artifactId>
         <groupId>org.springblade</groupId>
-        <version>2.6.2</version>
+        <version>2.7.0</version>
     </parent>
 
     <modelVersion>4.0.0</modelVersion>

+ 6 - 2
blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseEntity.java

@@ -18,6 +18,8 @@ package org.springblade.core.mp.base;
 
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import org.springblade.core.tool.utils.DateUtil;
@@ -37,8 +39,9 @@ public class BaseEntity implements Serializable {
 	/**
 	 * 创建人
 	 */
+	@JsonSerialize(using = ToStringSerializer.class)
 	@ApiModelProperty(value = "创建人")
-	private Integer createUser;
+	private Long createUser;
 
 	/**
 	 * 创建时间
@@ -51,8 +54,9 @@ public class BaseEntity implements Serializable {
 	/**
 	 * 更新人
 	 */
+	@JsonSerialize(using = ToStringSerializer.class)
 	@ApiModelProperty(value = "更新人")
-	private Integer updateUser;
+	private Long updateUser;
 
 	/**
 	 * 更新时间

+ 1 - 1
blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseService.java

@@ -34,6 +34,6 @@ public interface BaseService<T> extends IService<T> {
 	 * @param ids id集合(逗号分隔)
 	 * @return boolean
 	 */
-	boolean deleteLogic(@NotEmpty List<Integer> ids);
+	boolean deleteLogic(@NotEmpty List<Long> ids);
 
 }

+ 1 - 1
blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseServiceImpl.java

@@ -65,7 +65,7 @@ public class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseEntity> exte
 	}
 
 	@Override
-	public boolean deleteLogic(@NotEmpty List<Integer> ids) {
+	public boolean deleteLogic(@NotEmpty List<Long> ids) {
 		return super.removeByIds(ids);
 	}
 

+ 1 - 1
blade-core-oss/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>blade-tool</artifactId>
         <groupId>org.springblade</groupId>
-        <version>2.6.2</version>
+        <version>2.7.0</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
blade-core-secure/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>blade-tool</artifactId>
         <groupId>org.springblade</groupId>
-        <version>2.6.2</version>
+        <version>2.7.0</version>
     </parent>
 
     <modelVersion>4.0.0</modelVersion>

+ 1 - 1
blade-core-secure/src/main/java/org/springblade/core/secure/BladeUser.java

@@ -39,7 +39,7 @@ public class BladeUser implements Serializable {
 	 * 用户id
 	 */
 	@ApiModelProperty(hidden = true)
-	private Integer userId;
+	private Long userId;
 	/**
 	 * 租户ID
 	 */

+ 18 - 4
blade-core-secure/src/main/java/org/springblade/core/secure/utils/SecureUtil.java

@@ -27,6 +27,7 @@ import org.springblade.core.secure.constant.SecureConstant;
 import org.springblade.core.secure.exception.SecureException;
 import org.springblade.core.secure.provider.IClientDetails;
 import org.springblade.core.secure.provider.IClientDetailsService;
+import org.springblade.core.tool.constant.RoleConstant;
 import org.springblade.core.tool.utils.*;
 
 import javax.crypto.spec.SecretKeySpec;
@@ -94,7 +95,7 @@ public class SecureUtil {
 			return null;
 		}
 		String clientId = Func.toStr(claims.get(SecureUtil.CLIENT_ID));
-		Integer userId = Func.toInt(claims.get(SecureUtil.USER_ID));
+		Long userId = Func.toLong(claims.get(SecureUtil.USER_ID));
 		String tenantId = Func.toStr(claims.get(SecureUtil.TENANT_ID));
 		String roleId = Func.toStr(claims.get(SecureUtil.ROLE_ID));
 		String account = Func.toStr(claims.get(SecureUtil.ACCOUNT));
@@ -111,13 +112,21 @@ public class SecureUtil {
 		return bladeUser;
 	}
 
+	/**
+	 * 是否为超管
+	 *
+	 * @return boolean
+	 */
+	public static boolean isAdministrator() {
+		return StringUtil.containsAny(getUserRole(), RoleConstant.ADMIN);
+	}
 
 	/**
 	 * 获取用户id
 	 *
 	 * @return userId
 	 */
-	public static Integer getUserId() {
+	public static Long getUserId() {
 		BladeUser user = getUser();
 		return (null == user) ? -1 : user.getUserId();
 	}
@@ -128,7 +137,7 @@ public class SecureUtil {
 	 * @param request request
 	 * @return userId
 	 */
-	public static Integer getUserId(HttpServletRequest request) {
+	public static Long getUserId(HttpServletRequest request) {
 		BladeUser user = getUser(request);
 		return (null == user) ? -1 : user.getUserId();
 	}
@@ -246,12 +255,17 @@ public class SecureUtil {
 	 */
 	public static Claims getClaims(HttpServletRequest request) {
 		String auth = request.getHeader(SecureUtil.HEADER);
-		if ((auth != null) && (auth.length() > AUTH_LENGTH)) {
+		if (StringUtil.isNotBlank(auth) && auth.length() > AUTH_LENGTH) {
 			String headStr = auth.substring(0, 6).toLowerCase();
 			if (headStr.compareTo(SecureUtil.BEARER) == 0) {
 				auth = auth.substring(7);
 				return SecureUtil.parseJWT(auth);
 			}
+		} else {
+			String parameter = request.getParameter(SecureUtil.HEADER);
+			if (StringUtil.isNotBlank(parameter)) {
+				return SecureUtil.parseJWT(parameter);
+			}
 		}
 		return null;
 	}

+ 1 - 1
blade-core-swagger/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>blade-tool</artifactId>
         <groupId>org.springblade</groupId>
-        <version>2.6.2</version>
+        <version>2.7.0</version>
     </parent>
 
     <modelVersion>4.0.0</modelVersion>

+ 1 - 1
blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java

@@ -55,7 +55,7 @@ public class SwaggerProperties {
 	/**
 	 * 版本
 	 **/
-	private String version = "2.6.2";
+	private String version = "2.7.0";
 	/**
 	 * 许可证
 	 **/

+ 1 - 1
blade-core-test/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <groupId>org.springblade</groupId>
         <artifactId>blade-tool</artifactId>
-        <version>2.6.2</version>
+        <version>2.7.0</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
blade-core-tool/pom.xml

@@ -6,7 +6,7 @@
     <parent>
         <groupId>org.springblade</groupId>
         <artifactId>blade-tool</artifactId>
-        <version>2.6.2</version>
+        <version>2.7.0</version>
     </parent>
 
     <modelVersion>4.0.0</modelVersion>

+ 8 - 2
blade-core-tool/src/main/java/org/springblade/core/tool/node/BaseNode.java

@@ -16,6 +16,8 @@
 package org.springblade.core.tool.node;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import lombok.Data;
 
 import java.util.ArrayList;
@@ -29,15 +31,19 @@ import java.util.List;
 @Data
 public class BaseNode implements INode {
 
+	private static final long serialVersionUID = 1L;
+
 	/**
 	 * 主键ID
 	 */
-	protected Integer id;
+	@JsonSerialize(using = ToStringSerializer.class)
+	protected Long id;
 
 	/**
 	 * 父节点ID
 	 */
-	protected Integer parentId;
+	@JsonSerialize(using = ToStringSerializer.class)
+	protected Long parentId;
 
 	/**
 	 * 子孙节点

+ 3 - 1
blade-core-tool/src/main/java/org/springblade/core/tool/node/ForestNode.java

@@ -28,12 +28,14 @@ import lombok.EqualsAndHashCode;
 @EqualsAndHashCode(callSuper = false)
 public class ForestNode extends BaseNode {
 
+	private static final long serialVersionUID = 1L;
+
 	/**
 	 * 节点内容
 	 */
 	private Object content;
 
-	public ForestNode(Integer id, Integer parentId, Object content) {
+	public ForestNode(Long id, Long parentId, Object content) {
 		this.id = id;
 		this.parentId = parentId;
 		this.content = content;

+ 4 - 4
blade-core-tool/src/main/java/org/springblade/core/tool/node/ForestNodeManager.java

@@ -33,7 +33,7 @@ public class ForestNodeManager<T extends INode> {
 	/**
 	 * 森林的父节点ID
 	 */
-	private List<Integer> parentIds = new ArrayList<>();
+	private List<Long> parentIds = new ArrayList<>();
 
 	public ForestNodeManager(List<T> items) {
 		list = items;
@@ -45,9 +45,9 @@ public class ForestNodeManager<T extends INode> {
 	 * @param id 节点ID
 	 * @return 对应的节点对象
 	 */
-	public INode getTreeNodeAT(int id) {
+	public INode getTreeNodeAT(Long id) {
 		for (INode forestNode : list) {
-			if (forestNode.getId() == id) {
+			if (forestNode.getId().longValue() == id) {
 				return forestNode;
 			}
 		}
@@ -59,7 +59,7 @@ public class ForestNodeManager<T extends INode> {
 	 *
 	 * @param parentId 父节点ID
 	 */
-	public void addParentId(Integer parentId) {
+	public void addParentId(Long parentId) {
 		parentIds.add(parentId);
 	}
 

+ 4 - 3
blade-core-tool/src/main/java/org/springblade/core/tool/node/INode.java

@@ -15,6 +15,7 @@
  */
 package org.springblade.core.tool.node;
 
+import java.io.Serializable;
 import java.util.List;
 
 /**
@@ -22,21 +23,21 @@ import java.util.List;
  *
  * @author Chill
  */
-public interface INode {
+public interface INode extends Serializable {
 
 	/**
 	 * 主键
 	 *
 	 * @return Integer
 	 */
-	Integer getId();
+	Long getId();
 
 	/**
 	 * 父主键
 	 *
 	 * @return Integer
 	 */
-	Integer getParentId();
+	Long getParentId();
 
 	/**
 	 * 子孙节点

+ 10 - 10
blade-core-tool/src/main/java/org/springblade/core/tool/node/NodeTest.java

@@ -14,16 +14,16 @@ public class NodeTest {
 
 	public static void main(String[] args) {
 		List<ForestNode> list = new ArrayList<>();
-		list.add(new ForestNode(1, 0, "1"));
-		list.add(new ForestNode(2, 0, "2"));
-		list.add(new ForestNode(3, 1, "3"));
-		list.add(new ForestNode(4, 2, "4"));
-		list.add(new ForestNode(5, 3, "5"));
-		list.add(new ForestNode(6, 4, "6"));
-		list.add(new ForestNode(7, 3, "7"));
-		list.add(new ForestNode(8, 5, "8"));
-		list.add(new ForestNode(9, 6, "9"));
-		list.add(new ForestNode(10, 9, "10"));
+		list.add(new ForestNode(1L, 0L, "1"));
+		list.add(new ForestNode(2L, 0L, "2"));
+		list.add(new ForestNode(3L, 1L, "3"));
+		list.add(new ForestNode(4L, 2L, "4"));
+		list.add(new ForestNode(5L, 3L, "5"));
+		list.add(new ForestNode(6L, 4L, "6"));
+		list.add(new ForestNode(7L, 3L, "7"));
+		list.add(new ForestNode(8L, 5L, "8"));
+		list.add(new ForestNode(9L, 6L, "9"));
+		list.add(new ForestNode(10L, 9L, "10"));
 		List<ForestNode> tns = ForestNodeMerger.merge(list);
 		tns.forEach(node ->
 			System.out.println(JsonUtil.toJson(node))

+ 8 - 2
blade-core-tool/src/main/java/org/springblade/core/tool/node/TreeNode.java

@@ -15,6 +15,8 @@
  */
 package org.springblade.core.tool.node;
 
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -27,10 +29,14 @@ import lombok.EqualsAndHashCode;
 @EqualsAndHashCode(callSuper = false)
 public class TreeNode extends BaseNode {
 
+	private static final long serialVersionUID = 1L;
+
 	private String title;
 
-	private Integer key;
+	@JsonSerialize(using = ToStringSerializer.class)
+	private Long key;
 
-	private Integer value;
+	@JsonSerialize(using = ToStringSerializer.class)
+	private Long value;
 
 }

+ 1 - 1
blade-core-transaction/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>blade-tool</artifactId>
         <groupId>org.springblade</groupId>
-        <version>2.6.2</version>
+        <version>2.7.0</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 2 - 2
pom.xml

@@ -5,7 +5,7 @@
 
     <groupId>org.springblade</groupId>
     <artifactId>blade-tool</artifactId>
-    <version>2.6.2</version>
+    <version>2.7.0</version>
     <packaging>pom</packaging>
     <name>blade-tool</name>
     <description>
@@ -36,7 +36,7 @@
     </scm>
 
     <properties>
-        <blade.tool.version>2.6.2</blade.tool.version>
+        <blade.tool.version>2.7.0</blade.tool.version>
 
         <java.version>1.8</java.version>
         <maven.plugin.version>3.8.0</maven.plugin.version>