feat:配置修改,bug修改

master
汤全昆 2025-09-03 18:27:24 +08:00
parent 598acecab5
commit 917fc25027
2 changed files with 27 additions and 7 deletions

View File

@ -5,7 +5,7 @@ file:
upload: upload:
temp-dir: /var/lib/vdi/tmp/chunked-uploads temp-dir: /var/lib/vdi/tmp/chunked-uploads
dir: /var/lib/vdi/test dir: /var/lib/vdi/test
bt-url: http://10.100.51.86:8114 bt-url: http://10.100.51.179:8114
tool: tool:
dir: /vms/tool/iso dir: /vms/tool/iso
spring: spring:
@ -50,7 +50,7 @@ mybatis-plus:
grpc: grpc:
server: server:
# 指定Grpc暴露的端口后续客户端通过这个端口访问 # 指定Grpc暴露的端口后续客户端通过这个端口访问
port: 51051 port: 50051
# Feign 配置 # Feign 配置
feign: feign:
@ -70,6 +70,6 @@ logging:
com.unisinsight.project.feign.ExternalApiClient: debug com.unisinsight.project.feign.ExternalApiClient: debug
external: external:
api: api:
url: http://10.100.51.178:8000 url: http://10.100.51.179:8000
torrent: torrent:
url: http://10.100.51.178:8114 url: http://10.100.51.179:8114

View File

@ -34,7 +34,8 @@ public class DeskImageController {
public Double start(@RequestParam("name") String name) { public Double start(@RequestParam("name") String name) {
System.out.println("查询进度"); System.out.println("查询进度");
Map<String, Object> resultMap = ImageVirtualUtils.progress(name); Map<String, Object> resultMap = ImageVirtualUtils.progress(name);
// 使用log打印Map内容
// 使用log打印Map内容
if (resultMap != null) { if (resultMap != null) {
log.info("进度信息详情:"); log.info("进度信息详情:");
for (Map.Entry<String, Object> entry : resultMap.entrySet()) { for (Map.Entry<String, Object> entry : resultMap.entrySet()) {
@ -44,9 +45,28 @@ public class DeskImageController {
} else { } else {
log.warn("未获取到进度信息resultMap为null"); log.warn("未获取到进度信息resultMap为null");
} }
if (resultMap != null && resultMap.get("progress") != null) { if (resultMap != null && resultMap.get("progress") != null) {
// Object progressObj = resultMap.get("progress");
return (Double) resultMap.get("progress");
// 类型安全的转换
if (progressObj instanceof Double) {
return (Double) progressObj;
} else if (progressObj instanceof Integer) {
return ((Integer) progressObj).doubleValue();
} else if (progressObj instanceof Number) {
return ((Number) progressObj).doubleValue();
} else if (progressObj instanceof String) {
try {
return Double.parseDouble((String) progressObj);
} catch (NumberFormatException e) {
log.warn("无法解析进度值: {}", progressObj);
return 0.0;
}
} else {
log.warn("未知的进度值类型: {}", progressObj.getClass().getSimpleName());
return 0.0;
}
} else { } else {
return 0.0; return 0.0;
} }