diff --git a/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatus/ports/application/domain/GetHouseholdsStatus.java b/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatus/ports/application/domain/GetHouseholdsStatus.java index ce3873dd..41adfee1 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatus/ports/application/domain/GetHouseholdsStatus.java +++ b/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatus/ports/application/domain/GetHouseholdsStatus.java @@ -27,10 +27,5 @@ public class GetHouseholdsStatus { private Boolean isGiftSent; private String researcherName; private String researcherPhone; - private Integer ownerAge; - private String address; - private String industrySubMiddle; - private String industryDetail; - private String usageType; private Integer total; } diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/bankAutoTransfer/saveBankAutoTransferExpense/adapters/web/validator/SaveBankAutoTransferExpenseValidator.java b/admin/src/main/java/app/module/admin/usecase/household/tab/bankAutoTransfer/saveBankAutoTransferExpense/adapters/web/validator/SaveBankAutoTransferExpenseValidator.java index 23b7c2c8..a3174173 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/bankAutoTransfer/saveBankAutoTransferExpense/adapters/web/validator/SaveBankAutoTransferExpenseValidator.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/bankAutoTransfer/saveBankAutoTransferExpense/adapters/web/validator/SaveBankAutoTransferExpenseValidator.java @@ -1,6 +1,7 @@ package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.adapters.web.validator; import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.adapters.web.model.SaveBankAutoTransferExpenseReqVO; +import app.module.core.config.constants.CommonConstants; import org.springframework.stereotype.Component; import org.springframework.util.StringUtils; import org.springframework.validation.Errors; @@ -33,6 +34,13 @@ public class SaveBankAutoTransferExpenseValidator implements Validator { return; } + // 수량 0 이상 입력 + if (StringUtils.hasText(vo.getCount()) && Integer.parseInt(vo.getCount()) == 0) { + errors.rejectValue( + "count", CommonConstants.VALID_CODE_INVALID_ZERO, + "수량은 0 이상 입력해 주세요."); + } + // 수량 입력 O, 단위 선택 X if (StringUtils.hasText(vo.getCount()) && !StringUtils.hasText(vo.getUnitCode())) { errors.rejectValue("unitCode", "error.unitCode", @@ -59,5 +67,11 @@ public class SaveBankAutoTransferExpenseValidator implements Validator { errors.rejectValue("price", "error.price", "현금(원)을 입력해주세요."); } + + if (vo.getPrice() != null && vo.getPrice() == 0) { + errors.rejectValue( + "price", CommonConstants.VALID_CODE_INVALID_ZERO, + "현금(원)은 0 이상 입력해 주세요."); + } } } \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/bankAutoTransfer/saveBankAutoTransferIncome/adapters/web/validator/SaveBankAutoTransferIncomeValidator.java b/admin/src/main/java/app/module/admin/usecase/household/tab/bankAutoTransfer/saveBankAutoTransferIncome/adapters/web/validator/SaveBankAutoTransferIncomeValidator.java index ed09ab19..d0ad9b51 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/bankAutoTransfer/saveBankAutoTransferIncome/adapters/web/validator/SaveBankAutoTransferIncomeValidator.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/bankAutoTransfer/saveBankAutoTransferIncome/adapters/web/validator/SaveBankAutoTransferIncomeValidator.java @@ -1,6 +1,7 @@ package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.adapters.web.validator; import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.adapters.web.model.SaveBankAutoTransferIncomeReqVO; +import app.module.core.config.constants.CommonConstants; import org.springframework.stereotype.Component; import org.springframework.util.StringUtils; import org.springframework.validation.Errors; @@ -42,6 +43,13 @@ public class SaveBankAutoTransferIncomeValidator implements Validator { "수입의 종류를 입력해주세요."); } + // 수량 0 이상 입력 + if (StringUtils.hasText(vo.getCount()) && Integer.parseInt(vo.getCount()) == 0) { + errors.rejectValue( + "count", CommonConstants.VALID_CODE_INVALID_ZERO, + "수량은 0 이상 입력해 주세요."); + } + // 수량 입력 O, 단위 선택 X if (StringUtils.hasText(vo.getCount()) && !StringUtils.hasText(vo.getUnitCode())) { errors.rejectValue("unitCode", "error.unitCode", @@ -68,5 +76,11 @@ public class SaveBankAutoTransferIncomeValidator implements Validator { errors.rejectValue("price", "error.price", "현금(원)을 입력해주세요."); } + + if (vo.getPrice() != null && vo.getPrice() == 0) { + errors.rejectValue( + "price", CommonConstants.VALID_CODE_INVALID_ZERO, + "현금(원)은 0 이상 입력해 주세요."); + } } } \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyExpense/adapters/web/validator/SaveDailyExpenseValidator.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyExpense/adapters/web/validator/SaveDailyExpenseValidator.java index 107e0b35..8a1ed8e0 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyExpense/adapters/web/validator/SaveDailyExpenseValidator.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyExpense/adapters/web/validator/SaveDailyExpenseValidator.java @@ -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 이상 입력해 주세요."); + } } } diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyFarming/adapters/web/validator/SaveDailyFarmingValidator.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyFarming/adapters/web/validator/SaveDailyFarmingValidator.java index ab4d7494..ae46726b 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyFarming/adapters/web/validator/SaveDailyFarmingValidator.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyFarming/adapters/web/validator/SaveDailyFarmingValidator.java @@ -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 이상 입력해 주세요."); + } } } diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyForestry/adapters/web/validator/SaveDailyForestryValidator.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyForestry/adapters/web/validator/SaveDailyForestryValidator.java index fee8a8a7..2e092c4b 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyForestry/adapters/web/validator/SaveDailyForestryValidator.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyForestry/adapters/web/validator/SaveDailyForestryValidator.java @@ -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 이상 입력해 주세요."); + } + } } diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyIncome/adapters/web/validator/SaveDailyIncomeValidator.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyIncome/adapters/web/validator/SaveDailyIncomeValidator.java index 510915b5..4645348d 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyIncome/adapters/web/validator/SaveDailyIncomeValidator.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyIncome/adapters/web/validator/SaveDailyIncomeValidator.java @@ -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 이상 입력해 주세요."); + } } } diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/web/validator/SaveDailyPowerValidator.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/web/validator/SaveDailyPowerValidator.java index 7ec35dad..706bc08a 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/web/validator/SaveDailyPowerValidator.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/web/validator/SaveDailyPowerValidator.java @@ -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 이상 입력해 주세요."); + } } } diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyWork/adapters/web/validator/SaveDailyWorkValidator.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyWork/adapters/web/validator/SaveDailyWorkValidator.java index 2d0b013c..55da44bf 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyWork/adapters/web/validator/SaveDailyWorkValidator.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyWork/adapters/web/validator/SaveDailyWorkValidator.java @@ -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); + } } } diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/model/SaveForestProductReqVO.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/model/SaveForestProductReqVO.java index 388382d6..db690fda 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/model/SaveForestProductReqVO.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/model/SaveForestProductReqVO.java @@ -18,18 +18,18 @@ public class SaveForestProductReqVO { private String landType; private String town; private String cropName; - private String landArea; - private String availableArea; - private String mainYield; - private String mainYieldUnitCode; - private String mainYieldUnit; - private String mainSaleAmount; - private String mainSaleUnitCode; - private String mainSaleUnit; - private String subYield; - private String subYieldUnitCode; - private String subYieldUnit; - private String subSaleAmount; - private String subSaleUnitCode; - private String subSaleUnit; + private String landArea; // 면적(평) + private String availableArea; // 가능면적(평) + private String mainYield; // 주생산물 수확량 + private String mainYieldUnitCode; // 주생산물 수확량 단위 (select) + private String mainYieldUnit; // 주생산물 수확량 직접입력 단위 + private String mainSaleAmount; // 주생산물 판매량 + private String mainSaleUnitCode; // 주생산물 판매량 단위 (select) + private String mainSaleUnit; // 주생산물 판매량 직접입력 단위 + private String subYield; // 부생산물 수확량 + private String subYieldUnitCode; // 부생산물 수확량 단위 (select) + private String subYieldUnit; // 부생산물 수확량 직접입력 단위 + private String subSaleAmount; // 부생산물 판매량 + private String subSaleUnitCode; // 부생산물 판매량 단위 (select) + private String subSaleUnit; // 부생산물 판매량 직접입력 단위 } diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/validator/SaveForestProductValidator.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/validator/SaveForestProductValidator.java index fb55563a..497273d6 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/validator/SaveForestProductValidator.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/validator/SaveForestProductValidator.java @@ -1,6 +1,7 @@ package app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.adapters.web.validator; import app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.adapters.web.model.SaveForestProductReqVO; +import app.module.core.config.constants.CommonConstants; import org.springframework.stereotype.Component; import org.springframework.util.StringUtils; import org.springframework.validation.Errors; @@ -21,5 +22,93 @@ public class SaveForestProductValidator implements Validator { if (!StringUtils.hasText(vo.getCropName())) { errors.rejectValue("cropName", "error.cropName", "재배 작물명을 입력해주세요."); } + + if (StringUtils.hasText(vo.getLandArea()) && Integer.parseInt(vo.getLandArea()) == 0) { + errors.rejectValue( + "landArea", CommonConstants.VALID_CODE_INVALID_ZERO, + "면적(평)은 0 이상 입력해 주세요."); + } + + if (StringUtils.hasText(vo.getAvailableArea()) && Integer.parseInt(vo.getAvailableArea()) == 0) { + errors.rejectValue( + "availableArea", CommonConstants.VALID_CODE_INVALID_ZERO, + "가능면적(평)은 0 이상 입력해 주세요."); + } + + // 주생산물 수확량 + if (StringUtils.hasText(vo.getMainYield()) && Integer.parseInt(vo.getMainYield()) == 0) { + errors.rejectValue( + "mainYield", CommonConstants.VALID_CODE_INVALID_ZERO, + "주생산물 수확량은 0 이상 입력해 주세요."); + } + + if (StringUtils.hasText(vo.getMainYield()) && !StringUtils.hasText(vo.getMainYieldUnitCode())) { + errors.rejectValue( + "mainYieldUnitCode", CommonConstants.VALID_CODE_NOTBLANK, + "주생산물 수확량의 단위를 선택해 주세요."); + } + + if (CommonConstants.UNIT_CODE_SELF.equals(vo.getMainYieldUnitCode()) && !StringUtils.hasText(vo.getMainYieldUnit())) { + errors.rejectValue( + "mainYieldUnit", CommonConstants.VALID_CODE_NOTBLANK, + "주생산물 수확량 단위를 입력해 주세요."); + } + + // 주생산물 판매량 + if (StringUtils.hasText(vo.getMainSaleAmount()) && Integer.parseInt(vo.getMainSaleAmount()) == 0) { + errors.rejectValue( + "mainSaleAmount", CommonConstants.VALID_CODE_INVALID_ZERO, + "주생산물 판매량은 0 이상 입력해 주세요."); + } + + if (StringUtils.hasText(vo.getMainSaleAmount()) && !StringUtils.hasText(vo.getMainSaleUnitCode())) { + errors.rejectValue( + "mainSaleUnitCode", CommonConstants.VALID_CODE_NOTBLANK, + "주생산물 판매량의 단위를 선택해 주세요."); + } + + if (CommonConstants.UNIT_CODE_SELF.equals(vo.getMainSaleUnitCode()) && !StringUtils.hasText(vo.getMainSaleUnit())) { + errors.rejectValue( + "mainSaleUnit", CommonConstants.VALID_CODE_NOTBLANK, + "주생산물 판매량 단위를 입력해 주세요."); + } + + // 부생산물 수확량 + if (StringUtils.hasText(vo.getSubYield()) && Integer.parseInt(vo.getSubYield()) == 0) { + errors.rejectValue( + "subYield", CommonConstants.VALID_CODE_INVALID_ZERO, + "부생산물 수확량은 0 이상 입력해 주세요."); + } + + if (StringUtils.hasText(vo.getSubYield()) && !StringUtils.hasText(vo.getSubYieldUnitCode())) { + errors.rejectValue( + "subYieldUnitCode", CommonConstants.VALID_CODE_NOTBLANK, + "부생산물 수확량의 단위를 선택해 주세요."); + } + + if (CommonConstants.UNIT_CODE_SELF.equals(vo.getSubYieldUnitCode()) && !StringUtils.hasText(vo.getSubYieldUnit())) { + errors.rejectValue( + "subYieldUnit", CommonConstants.VALID_CODE_NOTBLANK, + "부생산물 수확량 단위를 입력해 주세요."); + } + + // 부생산물 판매량 + if (StringUtils.hasText(vo.getSubSaleAmount()) && Integer.parseInt(vo.getSubSaleAmount()) == 0) { + errors.rejectValue( + "subSaleAmount", CommonConstants.VALID_CODE_INVALID_ZERO, + "부생산물 판매량은 0 이상 입력해 주세요."); + } + + if (StringUtils.hasText(vo.getSubSaleAmount()) && !StringUtils.hasText(vo.getSubSaleUnitCode())) { + errors.rejectValue( + "subSaleUnitCode", CommonConstants.VALID_CODE_NOTBLANK, + "부생산물 판매량의 단위를 선택해 주세요."); + } + + if (CommonConstants.UNIT_CODE_SELF.equals(vo.getSubSaleUnitCode()) && !StringUtils.hasText(vo.getSubSaleUnit())) { + errors.rejectValue( + "subSaleUnit", CommonConstants.VALID_CODE_NOTBLANK, + "부생산물 판매량 단위를 입력해 주세요."); + } } -} \ No newline at end of file +} diff --git a/admin/src/main/resources/mappers/household/GetHouseholdsStatusMapper.xml b/admin/src/main/resources/mappers/household/GetHouseholdsStatusMapper.xml index b1f2c355..da8469a0 100644 --- a/admin/src/main/resources/mappers/household/GetHouseholdsStatusMapper.xml +++ b/admin/src/main/resources/mappers/household/GetHouseholdsStatusMapper.xml @@ -79,12 +79,7 @@ vs.second_visit_date AS secondVisitDate, COALESCE(vs.is_gift_sent, false) AS isGiftSent, r.researcher_name AS researcherName, - r.researcher_phone AS researcherPhone, - h.owner_age, /* 엑셀용 */ - h.address, /* 엑셀용 */ - h.industry_sub_middle, /* 엑셀용 */ - h.industry_detail, /* 엑셀용 */ - h.usage_type /* 엑셀용 */ + r.researcher_phone AS researcherPhone FROM v_household_with_code h CROSS JOIN total_days td LEFT JOIN daily_progress dp ON h.seq = dp.household_seq diff --git a/admin/src/main/resources/messages/validation.properties b/admin/src/main/resources/messages/validation.properties index e175623f..ba48523b 100644 --- a/admin/src/main/resources/messages/validation.properties +++ b/admin/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.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. diff --git a/admin/src/main/resources/templates/admin/adminCreateForm.html b/admin/src/main/resources/templates/admin/adminCreateForm.html index c0400618..17dff0cd 100644 --- a/admin/src/main/resources/templates/admin/adminCreateForm.html +++ b/admin/src/main/resources/templates/admin/adminCreateForm.html @@ -56,7 +56,7 @@ 중복확인 - 4~15자 / 영문,숫자,한글 가능/ 특수문자 _,- 사용가능 + 2~15자 / 영문,숫자,한글 가능/ 특수문자 _,- 사용가능 diff --git a/admin/src/main/resources/templates/households/modal/modal-bank-auto-transfer-expense.html b/admin/src/main/resources/templates/households/modal/modal-bank-auto-transfer-expense.html index 5461e6a2..702b8286 100644 --- a/admin/src/main/resources/templates/households/modal/modal-bank-auto-transfer-expense.html +++ b/admin/src/main/resources/templates/households/modal/modal-bank-auto-transfer-expense.html @@ -179,8 +179,9 @@ form.sourcePurpose.value = data.sourcePurpose ?? ''; form.transferCategoryCode.value = data.transferCategoryCode ?? ''; - toggleSelfInput(form.expenseCode.value, form.transferCategory); - toggleSelfInput(form.unitCode.value, form.unit); + // 초기 상태 업데이트 + toggleExpenseSelfInput(form.transferCategoryCode); + selectedSelf(form.unitCode); } @@ -255,11 +256,15 @@ f.expenseCode.value = codeValue; - const tr = el.closest('tr'); + toggleExpenseSelfInput(el); + } + + const toggleExpenseSelfInput = (selectElement) => { + const tr = selectElement.closest('tr'); const selfArea = tr.querySelector('.self-input'); const selfInput = tr.querySelector('.self-input input'); - if (el.value?.endsWith('.self')) { + if (selectElement.value?.endsWith('.self')) { selfInput.disabled = false; selfArea.classList.remove('input-disabled'); } else { 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 fa64cc24..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 @@ -17,14 +17,14 @@ public final class CommonConstants { /** * 관리자 아이디 생성 규칙 - * [정책] 아이디: 4~15자, 영문/숫자/한글/특수문자(_,-) 허용 + * [정책] 아이디: 2~15자, 영문/숫자/한글/특수문자(_,-) 허용 */ - public static final String ADMIN_ID_REGEX = "^[a-zA-Z0-9가-힣_-]{4,15}$"; + public static final String ADMIN_ID_REGEX = "^[a-zA-Z0-9가-힣_-]{2,15}$"; /** * 관리자 아이디 유효성 실패 메시지 */ - public static final String ADMIN_ID_MSG = "아이디는 4~15자, 영문/숫자/한글/특수문자(_,-)만 가능합니다."; + public static final String ADMIN_ID_MSG = "아이디는 2~15자, 영문/숫자/한글/특수문자(_,-)만 가능합니다."; /** * 관리자 비밀번호 생성 규칙 @@ -42,9 +42,19 @@ 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"; + /** * 핸드폰 번호 규칙 */ public static final String PHONE_REGEX = "^01([0|1|6|7|8|9])-?([0-9]{3,4})-?([0-9]{4})$"; + /** + * Validator Invalid Zero errorCode + */ + public static final String VALID_CODE_INVALID_ZERO = "valid.common.required.value.min"; + } diff --git a/core/src/main/resources/sql/data/04_second_open.sql b/core/src/main/resources/sql/data/04_second_open.sql index 2584475a..3e7957ae 100644 --- a/core/src/main/resources/sql/data/04_second_open.sql +++ b/core/src/main/resources/sql/data/04_second_open.sql @@ -185,6 +185,8 @@ AS SELECT h.seq, LEFT JOIN v_uicode_view_name ind_middle ON h.industry_middle_code::text = ind_middle.id::text WHERE h.is_deleted = false; +COMMENT ON VIEW public.v_household_with_code IS '임가 정보에 지역/업종 코드명을 조인한 조회용 뷰'; + -- 함수 생성 -- DROP FUNCTION public.fn_uicode_text(varchar); @@ -205,24 +207,6 @@ END; $function$ ; --- DROP FUNCTION public.fn_uicode_value(varchar); - -CREATE OR REPLACE FUNCTION public.fn_uicode_value(p_id character varying) - RETURNS character varying - LANGUAGE plpgsql -AS $function$ -DECLARE - result VARCHAR; -BEGIN - SELECT code_value - INTO result - FROM public.uicode - WHERE id = p_id AND is_deleted = false; - - RETURN result; -END; -$function$ -; -- ==================================================================================================================== -- 문자 발송 -- ==================================================================================================================== @@ -493,6 +477,7 @@ AS SELECT h.seq, WHERE h.is_deleted = false ORDER BY h.household_num; +COMMENT ON VIEW public.v_household_all IS '전체 임가 정보에 담당 조사원 매핑 정보를 포함한 조회용 뷰'; -- ============================================ -- VIEW : v_household_all_visit @@ -529,57 +514,7 @@ AS SELECT vha.seq, JOIN household_visit hv ON hv.household_seq = vha.seq AND hv.is_deleted = false ORDER BY vha.household_num, hv.visit_date; - --- ============================================ --- VIEW : v_household_day --- ============================================ --- DROP VIEW public.v_household_day; -CREATE OR REPLACE VIEW public.v_household_day -AS SELECT vha.seq, - vha.household_num, - vha.owner_name, - vha.owner_age, - vha.tel, - vha.phone, - vha.region_main_code_text, - vha.region_sub_code_text, - vha.region_detail_code_text, - vha.researcher_name, - vha.researcher_phone, - dr.record_month, - CASE - WHEN ddg.start_day = ddg.end_day THEN concat(ddg.start_day, '') - ELSE concat(ddg.start_day, '-', ddg.end_day) - END AS input_day, - dr.all_status, - dr.income_status, - ( SELECT count(*) AS count - FROM daily_income di - WHERE di.daily_record_seq = dr.id AND di.is_deleted = false) AS income_count, - dr.work_status, - ( SELECT count(*) AS count - FROM daily_work dw - WHERE dw.daily_record_seq = dr.id AND dw.is_deleted = false) AS work_count, - dr.expense_status, - ( SELECT count(*) AS count - FROM daily_expense de - WHERE de.daily_record_seq = dr.id AND de.is_deleted = false) AS expensecount, - dr.power_status, - ( SELECT count(*) AS count - FROM daily_power dp - WHERE dp.daily_record_seq = dr.id AND dp.is_deleted = false) AS power_count, - dr.forestry_status, - ( SELECT count(*) AS count - FROM daily_forestry df - WHERE df.daily_record_seq = dr.id AND df.is_deleted = false) AS forestry_count, - dr.farming_status, - ( SELECT count(*) AS count - FROM daily_farming df2 - WHERE df2.daily_record_seq = dr.id AND df2.is_deleted = false) AS farming_count - FROM v_household_all vha - JOIN daily_record dr ON vha.seq = dr.household_seq AND dr.is_deleted = false - LEFT JOIN daily_day_group ddg ON ddg.group_no = dr.day_group_no AND ddg.is_deleted = false - ORDER BY vha.household_num, dr.record_month, dr.day_group_no; +COMMENT ON VIEW public.v_household_all_visit IS '전체 임가 정보에 담당 조사원 매핑 정보를 포함한 조회용 뷰'; -- ============================================ @@ -594,6 +529,8 @@ AS SELECT daily_record.household_seq, WHERE daily_record.is_deleted = false AND (daily_record.all_status::text = ANY (ARRAY['DONE'::character varying, 'TODAY_NONE'::character varying]::text[])) GROUP BY daily_record.household_seq, daily_record.record_month; +COMMENT ON VIEW public.v_household_monthly_completed_days IS '임가별 월별 일계부 완료 일수 집계 뷰'; + -- ============================================ -- VIEW : v_household_monthly_target_days @@ -617,6 +554,8 @@ as WITH param_matrix AS ( JOIN daily_day_group g ON g.start_day <= p.last_day GROUP BY p.household_seq, p.record_month; +COMMENT ON VIEW public.v_household_monthly_target_days IS '임가 월별 그룹 일수 집계 뷰'; + -- ============================================ -- VIEW : v_household_visit_summary @@ -706,6 +645,8 @@ AS WITH ranked_visits AS ( final.gift_send FROM final; +COMMENT ON VIEW public.v_household_visit_summary IS '임가별 월별 1차,2차 방문 정보 뷰'; + -- ============================================ -- VIEW : v_monthly_completion_rate @@ -723,31 +664,8 @@ as SELECT d.household_seq, LEFT JOIN v_household_monthly_completed_days c ON d.household_seq = c.household_seq AND d.record_month::text = c.record_month::text ORDER BY d.household_seq, d.record_month; +COMMENT ON VIEW public.v_monthly_completion_rate IS '임가별 월간 일계부 등록 완료율을 계산하는 뷰'; --- ============================================ --- VIEW : v_researcher_count --- ============================================ --- DROP VIEW public.v_researcher_count; -CREATE OR REPLACE VIEW public.v_researcher_count -AS SELECT a.seq, - a.id, - count(rhh.id) AS household_count, - a.name, - a.phone, - a.region_main_code, - fn_uicode_text(a.region_main_code) AS region_main_code_text, - a.account_disabled, - CASE a.account_disabled - WHEN false THEN '사용'::text - WHEN true THEN '미사용'::text - ELSE NULL::text - END AS account_disabled_flag - FROM admin a - JOIN admin_has_role ahr ON a.seq = ahr.admin_seq AND ahr.is_deleted = false - LEFT JOIN researcher_has_household rhh ON rhh.admin_seq = a.seq AND rhh.is_deleted = false - LEFT JOIN household h ON h.seq = rhh.household_seq AND h.is_panel IS TRUE AND h.is_deleted = false - WHERE ahr.role_id::text = 'ROLE_RESEARCHER'::text - GROUP BY a.seq, a.id, a.name, a.phone, a.account_disabled; -- ============================================ -- 개인정보 변경 동의 내역 @@ -772,6 +690,15 @@ created_by varchar(255) null, CONSTRAINT term_agreement_pkey PRIMARY KEY (id) ); +COMMENT ON COLUMN public.term_agreement.id IS '동의 이력 ID'; +COMMENT ON COLUMN public.term_agreement.seq IS '사용자 seq'; +COMMENT ON COLUMN public.term_agreement."type" IS '동의타입'; +COMMENT ON COLUMN public.term_agreement.previous_data IS '이전데이터'; +COMMENT ON COLUMN public.term_agreement.created_at IS '생성일'; +COMMENT ON COLUMN public.term_agreement.created_by IS '생성자'; +COMMENT ON TABLE public.term_agreement IS '사용자 동의 이력 테이블'; + + -- ============================================ -- 영수증 매핑 테이블 -- ============================================ @@ -790,12 +717,25 @@ CREATE TABLE public.receipt_has_record ( CONSTRAINT receipt_has_record_pkey PRIMARY KEY (receipt_type_id, file_id) ); ---- 첨부파일 컬럼 추가 -COMMENT ON COLUMN public.upload_file.mapping_id IS '첨부파일 매핑 ID'; + +COMMENT ON TABLE public.receipt_has_record IS '영수증 매핑 테이블'; +COMMENT ON COLUMN public.receipt_has_record."type" IS '종류(INCOME,EXPENSE)'; +COMMENT ON COLUMN public.receipt_has_record.file_id IS '파일 ID'; +COMMENT ON COLUMN public.receipt_has_record.receipt_type_id IS '영수증 타입 ID'; +COMMENT ON COLUMN public.receipt_has_record.created_at IS '생성일'; +COMMENT ON COLUMN public.receipt_has_record.created_by IS '생성자'; +COMMENT ON COLUMN public.receipt_has_record.updated_at IS '수정일'; +COMMENT ON COLUMN public.receipt_has_record.updated_by IS '수정자'; +COMMENT ON COLUMN public.receipt_has_record.deleted_at IS '삭제일'; +COMMENT ON COLUMN public.receipt_has_record.deleted_by IS '삭제자'; + + ALTER TABLE public.upload_file ADD ocr text NULL; COMMENT ON COLUMN public.upload_file.ocr IS 'ocr'; +--- 첨부파일 컬럼 추가 +COMMENT ON COLUMN public.upload_file.mapping_id IS '첨부파일 매핑 ID'; @@ -832,5 +772,31 @@ SELECT setval('uri_has_role_seq', (SELECT COALESCE(MAX(id), 0) FROM +-- ==================================================================================================================== +-- 사용하지않는 view 삭제 +-- ==================================================================================================================== +DROP VIEW uicode_names; +DROP VIEW v_dashboard; +DROP VIEW v_role; +-- ==================================================================================================================== +-- 기존에 있던 view 의 Comment 추가 +-- ==================================================================================================================== +COMMENT ON VIEW public.v_household_researcher IS '조사원별 담당 임가 매핑 정보 뷰'; +COMMENT ON VIEW public.v_household_visit IS '임가별 방문 요약 정보 뷰'; +COMMENT ON VIEW public.v_uicode_view_name IS '코드값과 코드명을 조합한 UI 표시용 코드명 뷰'; + + +-- ==================================================================================================================== +-- 사용하지않는 function 삭제 +-- ==================================================================================================================== +DROP FUNCTION public.fn_monthly_input_status_target_month(varchar); +DROP FUNCTION public.sc_monthly_input_status(); + + +-- ==================================================================================================================== +-- 임업노동 투입내역 - 일계부 테이블 면적부호 칼럼 추가 +-- ==================================================================================================================== +ALTER TABLE daily_work ADD COLUMN area_mark VARCHAR(10); +COMMENT ON COLUMN daily_work.area_mark IS '면적 부호'; \ No newline at end of file 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 8bf132e4..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) { @@ -478,7 +482,7 @@ const field = form.elements.namedItem(key); if (field) { field.value = val; - if(key === 'transferCategoryCode' && (val === "code.bank.input.self" || val === "code.bank.input.1" || val === "code.bank.input.4")){ + if(key === 'transferCategoryCode' && (val !== "code.bank.input.10" && val !== "code.bank.input.12" && val !== "code.bank.input.13")){ document.getElementById(val+"_value").value = product["transferCategory"]; } if(key === 'unitCode' && val === "code.count.unit.self"){ diff --git a/front/src/main/resources/templates/info/bank/output.html b/front/src/main/resources/templates/info/bank/output.html index ed314924..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) { @@ -472,7 +476,7 @@ const field = form.elements.namedItem(key); if (field) { field.value = val; - if (key === 'transferCategoryCode' && val === "code.bank.input.self") { + if (key === 'transferCategoryCode' && val === "code.bank.output.self") { document.getElementById(val + "_value").value = product["transferCategory"]; } if (key === 'unitCode' && val === "code.count.unit.self") { @@ -481,6 +485,22 @@ } }); + + + if (product.transferCategoryCode === "code.bank.output.self") { + const transferCategoryInput = document.getElementById(product.transferCategoryCode + "_value"); + if (transferCategoryInput) { + transferCategoryInput.value = product.transferCategory || ""; + } + } + + // 단위 입력 필드 표시 여부 처리 + if (product.unitCode === "code.count.unit.self") { + const unitDiv = document.getElementById("unitDiv"); + if (unitDiv) { + unitDiv.style.display = ""; + } + } ENV.elementRefs.select.transferCategoryCodeSelect.setValue(product.transferCategoryCode); ENV.elementRefs.select.unitCodeSelect.setValue(product.unitCode); document.getElementById("unit").value = product.unit; diff --git a/front/src/main/resources/templates/info/monthly/form.html b/front/src/main/resources/templates/info/monthly/form.html index ad479b08..57b975a4 100644 --- a/front/src/main/resources/templates/info/monthly/form.html +++ b/front/src/main/resources/templates/info/monthly/form.html @@ -15,18 +15,6 @@

필수입력

- -
-
- -
-
- -
-
@@ -52,7 +40,18 @@
- + +
+
+ +
+
+ +
+
diff --git a/front/src/main/resources/templates/info/monthly/{id}.html b/front/src/main/resources/templates/info/monthly/{id}.html index 679f71a0..a6f8a0c5 100644 --- a/front/src/main/resources/templates/info/monthly/{id}.html +++ b/front/src/main/resources/templates/info/monthly/{id}.html @@ -239,12 +239,14 @@ const header = document.getElementById('listHeader'); const count = document.getElementById('listCount'); const total = ENV.data.productList.length; + const totalItems = document.getElementById('totalItems'); header.style.display = total > 0 ? '' : 'none'; status.style.display = total > 0 ? 'none' : ''; callPastInfoBtn.style.display = total > 0 ? 'none' : ''; count.textContent = total; + totalItems.textContent = total; btn.disabled = isChecked; @@ -376,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', @@ -395,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', @@ -411,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', @@ -427,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 @@
@@ -181,7 +180,6 @@
diff --git a/front/src/main/resources/templates/record/work/index.html b/front/src/main/resources/templates/record/work/index.html index 31ef079c..dc97541d 100644 --- a/front/src/main/resources/templates/record/work/index.html +++ b/front/src/main/resources/templates/record/work/index.html @@ -261,7 +261,15 @@ }, function () { // 노동투입시간 invalid reset - $('.segment-label .guide-info li').eq(2).addClass('invalid'); + if($('.type-sub').find('.input-info').length > 0 && $('.type-sub').find('.input-info').first().text() === "필수입력 항목입니다."){ + $('.segment-label .guide-info li').eq(2).text("최소 1개의 노동투입시간을 입력해 주세요."); + $('.segment-label .guide-info li').eq(2).addClass('invalid'); + }else if($('.type-sub').find('.input-info').length > 0 ){ + $('.segment-label .guide-info li').eq(2).text("입력값은 0보다 커야 합니다."); + $('.segment-label .guide-info li').eq(2).addClass('invalid'); + }else{ + $('.segment-label .guide-info li').eq(2).removeClass('invalid'); + } $('.type-sub').find('.input-info').remove(); $('.input-flex-group').find('.input-info').remove(); }