[BO] 일계부 등록 - 숫자값 0 입력에 대한 유효성 검사 추가

This commit is contained in:
kangsunlee
2025-07-25 17:35:23 +09:00
parent fcc56e8727
commit c7e3210093
8 changed files with 101 additions and 0 deletions

View File

@@ -27,6 +27,12 @@ public class SaveDailyExpenseValidator implements Validator {
"수량을 입력해 주세요.");
}
if (vo.getQuantity() != null && vo.getQuantity() == 0) {
errors.rejectValue(
"quantity", CommonConstants.VALID_CODE_INVALID_ZERO,
"수량은 0 이상 입력해 주세요.");
}
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
@@ -47,5 +53,15 @@ public class SaveDailyExpenseValidator implements Validator {
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
"현금 또는 현물평가액을 입력해 주세요.");
}
if ((vo.getPrice() != null && vo.getPrice() == 0)
|| (vo.getEstimatedValue() != null && vo.getEstimatedValue() == 0)) {
errors.rejectValue(
"price", CommonConstants.VALID_CODE_INVALID_ZERO,
"현금 또는 현물평가액은 0 이상 입력해 주세요.");
errors.rejectValue(
"estimatedValue", CommonConstants.VALID_CODE_INVALID_ZERO,
"현금 또는 현물평가액은 0 이상 입력해 주세요.");
}
}
}

View File

@@ -32,6 +32,12 @@ public class SaveDailyFarmingValidator implements Validator {
"수량을 입력해 주세요.");
}
if (vo.getQuantity() != null && vo.getQuantity() == 0) {
errors.rejectValue(
"quantity", CommonConstants.VALID_CODE_INVALID_ZERO,
"수량은 0 이상 입력해 주세요.");
}
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
@@ -49,5 +55,11 @@ public class SaveDailyFarmingValidator implements Validator {
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
"현물평가액을 입력해 주세요.");
}
if (vo.getEstimatedValue() != null && vo.getEstimatedValue() == 0) {
errors.rejectValue(
"estimatedValue", CommonConstants.VALID_CODE_INVALID_ZERO,
"현물평가액은 0 이상 입력해 주세요.");
}
}
}

View File

@@ -26,6 +26,12 @@ public class SaveDailyForestryValidator implements Validator {
"수량을 입력해 주세요.");
}
if (vo.getQuantity() != null && vo.getQuantity() == 0) {
errors.rejectValue(
"quantity", CommonConstants.VALID_CODE_INVALID_ZERO,
"수량은 0 이상 입력해 주세요.");
}
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
@@ -43,5 +49,12 @@ public class SaveDailyForestryValidator implements Validator {
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
"현물평가액을 입력해 주세요.");
}
if (vo.getEstimatedValue() != null && vo.getEstimatedValue() == 0) {
errors.rejectValue(
"estimatedValue", CommonConstants.VALID_CODE_INVALID_ZERO,
"현물평가액은 0 이상 입력해 주세요.");
}
}
}

View File

@@ -27,6 +27,12 @@ public class SaveDailyIncomeValidator implements Validator {
"수량을 입력해 주세요.");
}
if (vo.getQuantity() != null && vo.getQuantity() == 0) {
errors.rejectValue(
"quantity", CommonConstants.VALID_CODE_INVALID_ZERO,
"수량은 0 이상 입력해 주세요.");
}
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
@@ -47,5 +53,15 @@ public class SaveDailyIncomeValidator implements Validator {
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
"현금 또는 현물평가액을 입력해 주세요.");
}
if ((vo.getPrice() != null && vo.getPrice() == 0)
|| (vo.getEstimatedValue() != null && vo.getEstimatedValue() == 0)) {
errors.rejectValue(
"price", CommonConstants.VALID_CODE_INVALID_ZERO,
"현금 또는 현물평가액은 0 이상 입력해 주세요.");
errors.rejectValue(
"estimatedValue", CommonConstants.VALID_CODE_INVALID_ZERO,
"현금 또는 현물평가액은 0 이상 입력해 주세요.");
}
}
}

View File

@@ -27,5 +27,15 @@ public class SaveDailyPowerValidator implements Validator {
"leasedHours", CommonConstants.VALID_CODE_NOTBLANK,
"자가 사용시간 또는 임차 사용시간을 입력해 주세요.");
}
if ((vo.getOwnedHours() != null && vo.getOwnedHours() == 0)
|| (vo.getLeasedHours() != null && vo.getLeasedHours() == 0)) {
errors.rejectValue(
"ownedHours", CommonConstants.VALID_CODE_INVALID_ZERO,
"자가 사용시간 또는 임차 사용시간은 0 이상 입력해 주세요.");
errors.rejectValue(
"leasedHours", CommonConstants.VALID_CODE_INVALID_ZERO,
"자가 사용시간 또는 임차 사용시간은 0 이상 입력해 주세요.");
}
}
}

View File

@@ -44,6 +44,12 @@ public class SaveDailyWorkValidator implements Validator {
"수확량을 입력해 주세요.");
}
if (vo.getHarvestQuantity() != null && vo.getHarvestQuantity() == 0) {
errors.rejectValue(
"harvestQuantity", CommonConstants.VALID_CODE_INVALID_ZERO,
"수확량은 0 이상 입력해 주세요.");
}
if (vo.getHarvestQuantity() != null && StringUtils.isBlank(vo.getHarvestUnitCode())) {
errors.rejectValue(
"harvestUnitCode", CommonConstants.VALID_CODE_NOTBLANK,
@@ -72,5 +78,27 @@ public class SaveDailyWorkValidator implements Validator {
errors.rejectValue("volunteerMHours", CommonConstants.VALID_CODE_NOTBLANK);
errors.rejectValue("volunteerFHours", CommonConstants.VALID_CODE_NOTBLANK);
}
if ((vo.getOwnerTime() != null && vo.getOwnerTime() == 0)
|| (vo.getSpouseTime() != null && vo.getSpouseTime() == 0)
|| (vo.getFamilyMHours() != null && vo.getFamilyMHours() == 0)
|| (vo.getFamilyFHours() != null && vo.getFamilyFHours() == 0)
|| (vo.getHiredMHours() != null && vo.getHiredMHours() == 0)
|| (vo.getHiredFHours() != null && vo.getHiredFHours() == 0)
|| (vo.getSharedMHours() != null && vo.getSharedMHours() == 0)
|| (vo.getSharedFHours() != null && vo.getSharedFHours() == 0)
|| (vo.getVolunteerMHours() != null && vo.getVolunteerMHours() == 0)
|| (vo.getVolunteerFHours() != null && vo.getVolunteerFHours() == 0)) {
errors.rejectValue("ownerTime", CommonConstants.VALID_CODE_INVALID_ZERO, "노동투입시간은 0 이상 입력해 주세요.");
errors.rejectValue("spouseTime", CommonConstants.VALID_CODE_INVALID_ZERO);
errors.rejectValue("familyMHours", CommonConstants.VALID_CODE_INVALID_ZERO);
errors.rejectValue("familyFHours", CommonConstants.VALID_CODE_INVALID_ZERO);
errors.rejectValue("hiredMHours", CommonConstants.VALID_CODE_INVALID_ZERO);
errors.rejectValue("hiredFHours", CommonConstants.VALID_CODE_INVALID_ZERO);
errors.rejectValue("sharedMHours", CommonConstants.VALID_CODE_INVALID_ZERO);
errors.rejectValue("sharedFHours", CommonConstants.VALID_CODE_INVALID_ZERO);
errors.rejectValue("volunteerMHours", CommonConstants.VALID_CODE_INVALID_ZERO);
errors.rejectValue("volunteerFHours", CommonConstants.VALID_CODE_INVALID_ZERO);
}
}
}

View File

@@ -2,6 +2,7 @@ valid.common.required=\uD544\uC218\uC785\uB825 \uD56D\uBAA9\uC785\uB2C8\uB2E4.
valid.common.required.ask=\uD544\uC218\uC785\uB825\uD56D\uBAA9\uC744 \uD655\uC778\uD574\uC8FC\uC138\uC694.
valid.common.required.size={0} \uAC1C \uD56D\uBAA9\uC774 \uB2F4\uACA8\uC788\uC5B4\uC57C \uD569\uB2C8\uB2E4.
valid.common.required.size.min={0} \uAC1C \uC774\uC0C1 \uD56D\uBAA9\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.
valid.common.required.value.min={0} \uC774\uC0C1 \uC785\uB825\uD574 \uC8FC\uC138\uC694.
valid.common.required.remove.item=\uC0AD\uC81C\uD560 \uC544\uC774\uD15C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.
valid.common.email.wrong=\uC774\uBA54\uC77C \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
valid.common.nickname.wrong=\uB2C9\uB124\uC784(2-10\uAE00\uC790)\uC740 \uD55C\uAE00,\uC601\uC5B4 \uB300\uC18C\uBB38\uC790, -, _ \uB9CC \uC785\uB825\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.