feat: 实现VoableService接口并重构相关服务
refactor: 优化WebSocket通信和任务处理逻辑 fix: 修复客户和供应商路径选择功能 docs: 更新任务通信规则文档 build: 更新项目版本至0.0.86-SNAPSHOT style: 清理无用导入和日志输出 test: 添加CustomerFileMoveTasker测试类 chore: 更新tasker_mapper.json注册信息
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
public class ServiceException extends RuntimeException {
|
||||
|
||||
public ServiceException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ServiceException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
/**
|
||||
* 可转换为VO的服务
|
||||
*/
|
||||
public interface VoableService<M, Vo> {
|
||||
void updateByVo(M model, Vo vo);
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import org.springframework.web.socket.WebSocketSession;
|
||||
|
||||
import com.ecep.contract.Message;
|
||||
import com.ecep.contract.constant.WebSocketConstant;
|
||||
import com.ecep.contract.model.Voable;
|
||||
import com.ecep.contract.ui.Tasker;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
@@ -107,7 +108,12 @@ public class WebSocketServerTaskManager implements InitializingBean {
|
||||
if (tasker instanceof WebSocketServerTasker t) {
|
||||
t.setTitleHandler(title -> sendToSession(session, sessionId, "title", title));
|
||||
t.setMessageHandler(msg -> sendMessageToSession(session, sessionId, msg));
|
||||
t.setPropertyHandler((name, value) -> sendToSession(session, sessionId, "property", name, value));
|
||||
t.setPropertyHandler((name, value) -> {
|
||||
if (value instanceof Voable<?> voable) {
|
||||
value = voable.toVo();
|
||||
}
|
||||
sendToSession(session, sessionId, "property", name, value);
|
||||
});
|
||||
t.setProgressHandler((current, total) -> sendToSession(session, sessionId, "progress", current, total));
|
||||
t.init(argsNode.get(2));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user