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

@@ -17,10 +17,10 @@ public class DataCenterDto {
private Integer externalId;
private Integer number;
private AreaDto area;
@JsonProperty("physical_machine")
@JsonProperty("physical_machines")
private Map<String, PhysicalMachineDto> physicalMachine;
// Emission calculation fields
private SectorDto sector;
private SubSectorDto subSector;
@@ -62,12 +62,12 @@ public class DataCenterDto {
this.number = number;
}
public AreaDto getArea() {
return area;
public AreaDto getArea() {
return area;
}
public void setArea(AreaDto area) {
this.area = area;
public void setArea(AreaDto area) {
this.area = area;
}
public Map<String, PhysicalMachineDto> getPhysicalMachine() {

View File

@@ -805,10 +805,19 @@ public class MessageListener {
input.setVmId(vm.getId());
System.out.println("🔍 Setting VM ID: " + vm.getId());
// Use the source-specific power consumption (percentage of total VM power)
input.setConsuptionAmount(String.valueOf(sourceSpecificPower));
System.out.println("🔍 Setting Consumption Amount: " + sourceSpecificPower + "W");
// Use the source-specific power consumption (percentage of total VM power)
// Format to 6 decimal places to avoid very long strings
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 ID: " + vm.getId());
System.out.println(" VM Name: " + vm.getVmName());