spotless 적용

This commit is contained in:
2025-12-31 09:25:30 +09:00
parent 81cd69c99b
commit 0df6151777
3 changed files with 34 additions and 57 deletions

View File

@@ -18,14 +18,10 @@ public class LabelAllocateService {
allocateSheets(sheets, targetUsers);
// 2⃣ 전체 부족분 비율 계산
distributeShortage(targetUsers); //항상 마지막에 한 번만 호출해야함
distributeShortage(targetUsers); // 항상 마지막에 한 번만 호출해야함
}
public static void allocateSheets(
List<Sheet> sheets,
List<TargetUser> targets
) {
public static void allocateSheets(List<Sheet> sheets, List<TargetUser> targets) {
// 도엽 큰 것부터 (선택 사항)
sheets.sort(Comparator.comparingInt(Sheet::getCount).reversed());
@@ -35,10 +31,7 @@ public class LabelAllocateService {
while (it.hasNext() && target.getRemainDemand() > 0) {
Sheet sheet = it.next();
int assignable = Math.min(
sheet.getCount(),
target.getRemainDemand()
);
int assignable = Math.min(sheet.getCount(), target.getRemainDemand());
if (assignable > 0) {
target.assign(sheet.getSheetId(), assignable);
@@ -54,13 +47,9 @@ public class LabelAllocateService {
public static void distributeShortage(List<TargetUser> targets) {
int totalDemand = targets.stream()
.mapToInt(TargetUser::getDemand)
.sum();
int totalDemand = targets.stream().mapToInt(TargetUser::getDemand).sum();
int totalAllocated = targets.stream()
.mapToInt(t -> t.getAllocated())
.sum();
int totalAllocated = targets.stream().mapToInt(t -> t.getAllocated()).sum();
int shortage = totalDemand - totalAllocated;
@@ -86,5 +75,4 @@ public class LabelAllocateService {
t.setShortage(share);
}
}
}