fix: 合并冲突解决
This commit is contained in:
10
README.md
10
README.md
@@ -21,6 +21,14 @@
|
|||||||
| 后端工程 | https://gitee.com/youlaiorg/youlai-boot |
|
| 后端工程 | https://gitee.com/youlaiorg/youlai-boot |
|
||||||
| 前端工程 | https://gitee.com/youlaiorg/vue3-element-admin |
|
| 前端工程 | https://gitee.com/youlaiorg/vue3-element-admin |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 接口文档
|
||||||
|
|
||||||
|
- `knife4j` 接口文档:[http://localhost:8989/doc.html](http://localhost:8989/doc.html)
|
||||||
|
|
||||||
|
- `swagger` 接口文档:[http://localhost:8989/swagger-ui/index.html](http://localhost:8989/swagger-ui/index.html)
|
||||||
|
|
||||||
## 项目运行
|
## 项目运行
|
||||||
|
|
||||||
### 1. 数据库创建
|
### 1. 数据库创建
|
||||||
@@ -38,7 +46,7 @@
|
|||||||
|
|
||||||
### 4. 前端启动
|
### 4. 前端启动
|
||||||
|
|
||||||
参考前端工程说明文档:[README.md](https://gitee.com/youlaiorg/vue3-element-admin#%E9%A1%B9%E7%9B%AE%E5%90%AF%E5%8A%A8)
|
文档:[README.md](https://gitee.com/youlaiorg/vue3-element-admin#%E9%A1%B9%E7%9B%AE%E5%90%AF%E5%8A%A8)
|
||||||
|
|
||||||
## 开发规范
|
## 开发规范
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.youlai.system.common.util;
|
package com.youlai.system.common.util;
|
||||||
|
|
||||||
import com.alibaba.excel.EasyExcel;
|
import com.alibaba.excel.EasyExcel;
|
||||||
import com.youlai.system.framework.easyexcel.ExcelResult;
|
|
||||||
import com.youlai.system.framework.easyexcel.MyAnalysisEventListener;
|
import com.youlai.system.framework.easyexcel.MyAnalysisEventListener;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -14,11 +13,9 @@ import java.io.InputStream;
|
|||||||
*/
|
*/
|
||||||
public class ExcelUtils {
|
public class ExcelUtils {
|
||||||
|
|
||||||
public static <T> ExcelResult importExcel(InputStream is, Class clazz, MyAnalysisEventListener<T> listener) {
|
public static <T> String importExcel(InputStream is, Class clazz, MyAnalysisEventListener<T> listener) {
|
||||||
EasyExcel.read(is, clazz, listener).sheet().doRead();
|
EasyExcel.read(is, clazz, listener).sheet().doRead();
|
||||||
ExcelResult excelResult = listener.getResult();
|
String msg = listener.getMsg();
|
||||||
return excelResult;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,20 +4,20 @@ import com.fasterxml.jackson.core.JsonParser;
|
|||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
import jakarta.validation.Validation;
|
||||||
|
import jakarta.validation.Validator;
|
||||||
|
import jakarta.validation.ValidatorFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.hibernate.validator.HibernateValidator;
|
import org.hibernate.validator.HibernateValidator;
|
||||||
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
|
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
|
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.validation.beanvalidation.SpringConstraintValidatorFactory;
|
import org.springframework.validation.beanvalidation.SpringConstraintValidatorFactory;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
import jakarta.validation.Validation;
|
|
||||||
import jakarta.validation.Validator;
|
|
||||||
import jakarta.validation.ValidatorFactory;
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -29,6 +29,8 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||||
|
converters.add(new StringHttpMessageConverter());
|
||||||
|
|
||||||
MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();
|
MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();
|
||||||
ObjectMapper objectMapper = jackson2HttpMessageConverter.getObjectMapper();
|
ObjectMapper objectMapper = jackson2HttpMessageConverter.getObjectMapper();
|
||||||
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
|
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
|
||||||
@@ -42,7 +44,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
|||||||
objectMapper.registerModule(simpleModule);
|
objectMapper.registerModule(simpleModule);
|
||||||
|
|
||||||
jackson2HttpMessageConverter.setObjectMapper(objectMapper);
|
jackson2HttpMessageConverter.setObjectMapper(objectMapper);
|
||||||
converters.add(0, jackson2HttpMessageConverter);
|
converters.add(jackson2HttpMessageConverter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.youlai.system.common.result.PageResult;
|
import com.youlai.system.common.result.PageResult;
|
||||||
import com.youlai.system.common.result.Result;
|
import com.youlai.system.common.result.Result;
|
||||||
import com.youlai.system.common.util.ExcelUtils;
|
import com.youlai.system.common.util.ExcelUtils;
|
||||||
import com.youlai.system.framework.easyexcel.ExcelResult;
|
|
||||||
import com.youlai.system.listener.UserImportListener;
|
import com.youlai.system.listener.UserImportListener;
|
||||||
import com.youlai.system.pojo.vo.UserImportVO;
|
import com.youlai.system.pojo.vo.UserImportVO;
|
||||||
import com.youlai.system.pojo.form.UserForm;
|
import com.youlai.system.pojo.form.UserForm;
|
||||||
@@ -149,8 +148,8 @@ public class SysUserController {
|
|||||||
@PostMapping("/_import")
|
@PostMapping("/_import")
|
||||||
public Result importUsers(@Parameter(name = "部门ID") Long deptId, MultipartFile file) throws IOException {
|
public Result importUsers(@Parameter(name = "部门ID") Long deptId, MultipartFile file) throws IOException {
|
||||||
UserImportListener listener = new UserImportListener(deptId);
|
UserImportListener listener = new UserImportListener(deptId);
|
||||||
ExcelResult excelResult = ExcelUtils.importExcel(file.getInputStream(), UserImportVO.class, listener);
|
String msg = ExcelUtils.importExcel(file.getInputStream(), UserImportVO.class, listener);
|
||||||
return Result.success(excelResult.getMsg());
|
return Result.success(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "导出用户")
|
@Operation(summary = "导出用户")
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.youlai.system.pojo.bo.UserBO;
|
|||||||
import com.youlai.system.pojo.entity.SysUser;
|
import com.youlai.system.pojo.entity.SysUser;
|
||||||
import com.youlai.system.pojo.form.UserForm;
|
import com.youlai.system.pojo.form.UserForm;
|
||||||
import com.youlai.system.pojo.bo.UserFormBO;
|
import com.youlai.system.pojo.bo.UserFormBO;
|
||||||
|
import com.youlai.system.pojo.vo.UserImportVO;
|
||||||
import com.youlai.system.pojo.vo.UserInfoVO;
|
import com.youlai.system.pojo.vo.UserInfoVO;
|
||||||
import com.youlai.system.pojo.vo.UserPageVO;
|
import com.youlai.system.pojo.vo.UserPageVO;
|
||||||
import org.mapstruct.InheritInverseConfiguration;
|
import org.mapstruct.InheritInverseConfiguration;
|
||||||
@@ -22,13 +23,13 @@ import org.mapstruct.Mappings;
|
|||||||
public interface UserConverter {
|
public interface UserConverter {
|
||||||
|
|
||||||
@Mappings({
|
@Mappings({
|
||||||
@Mapping(target = "genderLabel", expression = "java(com.youlai.system.common.base.IBaseEnum.getLabelByValue(po.getGender(), com.youlai.system.common.enums.GenderEnum.class))")
|
@Mapping(target = "genderLabel", expression = "java(com.youlai.system.common.base.IBaseEnum.getLabelByValue(bo.getGender(), com.youlai.system.common.enums.GenderEnum.class))")
|
||||||
})
|
})
|
||||||
UserPageVO po2Vo(UserBO po);
|
UserPageVO bo2Vo(UserBO bo);
|
||||||
|
|
||||||
Page<UserPageVO> po2Vo(Page<UserBO> po);
|
Page<UserPageVO> bo2Vo(Page<UserBO> bo);
|
||||||
|
|
||||||
UserForm po2Form(UserFormBO po);
|
UserForm bo2Form(UserFormBO bo);
|
||||||
|
|
||||||
UserForm entity2Form(SysUser entity);
|
UserForm entity2Form(SysUser entity);
|
||||||
|
|
||||||
@@ -38,7 +39,8 @@ public interface UserConverter {
|
|||||||
@Mappings({
|
@Mappings({
|
||||||
@Mapping(target = "userId", source = "id")
|
@Mapping(target = "userId", source = "id")
|
||||||
})
|
})
|
||||||
UserInfoVO entity2LoginUser(SysUser entity);
|
UserInfoVO entity2UserInfoVo(SysUser entity);
|
||||||
|
|
||||||
|
SysUser importVo2Entity(UserImportVO vo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
package com.youlai.system.framework.easyexcel;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Excel 读取结果
|
|
||||||
*
|
|
||||||
* @author: haoxr
|
|
||||||
* @date: 2023/03/01
|
|
||||||
*/
|
|
||||||
public interface ExcelResult<T> {
|
|
||||||
|
|
||||||
List<T> getList();
|
|
||||||
|
|
||||||
String getMsg();
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -9,5 +9,7 @@ import com.alibaba.excel.event.AnalysisEventListener;
|
|||||||
* @date: 2023/03/01
|
* @date: 2023/03/01
|
||||||
*/
|
*/
|
||||||
public abstract class MyAnalysisEventListener<T> extends AnalysisEventListener<T> {
|
public abstract class MyAnalysisEventListener<T> extends AnalysisEventListener<T> {
|
||||||
public abstract ExcelResult<T> getResult();
|
|
||||||
|
private String msg;
|
||||||
|
public abstract String getMsg();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public class MyDataPermissionHandler implements DataPermissionHandler {
|
|||||||
// 默认部门及子部门数据权限
|
// 默认部门及子部门数据权限
|
||||||
default:
|
default:
|
||||||
deptId = SecurityUtils.getDeptId();
|
deptId = SecurityUtils.getDeptId();
|
||||||
appendSqlStr = deptColumnName + " IN ( SELECT id FROM sys_dept WHERE id = " + deptId + " or find_in_set( " + deptId + " , tree_path ) )";
|
appendSqlStr = deptColumnName + " IN ( SELECT id FROM sys_dept WHERE id = " + deptId + " OR FIND_IN_SET( " + deptId + " , tree_path ) )";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,29 @@
|
|||||||
package com.youlai.system.listener;
|
package com.youlai.system.listener;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Validator;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.alibaba.excel.context.AnalysisContext;
|
import com.alibaba.excel.context.AnalysisContext;
|
||||||
import com.alibaba.excel.util.ListUtils;
|
import com.alibaba.excel.util.ListUtils;
|
||||||
import com.youlai.system.framework.easyexcel.ExcelResult;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.youlai.system.common.base.IBaseEnum;
|
||||||
|
import com.youlai.system.common.constant.SystemConstants;
|
||||||
|
import com.youlai.system.common.enums.GenderEnum;
|
||||||
|
import com.youlai.system.converter.UserConverter;
|
||||||
import com.youlai.system.framework.easyexcel.MyAnalysisEventListener;
|
import com.youlai.system.framework.easyexcel.MyAnalysisEventListener;
|
||||||
|
import com.youlai.system.pojo.entity.SysUser;
|
||||||
import com.youlai.system.pojo.vo.UserImportVO;
|
import com.youlai.system.pojo.vo.UserImportVO;
|
||||||
import com.youlai.system.service.SysUserService;
|
import com.youlai.system.service.SysUserService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户导入监听器
|
* 用户导入监听器
|
||||||
* <p>
|
* <p>
|
||||||
* https://easyexcel.opensource.alibaba.com/docs/current/quickstart/read
|
* 最简单的读监听器:https://easyexcel.opensource.alibaba.com/docs/current/quickstart/read
|
||||||
*
|
*
|
||||||
* @author haoxr
|
* @author haoxr
|
||||||
* @date 2022/4/10 20:49
|
* @date 2022/4/10 20:49
|
||||||
@@ -28,11 +36,19 @@ public class UserImportListener extends MyAnalysisEventListener<UserImportVO> {
|
|||||||
*/
|
*/
|
||||||
private static final int BATCH_COUNT = 100;
|
private static final int BATCH_COUNT = 100;
|
||||||
|
|
||||||
|
private int validCount;
|
||||||
|
|
||||||
|
private int invalidCount;
|
||||||
|
|
||||||
|
private int currentIndex;
|
||||||
|
|
||||||
|
StringBuilder msg = new StringBuilder();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 缓存的数据
|
* 缓存的数据
|
||||||
*/
|
*/
|
||||||
private List<UserImportVO> cachedUserList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
|
private List<SysUser> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门ID
|
* 部门ID
|
||||||
@@ -41,12 +57,17 @@ public class UserImportListener extends MyAnalysisEventListener<UserImportVO> {
|
|||||||
|
|
||||||
private final SysUserService userService;
|
private final SysUserService userService;
|
||||||
|
|
||||||
|
private final PasswordEncoder passwordEncoder;
|
||||||
|
|
||||||
|
private final UserConverter userConverter;
|
||||||
|
|
||||||
public UserImportListener(Long deptId) {
|
public UserImportListener(Long deptId) {
|
||||||
this.deptId = deptId;
|
this.deptId = deptId;
|
||||||
this.userService = SpringUtil.getBean(SysUserService.class);
|
this.userService = SpringUtil.getBean(SysUserService.class);
|
||||||
|
this.passwordEncoder = SpringUtil.getBean(PasswordEncoder.class);
|
||||||
|
this.userConverter = SpringUtil.getBean(UserConverter.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 每一条数据解析都会来调用
|
* 每一条数据解析都会来调用
|
||||||
*
|
*
|
||||||
@@ -56,10 +77,61 @@ public class UserImportListener extends MyAnalysisEventListener<UserImportVO> {
|
|||||||
@Override
|
@Override
|
||||||
public void invoke(UserImportVO userImportVO, AnalysisContext analysisContext) {
|
public void invoke(UserImportVO userImportVO, AnalysisContext analysisContext) {
|
||||||
log.info("解析到一条用户数据:{}", JSONUtil.toJsonStr(userImportVO));
|
log.info("解析到一条用户数据:{}", JSONUtil.toJsonStr(userImportVO));
|
||||||
|
currentIndex++;
|
||||||
|
StringBuilder rowMsg = new StringBuilder();
|
||||||
|
boolean rowFlag = true;
|
||||||
|
// 校验数据
|
||||||
|
|
||||||
|
String username = userImportVO.getUsername();
|
||||||
|
if (StrUtil.isBlank(username)) {
|
||||||
|
rowFlag = false;
|
||||||
|
rowMsg.append("用户名为空;");
|
||||||
|
} else {
|
||||||
|
long count = userService.count(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUsername, username));
|
||||||
|
if (count > 0) {
|
||||||
|
rowFlag = false;
|
||||||
|
rowMsg.append("用户名已存在;");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String nickname = userImportVO.getNickname();
|
||||||
|
if (StrUtil.isBlank(nickname)) {
|
||||||
|
rowFlag = false;
|
||||||
|
rowMsg.append("用户昵称为空;");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String mobile = userImportVO.getMobile();
|
||||||
|
if (StrUtil.isBlank(mobile)) {
|
||||||
|
rowFlag = false;
|
||||||
|
rowMsg.append("手机号码为空;");
|
||||||
|
} else {
|
||||||
|
if (!Validator.isMobile(mobile)) {
|
||||||
|
rowFlag = false;
|
||||||
|
rowMsg.append("手机号码不正确;");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rowFlag) {
|
||||||
|
validCount++;
|
||||||
|
SysUser entity = userConverter.importVo2Entity(userImportVO);
|
||||||
|
// 默认密码
|
||||||
|
entity.setPassword(passwordEncoder.encode(SystemConstants.DEFAULT_PASSWORD));
|
||||||
|
// 性别转换
|
||||||
|
Integer gender = (Integer) IBaseEnum.getValueByLabel(userImportVO.getGender(), GenderEnum.class);
|
||||||
|
entity.setGender(gender);
|
||||||
|
entity.setDeptId(deptId);
|
||||||
|
|
||||||
|
cachedDataList.add(entity);
|
||||||
|
} else {
|
||||||
|
invalidCount++;
|
||||||
|
msg.append("第" + currentIndex + "行数据校验失败:").append(rowMsg + "<br/>");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cachedDataList.size() > BATCH_COUNT) {
|
||||||
|
saveData();
|
||||||
|
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -70,21 +142,20 @@ public class UserImportListener extends MyAnalysisEventListener<UserImportVO> {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
|
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
|
||||||
|
// 这里也要保存数据,确保最后遗留的数据也存储到数据库
|
||||||
|
saveData();
|
||||||
|
msg = new StringBuilder("导入用户结束:成功" + validCount + "条;失败" + invalidCount + "条<br/>").append(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 存储数据库
|
||||||
|
*/
|
||||||
|
private void saveData() {
|
||||||
|
userService.saveBatch(cachedDataList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ExcelResult<UserImportVO> getResult() {
|
public String getMsg() {
|
||||||
return new ExcelResult<UserImportVO>() {
|
return this.msg.toString();
|
||||||
@Override
|
|
||||||
public List<UserImportVO> getList() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMsg() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,13 +85,6 @@ public interface SysUserService extends IService<SysUser> {
|
|||||||
|
|
||||||
UserAuthInfo getUserAuthInfo(String username);
|
UserAuthInfo getUserAuthInfo(String username);
|
||||||
|
|
||||||
/**
|
|
||||||
* 导入用户
|
|
||||||
*
|
|
||||||
* @param userImportVO
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
String importUsers(UserImportVO userImportVO) throws IOException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取导出用户列表
|
* 获取导出用户列表
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import com.youlai.system.pojo.entity.SysUser;
|
|||||||
import com.youlai.system.pojo.form.UserForm;
|
import com.youlai.system.pojo.form.UserForm;
|
||||||
import com.youlai.system.pojo.query.UserPageQuery;
|
import com.youlai.system.pojo.query.UserPageQuery;
|
||||||
import com.youlai.system.pojo.vo.UserExportVO;
|
import com.youlai.system.pojo.vo.UserExportVO;
|
||||||
import com.youlai.system.pojo.vo.UserImportVO;
|
|
||||||
import com.youlai.system.pojo.vo.UserInfoVO;
|
import com.youlai.system.pojo.vo.UserInfoVO;
|
||||||
import com.youlai.system.pojo.vo.UserPageVO;
|
import com.youlai.system.pojo.vo.UserPageVO;
|
||||||
import com.youlai.system.service.SysMenuService;
|
import com.youlai.system.service.SysMenuService;
|
||||||
@@ -32,7 +31,6 @@ import org.springframework.security.crypto.password.PasswordEncoder;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -49,7 +47,9 @@ import java.util.stream.Collectors;
|
|||||||
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService {
|
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService {
|
||||||
|
|
||||||
private final PasswordEncoder passwordEncoder;
|
private final PasswordEncoder passwordEncoder;
|
||||||
|
|
||||||
private final SysUserRoleService userRoleService;
|
private final SysUserRoleService userRoleService;
|
||||||
|
|
||||||
private final UserConverter userConverter;
|
private final UserConverter userConverter;
|
||||||
|
|
||||||
private final SysMenuService menuService;
|
private final SysMenuService menuService;
|
||||||
@@ -73,10 +73,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||||||
Page<UserBO> page = new Page<>(pageNum, pageSize);
|
Page<UserBO> page = new Page<>(pageNum, pageSize);
|
||||||
|
|
||||||
// 查询数据
|
// 查询数据
|
||||||
Page<UserBO> userPoPage = this.baseMapper.listUserPages(page, queryParams);
|
Page<UserBO> userBoPage = this.baseMapper.listUserPages(page, queryParams);
|
||||||
|
|
||||||
// 实体转换
|
// 实体转换
|
||||||
Page<UserPageVO> userVoPage = userConverter.po2Vo(userPoPage);
|
Page<UserPageVO> userVoPage = userConverter.bo2Vo(userBoPage);
|
||||||
|
|
||||||
return userVoPage;
|
return userVoPage;
|
||||||
}
|
}
|
||||||
@@ -91,7 +91,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||||||
public UserForm getUserFormData(Long userId) {
|
public UserForm getUserFormData(Long userId) {
|
||||||
UserFormBO userFormBO = this.baseMapper.getUserDetail(userId);
|
UserFormBO userFormBO = this.baseMapper.getUserDetail(userId);
|
||||||
// 实体转换po->form
|
// 实体转换po->form
|
||||||
UserForm userForm = userConverter.po2Form(userFormBO);
|
UserForm userForm = userConverter.bo2Form(userFormBO);
|
||||||
return userForm;
|
return userForm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,19 +216,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||||||
return userAuthInfo;
|
return userAuthInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 导入用户
|
|
||||||
*
|
|
||||||
* @param userImportVO
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Transactional
|
|
||||||
@Override
|
|
||||||
public String importUsers(UserImportVO userImportVO) throws IOException {
|
|
||||||
|
|
||||||
return "导入成功";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取导出用户列表
|
* 获取导出用户列表
|
||||||
@@ -259,14 +246,14 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
// entity->VO
|
// entity->VO
|
||||||
UserInfoVO userInfoVO = userConverter.entity2LoginUser(user);
|
UserInfoVO userInfoVO = userConverter.entity2UserInfoVo(user);
|
||||||
|
|
||||||
// 用户角色集合
|
// 用户角色集合
|
||||||
Set<String> roles = SecurityUtils.getRoles();
|
Set<String> roles = SecurityUtils.getRoles();
|
||||||
userInfoVO.setRoles(roles);
|
userInfoVO.setRoles(roles);
|
||||||
|
|
||||||
// 用户权限集合
|
// 用户权限集合
|
||||||
Set<String> perms = (Set<String>)redisTemplate.opsForValue().get("USER_PERMS:" + user.getId());
|
Set<String> perms = (Set<String>) redisTemplate.opsForValue().get("USER_PERMS:" + user.getId());
|
||||||
userInfoVO.setPerms(perms);
|
userInfoVO.setPerms(perms);
|
||||||
|
|
||||||
return userInfoVO;
|
return userInfoVO;
|
||||||
|
|||||||
@@ -53,3 +53,11 @@ minio:
|
|||||||
# 自定义域名(非必须),Nginx配置反向代理转发文件路径
|
# 自定义域名(非必须),Nginx配置反向代理转发文件路径
|
||||||
custom-domain:
|
custom-domain:
|
||||||
|
|
||||||
|
|
||||||
|
# 接口文档
|
||||||
|
springdoc:
|
||||||
|
swagger-ui:
|
||||||
|
enabled: true
|
||||||
|
api-docs:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
|||||||
@@ -46,11 +46,18 @@ auth:
|
|||||||
|
|
||||||
# MinIO 分布式文件系统
|
# MinIO 分布式文件系统
|
||||||
minio:
|
minio:
|
||||||
endpoint: http://localhost:9000
|
endpoint: http://www.youlai.tech:9000
|
||||||
access-key: minioadmin
|
access-key: minioadmin
|
||||||
secret-key: minioadmin
|
secret-key: youlaitech
|
||||||
# 存储桶名称
|
bucket-name: youlai-boot
|
||||||
bucket-name: default
|
|
||||||
# 自定义域名(非必须),Nginx配置反向代理转发文件路径
|
# 自定义域名(非必须),Nginx配置反向代理转发文件路径
|
||||||
custom-domain:
|
custom-domain: https://oss.youlai.tech
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 接口文档
|
||||||
|
springdoc:
|
||||||
|
swagger-ui:
|
||||||
|
enabled: true
|
||||||
|
api-docs:
|
||||||
|
enabled: true
|
||||||
|
|||||||
Binary file not shown.
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
<!--1. 输出到控制台-->
|
<!--1. 输出到控制台-->
|
||||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
<withJansi>true</withJansi>
|
<!-- <withJansi>true</withJansi>-->
|
||||||
<!--此日志appender是为开发使用,只配置最低级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
|
<!--此日志appender是为开发使用,只配置最低级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
|
||||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||||
<level>DEBUG</level>
|
<level>DEBUG</level>
|
||||||
|
|||||||
Reference in New Issue
Block a user