[FO] 비밀번호 inputmode, 노동의 필수입력 수정, formContrl.init 삭제
This commit is contained in:
@@ -9,4 +9,9 @@ public class CommonConstants {
|
||||
* 단위의 직접입력 코드
|
||||
*/
|
||||
public static final String UNIT_CODE_SELF = "code.record.unit.self";
|
||||
|
||||
/**
|
||||
* 작업 면적의 직접입력 코드
|
||||
*/
|
||||
public static final String AREA_CODE_OTHER = "code.record.area.self";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package app.module.front.usecase.daily.farming.adapters.web.validator;
|
||||
|
||||
import app.module.front.config.constants.CommonConstants;
|
||||
import app.module.front.usecase.daily.farming.adapters.web.model.CreateDailyFarmingReqVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.tika.utils.StringUtils;
|
||||
@@ -20,7 +21,7 @@ public class CreateDailyFarmingValidator implements Validator {
|
||||
public void validate(Object target, Errors errors) {
|
||||
CreateDailyFarmingReqVO vo = (CreateDailyFarmingReqVO) target;
|
||||
|
||||
if ("SELF".equals(vo.getProductCode()) && StringUtils.isBlank(vo.getProductSelf())) {
|
||||
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getProductCode()) && StringUtils.isBlank(vo.getProductSelf())) {
|
||||
errors.rejectValue(
|
||||
"categorySelf", "valid.common.required",
|
||||
"생산물을 입력해 주세요.");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package app.module.front.usecase.daily.work.adapters.web.validator;
|
||||
|
||||
import app.module.front.config.constants.CommonConstants;
|
||||
import app.module.front.usecase.daily.work.adapters.web.model.CreateDailyWorkReqVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.tika.utils.StringUtils;
|
||||
@@ -20,19 +21,37 @@ public class CreateDailyWorkValidator implements Validator {
|
||||
public void validate(Object target, Errors errors) {
|
||||
CreateDailyWorkReqVO vo = (CreateDailyWorkReqVO) target;
|
||||
|
||||
if (vo.getHarvestQuantity() == null) {
|
||||
if (vo.getWorkLandArea() == null && !StringUtils.isBlank(vo.getAreaUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"harvestQuantity", "valid.common.required",
|
||||
"수확량을 입력해 주세요.");
|
||||
"workLandArea", "valid.common.required",
|
||||
"작업 면적을 입력해 주세요.");
|
||||
}
|
||||
|
||||
if ("SELF".equals(vo.getAreaUnitCode()) && StringUtils.isBlank(vo.getAreaUnitSelf())) {
|
||||
if (vo.getWorkLandArea() != null && StringUtils.isBlank(vo.getAreaUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"areaUnitCode", "valid.common.required",
|
||||
"단위를 선택해 주세요.");
|
||||
}
|
||||
|
||||
if (CommonConstants.AREA_CODE_OTHER.equals(vo.getAreaUnitCode()) && StringUtils.isBlank(vo.getAreaUnitSelf())) {
|
||||
errors.rejectValue(
|
||||
"areaUnitSelf", "valid.common.required",
|
||||
"단위를 입력해 주세요.");
|
||||
}
|
||||
|
||||
if ("SELF".equals(vo.getHarvestUnitCode()) && StringUtils.isBlank(vo.getHarvestUnitSelf())) {
|
||||
if (vo.getHarvestQuantity() == null && !StringUtils.isBlank(vo.getHarvestUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"harvestQuantity", "valid.common.required",
|
||||
"수확량을 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getHarvestQuantity() != null && StringUtils.isBlank(vo.getHarvestUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"harvestUnitCode", "valid.common.required",
|
||||
"단위를 선택해 주세요.");
|
||||
}
|
||||
|
||||
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getHarvestUnitCode()) && StringUtils.isBlank(vo.getHarvestUnitSelf())) {
|
||||
errors.rejectValue(
|
||||
"harvestUnitSelf", "valid.common.required",
|
||||
"단위를 입력해 주세요.");
|
||||
|
||||
Reference in New Issue
Block a user