调整手工开票Rate校验和夜数派生
This commit is contained in:
1 parent
5712f03d4f
commit
68ff9e2b38
10 files changed
+226
-21
No files matched your search
+11
-1
@@ -294,7 +294,7 @@ public class ReservationInvoiceGenerationServiceImpl implements ReservationInvoi
|
||||
errors.add(prefix + "room_type: 必填字段缺失。");
|
||||
}
|
||||
validatePositive(charge.quantity(), prefix + "quantity", errors);
|
||||
validatePositive(charge.rate(), prefix + "rate", errors);
|
||||
validateNonNegative(charge.rate(), prefix + "rate", errors);
|
||||
validatePositive(charge.nights(), prefix + "nights", errors);
|
||||
}
|
||||
}
|
||||
@@ -490,6 +490,16 @@ public class ReservationInvoiceGenerationServiceImpl implements ReservationInvoi
|
||||
}
|
||||
}
|
||||
|
||||
private void validateNonNegative(BigDecimal value, String fieldPath, List<String> errors) {
|
||||
if (value == null) {
|
||||
errors.add(fieldPath + ": 必填字段缺失。");
|
||||
return;
|
||||
}
|
||||
if (value.compareTo(BigDecimal.ZERO) < 0) {
|
||||
errors.add(fieldPath + ": 不能小于 0。");
|
||||
}
|
||||
}
|
||||
|
||||
private String writeJson(Object value) {
|
||||
try {
|
||||
return objectMapper.writeValueAsString(value);
|
||||
|
||||
Reference in new issue
Block a user