spotless 적용
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user