diff --git a/core/src/main/java/app/module/core/config/constants/CommonConstants.java b/core/src/main/java/app/module/core/config/constants/CommonConstants.java index 27475200..8b29138f 100644 --- a/core/src/main/java/app/module/core/config/constants/CommonConstants.java +++ b/core/src/main/java/app/module/core/config/constants/CommonConstants.java @@ -42,6 +42,11 @@ public final class CommonConstants { */ public static final String VALID_CODE_NOTBLANK = "valid.common.required"; + /** + * Validator NotBlank errorCode + */ + public static final String VALID_CODE_NOTZERO = "valid.common.notZero"; + /** * 핸드폰 번호 규칙 */ diff --git a/front/src/main/java/app/module/front/usecase/daily/expense/adapters/web/validator/CreateDailyExpenseValidator.java b/front/src/main/java/app/module/front/usecase/daily/expense/adapters/web/validator/CreateDailyExpenseValidator.java index 5a7257b1..98c66d50 100644 --- a/front/src/main/java/app/module/front/usecase/daily/expense/adapters/web/validator/CreateDailyExpenseValidator.java +++ b/front/src/main/java/app/module/front/usecase/daily/expense/adapters/web/validator/CreateDailyExpenseValidator.java @@ -25,6 +25,10 @@ public class CreateDailyExpenseValidator implements Validator { errors.rejectValue( "quantity", CommonConstants.VALID_CODE_NOTBLANK, "수량을 입력해 주세요."); + } else if(vo.getQuantity() != null && vo.getQuantity() <= 0){ + errors.rejectValue( + "quantity", CommonConstants.VALID_CODE_NOTZERO, + "입력값은 0보다 커야 합니다."); } if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) { @@ -46,6 +50,14 @@ public class CreateDailyExpenseValidator implements Validator { errors.rejectValue( "estimatedValue", CommonConstants.VALID_CODE_NOTBLANK, "현금 또는 현물평가액을 입력해 주세요."); + } else if(vo.getPrice() != null && vo.getPrice() <= 0 ){ + errors.rejectValue( + "price", CommonConstants.VALID_CODE_NOTZERO, + "입력값은 0보다 커야 합니다."); + } else if(vo.getEstimatedValue() != null && vo.getEstimatedValue() <= 0 ){ + errors.rejectValue( + "estimatedValue", CommonConstants.VALID_CODE_NOTZERO, + "입력값은 0보다 커야 합니다."); } } } diff --git a/front/src/main/java/app/module/front/usecase/daily/farming/adapters/web/validator/CreateDailyFarmingValidator.java b/front/src/main/java/app/module/front/usecase/daily/farming/adapters/web/validator/CreateDailyFarmingValidator.java index 0a209144..d6432f44 100644 --- a/front/src/main/java/app/module/front/usecase/daily/farming/adapters/web/validator/CreateDailyFarmingValidator.java +++ b/front/src/main/java/app/module/front/usecase/daily/farming/adapters/web/validator/CreateDailyFarmingValidator.java @@ -31,6 +31,10 @@ public class CreateDailyFarmingValidator implements Validator { errors.rejectValue( "quantity", CommonConstants.VALID_CODE_NOTBLANK, "수량을 입력해 주세요."); + } else if(vo.getQuantity() != null && vo.getQuantity() <= 0){ + errors.rejectValue( + "quantity", CommonConstants.VALID_CODE_NOTZERO, + "입력값은 0보다 커야 합니다."); } if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) { @@ -49,6 +53,10 @@ public class CreateDailyFarmingValidator implements Validator { errors.rejectValue( "estimatedValue", CommonConstants.VALID_CODE_NOTBLANK, "현물평가액을 입력해 주세요."); + } else if(vo.getEstimatedValue() <= 0 ){ + errors.rejectValue( + "estimatedValue", CommonConstants.VALID_CODE_NOTZERO, + "입력값은 0보다 커야 합니다."); } } } diff --git a/front/src/main/java/app/module/front/usecase/daily/forestry/adapters/web/validator/CreateDailyForestryValidator.java b/front/src/main/java/app/module/front/usecase/daily/forestry/adapters/web/validator/CreateDailyForestryValidator.java index e0985185..7a66a042 100644 --- a/front/src/main/java/app/module/front/usecase/daily/forestry/adapters/web/validator/CreateDailyForestryValidator.java +++ b/front/src/main/java/app/module/front/usecase/daily/forestry/adapters/web/validator/CreateDailyForestryValidator.java @@ -25,6 +25,10 @@ public class CreateDailyForestryValidator implements Validator { errors.rejectValue( "quantity", CommonConstants.VALID_CODE_NOTBLANK, "수량을 입력해 주세요."); + } else if(vo.getQuantity() != null && vo.getQuantity() <= 0){ + errors.rejectValue( + "quantity", CommonConstants.VALID_CODE_NOTZERO, + "입력값은 0보다 커야 합니다."); } if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) { @@ -43,6 +47,10 @@ public class CreateDailyForestryValidator implements Validator { errors.rejectValue( "estimatedValue", CommonConstants.VALID_CODE_NOTBLANK, "현물평가액을 입력해 주세요."); + } else if(vo.getEstimatedValue() <= 0 ){ + errors.rejectValue( + "estimatedValue", CommonConstants.VALID_CODE_NOTZERO, + "입력값은 0보다 커야 합니다."); } } } diff --git a/front/src/main/java/app/module/front/usecase/daily/income/adapters/web/validator/CreateDailyIncomeValidator.java b/front/src/main/java/app/module/front/usecase/daily/income/adapters/web/validator/CreateDailyIncomeValidator.java index 194a3f07..d1d971fc 100644 --- a/front/src/main/java/app/module/front/usecase/daily/income/adapters/web/validator/CreateDailyIncomeValidator.java +++ b/front/src/main/java/app/module/front/usecase/daily/income/adapters/web/validator/CreateDailyIncomeValidator.java @@ -25,6 +25,10 @@ public class CreateDailyIncomeValidator implements Validator { errors.rejectValue( "quantity", CommonConstants.VALID_CODE_NOTBLANK, "수량을 입력해 주세요."); + } else if(vo.getQuantity() != null && vo.getQuantity() <= 0){ + errors.rejectValue( + "quantity", CommonConstants.VALID_CODE_NOTZERO, + "입력값은 0보다 커야 합니다."); } if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) { @@ -46,6 +50,14 @@ public class CreateDailyIncomeValidator implements Validator { errors.rejectValue( "estimatedValue", CommonConstants.VALID_CODE_NOTBLANK, "현금 또는 현물평가액을 입력해 주세요."); + } else if(vo.getPrice() != null && vo.getPrice() <= 0 ){ + errors.rejectValue( + "price", CommonConstants.VALID_CODE_NOTZERO, + "입력값은 0보다 커야 합니다."); + } else if(vo.getEstimatedValue() != null && vo.getEstimatedValue() <= 0 ){ + errors.rejectValue( + "estimatedValue", CommonConstants.VALID_CODE_NOTZERO, + "입력값은 0보다 커야 합니다."); } } } diff --git a/front/src/main/java/app/module/front/usecase/daily/power/adapters/web/validator/CreateDailyPowerValidator.java b/front/src/main/java/app/module/front/usecase/daily/power/adapters/web/validator/CreateDailyPowerValidator.java index 5ee231c6..65726d2e 100644 --- a/front/src/main/java/app/module/front/usecase/daily/power/adapters/web/validator/CreateDailyPowerValidator.java +++ b/front/src/main/java/app/module/front/usecase/daily/power/adapters/web/validator/CreateDailyPowerValidator.java @@ -27,6 +27,14 @@ public class CreateDailyPowerValidator implements Validator { errors.rejectValue( "leasedHours", CommonConstants.VALID_CODE_NOTBLANK, "자가 사용시간 또는 임차 사용시간을 입력해 주세요."); + } else if(vo.getOwnedHours() != null && vo.getOwnedHours() <= 0 ){ + errors.rejectValue( + "ownedHours", CommonConstants.VALID_CODE_NOTZERO, + "자가 사용시간은 0보다 커야 합니다."); + } else if(vo.getLeasedHours() != null && vo.getLeasedHours() <= 0 ){ + errors.rejectValue( + "leasedHours", CommonConstants.VALID_CODE_NOTZERO, + "임차 사용시간은 0보다 커야 합니다."); } } } diff --git a/front/src/main/java/app/module/front/usecase/daily/work/adapters/web/validator/CreateDailyWorkValidator.java b/front/src/main/java/app/module/front/usecase/daily/work/adapters/web/validator/CreateDailyWorkValidator.java index 98349676..8e09e3a5 100644 --- a/front/src/main/java/app/module/front/usecase/daily/work/adapters/web/validator/CreateDailyWorkValidator.java +++ b/front/src/main/java/app/module/front/usecase/daily/work/adapters/web/validator/CreateDailyWorkValidator.java @@ -25,6 +25,10 @@ public class CreateDailyWorkValidator implements Validator { errors.rejectValue( "workLandArea", CommonConstants.VALID_CODE_NOTBLANK, "작업 면적을 입력해 주세요."); + } else if(vo.getWorkLandArea() != null && vo.getWorkLandArea() <= 0){ + errors.rejectValue( + "workLandArea", CommonConstants.VALID_CODE_NOTZERO, + "입력값은 0보다 커야 합니다."); } if (vo.getWorkLandArea() != null && StringUtils.isBlank(vo.getAreaUnitCode())) { @@ -43,6 +47,10 @@ public class CreateDailyWorkValidator implements Validator { errors.rejectValue( "harvestQuantity", CommonConstants.VALID_CODE_NOTBLANK, "수확량을 입력해 주세요."); + } else if(vo.getHarvestQuantity() != null && vo.getHarvestQuantity() <= 0){ + errors.rejectValue( + "harvestQuantity", CommonConstants.VALID_CODE_NOTZERO, + "입력값은 0보다 커야 합니다."); } if (vo.getHarvestQuantity() != null && StringUtils.isBlank(vo.getHarvestUnitCode())) { @@ -73,5 +81,45 @@ public class CreateDailyWorkValidator implements Validator { errors.rejectValue("volunteerMHours", "valid.common.required"); errors.rejectValue("volunteerFHours", "valid.common.required"); } + if(vo.getOwnerTime() != null && vo.getOwnerTime() <= 0){ + errors.rejectValue("ownerTime", CommonConstants.VALID_CODE_NOTZERO, + "입력값은 0보다 커야 합니다."); + } + if(vo.getSpouseTime() != null && vo.getSpouseTime() <= 0){ + errors.rejectValue("spouseTime", CommonConstants.VALID_CODE_NOTZERO, + "입력값은 0보다 커야 합니다."); + } + if(vo.getFamilyMHours() != null && vo.getFamilyMHours() <= 0){ + errors.rejectValue("familyMHours", CommonConstants.VALID_CODE_NOTZERO, + "입력값은 0보다 커야 합니다."); + } + if(vo.getFamilyFHours() != null && vo.getFamilyFHours() <= 0){ + errors.rejectValue("familyFHours", CommonConstants.VALID_CODE_NOTZERO, + "입력값은 0보다 커야 합니다."); + } + if(vo.getHiredMHours() != null && vo.getHiredMHours() <= 0){ + errors.rejectValue("hiredMHours", CommonConstants.VALID_CODE_NOTZERO, + "입력값은 0보다 커야 합니다."); + } + if(vo.getHiredFHours() != null && vo.getHiredFHours() <= 0){ + errors.rejectValue("hiredFHours", CommonConstants.VALID_CODE_NOTZERO, + "입력값은 0보다 커야 합니다."); + } + if(vo.getSharedMHours() != null && vo.getSharedMHours() <= 0){ + errors.rejectValue("sharedMHours", CommonConstants.VALID_CODE_NOTZERO, + "입력값은 0보다 커야 합니다."); + } + if(vo.getSharedFHours() != null && vo.getSharedFHours() <= 0){ + errors.rejectValue("sharedFHours", CommonConstants.VALID_CODE_NOTZERO, + "입력값은 0보다 커야 합니다."); + } + if(vo.getVolunteerMHours() != null && vo.getVolunteerMHours() <= 0){ + errors.rejectValue("volunteerMHours", CommonConstants.VALID_CODE_NOTZERO, + "입력값은 0보다 커야 합니다."); + } + if(vo.getVolunteerFHours() != null && vo.getVolunteerFHours() <= 0){ + errors.rejectValue("volunteerFHours", CommonConstants.VALID_CODE_NOTZERO, + "입력값은 0보다 커야 합니다."); + } } } diff --git a/front/src/main/resources/messages/validation.properties b/front/src/main/resources/messages/validation.properties index ec03437b..8208dcb4 100644 --- a/front/src/main/resources/messages/validation.properties +++ b/front/src/main/resources/messages/validation.properties @@ -2,6 +2,7 @@ valid.common.required=\uD544\uC218\uC785\uB825 \uD56D\uBAA9\uC785\uB2C8\uB2E4. 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.remove.item=\uC0AD\uC81C\uD560 \uC544\uC774\uD15C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4. +valid.common.notZero=\uC785\uB825\uAC12\uC740 0\uBCF4\uB2E4 \uCEE4\uC57C \uD569\uB2C8\uB2E4. valid.common.id.wrong=\uC601\uBB38 \uB300\uC18C\uBB38\uC790(a-zA-Z), \uC22B\uC790(0-9), \uD558\uC774\uD508(-), \uC5B8\uB354\uBC14(_)\uC744 \uC774\uC6A9\uD574 6\uC790 \uC774\uC0C1 12\uC790 \uC774\uD558\uC778 \uC544\uC774\uB514\uB97C \uAE30\uC785\uD574\uC8FC\uC138\uC694. 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. diff --git a/front/src/main/resources/static/assets/images/guide/detail_step08_05.png b/front/src/main/resources/static/assets/images/guide/detail_step08_05.png index 7a47db73..761698c1 100644 Binary files a/front/src/main/resources/static/assets/images/guide/detail_step08_05.png and b/front/src/main/resources/static/assets/images/guide/detail_step08_05.png differ diff --git a/front/src/main/resources/templates/info/bank/input.html b/front/src/main/resources/templates/info/bank/input.html index e2aec841..e35a4c02 100644 --- a/front/src/main/resources/templates/info/bank/input.html +++ b/front/src/main/resources/templates/info/bank/input.html @@ -415,6 +415,8 @@ } } + if (form.count.value && form.count.value <= 0) errors.push({field: 'count', message: '입력값은 0보다 커야 합니다. '}); + if(form.count.value){ if(!form.unitCode.value){ errors.push({ @@ -430,6 +432,8 @@ } } if (!form.price.value) errors.push({field: 'price', message: '금액을 입력해주세요.'}); + else if (form.price.value && form.price.value <= 0) errors.push({field: 'price', message: '입력값은 0보다 커야 합니다. '}); + console.log(errors) ////////////////////////// kri.form.error(errors); if (errors.length > 0) { diff --git a/front/src/main/resources/templates/info/bank/output.html b/front/src/main/resources/templates/info/bank/output.html index 5a51a527..3d19b7b5 100644 --- a/front/src/main/resources/templates/info/bank/output.html +++ b/front/src/main/resources/templates/info/bank/output.html @@ -406,6 +406,8 @@ } } + if (form.count.value && form.count.value <= 0) errors.push({field: 'count', message: '입력값은 0보다 커야 합니다. '}); + if(form.count.value){ if(!form.unitCode.value){ errors.push({ @@ -424,6 +426,8 @@ if (!form.price.value) errors.push({field: 'price', message: '금액을 입력해주세요.'}); + else if (form.price.value && form.price.value <= 0) errors.push({field: 'price', message: '입력값은 0보다 커야 합니다. '}); + console.log(errors) ////////////////////////// kri.form.error(errors); if (errors.length > 0) { diff --git a/front/src/main/resources/templates/info/monthly/{id}.html b/front/src/main/resources/templates/info/monthly/{id}.html index 90e16c6e..a6f8a0c5 100644 --- a/front/src/main/resources/templates/info/monthly/{id}.html +++ b/front/src/main/resources/templates/info/monthly/{id}.html @@ -378,10 +378,14 @@ }); const errors = []; + if (form.availableArea.value && form.availableArea.value <= 0) errors.push({field: 'availableArea', message: '입력값은 0보다 커야 합니다. '}); if (!form.cropName.value) errors.push({field: 'cropName', message: '재배 작물명을 입력해주세요.'}); + if (form.landArea.value && form.landArea.value <= 0) errors.push({field: 'landArea', message: '입력값은 0보다 커야 합니다. '}); if(form.mainYield.value){ + if (form.mainYield.value <= 0) errors.push({field: 'mainYield', message: '입력값은 0보다 커야 합니다. '}); + if(!form.mainYieldUnitCode.value){ errors.push({ field: 'mainYieldUnitCode', @@ -397,6 +401,7 @@ } if(form.mainSaleAmount.value){ + if (form.mainSaleAmount.value <= 0) errors.push({field: 'mainSaleAmount', message: '입력값은 0보다 커야 합니다. '}); if(!form.mainSaleUnitCode.value){ errors.push({ field: 'mainSaleUnitCode', @@ -413,6 +418,7 @@ if(form.subYield.value){ + if (form.subYield.value <= 0) errors.push({field: 'subYield', message: '입력값은 0보다 커야 합니다. '}); if(!form.subYieldUnitCode.value){ errors.push({ field: 'subYieldUnitCode', @@ -429,6 +435,7 @@ if(form.subSaleAmount.value){ + if (form.subSaleAmount.value <= 0) errors.push({field: 'subSaleAmount', message: '입력값은 0보다 커야 합니다. '}); if(!form.subSaleUnitCode.value){ errors.push({ field: 'subSaleUnitCode', diff --git a/front/src/main/resources/templates/record/work/form.html b/front/src/main/resources/templates/record/work/form.html index 41a4717a..b1d2a833 100644 --- a/front/src/main/resources/templates/record/work/form.html +++ b/front/src/main/resources/templates/record/work/form.html @@ -168,7 +168,6 @@