Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: 用户权限重构;新增工具类;拆分原项目实体类(未完成) #131

Open
wants to merge 5 commits into
base: refactor
Choose a base branch
from

Conversation

GLaxky
Copy link

@GLaxky GLaxky commented Feb 13, 2023

No description provided.

@GLaxky GLaxky requested a review from lilingj February 13, 2023 03:48

REVIEW_INTERNSHIP_APPLICATION(11, "实习申请审核人", "有权利通过/退回实习申请"),
REVIEW_PATENT_APPLICATION(12, "专利申请审核人", "有权利通过/退回专利申请"),
REVIEW_REIMBURSE_APPLICATION(13, "报销申请审核人", "有权利通过/退回报销申请"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

角色应该是权限的聚合,这里是权限枚举,应该定义原子权限


@RestControllerAdvice
@Slf4j
public class CommonExceptionConfig {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个组件放到config包下面,包括下面的拦截器。还要考虑和现存的全局异常捕捉/拦截器是否有冲突

var token_map = encryptorComponent.decrypt(token);
request.setAttribute("uid", token_map.get("uid")); //塞入 用户id
request.setAttribute("aid", token_map.get("aid")); //塞入 用户权限值
// var token_map = encryptorComponent.decrypt(token);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这些代码先别删,保持兼容,不然别的接口不知道会出什么问题

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@ManyToOne
@JoinColumn(name = "user_id")
User user;
UserPo user;
//状态 -1审核不通过,0审核中,1审核通过
int state;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看到好多类似的状态,后面重构的时候可以考虑抽出去,做一个枚举,代码层面上赋予语义

* @param map
*/
@AccessPermission(PermissionEnum.EDIT_ANY_USER_INFO)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

原来的代码先不要动,防止有其他未重构的代码依赖这些功能

* @return
*/
@GetMapping("/v2/user/permission")
public CommonResult<List<PermissionResp>> getPermissions(@RequestAttribute int uid){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新的代码可以先放到新的类里面,比如UserControllerV2,老的先加个@deprecated,后续确保没有问题再删除或者禁用


@GetMapping("/v2/user/team")
public CommonResult<List<TeamResp>> getTeams(@RequestAttribute int uid){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

team的代码放到属于它自己的类里面,别混着了

CreateEventRequest.CreateEventRequestReminders reminder = new CreateEventRequest.CreateEventRequestReminders()
.setMethod("dingtalk")
.setMinutes(60);
CreateEventRequest.CreateEventRequestEnd end = new CreateEventRequest.CreateEventRequestEnd()
.setDateTime(get_ISO0861_Time(dingTalkSchedule.getEnd()))
.setDateTime(get_ISO0861_Time(dingTalkSchedulePo.getEnd()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一个pr就改一个功能,不要动其他代码,方便出错排查回滚

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants