🎉 2.5.2.RELEASE 增加用户个人中心

This commit is contained in:
smallchill 2019-10-20 23:07:14 +08:00
parent d00dee6b88
commit a8b10d57ff
33 changed files with 126 additions and 48 deletions

View File

@ -1,5 +1,5 @@
<p align="center">
<img src="https://img.shields.io/badge/Release-V2.5.1-green.svg" alt="Downloads">
<img src="https://img.shields.io/badge/Release-V2.5.2-green.svg" alt="Downloads">
<img src="https://img.shields.io/badge/JDK-1.8+-green.svg" alt="Build Status">
<img src="https://img.shields.io/badge/license-Apache%202-blue.svg" alt="Build Status">
<img src="https://img.shields.io/badge/Spring%20Cloud-Greenwich.SR3-blue.svg" alt="Coverage Status">
@ -65,7 +65,7 @@ SpringBlade
* Archer-全能代码生成系统:[https://archer.bladex.vip](https://archer.bladex.vip)
## 技术文档
* [开发手册一览](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade开发手册)
* [SpringBlade开发手册一览](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade开发手册)
* [常见问题集锦](https://sns.bladex.vip/article-14966.html)
## 项目地址

View File

@ -8,7 +8,7 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.1</version>
<version>2.5.2</version>
</parent>
<artifactId>blade-auth</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.1</version>
<version>2.5.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.1</version>
<version>2.5.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -17,6 +17,7 @@ package org.springblade.gateway.utils;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import org.springblade.core.launch.constant.TokenConstant;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
@ -28,8 +29,8 @@ import java.util.Base64;
*/
public class JwtUtil {
public static String SIGN_KEY = "BladeX";
public static String BEARER = "bearer";
public static String SIGN_KEY = TokenConstant.SIGN_KEY;
public static String BEARER = TokenConstant.BEARER;
public static Integer AUTH_LENGTH = 7;
public static String BASE64_SECURITY = Base64.getEncoder().encodeToString(SIGN_KEY.getBytes(StandardCharsets.UTF_8));

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.1</version>
<version>2.5.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -14,4 +14,6 @@ spring:
boot:
admin:
discovery:
ignored-services: consul
ignored-services:
- consul
- serverAddr

View File

@ -6,7 +6,7 @@
<parent>
<groupId>org.springblade</groupId>
<artifactId>blade-ops</artifactId>
<version>2.5.1</version>
<version>2.5.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.1</version>
<version>2.5.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@ oss:
enable: true
name: qiniu
tenant-mode: true
endpoint: prt1thnw3.bkt.clouddn.com
endpoint: http://prt1thnw3.bkt.clouddn.com
access-key: N_Loh1ngBqcJovwiAJqR91Ifj2vgOWHOf8AwBA_h
secret-key: AuzuA1KHAbkIndCU0dB3Zfii2O3crHNODDmpxHRS
bucket-name: blade

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.1</version>
<version>2.5.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.1</version>
<version>2.5.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.1</version>
<version>2.5.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.1</version>
<version>2.5.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.1</version>
<version>2.5.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.1</version>
<version>2.5.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.1</version>
<version>2.5.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -60,6 +60,10 @@ public class User extends TenantEntity {
* 真名
*/
private String realName;
/**
* 头像
*/
private String avatar;
/**
* 邮箱
*/

View File

@ -5,13 +5,13 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.1</version>
<version>2.5.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>blade-service-api</artifactId>
<name>${project.artifactId}</name>
<version>2.5.1</version>
<version>2.5.2</version>
<packaging>pom</packaging>
<description>SpringBlade 微服务API集合</description>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>org.springblade</groupId>
<artifactId>blade-service</artifactId>
<version>2.5.1</version>
<version>2.5.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.1</version>
<version>2.5.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.1</version>
<version>2.5.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.1</version>
<version>2.5.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
/**
@ -59,6 +60,17 @@ public class UserController {
return R.data(UserWrapper.build().entityVO(detail));
}
/**
* 查询单条
*/
@ApiOperationSupport(order =2)
@ApiOperation(value = "查看详情", notes = "传入id")
@GetMapping("/info")
public R<UserVO> info(BladeUser user) {
User detail = userService.getById(user.getUserId());
return R.data(UserWrapper.build().entityVO(detail));
}
/**
* 用户列表
*/
@ -67,7 +79,7 @@ public class UserController {
@ApiImplicitParam(name = "account", value = "账号名", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "realName", value = "姓名", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 2)
@ApiOperationSupport(order = 3)
@ApiOperation(value = "列表", notes = "传入account和realName")
public R<IPage<UserVO>> list(@ApiIgnore @RequestParam Map<String, Object> user, Query query, BladeUser bladeUser) {
QueryWrapper<User> queryWrapper = Condition.getQueryWrapper(user, User.class);
@ -79,7 +91,7 @@ public class UserController {
* 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 3)
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增或修改", notes = "传入User")
public R submit(@Valid @RequestBody User user) {
return R.status(userService.submit(user));
@ -89,7 +101,7 @@ public class UserController {
* 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 4)
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入User")
public R update(@Valid @RequestBody User user) {
return R.status(userService.updateById(user));
@ -99,7 +111,7 @@ public class UserController {
* 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 5)
@ApiOperationSupport(order = 6)
@ApiOperation(value = "删除", notes = "传入地基和")
public R remove(@RequestParam String ids) {
return R.status(userService.deleteLogic(Func.toIntList(ids)));
@ -114,7 +126,7 @@ public class UserController {
* @return
*/
@PostMapping("/grant")
@ApiOperationSupport(order = 6)
@ApiOperationSupport(order = 7)
@ApiOperation(value = "权限设置", notes = "传入roleId集合以及menuId集合")
public R grant(@ApiParam(value = "userId集合", required = true) @RequestParam String userIds,
@ApiParam(value = "roleId集合", required = true) @RequestParam String roleIds) {
@ -123,11 +135,43 @@ public class UserController {
}
@PostMapping("/reset-password")
@ApiOperationSupport(order = 7)
@ApiOperationSupport(order = 8)
@ApiOperation(value = "初始化密码", notes = "传入userId集合")
public R resetPassword(@ApiParam(value = "userId集合", required = true) @RequestParam String userIds) {
boolean temp = userService.resetPassword(userIds);
return R.status(temp);
}
/**
* 修改密码
*
* @param oldPassword
* @param newPassword
* @param newPassword1
* @return
*/
@PostMapping("/update-password")
@ApiOperationSupport(order = 9)
@ApiOperation(value = "修改密码", notes = "传入密码")
public R updatePassword(BladeUser user, @ApiParam(value = "旧密码", required = true) @RequestParam String oldPassword,
@ApiParam(value = "新密码", required = true) @RequestParam String newPassword,
@ApiParam(value = "新密码", required = true) @RequestParam String newPassword1) {
boolean temp = userService.updatePassword(user.getUserId(), oldPassword, newPassword, newPassword1);
return R.status(temp);
}
/**
* 用户列表
*
* @param user
* @return
*/
@GetMapping("/user-list")
@ApiOperationSupport(order = 10)
@ApiOperation(value = "用户列表", notes = "传入user")
public R<List<User>> userList(User user) {
List<User> list = userService.list(Condition.getQueryWrapper(user));
return R.data(list);
}
}

View File

@ -82,6 +82,17 @@ public interface IUserService extends BaseService<User> {
*/
boolean resetPassword(String userIds);
/**
* 修改密码
*
* @param userId
* @param oldPassword
* @param newPassword
* @param newPassword1
* @return
*/
boolean updatePassword(Integer userId, String oldPassword, String newPassword, String newPassword1);
/**
* 获取角色名
*

View File

@ -20,6 +20,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.exceptions.ApiException;
import org.springblade.common.constant.CommonConstant;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.DigestUtil;
@ -96,6 +97,18 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
return this.update(user, Wrappers.<User>update().lambda().in(User::getId, Func.toIntList(userIds)));
}
@Override
public boolean updatePassword(Integer userId, String oldPassword, String newPassword, String newPassword1) {
User user = getById(userId);
if (!newPassword.equals(newPassword1)) {
throw new ServiceException("请输入正确的确认密码!");
}
if (!user.getPassword().equals(DigestUtil.encrypt(oldPassword))) {
throw new ServiceException("原密码不正确!");
}
return this.update(Wrappers.<User>update().lambda().set(User::getPassword, DigestUtil.encrypt(newPassword)).eq(User::getId, userId));
}
@Override
public List<String> getRoleName(String roleIds) {
return baseMapper.getRoleName(Func.toStrArray(roleIds));

View File

@ -7,12 +7,12 @@
<parent>
<groupId>org.springblade</groupId>
<artifactId>SpringBlade</artifactId>
<version>2.5.1</version>
<version>2.5.2</version>
</parent>
<artifactId>blade-service</artifactId>
<name>${project.artifactId}</name>
<version>2.5.1</version>
<version>2.5.2</version>
<packaging>pom</packaging>
<description>SpringBlade 微服务集合</description>

View File

@ -73,16 +73,15 @@ blade:
exclude-patterns:
- /weixin
secure:
url:
exclude-patterns:
skip-url:
- /test/**
client:
- client-id: sword
path-patterns:
- /sword/**
- client-id: saber
path-patterns:
- /saber/**
client:
- client-id: sword
path-patterns:
- /sword/**
- client-id: saber
path-patterns:
- /saber/**
tenant:
column: tenant_id
tables:

View File

@ -394,6 +394,7 @@ CREATE TABLE `blade_user` (
`password` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '密码',
`name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '昵称',
`real_name` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '真名',
`avatar` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '头像',
`email` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '邮箱',
`phone` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机',
`birthday` datetime(0) NULL DEFAULT NULL COMMENT '生日',
@ -413,7 +414,7 @@ CREATE TABLE `blade_user` (
-- Records of blade_user
-- ----------------------------
BEGIN;
INSERT INTO `blade_user` VALUES (1, '000000', 'admin', '90b9aa7e25f80cf4f64e990b78a9fc5ebd6cecad', '管理员', '管理员', 'admin@bladex.vip', '22233322', '2018-08-08 00:00:00', 1, '1', '1', 1, '2018-08-08 00:00:00', 1, '2018-08-08 00:00:00', 1, 0);
INSERT INTO `blade_user` VALUES (1, '000000', 'admin', '90b9aa7e25f80cf4f64e990b78a9fc5ebd6cecad', '管理员', '管理员', '', 'admin@bladex.vip', '22233322', '2018-08-08 00:00:00', 1, '1', '1', 1, '2018-08-08 00:00:00', 1, '2018-08-08 00:00:00', 1, 0);
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;

View File

@ -394,6 +394,7 @@ CREATE TABLE `blade_user` (
`password` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '密码',
`name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '昵称',
`real_name` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '真名',
`avatar` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '头像',
`email` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '邮箱',
`phone` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机',
`birthday` datetime(0) NULL DEFAULT NULL COMMENT '生日',
@ -413,7 +414,7 @@ CREATE TABLE `blade_user` (
-- Records of blade_user
-- ----------------------------
BEGIN;
INSERT INTO `blade_user` VALUES (1, '000000', 'admin', '90b9aa7e25f80cf4f64e990b78a9fc5ebd6cecad', '管理员', '管理员', 'admin@bladex.vip', '22233322', '2018-08-08 00:00:00', 1, '1', '1', 1, '2018-08-08 00:00:00', 1, '2018-08-08 00:00:00', 1, 0);
INSERT INTO `blade_user` VALUES (1, '000000', 'admin', '90b9aa7e25f80cf4f64e990b78a9fc5ebd6cecad', '管理员', '管理员', '', 'admin@bladex.vip', '22233322', '2018-08-08 00:00:00', 1, '1', '1', 1, '2018-08-08 00:00:00', 1, '2018-08-08 00:00:00', 1, 0);
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;

View File

@ -0,0 +1,2 @@
ALTER TABLE `blade`.`blade_user`
ADD COLUMN `avatar` varchar(2000) NULL COMMENT '头像' AFTER `real_name`;

View File

@ -5,12 +5,12 @@
<groupId>org.springblade</groupId>
<artifactId>SpringBlade</artifactId>
<version>2.5.1</version>
<version>2.5.2</version>
<packaging>pom</packaging>
<properties>
<blade.tool.version>2.5.1</blade.tool.version>
<blade.project.version>2.5.1</blade.project.version>
<blade.tool.version>2.5.2</blade.tool.version>
<blade.project.version>2.5.2</blade.project.version>
<java.version>1.8</java.version>
<swagger.version>2.9.2</swagger.version>

View File

@ -1,2 +1,2 @@
REGISTER=192.168.0.157/blade
TAG=2.5.1
TAG=2.5.2