refactor: 重构WebSocket服务及相关实体类
重构WebSocket服务名称从WebSocketService改为WebSocketClientService,并实现Serializable接口 添加WebSocket常量定义和消息处理实现 优化实体类equals和hashCode方法 修复控制器路径和日志配置 添加查询服务和任务接口方法
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ecep.contract.PageContent;
|
||||
import com.ecep.contract.model.Employee;
|
||||
import com.ecep.contract.model.EmployeeRole;
|
||||
import com.ecep.contract.vm.EmployeeViewModel;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
@Service
|
||||
public class EmployeeService extends QueryService<Employee, EmployeeViewModel> {
|
||||
@@ -19,14 +22,33 @@ public class EmployeeService extends QueryService<Employee, EmployeeViewModel> {
|
||||
}
|
||||
|
||||
public List<EmployeeRole> getRolesByEmployeeId(Integer id) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getRolesByEmployeeId'");
|
||||
try {
|
||||
return async("getRolesByEmployeeId", List.of(id), List.of(Integer.class)).handle((response, ex) -> {
|
||||
if (response != null) {
|
||||
try {
|
||||
List<EmployeeRole> content = new ArrayList<>();
|
||||
for (JsonNode node : response) {
|
||||
EmployeeRole newEntity = new EmployeeRole();
|
||||
objectMapper.updateValue(newEntity, node);
|
||||
content.add(newEntity);
|
||||
}
|
||||
return content;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(response.toString(), e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}).get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateActive(int sessionId) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'updateActive'");
|
||||
}
|
||||
|
||||
public Employee findByCode(String personCode) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findByCode'");
|
||||
|
||||
Reference in New Issue
Block a user