라벨 자동할당 로직 임시 커밋

This commit is contained in:
2025-12-31 09:10:11 +09:00
parent ff2c54d38e
commit 0f7dda261b
3 changed files with 214 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
package com.kamco.cd.kamcoback.label.dto;
import java.util.ArrayList;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
public class LabelAllocateDto {
@Getter
@AllArgsConstructor
public static class Sheet {
private final String sheetId;
private int count;
public void decrease(int amount) {
this.count -= amount;
}
}
@Getter
public static class TargetUser {
private final String userId;
private final int demand;
private final List<Sheet> assigned = new ArrayList<>();
private int allocated = 0;
@Setter
private int shortage = 0;
public TargetUser(String userId, int demand) {
this.userId = userId;
this.demand = demand;
}
public int getRemainDemand() {
return demand - allocated;
}
public void assign(String sheetId, int count) {
assigned.add(new Sheet(sheetId, count));
allocated += count;
}
}
}