refactor(service): 修改IEntityService泛型为VO类型并优化缓存策略

重构所有注解@CacheConfig的Service类,将IEntityService泛型从实体类改为VO类
实现实体与VO之间的转换逻辑,使用VO替代实体进行缓存以避免序列化问题
更新相关依赖组件和测试用例,确保功能完整性和系统兼容性
优化Redis缓存配置,清理旧缓存数据并验证新缓存策略有效性
This commit is contained in:
2025-09-28 18:19:00 +08:00
parent df6188db40
commit b03b5385a5
75 changed files with 3144 additions and 1377 deletions

View File

@@ -1,9 +1,17 @@
package com.ecep.contract.controller;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ecep.contract.SpringApp;
import com.ecep.contract.ds.other.service.EmployeeService;
import com.ecep.contract.model.Employee;
/**
* 基础控制器,处理根路径请求
*/
@@ -15,7 +23,22 @@ public class IndexController {
*/
@GetMapping("/")
public ResponseEntity<?> index() {
return ResponseEntity.ok("合同管理系统 REST API 服务已启动");
SecurityContext securityContext = SecurityContextHolder.getContext();
Authentication authentication = securityContext.getAuthentication();
Object principal = authentication.getPrincipal();
if (principal instanceof UserDetails userDetails) {
System.out.println(userDetails.getUsername());
EmployeeService employeeService = SpringApp.getBean(EmployeeService.class);
try {
Employee employee = employeeService.findByAccount(userDetails.getUsername());
return ResponseEntity.ok(employee);
} catch (Exception e) {
e.printStackTrace();
}
}
return ResponseEntity.ok(authentication);
}
}