修复: 保存全局参数后自动推送配置到边缘端
This commit is contained in:
@@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.aiot.config.AiServiceConfig;
|
||||
import com.genersoft.iot.vmp.aiot.dao.AiAlgorithmMapper;
|
||||
import com.genersoft.iot.vmp.aiot.service.IAiAlgorithmService;
|
||||
import com.genersoft.iot.vmp.aiot.service.IAiConfigLogService;
|
||||
import com.genersoft.iot.vmp.aiot.service.IAiConfigService;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -30,6 +31,9 @@ public class AiAlgorithmServiceImpl implements IAiAlgorithmService {
|
||||
@Autowired
|
||||
private IAiConfigLogService configLogService;
|
||||
|
||||
@Autowired
|
||||
private IAiConfigService configService;
|
||||
|
||||
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
/**
|
||||
@@ -163,5 +167,13 @@ public class AiAlgorithmServiceImpl implements IAiAlgorithmService {
|
||||
String now = LocalDateTime.now().format(FORMATTER);
|
||||
algorithmMapper.updateGlobalParams(algoCode, globalParams, now);
|
||||
log.info("[AI算法] 保存全局参数: algoCode={}, globalParams={}", algoCode, globalParams);
|
||||
|
||||
// 保存后自动推送配置到所有边缘端
|
||||
try {
|
||||
configService.pushAllConfig();
|
||||
log.info("[AI算法] 全局参数变更已推送到边缘端");
|
||||
} catch (Exception e) {
|
||||
log.warn("[AI算法] 全局参数推送失败(参数已保存): {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user