feat(contract): 新增合同余额功能及重构文件管理
重构合同文件管理逻辑,增加错误处理和日志记录 新增ContractBalance实体、Repository和VO类 完善Voable接口文档和实现规范 更新项目架构文档和数据库设计 修复SmbFileService的连接问题 移动合同相关TabSkin类到contract包 添加合同文件重建任务的WebSocket支持
This commit is contained in:
@@ -399,6 +399,10 @@ public class SmbFileService implements DisposableBean {
|
||||
try {
|
||||
// 获取连接
|
||||
connectionInfo = getConnectionInfo(hostname);
|
||||
if (connectionInfo == null) {
|
||||
log.error("Failed to get SMB connection for host: {}", hostname);
|
||||
break;
|
||||
}
|
||||
|
||||
// 从session池获取session
|
||||
sessionInfo = connectionInfo.peekSession();
|
||||
@@ -407,8 +411,13 @@ public class SmbFileService implements DisposableBean {
|
||||
// 获取认证上下文
|
||||
AuthenticationContext authContext = getAuthenticationContext(hostname);
|
||||
// 创建新session并添加到池中
|
||||
sessionInfo = connectionInfo.createSession(authContext);
|
||||
log.debug("Created new SMB session for host: {}", hostname);
|
||||
try {
|
||||
sessionInfo = connectionInfo.createSession(authContext);
|
||||
log.debug("Created new SMB session for host: {}", hostname);
|
||||
} catch (SMBRuntimeException ex) {
|
||||
log.error("Failed to create SMB session for host: {}, maxTrys:{}", hostname, maxTrys, ex);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
log.debug("Reusing SMB session for host: {}", hostname);
|
||||
}
|
||||
@@ -421,22 +430,16 @@ public class SmbFileService implements DisposableBean {
|
||||
log.debug("Returned SMB session to pool for host: {}", hostname);
|
||||
|
||||
} catch (SMBRuntimeException e) {
|
||||
sessionInfo.close();
|
||||
throw e;
|
||||
try {
|
||||
sessionInfo.close();
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
log.error("Failed to execute SMB operation for host: {}, maxTrys:{}", hostname, maxTrys, e);
|
||||
continue;
|
||||
} finally {
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
} catch (TransportException e) {
|
||||
log.warn("TransportException occurred while trying to connect to host: {}. Retrying...", hostname);
|
||||
// 延迟1秒
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException ex) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
continue;
|
||||
} catch (IOException e) {
|
||||
// 如果操作失败且连接信息存在,检查连接状态
|
||||
if (connectionInfo != null) {
|
||||
@@ -501,7 +504,7 @@ public class SmbFileService implements DisposableBean {
|
||||
* @throws IOException 如果检查失败
|
||||
*/
|
||||
public boolean exists(SmbPath smbPath) throws IOException {
|
||||
return executeSmbOperation(smbPath, (share, path) -> {
|
||||
Object result = executeSmbOperation(smbPath, (share, path) -> {
|
||||
try {
|
||||
FileAllInformation info = share.getFileInformation(path);
|
||||
if (info.getStandardInformation().isDirectory()) {
|
||||
@@ -516,6 +519,10 @@ public class SmbFileService implements DisposableBean {
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
if (result != null) {
|
||||
return (boolean) result;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user