Commit 86087ffc authored by 蔡镇泽's avatar 蔡镇泽

Merge remote-tracking branch 'origin/master'

parents 3cc435c6 16272d50
......@@ -33,7 +33,7 @@ public class UserDetailsServiceImpl implements UserDetailsService {
}
SystemUser systemUser = userRes.getData();
//根据用户id获取用户权限
Result<List<Long>> roles = systemAdminFeignService.loadUserRolesByUserId(systemUser.getId());
Result<List<Long>> roles = systemAdminFeignService.loadUserRolesByUserId(systemUser.getUserId());
UserLoginInfoVO userLoginInfoVO = new UserLoginInfoVO(systemUser);
userLoginInfoVO.setAuthorities(roles.getData());
......
......@@ -18,15 +18,13 @@ import java.util.List;
public class SystemResource {
@TableId
@TableField("RESOURCE_ID")
private Long id;
private Long resourceId;
private String resourceName;
private String resourceUrl;
private String method;
private String resourceType;
private Long parentId;
@TableField("RESOURCE_ICON")
private String icon;
private String resourceIcon;
private Date createTime;
@TableField(exist = false)
......
......@@ -17,10 +17,8 @@ import java.util.Date;
public class SystemRole {
@TableId
@TableField("ROLE_ID")
private Long id;
@TableField("ROLE_NAME")
private String name;
private Long roleId;
private String roleName;
private String status;
private Date createTime;
private Date modifyTime;
......
......@@ -17,14 +17,12 @@ import java.util.Date;
public class SystemUser {
@TableId
@TableField("USER_ID")
private Long id;
private Long userId;
private String account;
private String password;
private String realName;
private String avatar;
private String gender;
private String marketerCode;
private Integer userStatus;
private Date createdTime;
private Date updatedTime;
......
......@@ -28,11 +28,11 @@ public class UserLoginInfoVO implements UserDetails {
this.username = user.getAccount();
this.password = user.getPassword();
this.name = user.getRealName();
this.userId = user.getId();
this.enable = "1".equals(user.getUserStatus()) ;
this.userId = user.getUserId();
this.enable = user.getUserStatus() == 1;
}
public void setAuthorities(List<Long> roles){
public void setAuthorities(List<Long> roles) {
if (CollectionUtil.isNotEmpty(roles)) {
authorities = new ArrayList<>();
roles.forEach(roleId -> authorities.add(new SimpleGrantedAuthority(String.valueOf(roleId))));
......
......@@ -42,9 +42,9 @@ public class ResourcesController {
List<MainMenuVO> resourceList = resourceService.list(new LambdaQueryWrapper<SystemResource>().eq(SystemResource::getResourceType, "2"))
.stream().map(item -> {
MainMenuVO mainMenuVO = new MainMenuVO();
mainMenuVO.setIcon(item.getIcon());
mainMenuVO.setIcon(item.getResourceIcon());
mainMenuVO.setName(item.getResourceName());
mainMenuVO.setId(item.getId());
mainMenuVO.setId(item.getResourceId());
mainMenuVO.setParentId(item.getParentId());
return mainMenuVO;
}).collect(Collectors.toList());
......@@ -81,8 +81,8 @@ public class ResourcesController {
systemResource.setResourceName(reqResource.getName());
systemResource.setResourceUrl(reqResource.getUrl());
systemResource.setResourceType(reqResource.getType());
systemResource.setIcon(reqResource.getIcon());
systemResource.setIcon(reqResource.getIcon());
systemResource.setResourceId(reqResource.getId());
systemResource.setResourceIcon(reqResource.getIcon());
systemResource.setParentId(reqResource.getParentId());
systemResource.setCreateTime(new Date());
resourceService.save(systemResource);
......
......@@ -53,14 +53,14 @@ public class RoleController {
}
SystemRole role = roleService.getOne(new LambdaQueryWrapper<SystemRole>()
.eq(SystemRole::getName, reqRoleInfo.getName()));
.eq(SystemRole::getRoleName, reqRoleInfo.getName()));
if (role != null) {
return Result.failed("角色名称不能重复!");
}
SystemRole systemRole = new SystemRole();
systemRole.setName(reqRoleInfo.getName());
systemRole.setRoleName(reqRoleInfo.getName());
systemRole.setStatus(reqRoleInfo.getStatus());
systemRole.setCreateTime(new Date());
roleService.save(systemRole);
......@@ -89,7 +89,7 @@ public class RoleController {
return Result.failed("名称不能为空!");
}
SystemRole systemRole = roleService.getOne(new LambdaQueryWrapper<SystemRole>()
.eq(SystemRole::getName, roleName));
.eq(SystemRole::getRoleName, roleName));
if (systemRole != null) {
return Result.failed("名称已存在!");
}
......@@ -106,7 +106,7 @@ public class RoleController {
QueryWrapper<SystemRole> systemRoleQueryWrapper = new QueryWrapper<>();
if (!StrUtil.isBlankIfStr(reqRoleInfo.getName())) {
systemRoleQueryWrapper.and(wrapper -> wrapper.lambda().like(SystemRole::getName, reqRoleInfo.getName()));
systemRoleQueryWrapper.and(wrapper -> wrapper.lambda().like(SystemRole::getRoleName, reqRoleInfo.getName()));
}
if (!StrUtil.isBlankIfStr(reqRoleInfo.getStatus())) {
systemRoleQueryWrapper.and(wrapper -> wrapper.lambda().eq(SystemRole::getStatus, reqRoleInfo.getStatus()));
......@@ -124,13 +124,13 @@ public class RoleController {
if (reqRoleInfo.getId() == null || reqRoleInfo.getId() == 0) {
return Result.failed("角色ID无效!");
}
SystemRole systemRole = roleService.getOne(new LambdaQueryWrapper<SystemRole>().eq(SystemRole::getId, reqRoleInfo.getId()));
SystemRole systemRole = roleService.getOne(new LambdaQueryWrapper<SystemRole>().eq(SystemRole::getRoleId, reqRoleInfo.getId()));
if (systemRole == null) {
return Result.failed("角色ID无效!");
}
boolean flag = false;
if (!reqRoleInfo.getName().equals(systemRole.getName())) {
systemRole.setName(reqRoleInfo.getName());
if (!reqRoleInfo.getName().equals(systemRole.getRoleName())) {
systemRole.setRoleName(reqRoleInfo.getName());
flag = true;
}
if (!reqRoleInfo.getStatus().equals(systemRole.getStatus())) {
......
......@@ -95,16 +95,15 @@ public class UserController {
}
SystemUser systemUser = userInfoService.getOne(new LambdaQueryWrapper<SystemUser>()
.eq(SystemUser::getAccount, reqUserInfo.getAccount()).or()
.eq(SystemUser::getId, reqUserInfo.getId()));
.eq(SystemUser::getUserId, reqUserInfo.getId()));
if (systemUser != null) {
return Result.failed("账号已存在!");
}
SystemUser user = new SystemUser();
user.setId(reqUserInfo.getId());
user.setUserId(reqUserInfo.getId());
user.setAccount(reqUserInfo.getAccount());
user.setPassword(new BCryptPasswordEncoder().encode(reqUserInfo.getPassword()));
user.setGender(reqUserInfo.getGender());
user.setMarketerCode(reqUserInfo.getMarketerCode());
user.setRealName(reqUserInfo.getName());
user.setUserStatus(reqUserInfo.getEnable());
user.setCreatedTime(new Date());
......@@ -114,7 +113,7 @@ public class UserController {
roles.add(1L);
List<SystemUserRole> roleList = roles.stream().map(roleId -> {
SystemUserRole systemUserRole = new SystemUserRole();
systemUserRole.setUserId(user.getId());
systemUserRole.setUserId(user.getUserId());
systemUserRole.setRoleId(roleId);
return systemUserRole;
}).collect(Collectors.toList());
......@@ -183,13 +182,12 @@ public class UserController {
List<SystemUser> users = userInfoService.list(systemUserQueryWrapper);
List<ReqUserInfo> resUsers = users.stream().map(user -> {
ReqUserInfo userInfo = new ReqUserInfo();
userInfo.setId(user.getId());
userInfo.setId(user.getUserId());
userInfo.setName(user.getRealName());
userInfo.setAccount(user.getAccount());
userInfo.setEnable(user.getUserStatus());
userInfo.setAvatar(user.getAvatar());
userInfo.setGender(Gender.MAN.getCode().equals(user.getGender()) ? Gender.MAN.getDesc() : Gender.WOMAN.getDesc());
userInfo.setMarketerCode(user.getMarketerCode());
return userInfo;
}).collect(Collectors.toList());
return Result.success(resUsers);
......
......@@ -11,7 +11,7 @@ import java.util.List;
/**
* @author hubin
*/
@FeignClient("ltc-SYSTEM-ADMIN-SERVICE")
@FeignClient("LTC-SYSTEM-ADMIN-SERVICE")
public interface SystemAdminFeignService {
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment