Fix message queue data misnaming

This commit is contained in:
2025-08-19 00:07:20 +03:00
parent 92d88df213
commit 17d77fcda7
2 changed files with 20 additions and 11 deletions

View File

@@ -18,7 +18,7 @@ public class DataCenterDto {
private Integer number; private Integer number;
private AreaDto area; private AreaDto area;
@JsonProperty("physical_machine") @JsonProperty("physical_machines")
private Map<String, PhysicalMachineDto> physicalMachine; private Map<String, PhysicalMachineDto> physicalMachine;
// Emission calculation fields // Emission calculation fields

View File

@@ -806,8 +806,17 @@ public class MessageListener {
System.out.println("🔍 Setting VM ID: " + vm.getId()); System.out.println("🔍 Setting VM ID: " + vm.getId());
// Use the source-specific power consumption (percentage of total VM power) // Use the source-specific power consumption (percentage of total VM power)
input.setConsuptionAmount(String.valueOf(sourceSpecificPower)); // Format to 6 decimal places to avoid very long strings
System.out.println("🔍 Setting Consumption Amount: " + sourceSpecificPower + "W"); String formattedPower = String.format("%.6f", sourceSpecificPower);
input.setConsuptionAmount(formattedPower);
System.out.println("🔍 Setting Consumption Amount: " + formattedPower + "W");
// Validate field lengths to prevent database errors
System.out.println("🔍 Field length validation:");
System.out.println(" Year: " + (input.getYear() != null ? input.getYear().length() : "null"));
System.out.println(" Month: " + (input.getMonth() != null ? input.getMonth().length() : "null"));
System.out.println(" ConsuptionAmount: " + (input.getConsuptionAmount() != null ? input.getConsuptionAmount().length() : "null"));
System.out.println("🔍 VM Emission Input for Source:"); System.out.println("🔍 VM Emission Input for Source:");
System.out.println(" VM ID: " + vm.getId()); System.out.println(" VM ID: " + vm.getId());