feat: 新增多个服务类及工具类,重构部分代码结构

重构服务类结构,将分散的服务统一整合到service包下
新增ProjectConstant常量类及多个实体服务类
添加SecurityUtils安全工具类和BeanCacher工具类
优化部分UI控件和转换器的实现
This commit is contained in:
2025-09-06 13:43:52 +08:00
parent 0e444508ff
commit effd7b103c
253 changed files with 2920 additions and 1646 deletions

View File

@@ -0,0 +1,15 @@
package com.ecep.contract.util;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;
public class SecurityUtils {
public static User getCurrentUser() {
return (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
}
public static boolean currentUserHasRole(String role) {
return getCurrentUser().getAuthorities().stream()
.anyMatch(grantedAuthority -> grantedAuthority.getAuthority().equals(role));
}
}