重构WebSocket服务名称从WebSocketService改为WebSocketClientService,并实现Serializable接口 添加WebSocket常量定义和消息处理实现 优化实体类equals和hashCode方法 修复控制器路径和日志配置 添加查询服务和任务接口方法
59 lines
2.0 KiB
Java
59 lines
2.0 KiB
Java
package com.ecep.contract.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> {
|
|
|
|
public static final int DEFAULT_SYSTEM_EMPLOYEE_ID = 26;
|
|
|
|
public Employee findByName(String name) {
|
|
// TODO Auto-generated method stub
|
|
throw new UnsupportedOperationException("Unimplemented method 'findByName'");
|
|
}
|
|
|
|
public List<EmployeeRole> getRolesByEmployeeId(Integer id) {
|
|
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'");
|
|
}
|
|
|
|
|
|
}
|