fix: 项目优选重新补丁
This commit is contained in:
parent
1ba0b73ac7
commit
e65efd1883
@ -1,15 +1,23 @@
|
|||||||
package com.jsl.oa.controllers;
|
package com.jsl.oa.controllers;
|
||||||
|
|
||||||
|
import com.jsl.oa.model.voData.RoleAddVo;
|
||||||
|
import com.jsl.oa.model.voData.RoleEditVO;
|
||||||
import com.jsl.oa.services.RoleService;
|
import com.jsl.oa.services.RoleService;
|
||||||
import com.jsl.oa.utils.BaseResponse;
|
import com.jsl.oa.utils.BaseResponse;
|
||||||
import com.jsl.oa.utils.ErrorCode;
|
import com.jsl.oa.utils.ErrorCode;
|
||||||
|
import com.jsl.oa.utils.Processing;
|
||||||
import com.jsl.oa.utils.ResultUtil;
|
import com.jsl.oa.utils.ResultUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.lang.Nullable;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.springframework.validation.BindingResult;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.validation.constraints.NotNull;
|
import java.util.ArrayList;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1>角色控制器</h1>
|
* <h1>角色控制器</h1>
|
||||||
@ -20,6 +28,7 @@ import javax.validation.constraints.NotNull;
|
|||||||
* @see RoleService
|
* @see RoleService
|
||||||
* @since v1.1.0
|
* @since v1.1.0
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class RoleController {
|
public class RoleController {
|
||||||
@ -35,9 +44,55 @@ public class RoleController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/role/get")
|
@GetMapping("/role/get")
|
||||||
public BaseResponse roleGet(HttpServletRequest request, @RequestParam @Nullable String id) {
|
public BaseResponse roleGet(HttpServletRequest request, @RequestParam @Nullable String id) {
|
||||||
|
log.info("请求接口[GET]: /role/get");
|
||||||
return roleService.roleGet(request, id);
|
return roleService.roleGet(request, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>角色编辑</h2>
|
||||||
|
* <hr/>
|
||||||
|
* 角色编辑接口
|
||||||
|
*
|
||||||
|
* @param request 请求
|
||||||
|
* @param roleEditVO 角色编辑VO
|
||||||
|
* @param bindingResult 参数校验结果
|
||||||
|
* @return {@link BaseResponse}
|
||||||
|
*/
|
||||||
|
@PutMapping("/role/edit")
|
||||||
|
public BaseResponse roleEdit(HttpServletRequest request, @RequestBody @Validated RoleEditVO roleEditVO, @NotNull BindingResult bindingResult) {
|
||||||
|
log.info("请求接口[PUT]: /role/edit");
|
||||||
|
// 判断是否有参数错误
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return ResultUtil.error(ErrorCode.REQUEST_BODY_ERROR, Processing.getValidatedErrorList(bindingResult));
|
||||||
|
}
|
||||||
|
return roleService.roleEdit(request, roleEditVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>角色删除</h2>
|
||||||
|
* <hr/>
|
||||||
|
* 角色删除接口
|
||||||
|
*
|
||||||
|
* @param request 请求
|
||||||
|
* @param id 角色id
|
||||||
|
* @return {@link BaseResponse}
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/role/delete")
|
||||||
|
public BaseResponse roleDelete(HttpServletRequest request, @RequestParam String id) {
|
||||||
|
log.info("请求接口[DELETE]: /role/delete");
|
||||||
|
// 判断是否有参数错误
|
||||||
|
if (id == null) {
|
||||||
|
return ResultUtil.error(ErrorCode.PARAMETER_ERROR);
|
||||||
|
} else {
|
||||||
|
if (Pattern.matches("^[0-9]+$", id)) {
|
||||||
|
ArrayList<String> error = new ArrayList<>();
|
||||||
|
error.add("id 只能为数字");
|
||||||
|
return ResultUtil.error(ErrorCode.PARAMETER_ERROR, error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return roleService.roleDelete(request, Long.valueOf(id));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户权限授予
|
* 用户权限授予
|
||||||
*
|
*
|
||||||
@ -45,11 +100,12 @@ public class RoleController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("role/user/add")
|
@PostMapping("role/user/add")
|
||||||
public BaseResponse roleAddUser(HttpServletRequest request, @RequestParam Long uid, @RequestParam Long rid) {
|
public BaseResponse roleAddUser(HttpServletRequest request, @RequestParam Long uid, @RequestParam Long rid) {
|
||||||
|
log.info("请求接口[POST]: /role/user/add");
|
||||||
// 判断是否有参数错误
|
// 判断是否有参数错误
|
||||||
if (uid == null || rid == null) {
|
if (uid == null || rid == null) {
|
||||||
return ResultUtil.error(ErrorCode.PARAMETER_ERROR);
|
return ResultUtil.error(ErrorCode.PARAMETER_ERROR);
|
||||||
}
|
}
|
||||||
return roleService.roleAddUser(request,uid, rid);
|
return roleService.roleAddUser(request, uid, rid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,11 +114,40 @@ public class RoleController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@DeleteMapping("role/user/remove")
|
@DeleteMapping("role/user/remove")
|
||||||
public BaseResponse roleRemoveUser(HttpServletRequest request,@RequestParam Long uid) {
|
public BaseResponse roleRemoveUser(HttpServletRequest request, @RequestParam Long uid) {
|
||||||
|
log.info("请求接口[POST]: /role/user/remove");
|
||||||
// 判断是否有参数错误
|
// 判断是否有参数错误
|
||||||
if (uid == null) {
|
if (uid == null) {
|
||||||
return ResultUtil.error(ErrorCode.PARAMETER_ERROR);
|
return ResultUtil.error(ErrorCode.PARAMETER_ERROR);
|
||||||
}
|
}
|
||||||
return roleService.roleRemoveUser(request,uid);
|
return roleService.roleRemoveUser(request, uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 添加用户权限
|
||||||
|
* @Date: 2024/1/19
|
||||||
|
* @Param request:
|
||||||
|
* @Param uid:
|
||||||
|
**/
|
||||||
|
@PostMapping("role/add")
|
||||||
|
public BaseResponse addRole(HttpServletRequest request, @RequestBody @Validated RoleAddVo roleAddVO, @NotNull BindingResult bindingResult ) {
|
||||||
|
log.info("请求接口[POST]: /role/add");
|
||||||
|
// 判断是否有参数错误
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return ResultUtil.error(ErrorCode.REQUEST_BODY_ERROR, Processing.getValidatedErrorList(bindingResult));
|
||||||
|
}
|
||||||
|
return roleService.addRole(request, roleAddVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PutMapping("role/user/change")
|
||||||
|
public BaseResponse roleChangeUser(HttpServletRequest request, @RequestParam Long uid, @RequestParam Long rid) {
|
||||||
|
log.info("请求接口[POST]: /role/user/change");
|
||||||
|
// 判断是否有参数错误
|
||||||
|
if (uid == null || rid == null) {
|
||||||
|
return ResultUtil.error(ErrorCode.PARAMETER_ERROR);
|
||||||
|
}
|
||||||
|
return roleService.roleChangeUser(request, uid, rid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,13 +21,36 @@ public class RoleDAO {
|
|||||||
roleMapper.roleRemoveUser(uid);
|
roleMapper.roleRemoveUser(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<RoleDO> getRoleById(String id) {
|
public List<RoleDO> getRolesById(String id) {
|
||||||
ArrayList<RoleDO> getRoleList = new ArrayList<>();
|
ArrayList<RoleDO> getRoleList = new ArrayList<>();
|
||||||
getRoleList.add(roleMapper.getRoleById(Long.valueOf(id)));
|
getRoleList.add(roleMapper.getRoleById(Long.valueOf(id)));
|
||||||
return getRoleList;
|
return getRoleList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RoleDO getRoleById(Long id) {
|
||||||
|
return roleMapper.getRoleById(id);
|
||||||
|
}
|
||||||
|
|
||||||
public List<RoleDO> getRole() {
|
public List<RoleDO> getRole() {
|
||||||
return roleMapper.getRole();
|
return roleMapper.getRole();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void roleAdd(RoleDO roleDO) { roleMapper.roleAdd(roleDO);}
|
||||||
|
|
||||||
|
public boolean roleEdit(RoleDO getRole) {
|
||||||
|
return roleMapper.roleEdit(getRole);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean roleDelete(Long id) {
|
||||||
|
return roleMapper.roleDelete(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isExistRoleByRoleName(String roleName){
|
||||||
|
RoleDO roleDO = roleMapper.getRoleByRoleName(roleName);
|
||||||
|
return roleDO != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean roleChangeUser(Long uid, Long rid) {
|
||||||
|
return roleMapper.roleChangeUser(uid,rid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,7 @@ package com.jsl.oa.mapper;
|
|||||||
|
|
||||||
import com.jsl.oa.model.doData.RoleDO;
|
import com.jsl.oa.model.doData.RoleDO;
|
||||||
import com.jsl.oa.model.doData.RoleUserDO;
|
import com.jsl.oa.model.doData.RoleUserDO;
|
||||||
import org.apache.ibatis.annotations.Delete;
|
import org.apache.ibatis.annotations.*;
|
||||||
import org.apache.ibatis.annotations.Insert;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -13,7 +10,10 @@ import java.util.List;
|
|||||||
public interface RoleMapper {
|
public interface RoleMapper {
|
||||||
|
|
||||||
@Insert("insert into organize_oa.oa_role_user (uid, rid) VALUE (#{uid},#{rid})")
|
@Insert("insert into organize_oa.oa_role_user (uid, rid) VALUE (#{uid},#{rid})")
|
||||||
void roleAddUser(Long uid,Long rid);
|
void roleAddUser(Long uid, Long rid);
|
||||||
|
|
||||||
|
@Select("INSERT INTO organize_oa.oa_role (role_name, display_name) VALUES (#{roleName}, #{displayName})")
|
||||||
|
void roleAdd(RoleDO roleDO);
|
||||||
|
|
||||||
@Delete("delete from organize_oa.oa_role_user where uid=#{uid}")
|
@Delete("delete from organize_oa.oa_role_user where uid=#{uid}")
|
||||||
void roleRemoveUser(Long uid);
|
void roleRemoveUser(Long uid);
|
||||||
@ -29,4 +29,16 @@ public interface RoleMapper {
|
|||||||
|
|
||||||
@Select("SELECT * FROM organize_oa.oa_role ORDER BY id DESC")
|
@Select("SELECT * FROM organize_oa.oa_role ORDER BY id DESC")
|
||||||
List<RoleDO> getRole();
|
List<RoleDO> getRole();
|
||||||
|
|
||||||
|
@Update("UPDATE organize_oa.oa_role SET role_name=#{roleName},display_name=#{displayName} WHERE id=#{id}")
|
||||||
|
boolean roleEdit(RoleDO getRole);
|
||||||
|
|
||||||
|
@Update("UPDATE organize_oa.oa_role_user SET rid = #{rid} WHERE uid = #{uid}")
|
||||||
|
boolean roleChangeUser(Long uid, Long rid);
|
||||||
|
|
||||||
|
@Delete("DELETE FROM organize_oa.oa_role WHERE id=#{id}")
|
||||||
|
boolean roleDelete(Long id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ import java.sql.Timestamp;
|
|||||||
public class RoleDO {
|
public class RoleDO {
|
||||||
private Long id;
|
private Long id;
|
||||||
private String roleName;
|
private String roleName;
|
||||||
|
private String displayName;
|
||||||
private Timestamp createdAt;
|
private Timestamp createdAt;
|
||||||
private Timestamp updatedAt;
|
private Timestamp updatedAt;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.jsl.oa.services;
|
package com.jsl.oa.services;
|
||||||
|
|
||||||
|
import com.jsl.oa.model.voData.RoleAddVo;
|
||||||
|
import com.jsl.oa.model.voData.RoleEditVO;
|
||||||
import com.jsl.oa.utils.BaseResponse;
|
import com.jsl.oa.utils.BaseResponse;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@ -18,4 +20,12 @@ public interface RoleService {
|
|||||||
BaseResponse roleRemoveUser(HttpServletRequest request,Long uid);
|
BaseResponse roleRemoveUser(HttpServletRequest request,Long uid);
|
||||||
|
|
||||||
BaseResponse roleGet(HttpServletRequest request, String id);
|
BaseResponse roleGet(HttpServletRequest request, String id);
|
||||||
|
|
||||||
|
BaseResponse roleEdit(HttpServletRequest request, RoleEditVO roleEditVO);
|
||||||
|
|
||||||
|
BaseResponse roleDelete(HttpServletRequest request, Long id);
|
||||||
|
|
||||||
|
BaseResponse addRole(HttpServletRequest request, RoleAddVo roleAddVO);
|
||||||
|
|
||||||
|
BaseResponse roleChangeUser(HttpServletRequest request, Long uid, Long rid);
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package com.jsl.oa.services.impl;
|
package com.jsl.oa.services.impl;
|
||||||
|
|
||||||
import com.jsl.oa.dao.RoleDAO;
|
import com.jsl.oa.dao.RoleDAO;
|
||||||
import com.jsl.oa.dao.UserDAO;
|
|
||||||
import com.jsl.oa.model.doData.RoleDO;
|
import com.jsl.oa.model.doData.RoleDO;
|
||||||
|
import com.jsl.oa.model.voData.RoleAddVo;
|
||||||
|
import com.jsl.oa.model.voData.RoleEditVO;
|
||||||
import com.jsl.oa.services.RoleService;
|
import com.jsl.oa.services.RoleService;
|
||||||
import com.jsl.oa.utils.BaseResponse;
|
import com.jsl.oa.utils.BaseResponse;
|
||||||
import com.jsl.oa.utils.ErrorCode;
|
import com.jsl.oa.utils.ErrorCode;
|
||||||
@ -22,21 +23,31 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
private final RoleDAO roleDAO;
|
private final RoleDAO roleDAO;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseResponse roleAddUser(HttpServletRequest request,Long uid, Long rid) {
|
public BaseResponse roleAddUser(HttpServletRequest request, Long uid, Long rid) {
|
||||||
if (Processing.checkUserIsAdmin(request,roleDAO.roleMapper)) {
|
if (Processing.checkUserIsAdmin(request, roleDAO.roleMapper)) {
|
||||||
roleDAO.roleAddUser(uid, rid);
|
roleDAO.roleAddUser(uid, rid);
|
||||||
return ResultUtil.success();
|
return ResultUtil.success();
|
||||||
} else return ResultUtil.error(ErrorCode.NOT_ADMIN);
|
} else return ResultUtil.error(ErrorCode.NOT_ADMIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseResponse roleRemoveUser(HttpServletRequest request,Long uid) {
|
public BaseResponse roleRemoveUser(HttpServletRequest request, Long uid) {
|
||||||
if (Processing.checkUserIsAdmin(request,roleDAO.roleMapper)) {
|
if (Processing.checkUserIsAdmin(request, roleDAO.roleMapper)) {
|
||||||
roleDAO.roleRemoveUser(uid);
|
roleDAO.roleRemoveUser(uid);
|
||||||
return ResultUtil.success();
|
return ResultUtil.success();
|
||||||
} else return ResultUtil.error(ErrorCode.NOT_ADMIN);
|
} else return ResultUtil.error(ErrorCode.NOT_ADMIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse roleChangeUser(HttpServletRequest request, Long uid, Long rid) {
|
||||||
|
if (Processing.checkUserIsAdmin(request, roleDAO.roleMapper)) {
|
||||||
|
if(!roleDAO.roleChangeUser(uid, rid)){
|
||||||
|
return ResultUtil.error(ErrorCode.DATABASE_UPDATE_ERROR);
|
||||||
|
}
|
||||||
|
return ResultUtil.success();
|
||||||
|
} else return ResultUtil.error(ErrorCode.NOT_ADMIN);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseResponse roleGet(HttpServletRequest request, String id) {
|
public BaseResponse roleGet(HttpServletRequest request, String id) {
|
||||||
// 检查用户权限
|
// 检查用户权限
|
||||||
@ -47,7 +58,7 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
ArrayList<RoleDO> getRoleList;
|
ArrayList<RoleDO> getRoleList;
|
||||||
if (id != null && !id.isEmpty()) {
|
if (id != null && !id.isEmpty()) {
|
||||||
if (Pattern.matches("^[0-9]+$", id)) {
|
if (Pattern.matches("^[0-9]+$", id)) {
|
||||||
getRoleList = (ArrayList<RoleDO>) roleDAO.getRoleById(id);
|
getRoleList = (ArrayList<RoleDO>) roleDAO.getRolesById(id);
|
||||||
} else {
|
} else {
|
||||||
ArrayList<String> error = new ArrayList<>();
|
ArrayList<String> error = new ArrayList<>();
|
||||||
error.add("id 只能为数字");
|
error.add("id 只能为数字");
|
||||||
@ -60,4 +71,77 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
// 返回数据
|
// 返回数据
|
||||||
return ResultUtil.success(getRoleList);
|
return ResultUtil.success(getRoleList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse roleEdit(HttpServletRequest request, RoleEditVO roleEditVO) {
|
||||||
|
// 检查用户权限
|
||||||
|
if (!Processing.checkUserIsAdmin(request, roleDAO.roleMapper)) {
|
||||||
|
return ResultUtil.error(ErrorCode.NOT_ADMIN);
|
||||||
|
}
|
||||||
|
// 获取 Role 相关信息
|
||||||
|
RoleDO getRole = roleDAO.getRoleById(roleEditVO.getId());
|
||||||
|
// 判断是否存在该 Role
|
||||||
|
if (getRole != null) {
|
||||||
|
// 替换 Role 信息
|
||||||
|
getRole.setRoleName(roleEditVO.getName())
|
||||||
|
.setDisplayName(roleEditVO.getDisplayName());
|
||||||
|
// 更新 Role 信息
|
||||||
|
if (roleDAO.roleEdit(getRole)) {
|
||||||
|
return ResultUtil.success();
|
||||||
|
} else {
|
||||||
|
return ResultUtil.error(ErrorCode.DATABASE_UPDATE_ERROR);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return ResultUtil.error(ErrorCode.ROLE_NOT_FOUNDED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse roleDelete(HttpServletRequest request, Long id) {
|
||||||
|
// 检查用户权限
|
||||||
|
if (!Processing.checkUserIsAdmin(request, roleDAO.roleMapper)) {
|
||||||
|
return ResultUtil.error(ErrorCode.NOT_ADMIN);
|
||||||
|
}
|
||||||
|
// 获取 Role 相关信息
|
||||||
|
RoleDO getRole = roleDAO.getRoleById(id);
|
||||||
|
// 判断是否存在该 Role
|
||||||
|
if (getRole != null) {
|
||||||
|
// 删除 Role 信息
|
||||||
|
if (roleDAO.roleDelete(id)) {
|
||||||
|
return ResultUtil.success();
|
||||||
|
} else {
|
||||||
|
return ResultUtil.error(ErrorCode.DATABASE_DELETE_ERROR);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return ResultUtil.error(ErrorCode.ROLE_NOT_FOUNDED);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse addRole(HttpServletRequest request, RoleAddVo roleAddVO) {
|
||||||
|
// 检查用户权限
|
||||||
|
if (!Processing.checkUserIsAdmin(request, roleDAO.roleMapper)) {
|
||||||
|
return ResultUtil.error(ErrorCode.NOT_ADMIN);
|
||||||
|
}
|
||||||
|
// 检查权限名称是否重复
|
||||||
|
String roleName = roleAddVO.getName();
|
||||||
|
RoleDO roleDO = new RoleDO();
|
||||||
|
if (!roleDAO.isExistRoleByRoleName(roleName)) {
|
||||||
|
try {
|
||||||
|
Processing.copyProperties(roleAddVO, roleDO);
|
||||||
|
roleDO.setRoleName(roleAddVO.getName());
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResultUtil.error(ErrorCode.CLASS_COPY_EXCEPTION);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return ResultUtil.error(ErrorCode.ROLE_NAME_REPEAT);
|
||||||
|
}
|
||||||
|
//向数据库中插入数据
|
||||||
|
roleDAO.roleAdd(roleDO);
|
||||||
|
|
||||||
|
return ResultUtil.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
try {
|
try {
|
||||||
Processing.copyProperties(userEditVo, userDO);
|
Processing.copyProperties(userEditVo, userDO);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
return ResultUtil.error(ErrorCode.CLASS_COPY_EXCEPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
//向数据库中修改属性
|
//向数据库中修改属性
|
||||||
@ -199,7 +199,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
try {
|
try {
|
||||||
Processing.copyProperties(userDO, userProfile);
|
Processing.copyProperties(userDO, userProfile);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
return ResultUtil.error(ErrorCode.CLASS_COPY_EXCEPTION);
|
||||||
}
|
}
|
||||||
userProfile.setSex(Processing.getSex(userDO.getSex()));
|
userProfile.setSex(Processing.getSex(userDO.getSex()));
|
||||||
return ResultUtil.success(userProfile);
|
return ResultUtil.success(userProfile);
|
||||||
|
@ -18,12 +18,15 @@ public enum ErrorCode {
|
|||||||
TOKEN_EXPIRED("TokenExpired", 40101, "Token已过期"),
|
TOKEN_EXPIRED("TokenExpired", 40101, "Token已过期"),
|
||||||
VERIFICATION_INVALID("VerificationInvalid", 40102, "验证码无效"),
|
VERIFICATION_INVALID("VerificationInvalid", 40102, "验证码无效"),
|
||||||
TOKEN_NOT_EXIST("TokenNotExist", 40103, "Token不存在"),
|
TOKEN_NOT_EXIST("TokenNotExist", 40103, "Token不存在"),
|
||||||
|
CLASS_COPY_EXCEPTION("ClassCopyException",40104,"实体类拷贝异常"),
|
||||||
USER_IS_LOCKED("UserIsLocked", 40300, "用户已被锁定"),
|
USER_IS_LOCKED("UserIsLocked", 40300, "用户已被锁定"),
|
||||||
USER_IS_DEACTIVATED("UserIsDeactivated", 40301, "用户已被禁用"),
|
USER_IS_DEACTIVATED("UserIsDeactivated", 40301, "用户已被禁用"),
|
||||||
NOT_ADMIN("NotAdmin", 40302, "不是管理员"),
|
NOT_ADMIN("NotAdmin", 40302, "不是管理员"),
|
||||||
EMAIL_LOGIN_NOT_SUPPORT("EmailLoginNotSupport", 40303, "请使用邮箱登陆"),
|
EMAIL_LOGIN_NOT_SUPPORT("EmailLoginNotSupport", 40303, "请使用邮箱登陆"),
|
||||||
PASSWORD_NOT_SAME("PasswordNotSame", 40304, "两次密码不一致"),
|
PASSWORD_NOT_SAME("PasswordNotSame", 40304, "两次密码不一致"),
|
||||||
ID_NOT_EXIST("IdNotExist", 40305, "ID不存在"),
|
ID_NOT_EXIST("IdNotExist", 40400, "ID不存在"),
|
||||||
|
ROLE_NOT_FOUNDED("RoleNotFounded", 40401, "角色不存在"),
|
||||||
|
ROLE_NAME_REPEAT("RoleNameRepeat", 40402, "权限名称重复"),
|
||||||
DATABASE_INSERT_ERROR("DatabaseInsertError", 50010, "数据库插入错误"),
|
DATABASE_INSERT_ERROR("DatabaseInsertError", 50010, "数据库插入错误"),
|
||||||
DATABASE_UPDATE_ERROR("DatabaseUpdateError", 50011, "数据库更新错误"),
|
DATABASE_UPDATE_ERROR("DatabaseUpdateError", 50011, "数据库更新错误"),
|
||||||
DATABASE_DELETE_ERROR("DatabaseDeleteError", 50012, "数据库删除错误"),
|
DATABASE_DELETE_ERROR("DatabaseDeleteError", 50012, "数据库删除错误"),
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.jsl.oa.utils;
|
package com.jsl.oa.utils;
|
||||||
|
|
||||||
import com.jsl.oa.common.constant.SafeConstants;
|
import com.jsl.oa.common.constant.SafeConstants;
|
||||||
import com.jsl.oa.config.filter.JwtFilter;
|
|
||||||
import io.jsonwebtoken.Claims;
|
import io.jsonwebtoken.Claims;
|
||||||
import io.jsonwebtoken.Jws;
|
import io.jsonwebtoken.Jws;
|
||||||
import io.jsonwebtoken.Jwts;
|
import io.jsonwebtoken.Jwts;
|
||||||
@ -20,7 +19,7 @@ import java.util.regex.Pattern;
|
|||||||
*
|
*
|
||||||
* @author 筱锋xiao_lfeng
|
* @author 筱锋xiao_lfeng
|
||||||
* @version v1.1.0
|
* @version v1.1.0
|
||||||
* @see JwtFilter
|
* @see com.jsl.oa.config.filter.JwtFilter
|
||||||
* @since v1.1.0
|
* @since v1.1.0
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
Loading…
x
Reference in New Issue
Block a user