完成mp改造
This commit is contained in:
@ -55,7 +55,7 @@ import java.util.stream.Collectors;
|
|||||||
@Api(tags = "系统:用户管理")
|
@Api(tags = "系统:用户管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/users")
|
@RequestMapping("/api/users")
|
||||||
public class UserController {
|
public class SysUserController {
|
||||||
|
|
||||||
@Value("${rsa.private_key}")
|
@Value("${rsa.private_key}")
|
||||||
private String privateKey;
|
private String privateKey;
|
||||||
@ -67,7 +67,7 @@ public class UserController {
|
|||||||
private final VerificationCodeService verificationCodeService;
|
private final VerificationCodeService verificationCodeService;
|
||||||
private final IGenerator generator;
|
private final IGenerator generator;
|
||||||
|
|
||||||
public UserController(PasswordEncoder passwordEncoder, UserService userService, DataScope dataScope, DeptService deptService, RoleService roleService, VerificationCodeService verificationCodeService, IGenerator generator) {
|
public SysUserController(PasswordEncoder passwordEncoder, UserService userService, DataScope dataScope, DeptService deptService, RoleService roleService, VerificationCodeService verificationCodeService, IGenerator generator) {
|
||||||
this.passwordEncoder = passwordEncoder;
|
this.passwordEncoder = passwordEncoder;
|
||||||
this.userService = userService;
|
this.userService = userService;
|
||||||
this.dataScope = dataScope;
|
this.dataScope = dataScope;
|
||||||
@ -45,4 +45,6 @@ public interface UserAvatarService extends BaseService<UserAvatar>{
|
|||||||
* @throws IOException /
|
* @throws IOException /
|
||||||
*/
|
*/
|
||||||
void download(List<UserAvatarDto> all, HttpServletResponse response) throws IOException;
|
void download(List<UserAvatarDto> all, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
|
UserAvatar saveFile(UserAvatar userAvatar);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -161,9 +161,9 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, Dept> implement
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<DeptDto> getDeleteDepts(List<Dept> deptList, Set<DeptDto> deptDtos) {
|
public Set<DeptDto> getDeleteDepts(List<Dept> deptList, Set<DeptDto> deptDtos) {
|
||||||
|
|
||||||
for (Dept dept : deptList) {
|
for (Dept dept : deptList) {
|
||||||
//todo
|
deptDtos.add((DeptDto)generator.convert(deptList,DeptDto.class));
|
||||||
//deptDtos.add(generator.convert(dept,deptDtos));
|
|
||||||
List<Dept> depts = Collections.singletonList(this.getOne(new QueryWrapper<Dept>().eq("id", dept.getId())));
|
List<Dept> depts = Collections.singletonList(this.getOne(new QueryWrapper<Dept>().eq("id", dept.getId())));
|
||||||
if(depts!=null && depts.size()!=0){
|
if(depts!=null && depts.size()!=0){
|
||||||
getDeleteDepts(depts, deptDtos);
|
getDeleteDepts(depts, deptDtos);
|
||||||
|
|||||||
@ -149,9 +149,7 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, Role> implement
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void updateMenu(Role resources, RoleDto roleDto) {
|
public void updateMenu(Role resources, RoleDto roleDto) {
|
||||||
//Role role =generator.convert(resources,roleDto);
|
Role role =generator.convert(roleDto,Role.class);
|
||||||
//todo
|
|
||||||
Role role = new Role();
|
|
||||||
role.setMenus(resources.getMenus());
|
role.setMenus(resources.getMenus());
|
||||||
this.save(role);
|
this.save(role);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@ package co.yixiang.modules.system.service.impl;
|
|||||||
import co.yixiang.modules.system.domain.User;
|
import co.yixiang.modules.system.domain.User;
|
||||||
import co.yixiang.common.service.impl.BaseServiceImpl;
|
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||||
import co.yixiang.modules.system.domain.UserAvatar;
|
import co.yixiang.modules.system.domain.UserAvatar;
|
||||||
|
import co.yixiang.modules.system.service.UserAvatarService;
|
||||||
import co.yixiang.utils.SecurityUtils;
|
import co.yixiang.utils.SecurityUtils;
|
||||||
import co.yixiang.utils.StringUtils;
|
import co.yixiang.utils.StringUtils;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
@ -21,8 +22,7 @@ import co.yixiang.utils.FileUtil;
|
|||||||
import co.yixiang.modules.system.service.UserService;
|
import co.yixiang.modules.system.service.UserService;
|
||||||
import co.yixiang.modules.system.service.dto.UserDto;
|
import co.yixiang.modules.system.service.dto.UserDto;
|
||||||
import co.yixiang.modules.system.service.dto.UserQueryCriteria;
|
import co.yixiang.modules.system.service.dto.UserQueryCriteria;
|
||||||
import co.yixiang.modules.system.service.mapper.UserMapper;
|
import co.yixiang.modules.system.service.mapper.SysUserMapper;
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
@ -48,16 +48,23 @@ import java.util.LinkedHashMap;
|
|||||||
* @date 2020-05-14
|
* @date 2020-05-14
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@AllArgsConstructor
|
//@AllArgsConstructor
|
||||||
//@CacheConfig(cacheNames = "user")
|
//@CacheConfig(cacheNames = "user")
|
||||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||||
public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implements UserService {
|
public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, User> implements UserService {
|
||||||
|
|
||||||
@Value("${file.avatar}")
|
@Value("${file.avatar}")
|
||||||
private String avatar;
|
private String avatar;
|
||||||
|
|
||||||
private final IGenerator generator;
|
private final IGenerator generator;
|
||||||
private final UserMapper userMapper;
|
private final SysUserMapper userMapper;
|
||||||
|
private final UserAvatarService userAvatarService;
|
||||||
|
|
||||||
|
public SysUserServiceImpl(IGenerator generator, SysUserMapper userMapper, UserAvatarService userAvatarService) {
|
||||||
|
this.generator = generator;
|
||||||
|
this.userMapper = userMapper;
|
||||||
|
this.userAvatarService = userAvatarService;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
//@Cacheable
|
//@Cacheable
|
||||||
@ -139,9 +146,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|||||||
}
|
}
|
||||||
File file = FileUtil.upload(multipartFile, avatar);
|
File file = FileUtil.upload(multipartFile, avatar);
|
||||||
assert file != null;
|
assert file != null;
|
||||||
//todo
|
UserAvatar saveUserAvatar = new UserAvatar(userAvatar,file.getName(), file.getPath(), FileUtil.getSize(multipartFile.getSize()));
|
||||||
//userAvatar = userAvatarService.save(new UserAvatar(userAvatar,file.getName(), file.getPath(), FileUtil.getSize(multipartFile.getSize())));
|
userAvatarService.save(saveUserAvatar);
|
||||||
user.setUserAvatar(userAvatar);
|
user.setUserAvatar(saveUserAvatar);
|
||||||
this.save(user);
|
this.save(user);
|
||||||
if(StringUtils.isNotBlank(oldPath)){
|
if(StringUtils.isNotBlank(oldPath)){
|
||||||
FileUtil.del(oldPath);
|
FileUtil.del(oldPath);
|
||||||
@ -87,4 +87,10 @@ public class UserAvatarServiceImpl extends BaseServiceImpl<UserAvatarMapper, Use
|
|||||||
}
|
}
|
||||||
FileUtil.downloadExcel(list, response);
|
FileUtil.downloadExcel(list, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserAvatar saveFile(UserAvatar userAvatar) {
|
||||||
|
//todo
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,7 @@ import java.util.Date;
|
|||||||
*/
|
*/
|
||||||
@Repository
|
@Repository
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface UserMapper extends CoreMapper<User> {
|
public interface SysUserMapper extends CoreMapper<User> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改密码
|
* 修改密码
|
||||||
@ -6,7 +6,7 @@ spring:
|
|||||||
druid:
|
druid:
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||||
url: jdbc:log4jdbc:mysql://localhost:3306/yxshop?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull
|
url: jdbc:log4jdbc:mysql://localhost:3306/yshop?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull
|
||||||
username: root
|
username: root
|
||||||
password: root
|
password: root
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user