refactor: 重构供应商文件类型枚举及相关服务

feat: 为多个服务添加缓存支持
fix: 修复WebSocket任务管理和远程调用异常处理
refactor: 重命名CompanyVendorFileType为VendorFileType
refactor: 优化项目成本导入任务实现
fix: 修复ContractTabSkinBase中的空指针问题
refactor: 统一WebSocket客户端任务调用接口
This commit is contained in:
2025-09-17 22:28:17 +08:00
parent 7560250036
commit c0e4916474
43 changed files with 624 additions and 260 deletions

View File

@@ -66,6 +66,9 @@ public class QueryService<T extends IdentityEntity, TV extends IdentityViewModel
public T save(T entity) {
try {
return async("save", entity, entity.getClass().getName()).handle((response, ex) -> {
if (ex != null) {
throw new RuntimeException("保存实体失败", ex);
}
if (response != null) {
try {
objectMapper.updateValue(entity, response);
@@ -84,6 +87,9 @@ public class QueryService<T extends IdentityEntity, TV extends IdentityViewModel
public void delete(T entity) {
try {
async("delete", entity, entity.getClass().getName()).handle((response, ex) -> {
if (ex != null) {
throw new RuntimeException("删除实体失败", ex);
}
if (response != null) {
return updateValue(entity, response);
}
@@ -116,6 +122,9 @@ public class QueryService<T extends IdentityEntity, TV extends IdentityViewModel
public CompletableFuture<T> asyncFindById(Integer id) {
return async("findById", id, Integer.class).handle((response, ex) -> {
if (ex != null) {
throw new RuntimeException("查询实体失败", ex);
}
T newEntity = createNewEntity();
return updateValue(newEntity, response);
});
@@ -145,6 +154,9 @@ public class QueryService<T extends IdentityEntity, TV extends IdentityViewModel
public CompletableFuture<Page<T>> asyncFindAll(Map<String, Object> params, Pageable pageable) {
// 调用async方法发送WebSocket请求获取异步响应结果
return async("findAll", params, PageArgument.of(pageable)).handle((response, ex) -> {
if (ex != null) {
throw new RuntimeException("远程方法+findAll+调用失败", ex);
}
try {
// 将响应结果转换为PageContent对象使用当前类的createNewEntity方法创建实体实例
PageContent<T> pageContent = of(response, objectMapper, this::createNewEntity);
@@ -186,6 +198,9 @@ public class QueryService<T extends IdentityEntity, TV extends IdentityViewModel
// 调用async方法执行名为"count"的异步操作传入参数params
// 使用handle方法处理异步操作的结果或异常
return async("count", params).handle((response, ex) -> {
if (ex != null) {
throw new RuntimeException("远程方法+count+调用失败", ex);
}
// 将响应结果转换为Long类型并返回
return response.asLong();
});