From d194e1478040c857bcbf629ab7f53551915d6f81 Mon Sep 17 00:00:00 2001
From: niudehua <657563945@qq.com>
Date: Fri, 15 Oct 2021 21:16:10 +0800
Subject: [PATCH 1/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9maven=E6=A8=A1=E5=9D=97?=
=?UTF-8?q?=E5=90=8D=E7=A7=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
yudao-core-service/pom.xml | 2 +-
yudao-user-server/pom.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/yudao-core-service/pom.xml b/yudao-core-service/pom.xml
index 3ce350b54..43cdae127 100644
--- a/yudao-core-service/pom.xml
+++ b/yudao-core-service/pom.xml
@@ -12,7 +12,7 @@
yudao-core-service
jar
- yudao-admin-server
+ yudao-core-service
公共服务,通过 jar 包的方式,被 yudao-admin-server、yudao-user-service 使用。例如说:
1. 日志相关:访问日志、登录日志、异常日志等等
diff --git a/yudao-user-server/pom.xml b/yudao-user-server/pom.xml
index fe55b34f9..2aa1ee772 100644
--- a/yudao-user-server/pom.xml
+++ b/yudao-user-server/pom.xml
@@ -12,7 +12,7 @@
yudao-user-server
jar
- yudao-admin-server
+ yudao-user-server
用户前台 Server,提供其 API 接口
https://github.com/YunaiV/ruoyi-vue-pro
From c06d6e53f60f1ff0719d3ef80adab4a36adf8981 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AE=8B=E5=A4=A9?= <2982176321@qq.com>
Date: Tue, 19 Oct 2021 22:16:42 +0800
Subject: [PATCH 2/6] =?UTF-8?q?[update]=20=E6=96=B0=E5=A2=9E=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9=E6=98=B5=E7=A7=B0=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=A4=B4?=
=?UTF-8?q?=E5=83=8F=EF=BC=8C=E6=9F=A5=E8=AF=A2=E6=98=B5=E7=A7=B0=E4=B8=8E?=
=?UTF-8?q?=E5=A4=B4=E5=83=8F=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../controller/file/InfFileController.java | 8 +--
.../infra/convert/file/InfFileConvert.java | 2 +-
.../infra/dal/mysql/file/InfFileMapper.java | 25 --------
.../infra/enums/InfErrorCodeConstants.java | 3 -
.../service/user/impl/SysUserServiceImpl.java | 4 +-
.../service/file/InfFileServiceTest.java | 16 ++---
.../service/user/SysUserServiceImplTest.java | 4 +-
.../dal/mysql/file/InfFileCoreMapper.java | 14 +++++
.../infra}/file/vo/InfFilePageReqVO.java | 2 +-
.../modules/infra}/file/vo/InfFileRespVO.java | 2 +-
.../file/config/FileConfiguration.java | 2 +-
.../framework/file/config/FileProperties.java | 2 +-
.../infra/framework/file/package-info.java | 2 +-
.../service/file/InfFileCoreService.java | 15 ++---
.../file/impl/InfFileCoreServiceImpl.java | 25 ++++----
.../user/vo/SysUserCoreProfileRespVo.java | 20 ++++++
.../system/enums/SysErrorCodeConstants.java | 3 +
.../user/SysUserProfileController.http | 8 +++
.../user/SysUserProfileController.java | 42 ++++++++++++-
.../member/enums/MbrErrorCodeConstants.java | 5 ++
.../member/service/user/MbrUserService.java | 25 ++++++++
.../service/user/impl/MbrUserServiceImpl.java | 61 +++++++++++++++++++
22 files changed, 218 insertions(+), 72 deletions(-)
delete mode 100644 yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/dal/mysql/file/InfFileMapper.java
rename {yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller => yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra}/file/vo/InfFilePageReqVO.java (94%)
rename {yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller => yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra}/file/vo/InfFileRespVO.java (88%)
rename {yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver => yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice}/modules/infra/framework/file/config/FileConfiguration.java (81%)
rename {yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver => yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice}/modules/infra/framework/file/config/FileProperties.java (88%)
rename {yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver => yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice}/modules/infra/framework/file/package-info.java (92%)
rename yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileService.java => yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/InfFileCoreService.java (69%)
rename yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/impl/InfFileServiceImpl.java => yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/impl/InfFileCoreServiceImpl.java (66%)
create mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/controller/user/vo/SysUserCoreProfileRespVo.java
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/InfFileController.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/InfFileController.java
index 6b2c743ca..2fcbbd00f 100644
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/InfFileController.java
+++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/InfFileController.java
@@ -2,12 +2,12 @@ package cn.iocoder.yudao.adminserver.modules.infra.controller.file;
import cn.hutool.core.io.IoUtil;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
+import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.adminserver.modules.infra.controller.file.vo.InfFilePageReqVO;
-import cn.iocoder.yudao.adminserver.modules.infra.controller.file.vo.InfFileRespVO;
+import cn.iocoder.yudao.coreservice.modules.infra.file.vo.InfFilePageReqVO;
+import cn.iocoder.yudao.coreservice.modules.infra.file.vo.InfFileRespVO;
import cn.iocoder.yudao.adminserver.modules.infra.convert.file.InfFileConvert;
-import cn.iocoder.yudao.adminserver.modules.infra.service.file.InfFileService;
import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -35,7 +35,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
public class InfFileController {
@Resource
- private InfFileService fileService;
+ private InfFileCoreService fileService;
@PostMapping("/upload")
@ApiOperation("上传文件")
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/convert/file/InfFileConvert.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/convert/file/InfFileConvert.java
index d39452ffe..78b665292 100644
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/convert/file/InfFileConvert.java
+++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/convert/file/InfFileConvert.java
@@ -2,7 +2,7 @@ package cn.iocoder.yudao.adminserver.modules.infra.convert.file;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.adminserver.modules.infra.controller.file.vo.InfFileRespVO;
+import cn.iocoder.yudao.coreservice.modules.infra.file.vo.InfFileRespVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/dal/mysql/file/InfFileMapper.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/dal/mysql/file/InfFileMapper.java
deleted file mode 100644
index 022f90acb..000000000
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/dal/mysql/file/InfFileMapper.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package cn.iocoder.yudao.adminserver.modules.infra.dal.mysql.file;
-
-import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
-import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
-import cn.iocoder.yudao.adminserver.modules.infra.controller.file.vo.InfFilePageReqVO;
-import org.apache.ibatis.annotations.Mapper;
-
-@Mapper
-public interface InfFileMapper extends BaseMapperX {
-
- default Integer selectCountById(String id) {
- return selectCount("id", id);
- }
-
- default PageResult selectPage(InfFilePageReqVO reqVO) {
- return selectPage(reqVO, new QueryWrapperX()
- .likeIfPresent("id", reqVO.getId())
- .likeIfPresent("type", reqVO.getType())
- .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
- .orderByDesc("create_time"));
- }
-
-}
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/enums/InfErrorCodeConstants.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/enums/InfErrorCodeConstants.java
index b53ff8c1d..98155e723 100644
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/enums/InfErrorCodeConstants.java
+++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/enums/InfErrorCodeConstants.java
@@ -27,7 +27,4 @@ public interface InfErrorCodeConstants {
ErrorCode API_ERROR_LOG_NOT_FOUND = new ErrorCode(1001002000, "API 错误日志不存在");
ErrorCode API_ERROR_LOG_PROCESSED = new ErrorCode(1001002001, "API 错误日志已处理");
- // ========== 文件 1001003000 ==========
- ErrorCode FILE_NOT_EXISTS = new ErrorCode(1001003000, "文件不存在");
-
}
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/user/impl/SysUserServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/user/impl/SysUserServiceImpl.java
index af7705b63..8901ca022 100644
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/user/impl/SysUserServiceImpl.java
+++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/user/impl/SysUserServiceImpl.java
@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
-import cn.iocoder.yudao.adminserver.modules.infra.service.file.InfFileService;
import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.profile.SysUserProfileUpdatePasswordReqVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.profile.SysUserProfileUpdateReqVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.user.*;
@@ -16,6 +15,7 @@ import cn.iocoder.yudao.adminserver.modules.system.service.dept.SysDeptService;
import cn.iocoder.yudao.adminserver.modules.system.service.dept.SysPostService;
import cn.iocoder.yudao.adminserver.modules.system.service.permission.SysPermissionService;
import cn.iocoder.yudao.adminserver.modules.system.service.user.SysUserService;
+import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.exception.ServiceException;
@@ -59,7 +59,7 @@ public class SysUserServiceImpl implements SysUserService {
@Resource
private PasswordEncoder passwordEncoder;
@Resource
- private InfFileService fileService;
+ private InfFileCoreService fileService;
@Override
public Long createUser(SysUserCreateReqVO reqVO) {
diff --git a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileServiceTest.java b/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileServiceTest.java
index 4849d49cd..7c9cafce3 100644
--- a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileServiceTest.java
+++ b/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileServiceTest.java
@@ -3,11 +3,11 @@ package cn.iocoder.yudao.adminserver.modules.infra.service.file;
import cn.hutool.core.io.resource.ResourceUtil;
import cn.iocoder.yudao.adminserver.BaseDbUnitTest;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
+import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.file.InfFileCoreMapper;
+import cn.iocoder.yudao.coreservice.modules.infra.service.file.impl.InfFileCoreServiceImpl;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.adminserver.modules.infra.framework.file.config.FileProperties;
-import cn.iocoder.yudao.adminserver.modules.infra.controller.file.vo.InfFilePageReqVO;
-import cn.iocoder.yudao.adminserver.modules.infra.dal.mysql.file.InfFileMapper;
-import cn.iocoder.yudao.adminserver.modules.infra.service.file.impl.InfFileServiceImpl;
+import cn.iocoder.yudao.coreservice.modules.infra.framework.file.config.FileProperties;
+import cn.iocoder.yudao.coreservice.modules.infra.file.vo.InfFilePageReqVO;
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.mock.mockito.MockBean;
@@ -15,8 +15,8 @@ import org.springframework.context.annotation.Import;
import javax.annotation.Resource;
+import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.FILE_NOT_EXISTS;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
-import static cn.iocoder.yudao.adminserver.modules.infra.enums.InfErrorCodeConstants.FILE_NOT_EXISTS;
import static cn.iocoder.yudao.adminserver.modules.system.enums.SysErrorCodeConstants.FILE_PATH_EXISTS;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
@@ -24,17 +24,17 @@ import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomString
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime;
import static org.junit.jupiter.api.Assertions.*;
-@Import({InfFileServiceImpl.class, FileProperties.class})
+@Import({InfFileCoreServiceImpl.class, FileProperties.class})
public class InfFileServiceTest extends BaseDbUnitTest {
@Resource
- private InfFileServiceImpl fileService;
+ private InfFileCoreServiceImpl fileService;
@MockBean
private FileProperties fileProperties;
@Resource
- private InfFileMapper fileMapper;
+ private InfFileCoreMapper fileMapper;
@Test
public void testCreateFile_success() {
diff --git a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/system/service/user/SysUserServiceImplTest.java b/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/system/service/user/SysUserServiceImplTest.java
index e20e72793..70751eeac 100644
--- a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/system/service/user/SysUserServiceImplTest.java
+++ b/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/system/service/user/SysUserServiceImplTest.java
@@ -3,7 +3,6 @@ package cn.iocoder.yudao.adminserver.modules.system.service.user;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.RandomUtil;
import cn.iocoder.yudao.adminserver.BaseDbUnitTest;
-import cn.iocoder.yudao.adminserver.modules.infra.service.file.InfFileService;
import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.profile.SysUserProfileUpdatePasswordReqVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.profile.SysUserProfileUpdateReqVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.user.*;
@@ -14,6 +13,7 @@ import cn.iocoder.yudao.adminserver.modules.system.service.dept.SysDeptService;
import cn.iocoder.yudao.adminserver.modules.system.service.dept.SysPostService;
import cn.iocoder.yudao.adminserver.modules.system.service.permission.SysPermissionService;
import cn.iocoder.yudao.adminserver.modules.system.service.user.impl.SysUserServiceImpl;
+import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO;
import cn.iocoder.yudao.coreservice.modules.system.enums.common.SysSexEnum;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
@@ -69,7 +69,7 @@ public class SysUserServiceImplTest extends BaseDbUnitTest {
@MockBean
private PasswordEncoder passwordEncoder;
@MockBean
- private InfFileService fileService;
+ private InfFileCoreService fileService;
@Test
public void testCreatUser_success() {
diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/dal/mysql/file/InfFileCoreMapper.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/dal/mysql/file/InfFileCoreMapper.java
index 180dc2d79..43703c5da 100644
--- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/dal/mysql/file/InfFileCoreMapper.java
+++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/dal/mysql/file/InfFileCoreMapper.java
@@ -1,10 +1,24 @@
package cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.file;
+import cn.iocoder.yudao.coreservice.modules.infra.file.vo.InfFilePageReqVO;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
+import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface InfFileCoreMapper extends BaseMapperX {
+ default Integer selectCountById(String id) {
+ return selectCount("id", id);
+ }
+
+ default PageResult selectPage(InfFilePageReqVO reqVO) {
+ return selectPage(reqVO, new QueryWrapperX()
+ .likeIfPresent("id", reqVO.getId())
+ .likeIfPresent("type", reqVO.getType())
+ .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
+ .orderByDesc("create_time"));
+ }
}
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/vo/InfFilePageReqVO.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/file/vo/InfFilePageReqVO.java
similarity index 94%
rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/vo/InfFilePageReqVO.java
rename to yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/file/vo/InfFilePageReqVO.java
index 152466a19..a6124f7ea 100644
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/vo/InfFilePageReqVO.java
+++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/file/vo/InfFilePageReqVO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.adminserver.modules.infra.controller.file.vo;
+package cn.iocoder.yudao.coreservice.modules.infra.file.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel;
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/vo/InfFileRespVO.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/file/vo/InfFileRespVO.java
similarity index 88%
rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/vo/InfFileRespVO.java
rename to yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/file/vo/InfFileRespVO.java
index 2388d7f3d..57dd5b197 100644
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/vo/InfFileRespVO.java
+++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/file/vo/InfFileRespVO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.adminserver.modules.infra.controller.file.vo;
+package cn.iocoder.yudao.coreservice.modules.infra.file.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/framework/file/config/FileConfiguration.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/framework/file/config/FileConfiguration.java
similarity index 81%
rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/framework/file/config/FileConfiguration.java
rename to yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/framework/file/config/FileConfiguration.java
index e71377e3f..a10c7a7af 100644
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/framework/file/config/FileConfiguration.java
+++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/framework/file/config/FileConfiguration.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.adminserver.modules.infra.framework.file.config;
+package cn.iocoder.yudao.coreservice.modules.infra.framework.file.config;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/framework/file/config/FileProperties.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/framework/file/config/FileProperties.java
similarity index 88%
rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/framework/file/config/FileProperties.java
rename to yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/framework/file/config/FileProperties.java
index db1a6b71f..0d8ed7cda 100644
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/framework/file/config/FileProperties.java
+++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/framework/file/config/FileProperties.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.adminserver.modules.infra.framework.file.config;
+package cn.iocoder.yudao.coreservice.modules.infra.framework.file.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/framework/file/package-info.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/framework/file/package-info.java
similarity index 92%
rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/framework/file/package-info.java
rename to yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/framework/file/package-info.java
index a69b53eb5..2c2798ee6 100644
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/framework/file/package-info.java
+++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/framework/file/package-info.java
@@ -13,4 +13,4 @@
* 综合考虑,暂时使用方案 3 的方式,比较适合这样一个 all in one 的项目。
* 随着文件的量级大了之后,还是推荐采用云服务。
*/
-package cn.iocoder.yudao.adminserver.modules.infra.framework.file;
+package cn.iocoder.yudao.coreservice.modules.infra.framework.file;
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileService.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/InfFileCoreService.java
similarity index 69%
rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileService.java
rename to yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/InfFileCoreService.java
index e19e3ecab..f6f251abe 100644
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileService.java
+++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/InfFileCoreService.java
@@ -1,15 +1,17 @@
-package cn.iocoder.yudao.adminserver.modules.infra.service.file;
+package cn.iocoder.yudao.coreservice.modules.infra.service.file;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
+import cn.iocoder.yudao.coreservice.modules.infra.file.vo.InfFilePageReqVO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.adminserver.modules.infra.controller.file.vo.InfFilePageReqVO;
/**
- * 文件 Service 接口
- *
- * @author 芋道源码
+ * @Class:ruoyi-vue-pro.cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService
+ * @Descript: 文件 core Service 接口
+ * @Author:宋天
+ * @Date:2021/10/19
*/
-public interface InfFileService {
+public interface InfFileCoreService {
+
/**
* 保存文件,并返回文件的访问路径
@@ -42,5 +44,4 @@ public interface InfFileService {
* @return 文件分页
*/
PageResult getFilePage(InfFilePageReqVO pageReqVO);
-
}
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/impl/InfFileServiceImpl.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/impl/InfFileCoreServiceImpl.java
similarity index 66%
rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/impl/InfFileServiceImpl.java
rename to yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/impl/InfFileCoreServiceImpl.java
index 0436b804f..850701ffa 100644
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/impl/InfFileServiceImpl.java
+++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/impl/InfFileCoreServiceImpl.java
@@ -1,31 +1,32 @@
-package cn.iocoder.yudao.adminserver.modules.infra.service.file.impl;
+package cn.iocoder.yudao.coreservice.modules.infra.service.file.impl;
import cn.hutool.core.io.FileTypeUtil;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
+import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.file.InfFileCoreMapper;
+import cn.iocoder.yudao.coreservice.modules.infra.file.vo.InfFilePageReqVO;
+import cn.iocoder.yudao.coreservice.modules.infra.framework.file.config.FileProperties;
+import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.adminserver.modules.infra.framework.file.config.FileProperties;
-import cn.iocoder.yudao.adminserver.modules.infra.controller.file.vo.InfFilePageReqVO;
-import cn.iocoder.yudao.adminserver.modules.infra.dal.mysql.file.InfFileMapper;
-import cn.iocoder.yudao.adminserver.modules.infra.service.file.InfFileService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.ByteArrayInputStream;
+import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.FILE_NOT_EXISTS;
+import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.FILE_PATH_EXISTS;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
-import static cn.iocoder.yudao.adminserver.modules.infra.enums.InfErrorCodeConstants.FILE_NOT_EXISTS;
-import static cn.iocoder.yudao.adminserver.modules.system.enums.SysErrorCodeConstants.FILE_PATH_EXISTS;
/**
- * 文件 Service 实现类
- *
- * @author 芋道源码
+ * @Class:ruoyi-vue-pro.cn.iocoder.yudao.coreservice.modules.infra.service.file.impl.InfFileCoreServiceImpl
+ * @Descript: core service 文件实现类
+ * @Author:宋天
+ * @Date:2021/10/19
*/
@Service
-public class InfFileServiceImpl implements InfFileService {
+public class InfFileCoreServiceImpl implements InfFileCoreService {
@Resource
- private InfFileMapper fileMapper;
+ private InfFileCoreMapper fileMapper;
@Resource
private FileProperties fileProperties;
diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/controller/user/vo/SysUserCoreProfileRespVo.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/controller/user/vo/SysUserCoreProfileRespVo.java
new file mode 100644
index 000000000..50c9a6856
--- /dev/null
+++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/controller/user/vo/SysUserCoreProfileRespVo.java
@@ -0,0 +1,20 @@
+package cn.iocoder.yudao.coreservice.modules.system.controller.user.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@ApiModel("用户个人中心信息 Response VO")
+public class SysUserCoreProfileRespVo {
+
+ @ApiModelProperty(value = "用户昵称", required = true, example = "芋艿")
+ private String nickName;
+
+ @ApiModelProperty(value = "用户头像", required = true, example = "/infra/file/get/35a12e57-4297-4faa-bf7d-7ed2f211c952")
+ private String avatar;
+}
diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/SysErrorCodeConstants.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/SysErrorCodeConstants.java
index 3c1fc87ef..60249398c 100644
--- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/SysErrorCodeConstants.java
+++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/SysErrorCodeConstants.java
@@ -14,4 +14,7 @@ public interface SysErrorCodeConstants {
ErrorCode SMS_SEND_MOBILE_TEMPLATE_PARAM_MISS = new ErrorCode(1006000001, "模板参数({})缺失");
ErrorCode SMS_SEND_TEMPLATE_NOT_EXISTS = new ErrorCode(1006000000, "短信模板不存在");
+ // 文件相关
+ ErrorCode FILE_PATH_EXISTS = new ErrorCode(1006001000, "文件路径已存在");
+ ErrorCode FILE_NOT_EXISTS = new ErrorCode(1006001002, "文件不存在");
}
diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.http b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.http
index 72cf861b8..eb3d8fea6 100644
--- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.http
+++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.http
@@ -1,3 +1,11 @@
### 请求 /system/user/profile/get 接口 => 没有权限
GET {{userServerUrl}}/system/user/profile/get
Authorization: Bearer test245
+
+### 请求 /system/user/profile/revise-nickname 接口 成功
+PUT http://localhost:28080/api/system/user/profile/revise-nickname?nickName=yunai111
+Authorization: Bearer test245
+
+### 请求 /system/user/profile/get-user-info 接口 成功
+GET http://localhost:28080/api/system/user/profile/get-user-info?id=245
+Authorization: Bearer test245
\ No newline at end of file
diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.java
index 4b66b4e18..a1e0f5a25 100644
--- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.java
+++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.java
@@ -1,14 +1,24 @@
package cn.iocoder.yudao.userserver.modules.member.controller.user;
+import cn.iocoder.yudao.coreservice.modules.system.controller.user.vo.SysUserCoreProfileRespVo;
+import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
+import cn.iocoder.yudao.userserver.modules.member.service.user.MbrUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+
+import java.io.IOException;
+
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
+import static cn.iocoder.yudao.userserver.modules.member.enums.MbrErrorCodeConstants.FILE_IS_EMPTY;
@Api(tags = "用户个人中心")
@RestController
@@ -17,6 +27,9 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j
public class SysUserProfileController {
+ @Resource
+ private MbrUserService userService;
+
@GetMapping("/get")
@ApiOperation("获得登录用户信息")
@PreAuthenticated
@@ -24,4 +37,27 @@ public class SysUserProfileController {
return null;
}
+ @PutMapping("/revise-nickname")
+ @ApiOperation("修改用户昵称")
+ public CommonResult reviseNickname(@RequestParam("nickName") String nickName) {
+ userService.reviseNickname(getLoginUserId(), nickName);
+ return success(true);
+ }
+
+ @PutMapping("/revise-avatar")
+ @ApiOperation("修改用户头像")
+ public CommonResult reviseAvatar(@RequestParam("avatarFile") MultipartFile file) throws IOException {
+ if (file.isEmpty()) {
+ throw ServiceExceptionUtil.exception(FILE_IS_EMPTY);
+ }
+ String avatar = userService.reviseAvatar(getLoginUserId(), file.getInputStream());
+ return success(avatar);
+ }
+
+ @GetMapping("/get-user-info")
+ @ApiOperation("获取用户头像与昵称")
+ public CommonResult getUserInfo(@RequestParam("id") Long id) {
+ return success(userService.getUserInfo(id));
+ }
}
+
diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/enums/MbrErrorCodeConstants.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/enums/MbrErrorCodeConstants.java
index 265d1d485..5d8507d7f 100644
--- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/enums/MbrErrorCodeConstants.java
+++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/enums/MbrErrorCodeConstants.java
@@ -9,4 +9,9 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
*/
public interface MbrErrorCodeConstants {
+ // 用户相关
+ ErrorCode USER_NOT_EXISTS = new ErrorCode(1004000000, "用户不存在");
+
+ // 文件相关
+ ErrorCode FILE_IS_EMPTY = new ErrorCode(1004000000, "用户不存在");
}
diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/MbrUserService.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/MbrUserService.java
index 2d5466865..bb81d3718 100644
--- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/MbrUserService.java
+++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/MbrUserService.java
@@ -1,8 +1,11 @@
package cn.iocoder.yudao.userserver.modules.member.service.user;
import cn.iocoder.yudao.coreservice.modules.member.dal.dataobject.user.MbrUserDO;
+import cn.iocoder.yudao.coreservice.modules.system.controller.user.vo.SysUserCoreProfileRespVo;
import cn.iocoder.yudao.framework.common.validation.Mobile;
+import java.io.InputStream;
+
/**
* 前台用户 Service 接口
*
@@ -44,4 +47,26 @@ public interface MbrUserService {
*/
MbrUserDO getUser(Long id);
+ /**
+ * 修改用户昵称
+ * @param loginUserId 登录用户id
+ * @param nickName 用户新昵称
+ */
+ void reviseNickname(Long loginUserId, String nickName);
+
+ /**
+ * 修改用户头像
+ * @param loginUserId 登录用户id
+ * @param inputStream 头像文件
+ * @return 头像url
+ */
+ String reviseAvatar(Long loginUserId, InputStream inputStream);
+
+ /**
+ * 根据用户id,获取用户头像与昵称
+ * @param loginUserId 登录用户id
+ * @return 用户响应实体类
+ */
+ SysUserCoreProfileRespVo getUserInfo(Long loginUserId);
+
}
diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/impl/MbrUserServiceImpl.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/impl/MbrUserServiceImpl.java
index 71fb9dd88..f10c03ed1 100644
--- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/impl/MbrUserServiceImpl.java
+++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/impl/MbrUserServiceImpl.java
@@ -1,18 +1,27 @@
package cn.iocoder.yudao.userserver.modules.member.service.user.impl;
+import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.IdUtil;
+import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService;
import cn.iocoder.yudao.coreservice.modules.member.dal.dataobject.user.MbrUserDO;
+import cn.iocoder.yudao.coreservice.modules.system.controller.user.vo.SysUserCoreProfileRespVo;
+import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.userserver.modules.member.dal.mysql.user.MbrUserMapper;
import cn.iocoder.yudao.userserver.modules.member.service.user.MbrUserService;
+import com.google.common.annotations.VisibleForTesting;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.validation.Valid;
+import java.io.InputStream;
import java.util.Date;
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.iocoder.yudao.userserver.modules.member.enums.MbrErrorCodeConstants.USER_NOT_EXISTS;
+
/**
* User Service 实现类
*
@@ -26,6 +35,9 @@ public class MbrUserServiceImpl implements MbrUserService {
@Resource
private MbrUserMapper userMapper;
+ @Resource
+ private InfFileCoreService fileCoreService;
+
@Resource
private PasswordEncoder passwordEncoder;
@@ -68,4 +80,53 @@ public class MbrUserServiceImpl implements MbrUserService {
return userMapper.selectById(id);
}
+ @Override
+ public void reviseNickname(Long loginUserId, String nickName) {
+ MbrUserDO mbrUserDO = userMapper.selectById(loginUserId);
+ // 仅当新昵称不等于旧昵称时进行修改
+ if (!nickName.equals(mbrUserDO.getNickname())){
+ MbrUserDO user = new MbrUserDO();
+ user.setId(mbrUserDO.getId());
+ user.setNickname(nickName);
+ userMapper.updateById(user);
+ }
+ }
+
+ @Override
+ public String reviseAvatar(Long loginUserId, InputStream avatarFile) {
+ this.checkUserExists(loginUserId);
+ // 创建文件
+ String avatar = fileCoreService.createFile(IdUtil.fastUUID(), IoUtil.readBytes(avatarFile));
+ // 更新头像路径
+ MbrUserDO userDO = new MbrUserDO();
+ userDO.setId(loginUserId);
+ userDO.setAvatar(avatar);
+ userMapper.updateById(userDO);
+ return avatar;
+ }
+
+ @Override
+ public SysUserCoreProfileRespVo getUserInfo(Long loginUserId) {
+ MbrUserDO mbrUserDO = userMapper.selectById(loginUserId);
+ if (mbrUserDO == null){
+ log.error("用户不存在:{}",loginUserId);
+ throw exception(USER_NOT_EXISTS);
+ }
+
+ SysUserCoreProfileRespVo userRes = new SysUserCoreProfileRespVo();
+ userRes.setNickName(mbrUserDO.getNickname());
+ userRes.setAvatar(mbrUserDO.getAvatar());
+ return userRes;
+ }
+
+ @VisibleForTesting
+ public void checkUserExists(Long id) {
+ if (id == null) {
+ return;
+ }
+ MbrUserDO user = userMapper.selectById(id);
+ if (user == null) {
+ throw exception(USER_NOT_EXISTS);
+ }
+ }
}
From 79da36ac040910496eeefb9f7720c94238956de6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AE=8B=E5=A4=A9?= <2982176321@qq.com>
Date: Wed, 20 Oct 2021 16:59:47 +0800
Subject: [PATCH 3/6] =?UTF-8?q?[update]=E6=9B=B4=E6=96=B0=E4=BB=A3?=
=?UTF-8?q?=E7=A0=81=E8=A7=84=E8=8C=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../controller/file/InfFileController.java | 8 +--
.../infra/convert/file/InfFileConvert.java | 2 +-
.../infra/service/file/InfFileService.java | 46 ++++++++++++++++
.../service/file/impl/InfFileServiceImpl.java | 46 ++++++++++++++++
.../service/file/InfFileServiceTest.java | 4 +-
.../file/vo/InfFilePageReqVO.java | 2 +-
.../file/vo/InfFileRespVO.java | 2 +-
.../dal/mysql/file/InfFileCoreMapper.java | 2 +-
.../service/file/InfFileCoreService.java | 17 ++----
.../file/impl/InfFileCoreServiceImpl.java | 17 ++----
.../user/SysUserProfileController.http | 2 +-
.../user/SysUserProfileController.java | 15 +++---
.../controller/user/vo/SysUserInfoRespVO.java | 6 +--
.../member/enums/MbrErrorCodeConstants.java | 8 +--
.../member/service/user/MbrUserService.java | 14 ++---
.../service/user/impl/MbrUserServiceImpl.java | 52 +++++++++----------
16 files changed, 158 insertions(+), 85 deletions(-)
create mode 100644 yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileService.java
create mode 100644 yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/impl/InfFileServiceImpl.java
rename yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/{ => controller}/file/vo/InfFilePageReqVO.java (94%)
rename yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/{ => controller}/file/vo/InfFileRespVO.java (88%)
rename yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/controller/user/vo/SysUserCoreProfileRespVo.java => yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/vo/SysUserInfoRespVO.java (75%)
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/InfFileController.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/InfFileController.java
index 2fcbbd00f..d0f31429a 100644
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/InfFileController.java
+++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/InfFileController.java
@@ -1,12 +1,12 @@
package cn.iocoder.yudao.adminserver.modules.infra.controller.file;
import cn.hutool.core.io.IoUtil;
+import cn.iocoder.yudao.adminserver.modules.infra.service.file.InfFileService;
+import cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo.InfFilePageReqVO;
+import cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo.InfFileRespVO;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
-import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.coreservice.modules.infra.file.vo.InfFilePageReqVO;
-import cn.iocoder.yudao.coreservice.modules.infra.file.vo.InfFileRespVO;
import cn.iocoder.yudao.adminserver.modules.infra.convert.file.InfFileConvert;
import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
import io.swagger.annotations.Api;
@@ -35,7 +35,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
public class InfFileController {
@Resource
- private InfFileCoreService fileService;
+ private InfFileService fileService;
@PostMapping("/upload")
@ApiOperation("上传文件")
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/convert/file/InfFileConvert.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/convert/file/InfFileConvert.java
index 78b665292..aedad94d9 100644
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/convert/file/InfFileConvert.java
+++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/convert/file/InfFileConvert.java
@@ -1,8 +1,8 @@
package cn.iocoder.yudao.adminserver.modules.infra.convert.file;
+import cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo.InfFileRespVO;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.coreservice.modules.infra.file.vo.InfFileRespVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileService.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileService.java
new file mode 100644
index 000000000..136175112
--- /dev/null
+++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileService.java
@@ -0,0 +1,46 @@
+package cn.iocoder.yudao.adminserver.modules.infra.service.file;
+
+import cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo.InfFilePageReqVO;
+import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+
+/**
+ * 文件 Service 接口
+ *
+ * @author 芋道源码
+ */
+public interface InfFileService {
+
+ /**
+ * 保存文件,并返回文件的访问路径
+ *
+ * @param path 文件路径
+ * @param content 文件内容
+ * @return 文件路径
+ */
+ String createFile(String path, byte[] content);
+
+ /**
+ * 删除文件
+ *
+ * @param id 编号
+ */
+ void deleteFile(String id);
+
+ /**
+ * 获得文件
+ *
+ * @param path 文件路径
+ * @return 文件
+ */
+ InfFileDO getFile(String path);
+
+ /**
+ * 获得文件分页
+ *
+ * @param pageReqVO 分页查询
+ * @return 文件分页
+ */
+ PageResult getFilePage(InfFilePageReqVO pageReqVO);
+
+}
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/impl/InfFileServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/impl/InfFileServiceImpl.java
new file mode 100644
index 000000000..9598d0481
--- /dev/null
+++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/impl/InfFileServiceImpl.java
@@ -0,0 +1,46 @@
+package cn.iocoder.yudao.adminserver.modules.infra.service.file.impl;
+
+import cn.iocoder.yudao.adminserver.modules.infra.service.file.InfFileService;
+import cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo.InfFilePageReqVO;
+import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
+import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.file.InfFileCoreMapper;
+import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+/**
+ * 文件 Service 实现类
+ *
+ * @author 芋道源码
+ */
+@Service
+public class InfFileServiceImpl implements InfFileService {
+ @Resource
+ private InfFileCoreMapper fileCoreMapper;
+
+ @Resource
+ private InfFileCoreService fileCoreService;
+
+ @Override
+ public String createFile(String path, byte[] content) {
+ return fileCoreService.createFile(path,content);
+ }
+
+ @Override
+ public void deleteFile(String id) {
+ fileCoreService.deleteFile(id);
+ }
+
+ @Override
+ public InfFileDO getFile(String path) {
+ return fileCoreService.getFile(path);
+ }
+
+ @Override
+ public PageResult getFilePage(InfFilePageReqVO pageReqVO) {
+ return fileCoreMapper.selectPage(pageReqVO);
+ }
+
+}
diff --git a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileServiceTest.java b/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileServiceTest.java
index 7c9cafce3..0b25d4f6e 100644
--- a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileServiceTest.java
+++ b/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileServiceTest.java
@@ -2,12 +2,12 @@ package cn.iocoder.yudao.adminserver.modules.infra.service.file;
import cn.hutool.core.io.resource.ResourceUtil;
import cn.iocoder.yudao.adminserver.BaseDbUnitTest;
+import cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo.InfFilePageReqVO;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.file.InfFileCoreMapper;
import cn.iocoder.yudao.coreservice.modules.infra.service.file.impl.InfFileCoreServiceImpl;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.coreservice.modules.infra.framework.file.config.FileProperties;
-import cn.iocoder.yudao.coreservice.modules.infra.file.vo.InfFilePageReqVO;
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.mock.mockito.MockBean;
@@ -28,7 +28,7 @@ import static org.junit.jupiter.api.Assertions.*;
public class InfFileServiceTest extends BaseDbUnitTest {
@Resource
- private InfFileCoreServiceImpl fileService;
+ private InfFileService fileService;
@MockBean
private FileProperties fileProperties;
diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/file/vo/InfFilePageReqVO.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/controller/file/vo/InfFilePageReqVO.java
similarity index 94%
rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/file/vo/InfFilePageReqVO.java
rename to yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/controller/file/vo/InfFilePageReqVO.java
index a6124f7ea..8e43b6642 100644
--- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/file/vo/InfFilePageReqVO.java
+++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/controller/file/vo/InfFilePageReqVO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.coreservice.modules.infra.file.vo;
+package cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel;
diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/file/vo/InfFileRespVO.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/controller/file/vo/InfFileRespVO.java
similarity index 88%
rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/file/vo/InfFileRespVO.java
rename to yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/controller/file/vo/InfFileRespVO.java
index 57dd5b197..e264a3fd2 100644
--- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/file/vo/InfFileRespVO.java
+++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/controller/file/vo/InfFileRespVO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.coreservice.modules.infra.file.vo;
+package cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/dal/mysql/file/InfFileCoreMapper.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/dal/mysql/file/InfFileCoreMapper.java
index 43703c5da..775d81eba 100644
--- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/dal/mysql/file/InfFileCoreMapper.java
+++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/dal/mysql/file/InfFileCoreMapper.java
@@ -1,6 +1,6 @@
package cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.file;
-import cn.iocoder.yudao.coreservice.modules.infra.file.vo.InfFilePageReqVO;
+import cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo.InfFilePageReqVO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/InfFileCoreService.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/InfFileCoreService.java
index f6f251abe..a594bcef4 100644
--- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/InfFileCoreService.java
+++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/InfFileCoreService.java
@@ -1,14 +1,11 @@
package cn.iocoder.yudao.coreservice.modules.infra.service.file;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
-import cn.iocoder.yudao.coreservice.modules.infra.file.vo.InfFilePageReqVO;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
/**
- * @Class:ruoyi-vue-pro.cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService
- * @Descript: 文件 core Service 接口
- * @Author:宋天
- * @Date:2021/10/19
+ * core service 文件接口
+ *
+ * @author 宋天
*/
public interface InfFileCoreService {
@@ -36,12 +33,4 @@ public interface InfFileCoreService {
* @return 文件
*/
InfFileDO getFile(String path);
-
- /**
- * 获得文件分页
- *
- * @param pageReqVO 分页查询
- * @return 文件分页
- */
- PageResult getFilePage(InfFilePageReqVO pageReqVO);
}
diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/impl/InfFileCoreServiceImpl.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/impl/InfFileCoreServiceImpl.java
index 850701ffa..2f0fb2865 100644
--- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/impl/InfFileCoreServiceImpl.java
+++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/impl/InfFileCoreServiceImpl.java
@@ -3,24 +3,20 @@ package cn.iocoder.yudao.coreservice.modules.infra.service.file.impl;
import cn.hutool.core.io.FileTypeUtil;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.file.InfFileCoreMapper;
-import cn.iocoder.yudao.coreservice.modules.infra.file.vo.InfFilePageReqVO;
import cn.iocoder.yudao.coreservice.modules.infra.framework.file.config.FileProperties;
import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.ByteArrayInputStream;
-import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.FILE_NOT_EXISTS;
-import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.FILE_PATH_EXISTS;
+import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.*;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
/**
- * @Class:ruoyi-vue-pro.cn.iocoder.yudao.coreservice.modules.infra.service.file.impl.InfFileCoreServiceImpl
- * @Descript: core service 文件实现类
- * @Author:宋天
- * @Date:2021/10/19
+ * core service 文件实现类
+ *
+ * @author 宋天
*/
@Service
public class InfFileCoreServiceImpl implements InfFileCoreService {
@@ -65,9 +61,4 @@ public class InfFileCoreServiceImpl implements InfFileCoreService {
return fileMapper.selectById(path);
}
- @Override
- public PageResult getFilePage(InfFilePageReqVO pageReqVO) {
- return fileMapper.selectPage(pageReqVO);
- }
-
}
diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.http b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.http
index eb3d8fea6..d8fd6f8dd 100644
--- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.http
+++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.http
@@ -3,7 +3,7 @@ GET {{userServerUrl}}/system/user/profile/get
Authorization: Bearer test245
### 请求 /system/user/profile/revise-nickname 接口 成功
-PUT http://localhost:28080/api/system/user/profile/revise-nickname?nickName=yunai111
+PUT http://localhost:28080/api/system/user/profile/update-nickname?nickName=yunai222
Authorization: Bearer test245
### 请求 /system/user/profile/get-user-info 接口 成功
diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.java
index a1e0f5a25..9619f405f 100644
--- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.java
+++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.java
@@ -1,6 +1,6 @@
package cn.iocoder.yudao.userserver.modules.member.controller.user;
-import cn.iocoder.yudao.coreservice.modules.system.controller.user.vo.SysUserCoreProfileRespVo;
+import cn.iocoder.yudao.userserver.modules.member.controller.user.vo.SysUserInfoRespVO;
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
@@ -37,15 +37,17 @@ public class SysUserProfileController {
return null;
}
- @PutMapping("/revise-nickname")
+ @PutMapping("/update-nickname")
@ApiOperation("修改用户昵称")
- public CommonResult reviseNickname(@RequestParam("nickName") String nickName) {
- userService.reviseNickname(getLoginUserId(), nickName);
+ @PreAuthenticated
+ public CommonResult updateNickname(@RequestParam("nickName") String nickName) {
+ userService.updateNickname(getLoginUserId(), nickName);
return success(true);
}
@PutMapping("/revise-avatar")
@ApiOperation("修改用户头像")
+ @PreAuthenticated
public CommonResult reviseAvatar(@RequestParam("avatarFile") MultipartFile file) throws IOException {
if (file.isEmpty()) {
throw ServiceExceptionUtil.exception(FILE_IS_EMPTY);
@@ -56,8 +58,9 @@ public class SysUserProfileController {
@GetMapping("/get-user-info")
@ApiOperation("获取用户头像与昵称")
- public CommonResult getUserInfo(@RequestParam("id") Long id) {
- return success(userService.getUserInfo(id));
+ @PreAuthenticated
+ public CommonResult getUserInfo() {
+ return success(userService.getUserInfo(getLoginUserId()));
}
}
diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/controller/user/vo/SysUserCoreProfileRespVo.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/vo/SysUserInfoRespVO.java
similarity index 75%
rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/controller/user/vo/SysUserCoreProfileRespVo.java
rename to yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/vo/SysUserInfoRespVO.java
index 50c9a6856..0468960bd 100644
--- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/controller/user/vo/SysUserCoreProfileRespVo.java
+++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/vo/SysUserInfoRespVO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.coreservice.modules.system.controller.user.vo;
+package cn.iocoder.yudao.userserver.modules.member.controller.user.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -6,11 +6,11 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
+@ApiModel("用户个人信息 Response VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
-@ApiModel("用户个人中心信息 Response VO")
-public class SysUserCoreProfileRespVo {
+public class SysUserInfoRespVO {
@ApiModelProperty(value = "用户昵称", required = true, example = "芋艿")
private String nickName;
diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/enums/MbrErrorCodeConstants.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/enums/MbrErrorCodeConstants.java
index 5d8507d7f..058918b3e 100644
--- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/enums/MbrErrorCodeConstants.java
+++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/enums/MbrErrorCodeConstants.java
@@ -9,9 +9,9 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
*/
public interface MbrErrorCodeConstants {
- // 用户相关
- ErrorCode USER_NOT_EXISTS = new ErrorCode(1004000000, "用户不存在");
+ // ==========用户相关============
+ ErrorCode USER_NOT_EXISTS = new ErrorCode(1004001000, "用户不存在");
- // 文件相关
- ErrorCode FILE_IS_EMPTY = new ErrorCode(1004000000, "用户不存在");
+ // ==========文件相关 ===========
+ ErrorCode FILE_IS_EMPTY = new ErrorCode(1004002000, "文件不存在");
}
diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/MbrUserService.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/MbrUserService.java
index bb81d3718..32073540b 100644
--- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/MbrUserService.java
+++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/MbrUserService.java
@@ -1,7 +1,7 @@
package cn.iocoder.yudao.userserver.modules.member.service.user;
import cn.iocoder.yudao.coreservice.modules.member.dal.dataobject.user.MbrUserDO;
-import cn.iocoder.yudao.coreservice.modules.system.controller.user.vo.SysUserCoreProfileRespVo;
+import cn.iocoder.yudao.userserver.modules.member.controller.user.vo.SysUserInfoRespVO;
import cn.iocoder.yudao.framework.common.validation.Mobile;
import java.io.InputStream;
@@ -49,24 +49,24 @@ public interface MbrUserService {
/**
* 修改用户昵称
- * @param loginUserId 登录用户id
+ * @param userId 用户id
* @param nickName 用户新昵称
*/
- void reviseNickname(Long loginUserId, String nickName);
+ void updateNickname(Long userId, String nickName);
/**
* 修改用户头像
- * @param loginUserId 登录用户id
+ * @param userId 用户id
* @param inputStream 头像文件
* @return 头像url
*/
- String reviseAvatar(Long loginUserId, InputStream inputStream);
+ String reviseAvatar(Long userId, InputStream inputStream);
/**
* 根据用户id,获取用户头像与昵称
- * @param loginUserId 登录用户id
+ * @param userId 用户id
* @return 用户响应实体类
*/
- SysUserCoreProfileRespVo getUserInfo(Long loginUserId);
+ SysUserInfoRespVO getUserInfo(Long userId);
}
diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/impl/MbrUserServiceImpl.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/impl/MbrUserServiceImpl.java
index f10c03ed1..3f2531067 100644
--- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/impl/MbrUserServiceImpl.java
+++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/impl/MbrUserServiceImpl.java
@@ -4,8 +4,7 @@ import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.IdUtil;
import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService;
import cn.iocoder.yudao.coreservice.modules.member.dal.dataobject.user.MbrUserDO;
-import cn.iocoder.yudao.coreservice.modules.system.controller.user.vo.SysUserCoreProfileRespVo;
-import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO;
+import cn.iocoder.yudao.userserver.modules.member.controller.user.vo.SysUserInfoRespVO;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.userserver.modules.member.dal.mysql.user.MbrUserMapper;
import cn.iocoder.yudao.userserver.modules.member.service.user.MbrUserService;
@@ -81,52 +80,51 @@ public class MbrUserServiceImpl implements MbrUserService {
}
@Override
- public void reviseNickname(Long loginUserId, String nickName) {
- MbrUserDO mbrUserDO = userMapper.selectById(loginUserId);
+ public void updateNickname(Long userId, String nickName) {
+ MbrUserDO user = this.checkUserExists(userId);
// 仅当新昵称不等于旧昵称时进行修改
- if (!nickName.equals(mbrUserDO.getNickname())){
- MbrUserDO user = new MbrUserDO();
- user.setId(mbrUserDO.getId());
- user.setNickname(nickName);
- userMapper.updateById(user);
+ if (nickName.equals(user.getNickname())){
+ return;
}
+ MbrUserDO userDO = new MbrUserDO();
+ userDO.setId(user.getId());
+ userDO.setNickname(nickName);
+ userMapper.updateById(userDO);
}
@Override
- public String reviseAvatar(Long loginUserId, InputStream avatarFile) {
- this.checkUserExists(loginUserId);
+ public String reviseAvatar(Long userId, InputStream avatarFile) {
+ this.checkUserExists(userId);
// 创建文件
String avatar = fileCoreService.createFile(IdUtil.fastUUID(), IoUtil.readBytes(avatarFile));
// 更新头像路径
- MbrUserDO userDO = new MbrUserDO();
- userDO.setId(loginUserId);
- userDO.setAvatar(avatar);
+ MbrUserDO userDO = MbrUserDO.builder()
+ .id(userId)
+ .avatar(avatar)
+ .build();
userMapper.updateById(userDO);
return avatar;
}
@Override
- public SysUserCoreProfileRespVo getUserInfo(Long loginUserId) {
- MbrUserDO mbrUserDO = userMapper.selectById(loginUserId);
- if (mbrUserDO == null){
- log.error("用户不存在:{}",loginUserId);
- throw exception(USER_NOT_EXISTS);
- }
-
- SysUserCoreProfileRespVo userRes = new SysUserCoreProfileRespVo();
- userRes.setNickName(mbrUserDO.getNickname());
- userRes.setAvatar(mbrUserDO.getAvatar());
- return userRes;
+ public SysUserInfoRespVO getUserInfo(Long userId) {
+ MbrUserDO user = this.checkUserExists(userId);
+ SysUserInfoRespVO userResp = new SysUserInfoRespVO();
+ userResp.setNickName(user.getNickname());
+ userResp.setAvatar(user.getAvatar());
+ return userResp;
}
@VisibleForTesting
- public void checkUserExists(Long id) {
+ public MbrUserDO checkUserExists(Long id) {
if (id == null) {
- return;
+ return null;
}
MbrUserDO user = userMapper.selectById(id);
if (user == null) {
throw exception(USER_NOT_EXISTS);
+ }else{
+ return user;
}
}
}
From 5193de7c568a5da09561311f229192208e600e87 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AE=8B=E5=A4=A9?= <2982176321@qq.com>
Date: Wed, 20 Oct 2021 18:51:51 +0800
Subject: [PATCH 4/6] =?UTF-8?q?[fix]=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF?=
=?UTF-8?q?=E5=86=85=E5=AE=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../userserver/modules/member/enums/MbrErrorCodeConstants.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/enums/MbrErrorCodeConstants.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/enums/MbrErrorCodeConstants.java
index 058918b3e..d6a3c11b2 100644
--- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/enums/MbrErrorCodeConstants.java
+++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/enums/MbrErrorCodeConstants.java
@@ -13,5 +13,5 @@ public interface MbrErrorCodeConstants {
ErrorCode USER_NOT_EXISTS = new ErrorCode(1004001000, "用户不存在");
// ==========文件相关 ===========
- ErrorCode FILE_IS_EMPTY = new ErrorCode(1004002000, "文件不存在");
+ ErrorCode FILE_IS_EMPTY = new ErrorCode(1004002000, "文件为空");
}
From f4a5a139b5719dbcde750fbb2f97de15bbda10cf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AE=8B=E5=A4=A9?= <2982176321@qq.com>
Date: Sun, 24 Oct 2021 22:33:32 +0800
Subject: [PATCH 5/6] =?UTF-8?q?[update]user=20server=E6=A8=A1=E5=9D=97?=
=?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B5=8B=E8=AF=95=EF=BC=8C=E4=BF=AE=E6=94=B9?=
=?UTF-8?q?=E9=83=A8=E5=88=86=E6=8E=A5=E5=8F=A3=E8=A7=84=E8=8C=83=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../controller/file/InfFileController.java | 2 +-
.../controller/file/vo/InfFilePageReqVO.java | 2 +-
.../infra/dal/mysql/file/InfFileMapper.java | 24 ++++
.../infra/service/file/InfFileService.java | 2 +-
.../service/file/impl/InfFileServiceImpl.java | 9 +-
.../service/file/InfFileServiceTest.java | 2 +-
.../dal/mysql/file/InfFileCoreMapper.java | 12 --
.../system/enums/SysErrorCodeConstants.java | 2 +-
.../user/SysUserProfileController.http | 4 +-
.../user/SysUserProfileController.java | 17 +--
...InfoRespVO.java => MbrUserInfoRespVO.java} | 2 +-
.../member/enums/MbrErrorCodeConstants.java | 4 +-
.../member/service/user/MbrUserService.java | 6 +-
.../service/user/impl/MbrUserServiceImpl.java | 8 +-
.../yudao/userserver/BaseDbUnitTest.java | 39 +++++++
.../service/MbrUserServiceImplTest.java | 107 ++++++++++++++++++
.../test/resources/application-unit-test.yaml | 44 +++++++
.../src/test/resources/file/erweima.jpg | Bin 0 -> 18385 bytes
.../src/test/resources/logback-spring.xml | 4 +
.../src/test/resources/sql/clean.sql | 2 +
.../src/test/resources/sql/create_tables.sql | 32 ++++++
21 files changed, 279 insertions(+), 45 deletions(-)
rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice => yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver}/modules/infra/controller/file/vo/InfFilePageReqVO.java (94%)
create mode 100644 yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/dal/mysql/file/InfFileMapper.java
rename yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/vo/{SysUserInfoRespVO.java => MbrUserInfoRespVO.java} (94%)
create mode 100644 yudao-user-server/src/test/java/cn/iocoder/yudao/userserver/BaseDbUnitTest.java
create mode 100644 yudao-user-server/src/test/java/cn/iocoder/yudao/userserver/modules/member/service/MbrUserServiceImplTest.java
create mode 100644 yudao-user-server/src/test/resources/application-unit-test.yaml
create mode 100644 yudao-user-server/src/test/resources/file/erweima.jpg
create mode 100644 yudao-user-server/src/test/resources/logback-spring.xml
create mode 100644 yudao-user-server/src/test/resources/sql/clean.sql
create mode 100644 yudao-user-server/src/test/resources/sql/create_tables.sql
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/InfFileController.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/InfFileController.java
index d0f31429a..b2a49d6e1 100644
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/InfFileController.java
+++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/InfFileController.java
@@ -2,7 +2,7 @@ package cn.iocoder.yudao.adminserver.modules.infra.controller.file;
import cn.hutool.core.io.IoUtil;
import cn.iocoder.yudao.adminserver.modules.infra.service.file.InfFileService;
-import cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo.InfFilePageReqVO;
+import cn.iocoder.yudao.adminserver.modules.infra.controller.file.vo.InfFilePageReqVO;
import cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo.InfFileRespVO;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/controller/file/vo/InfFilePageReqVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/vo/InfFilePageReqVO.java
similarity index 94%
rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/controller/file/vo/InfFilePageReqVO.java
rename to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/vo/InfFilePageReqVO.java
index 8e43b6642..152466a19 100644
--- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/controller/file/vo/InfFilePageReqVO.java
+++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/vo/InfFilePageReqVO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo;
+package cn.iocoder.yudao.adminserver.modules.infra.controller.file.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel;
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/dal/mysql/file/InfFileMapper.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/dal/mysql/file/InfFileMapper.java
new file mode 100644
index 000000000..d3dfcccbb
--- /dev/null
+++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/dal/mysql/file/InfFileMapper.java
@@ -0,0 +1,24 @@
+package cn.iocoder.yudao.adminserver.modules.infra.dal.mysql.file;
+
+import cn.iocoder.yudao.adminserver.modules.infra.controller.file.vo.InfFilePageReqVO;
+import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * admin 文件操作 Mapper
+ *
+ * @author 芋道源码
+ */
+@Mapper
+public interface InfFileMapper extends BaseMapperX {
+ default PageResult selectPage(InfFilePageReqVO reqVO) {
+ return selectPage(reqVO, new QueryWrapperX()
+ .likeIfPresent("id", reqVO.getId())
+ .likeIfPresent("type", reqVO.getType())
+ .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
+ .orderByDesc("create_time"));
+ }
+}
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileService.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileService.java
index 136175112..a98fd16a7 100644
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileService.java
+++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileService.java
@@ -1,6 +1,6 @@
package cn.iocoder.yudao.adminserver.modules.infra.service.file;
-import cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo.InfFilePageReqVO;
+import cn.iocoder.yudao.adminserver.modules.infra.controller.file.vo.InfFilePageReqVO;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/impl/InfFileServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/impl/InfFileServiceImpl.java
index 9598d0481..69b4cf0db 100644
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/impl/InfFileServiceImpl.java
+++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/impl/InfFileServiceImpl.java
@@ -1,9 +1,9 @@
package cn.iocoder.yudao.adminserver.modules.infra.service.file.impl;
+import cn.iocoder.yudao.adminserver.modules.infra.dal.mysql.file.InfFileMapper;
import cn.iocoder.yudao.adminserver.modules.infra.service.file.InfFileService;
-import cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo.InfFilePageReqVO;
+import cn.iocoder.yudao.adminserver.modules.infra.controller.file.vo.InfFilePageReqVO;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
-import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.file.InfFileCoreMapper;
import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.springframework.stereotype.Service;
@@ -17,8 +17,9 @@ import javax.annotation.Resource;
*/
@Service
public class InfFileServiceImpl implements InfFileService {
+
@Resource
- private InfFileCoreMapper fileCoreMapper;
+ private InfFileMapper fileMapper;
@Resource
private InfFileCoreService fileCoreService;
@@ -40,7 +41,7 @@ public class InfFileServiceImpl implements InfFileService {
@Override
public PageResult getFilePage(InfFilePageReqVO pageReqVO) {
- return fileCoreMapper.selectPage(pageReqVO);
+ return fileMapper.selectPage(pageReqVO);
}
}
diff --git a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileServiceTest.java b/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileServiceTest.java
index 0b25d4f6e..ca92bc7d9 100644
--- a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileServiceTest.java
+++ b/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileServiceTest.java
@@ -2,7 +2,7 @@ package cn.iocoder.yudao.adminserver.modules.infra.service.file;
import cn.hutool.core.io.resource.ResourceUtil;
import cn.iocoder.yudao.adminserver.BaseDbUnitTest;
-import cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo.InfFilePageReqVO;
+import cn.iocoder.yudao.adminserver.modules.infra.controller.file.vo.InfFilePageReqVO;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.file.InfFileCoreMapper;
import cn.iocoder.yudao.coreservice.modules.infra.service.file.impl.InfFileCoreServiceImpl;
diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/dal/mysql/file/InfFileCoreMapper.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/dal/mysql/file/InfFileCoreMapper.java
index 775d81eba..88266caae 100644
--- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/dal/mysql/file/InfFileCoreMapper.java
+++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/dal/mysql/file/InfFileCoreMapper.java
@@ -1,10 +1,7 @@
package cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.file;
-import cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo.InfFilePageReqVO;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
-import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
import org.apache.ibatis.annotations.Mapper;
@Mapper
@@ -12,13 +9,4 @@ public interface InfFileCoreMapper extends BaseMapperX {
default Integer selectCountById(String id) {
return selectCount("id", id);
}
-
- default PageResult selectPage(InfFilePageReqVO reqVO) {
- return selectPage(reqVO, new QueryWrapperX()
- .likeIfPresent("id", reqVO.getId())
- .likeIfPresent("type", reqVO.getType())
- .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
- .orderByDesc("create_time"));
- }
-
}
diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/SysErrorCodeConstants.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/SysErrorCodeConstants.java
index 60249398c..09a3e7204 100644
--- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/SysErrorCodeConstants.java
+++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/SysErrorCodeConstants.java
@@ -14,7 +14,7 @@ public interface SysErrorCodeConstants {
ErrorCode SMS_SEND_MOBILE_TEMPLATE_PARAM_MISS = new ErrorCode(1006000001, "模板参数({})缺失");
ErrorCode SMS_SEND_TEMPLATE_NOT_EXISTS = new ErrorCode(1006000000, "短信模板不存在");
- // 文件相关
+ // ========= 文件相关 1006001000=================
ErrorCode FILE_PATH_EXISTS = new ErrorCode(1006001000, "文件路径已存在");
ErrorCode FILE_NOT_EXISTS = new ErrorCode(1006001002, "文件不存在");
}
diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.http b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.http
index d8fd6f8dd..1ce9eea62 100644
--- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.http
+++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.http
@@ -3,9 +3,9 @@ GET {{userServerUrl}}/system/user/profile/get
Authorization: Bearer test245
### 请求 /system/user/profile/revise-nickname 接口 成功
-PUT http://localhost:28080/api/system/user/profile/update-nickname?nickName=yunai222
+PUT {{userServerUrl}}/system/user/profile/update-nickname?nickName=yunai222
Authorization: Bearer test245
### 请求 /system/user/profile/get-user-info 接口 成功
-GET http://localhost:28080/api/system/user/profile/get-user-info?id=245
+GET {{userServerUrl}}/system/user/profile/get-user-info?id=245
Authorization: Bearer test245
\ No newline at end of file
diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.java
index 9619f405f..11c5f706a 100644
--- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.java
+++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.java
@@ -1,6 +1,6 @@
package cn.iocoder.yudao.userserver.modules.member.controller.user;
-import cn.iocoder.yudao.userserver.modules.member.controller.user.vo.SysUserInfoRespVO;
+import cn.iocoder.yudao.userserver.modules.member.controller.user.vo.MbrUserInfoRespVO;
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
@@ -30,13 +30,6 @@ public class SysUserProfileController {
@Resource
private MbrUserService userService;
- @GetMapping("/get")
- @ApiOperation("获得登录用户信息")
- @PreAuthenticated
- public CommonResult profile() {
- return null;
- }
-
@PutMapping("/update-nickname")
@ApiOperation("修改用户昵称")
@PreAuthenticated
@@ -45,21 +38,21 @@ public class SysUserProfileController {
return success(true);
}
- @PutMapping("/revise-avatar")
+ @PutMapping("/update-avatar")
@ApiOperation("修改用户头像")
@PreAuthenticated
- public CommonResult reviseAvatar(@RequestParam("avatarFile") MultipartFile file) throws IOException {
+ public CommonResult updateAvatar(@RequestParam("avatarFile") MultipartFile file) throws IOException {
if (file.isEmpty()) {
throw ServiceExceptionUtil.exception(FILE_IS_EMPTY);
}
- String avatar = userService.reviseAvatar(getLoginUserId(), file.getInputStream());
+ String avatar = userService.updateAvatar(getLoginUserId(), file.getInputStream());
return success(avatar);
}
@GetMapping("/get-user-info")
@ApiOperation("获取用户头像与昵称")
@PreAuthenticated
- public CommonResult getUserInfo() {
+ public CommonResult getUserInfo() {
return success(userService.getUserInfo(getLoginUserId()));
}
}
diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/vo/SysUserInfoRespVO.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/vo/MbrUserInfoRespVO.java
similarity index 94%
rename from yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/vo/SysUserInfoRespVO.java
rename to yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/vo/MbrUserInfoRespVO.java
index 0468960bd..e46bd410f 100644
--- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/vo/SysUserInfoRespVO.java
+++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/vo/MbrUserInfoRespVO.java
@@ -10,7 +10,7 @@ import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
-public class SysUserInfoRespVO {
+public class MbrUserInfoRespVO {
@ApiModelProperty(value = "用户昵称", required = true, example = "芋艿")
private String nickName;
diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/enums/MbrErrorCodeConstants.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/enums/MbrErrorCodeConstants.java
index d6a3c11b2..3794eb09d 100644
--- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/enums/MbrErrorCodeConstants.java
+++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/enums/MbrErrorCodeConstants.java
@@ -9,9 +9,9 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
*/
public interface MbrErrorCodeConstants {
- // ==========用户相关============
+ // ==========用户相关 1004001000============
ErrorCode USER_NOT_EXISTS = new ErrorCode(1004001000, "用户不存在");
- // ==========文件相关 ===========
+ // ==========文件相关 1004002000 ===========
ErrorCode FILE_IS_EMPTY = new ErrorCode(1004002000, "文件为空");
}
diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/MbrUserService.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/MbrUserService.java
index 32073540b..6b6a36a8e 100644
--- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/MbrUserService.java
+++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/MbrUserService.java
@@ -1,7 +1,7 @@
package cn.iocoder.yudao.userserver.modules.member.service.user;
import cn.iocoder.yudao.coreservice.modules.member.dal.dataobject.user.MbrUserDO;
-import cn.iocoder.yudao.userserver.modules.member.controller.user.vo.SysUserInfoRespVO;
+import cn.iocoder.yudao.userserver.modules.member.controller.user.vo.MbrUserInfoRespVO;
import cn.iocoder.yudao.framework.common.validation.Mobile;
import java.io.InputStream;
@@ -60,13 +60,13 @@ public interface MbrUserService {
* @param inputStream 头像文件
* @return 头像url
*/
- String reviseAvatar(Long userId, InputStream inputStream);
+ String updateAvatar(Long userId, InputStream inputStream);
/**
* 根据用户id,获取用户头像与昵称
* @param userId 用户id
* @return 用户响应实体类
*/
- SysUserInfoRespVO getUserInfo(Long userId);
+ MbrUserInfoRespVO getUserInfo(Long userId);
}
diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/impl/MbrUserServiceImpl.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/impl/MbrUserServiceImpl.java
index 3f2531067..5bff9d6cb 100644
--- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/impl/MbrUserServiceImpl.java
+++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/impl/MbrUserServiceImpl.java
@@ -4,7 +4,7 @@ import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.IdUtil;
import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService;
import cn.iocoder.yudao.coreservice.modules.member.dal.dataobject.user.MbrUserDO;
-import cn.iocoder.yudao.userserver.modules.member.controller.user.vo.SysUserInfoRespVO;
+import cn.iocoder.yudao.userserver.modules.member.controller.user.vo.MbrUserInfoRespVO;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.userserver.modules.member.dal.mysql.user.MbrUserMapper;
import cn.iocoder.yudao.userserver.modules.member.service.user.MbrUserService;
@@ -93,7 +93,7 @@ public class MbrUserServiceImpl implements MbrUserService {
}
@Override
- public String reviseAvatar(Long userId, InputStream avatarFile) {
+ public String updateAvatar(Long userId, InputStream avatarFile) {
this.checkUserExists(userId);
// 创建文件
String avatar = fileCoreService.createFile(IdUtil.fastUUID(), IoUtil.readBytes(avatarFile));
@@ -107,9 +107,9 @@ public class MbrUserServiceImpl implements MbrUserService {
}
@Override
- public SysUserInfoRespVO getUserInfo(Long userId) {
+ public MbrUserInfoRespVO getUserInfo(Long userId) {
MbrUserDO user = this.checkUserExists(userId);
- SysUserInfoRespVO userResp = new SysUserInfoRespVO();
+ MbrUserInfoRespVO userResp = new MbrUserInfoRespVO();
userResp.setNickName(user.getNickname());
userResp.setAvatar(user.getAvatar());
return userResp;
diff --git a/yudao-user-server/src/test/java/cn/iocoder/yudao/userserver/BaseDbUnitTest.java b/yudao-user-server/src/test/java/cn/iocoder/yudao/userserver/BaseDbUnitTest.java
new file mode 100644
index 000000000..af8d71a0c
--- /dev/null
+++ b/yudao-user-server/src/test/java/cn/iocoder/yudao/userserver/BaseDbUnitTest.java
@@ -0,0 +1,39 @@
+package cn.iocoder.yudao.userserver;
+
+import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration;
+import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration;
+import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
+import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Import;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.jdbc.Sql;
+
+/**
+ * 依赖内存 DB 的单元测试
+ *
+ * 注意,Service 层同样适用。对于 Service 层的单元测试,我们针对自己模块的 Mapper 走的是 H2 内存数据库,针对别的模块的 Service 走的是 Mock 方法
+ *
+ * @author 芋道源码
+ */
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = BaseDbUnitTest.Application.class)
+@ActiveProfiles("unit-test") // 设置使用 application-unit-test 配置文件
+@Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) // 每个单元测试结束后,清理 DB
+public class BaseDbUnitTest {
+
+ @Import({
+ // DB 配置类
+ YudaoDataSourceAutoConfiguration.class, // 自己的 DB 配置类
+ DataSourceAutoConfiguration.class, // Spring DB 自动配置类
+ DataSourceTransactionManagerAutoConfiguration.class, // Spring 事务自动配置类
+ DruidDataSourceAutoConfigure.class, // Druid 自动配置类
+ // MyBatis 配置类
+ YudaoMybatisAutoConfiguration.class, // 自己的 MyBatis 配置类
+ MybatisPlusAutoConfiguration.class, // MyBatis 的自动配置类
+ })
+ public static class Application {
+ }
+
+}
diff --git a/yudao-user-server/src/test/java/cn/iocoder/yudao/userserver/modules/member/service/MbrUserServiceImplTest.java b/yudao-user-server/src/test/java/cn/iocoder/yudao/userserver/modules/member/service/MbrUserServiceImplTest.java
new file mode 100644
index 000000000..3639c25db
--- /dev/null
+++ b/yudao-user-server/src/test/java/cn/iocoder/yudao/userserver/modules/member/service/MbrUserServiceImplTest.java
@@ -0,0 +1,107 @@
+package cn.iocoder.yudao.userserver.modules.member.service;
+
+import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService;
+import cn.iocoder.yudao.coreservice.modules.member.dal.dataobject.user.MbrUserDO;
+import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO;
+import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
+import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils;
+import cn.iocoder.yudao.userserver.BaseDbUnitTest;
+import cn.iocoder.yudao.userserver.modules.member.controller.user.vo.MbrUserInfoRespVO;
+import cn.iocoder.yudao.userserver.modules.member.dal.mysql.user.MbrUserMapper;
+import cn.iocoder.yudao.userserver.modules.member.service.user.impl.MbrUserServiceImpl;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.context.annotation.Import;
+import org.springframework.http.MediaType;
+import org.springframework.mock.web.MockMultipartFile;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.util.Assert;
+
+import javax.annotation.Resource;
+import java.io.*;
+import java.util.function.Consumer;
+
+import static cn.hutool.core.util.RandomUtil.randomBytes;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static cn.hutool.core.util.RandomUtil.randomEle;
+import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
+import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomString;
+import static org.mockito.Mockito.*;
+/**
+ * {@link MbrUserServiceImpl} 的单元测试类
+ *
+ * @author 宋天
+ */
+@Import(MbrUserServiceImpl.class)
+public class MbrUserServiceImplTest extends BaseDbUnitTest {
+
+ @Resource
+ private MbrUserServiceImpl mbrUserService;
+
+ @Resource
+ private MbrUserMapper userMapper;
+
+ @MockBean
+ private InfFileCoreService fileCoreService;
+
+ @MockBean
+ private PasswordEncoder passwordEncoder;
+
+ @Test
+ public void testUpdateNickName_success(){
+ // mock 数据
+ MbrUserDO userDO = randomMbrUserDO();
+ userMapper.insert(userDO);
+
+ // 随机昵称
+ String newNickName = randomString();
+
+ // 调用接口修改昵称
+ mbrUserService.updateNickname(userDO.getId(),newNickName);
+ // 查询新修改后的昵称
+ String nickname = mbrUserService.getUser(userDO.getId()).getNickname();
+ // 断言
+ assertEquals(newNickName,nickname);
+ }
+
+ @Test
+ public void testGetUserInfo_success(){
+ // mock 数据
+ MbrUserDO userDO = randomMbrUserDO();
+ userMapper.insert(userDO);
+
+ // 查询用户昵称与头像
+ MbrUserInfoRespVO userInfo = mbrUserService.getUserInfo(userDO.getId());
+ System.out.println(userInfo);
+ }
+
+ @Test
+ public void testUpdateAvatar_success(){
+ // mock 数据
+ MbrUserDO dbUser = randomMbrUserDO();
+ userMapper.insert(dbUser);
+
+ // 准备参数
+ Long userId = dbUser.getId();
+ byte[] avatarFileBytes = randomBytes(10);
+ ByteArrayInputStream avatarFile = new ByteArrayInputStream(avatarFileBytes);
+ // mock 方法
+ String avatar = randomString();
+ when(fileCoreService.createFile(anyString(), eq(avatarFileBytes))).thenReturn(avatar);
+ // 调用
+ String str = mbrUserService.updateAvatar(userId, avatarFile);
+ // 断言
+ assertEquals(avatar, str);
+ }
+
+ // ========== 随机对象 ==========
+
+ @SafeVarargs
+ private static MbrUserDO randomMbrUserDO(Consumer... consumers) {
+ Consumer consumer = (o) -> {
+ o.setStatus(randomEle(CommonStatusEnum.values()).getStatus()); // 保证 status 的范围
+ };
+ return randomPojo(MbrUserDO.class, ArrayUtils.append(consumer, consumers));
+ }
+
+}
diff --git a/yudao-user-server/src/test/resources/application-unit-test.yaml b/yudao-user-server/src/test/resources/application-unit-test.yaml
new file mode 100644
index 000000000..d306a7af4
--- /dev/null
+++ b/yudao-user-server/src/test/resources/application-unit-test.yaml
@@ -0,0 +1,44 @@
+spring:
+ main:
+ lazy-initialization: true # 开启懒加载,加快速度
+ banner-mode: off # 单元测试,禁用 Banner
+
+--- #################### 数据库相关配置 ####################
+
+spring:
+ # 数据源配置项
+ datasource:
+ name: ruoyi-vue-pro
+ url: jdbc:h2:mem:testdb;MODE=MYSQL;DATABASE_TO_UPPER=false; # MODE 使用 MySQL 模式;DATABASE_TO_UPPER 配置表和字段使用小写
+ driver-class-name: org.h2.Driver
+ username: sa
+ password:
+ schema: classpath:sql/create_tables.sql # MySQL 转 H2 的语句,使用 https://www.jooq.org/translate/ 工具
+ druid:
+ async-init: true # 单元测试,异步初始化 Druid 连接池,提升启动速度
+ initial-size: 1 # 单元测试,配置为 1,提升启动速度
+
+ # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
+ redis:
+ host: 127.0.0.1 # 地址
+ port: 16379 # 端口(单元测试,使用 16379 端口)
+ database: 0 # 数据库索引
+
+mybatis:
+ lazy-initialization: true # 单元测试,设置 MyBatis Mapper 延迟加载,加速每个单元测试
+
+--- #################### 定时任务相关配置 ####################
+
+--- #################### 配置中心相关配置 ####################
+
+--- #################### 服务保障相关配置 ####################
+
+# Lock4j 配置项(单元测试,禁用 Lock4j)
+
+# Resilience4j 配置项
+
+--- #################### 监控相关配置 ####################
+
+--- #################### 芋道相关配置 ####################
+
+# 芋道配置项,设置当前项目所有自定义的配置
diff --git a/yudao-user-server/src/test/resources/file/erweima.jpg b/yudao-user-server/src/test/resources/file/erweima.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..1447283cdf1b49b51c1204a160e01cb789e957a8
GIT binary patch
literal 18385
zcmb7s2Rzm9+yCL%A+xNq$sv0yBYV$7${yL72_=by>^(#Fv7$0Ev!kp?5wb^FWrg_P
zpQHMH%lG#@|3|%E9nLwQao^YbdXMYm@crQ@7>SC4vH}bP0|vtYe_)5BFj*KJ6BGIi
zzOcYwY&>jiEG%pSTwEMHLIOg<69gwt5D}A+5D}9SpEyBsiiDJ$f|8Pw@Z@Q#QxsHW
z6qFRuK``LpJy_WI*x2|KL??(S{?A{B%`j3t3``76I0h*UlN19^igDNqI}3xsF@Ao*
zj=u2laWQZRFtM=V;CVW5C*U2>{rvjEz{bSF!G+@;j=%`v;8_wl33v)+_Urjy|Kg$_
zEYOL&EWqgCnJzFG_?HFa?p@d+?8NuGcTew3GT`ns5n#fwFfbc17@A-w_F=eqSjKR;
zC??8VnnQ-OJ&kBTmB9>~jf6qSOyt`gO6|87%2A|djZH9@yYjjWB&Ro!>ROqY1@<|Y
zc|P4G(mthFSx+S#-!Mn8dyS3^ETUjdRAj&UIql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ean.sql b/yudao-user-server/src/test/resources/sql/clean.sql
new file mode 100644
index 000000000..bedf8d008
--- /dev/null
+++ b/yudao-user-server/src/test/resources/sql/clean.sql
@@ -0,0 +1,2 @@
+-- mbr 开头的 DB
+DELETE FROM "mbr_user";
\ No newline at end of file
diff --git a/yudao-user-server/src/test/resources/sql/create_tables.sql b/yudao-user-server/src/test/resources/sql/create_tables.sql
new file mode 100644
index 000000000..306900101
--- /dev/null
+++ b/yudao-user-server/src/test/resources/sql/create_tables.sql
@@ -0,0 +1,32 @@
+-- mbr 开头的 DB
+CREATE TABLE IF NOT EXISTS "mbr_user" (
+ "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
+ "nickname" varchar(30) NOT NULL DEFAULT '' COMMENT '用户昵称',
+ "avatar" varchar(255) NOT NULL DEFAULT '' COMMENT '头像',
+ "status" tinyint NOT NULL COMMENT '状态',
+ "mobile" varchar(11) NOT NULL COMMENT '手机号',
+ "password" varchar(100) NOT NULL DEFAULT '' COMMENT '密码',
+ "register_ip" varchar(32) NOT NULL COMMENT '注册 IP',
+ "login_ip" varchar(50) NULL DEFAULT '' COMMENT '最后登录IP',
+ "login_date" datetime NULL DEFAULT NULL COMMENT '最后登录时间',
+ "creator" varchar(64) NULL DEFAULT '' COMMENT '创建者',
+ "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ "updater" varchar(64) NULL DEFAULT '' COMMENT '更新者',
+ "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+ "deleted" bit(1) NOT NULL DEFAULT '0' COMMENT '是否删除',
+ PRIMARY KEY ("id")
+) COMMENT '会员表';
+
+-- inf 开头的 DB
+CREATE TABLE IF NOT EXISTS "inf_file" (
+ "id" varchar(188) NOT NULL,
+ "type" varchar(63) DEFAULT NULL,
+ "content" blob NOT NULL,
+ "creator" varchar(64) DEFAULT '',
+ "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ "updater" varchar(64) DEFAULT '',
+ "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ "deleted" bit NOT NULL DEFAULT FALSE,
+ PRIMARY KEY ("id")
+) COMMENT '文件表';
+
From 65843d55a07693e7651934bf740c6bce0aabfde8 Mon Sep 17 00:00:00 2001
From: YunaiV
Date: Wed, 27 Oct 2021 10:17:42 +0800
Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=89=88=E6=9C=AC?=
=?UTF-8?q?=E5=8F=B7=E4=B8=BA=201.2.0-snapshot?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 2 +-
.../controller/file/InfFileController.java | 9 ++++---
.../infra/service/file/InfFileService.java | 24 -------------------
.../service/file/impl/InfFileServiceImpl.java | 18 --------------
.../system/enums/SysErrorCodeConstants.java | 1 -
yudao-core-service/pom.xml | 2 +-
yudao-dependencies/pom.xml | 2 +-
.../user/SysUserProfileController.java | 1 +
.../service/user/impl/MbrUserServiceImpl.java | 1 +
更新日志.md | 10 +++++---
10 files changed, 18 insertions(+), 52 deletions(-)
diff --git a/pom.xml b/pom.xml
index 1ca158c9f..b6290c1d6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,7 @@
https://github.com/YunaiV/ruoyi-vue-pro
- 1.1.0-snapshot
+ 1.2.0-snapshot
1.8
${java.version}
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/InfFileController.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/InfFileController.java
index b2a49d6e1..ede2a68bb 100644
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/InfFileController.java
+++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/file/InfFileController.java
@@ -5,6 +5,7 @@ import cn.iocoder.yudao.adminserver.modules.infra.service.file.InfFileService;
import cn.iocoder.yudao.adminserver.modules.infra.controller.file.vo.InfFilePageReqVO;
import cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo.InfFileRespVO;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
+import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.adminserver.modules.infra.convert.file.InfFileConvert;
@@ -36,6 +37,8 @@ public class InfFileController {
@Resource
private InfFileService fileService;
+ @Resource
+ private InfFileCoreService fileCoreService;
@PostMapping("/upload")
@ApiOperation("上传文件")
@@ -45,7 +48,7 @@ public class InfFileController {
})
public CommonResult uploadFile(@RequestParam("file") MultipartFile file,
@RequestParam("path") String path) throws IOException {
- return success(fileService.createFile(path, IoUtil.readBytes(file.getInputStream())));
+ return success(fileCoreService.createFile(path, IoUtil.readBytes(file.getInputStream())));
}
@DeleteMapping("/delete")
@@ -53,7 +56,7 @@ public class InfFileController {
@ApiImplicitParam(name = "id", value = "编号", required = true)
@PreAuthorize("@ss.hasPermission('infra:file:delete')")
public CommonResult deleteFile(@RequestParam("id") String id) {
- fileService.deleteFile(id);
+ fileCoreService.deleteFile(id);
return success(true);
}
@@ -61,7 +64,7 @@ public class InfFileController {
@ApiOperation("下载文件")
@ApiImplicitParam(name = "path", value = "文件附件", required = true, dataTypeClass = MultipartFile.class)
public void getFile(HttpServletResponse response, @PathVariable("path") String path) throws IOException {
- InfFileDO file = fileService.getFile(path);
+ InfFileDO file = fileCoreService.getFile(path);
if (file == null) {
log.warn("[getFile][path({}) 文件不存在]", path);
response.setStatus(HttpStatus.NOT_FOUND.value());
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileService.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileService.java
index a98fd16a7..1c8311b29 100644
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileService.java
+++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/InfFileService.java
@@ -11,30 +11,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
*/
public interface InfFileService {
- /**
- * 保存文件,并返回文件的访问路径
- *
- * @param path 文件路径
- * @param content 文件内容
- * @return 文件路径
- */
- String createFile(String path, byte[] content);
-
- /**
- * 删除文件
- *
- * @param id 编号
- */
- void deleteFile(String id);
-
- /**
- * 获得文件
- *
- * @param path 文件路径
- * @return 文件
- */
- InfFileDO getFile(String path);
-
/**
* 获得文件分页
*
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/impl/InfFileServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/impl/InfFileServiceImpl.java
index 69b4cf0db..b8967c638 100644
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/impl/InfFileServiceImpl.java
+++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/service/file/impl/InfFileServiceImpl.java
@@ -21,24 +21,6 @@ public class InfFileServiceImpl implements InfFileService {
@Resource
private InfFileMapper fileMapper;
- @Resource
- private InfFileCoreService fileCoreService;
-
- @Override
- public String createFile(String path, byte[] content) {
- return fileCoreService.createFile(path,content);
- }
-
- @Override
- public void deleteFile(String id) {
- fileCoreService.deleteFile(id);
- }
-
- @Override
- public InfFileDO getFile(String path) {
- return fileCoreService.getFile(path);
- }
-
@Override
public PageResult getFilePage(InfFilePageReqVO pageReqVO) {
return fileMapper.selectPage(pageReqVO);
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/enums/SysErrorCodeConstants.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/enums/SysErrorCodeConstants.java
index 8a606e062..0fad26be8 100644
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/enums/SysErrorCodeConstants.java
+++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/enums/SysErrorCodeConstants.java
@@ -1,7 +1,6 @@
package cn.iocoder.yudao.adminserver.modules.system.enums;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
-import javafx.beans.binding.MapExpression;
/**
* System 错误码枚举类
diff --git a/yudao-core-service/pom.xml b/yudao-core-service/pom.xml
index 43cdae127..72d763a99 100644
--- a/yudao-core-service/pom.xml
+++ b/yudao-core-service/pom.xml
@@ -5,7 +5,7 @@
yudao
cn.iocoder.boot
- 1.1.0-snapshot
+ 1.2.0-snapshot
4.0.0
diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml
index 125d3bdaf..723ea0c6a 100644
--- a/yudao-dependencies/pom.xml
+++ b/yudao-dependencies/pom.xml
@@ -14,7 +14,7 @@
https://github.com/YunaiV/ruoyi-vue-pro
- 1.1.0-snapshot
+ 1.2.0-snapshot
2.4.5
diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.java
index 11c5f706a..870d33718 100644
--- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.java
+++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/user/SysUserProfileController.java
@@ -55,5 +55,6 @@ public class SysUserProfileController {
public CommonResult getUserInfo() {
return success(userService.getUserInfo(getLoginUserId()));
}
+
}
diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/impl/MbrUserServiceImpl.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/impl/MbrUserServiceImpl.java
index 5bff9d6cb..f340c5fe9 100644
--- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/impl/MbrUserServiceImpl.java
+++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/user/impl/MbrUserServiceImpl.java
@@ -109,6 +109,7 @@ public class MbrUserServiceImpl implements MbrUserService {
@Override
public MbrUserInfoRespVO getUserInfo(Long userId) {
MbrUserDO user = this.checkUserExists(userId);
+ // 拼接返回结果
MbrUserInfoRespVO userResp = new MbrUserInfoRespVO();
userResp.setNickName(user.getNickname());
userResp.setAvatar(user.getAvatar());
diff --git a/更新日志.md b/更新日志.md
index 206599b25..6d5ea6f95 100644
--- a/更新日志.md
+++ b/更新日志.md
@@ -3,16 +3,20 @@
* 邮件
* 钉钉、飞书等通知
-## [v1.2.0] 待定
+## [v1.3.0] 待定
* 工作流
-## [v1.1.1] 待定
+## [v1.2.0] 进行中
+
+* 新增用户前台的昵称、头像的修改
+
+TODO
* 支付
* 用户前台的社交登陆
-## [v1.1.0] 进行中
+## [v1.1.0] 2021.10.25
* 新增管理后台的企业微信、钉钉等社交登录
* 新增用户前台(例如说,用户使用的小程序)的后端项目 `yudao-user-server`