Merge branch 'bo_bug_fixes' into 'dev'

Bo bug fixes

See merge request korea-research/korea-research!153
This commit is contained in:
이강선 매니저/ST
2025-07-28 03:07:27 +00:00
14 changed files with 246 additions and 23 deletions

View File

@@ -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 이상 입력해 주세요.");
}
}
}

View File

@@ -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 이상 입력해 주세요.");
}
}
}

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

@@ -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; // 부생산물 판매량 직접입력 단위
}

View File

@@ -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,
"부생산물 판매량 단위를 입력해 주세요.");
}
}
}
}

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.

View File

@@ -56,7 +56,7 @@
<span class="btn-txt">중복확인</span>
</button>
</div>
<span>4~15자 / 영문,숫자,한글 가능/ 특수문자 _,- 사용가능</span>
<span>2~15자 / 영문,숫자,한글 가능/ 특수문자 _,- 사용가능</span>
</div>
</div>
</td>

View File

@@ -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);
}
</script>
@@ -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 {

View File

@@ -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자, 영문/숫자/한글/특수문자(_,-)만 가능합니다.";
/**
* 관리자 비밀번호 생성 규칙
@@ -47,4 +47,9 @@ public final class CommonConstants {
*/
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";
}