Merge branch 'dev' into deploy-dev-admin

This commit is contained in:
주수현
2025-07-21 15:12:24 +09:00
32 changed files with 298 additions and 206 deletions

View File

@@ -30,6 +30,7 @@ public class AdminURIInterceptor implements HandlerInterceptor {
private final URICurrentMatchingPortIn uriCurrentMatchingPortIn;
private final URIAncestryPortIn uriAncestryPortIn;
private final URITopTierPortIn topTierPortIn;
@Value("${spring.profiles.active}")
private String activeProfiles;
@@ -39,6 +40,11 @@ public class AdminURIInterceptor implements HandlerInterceptor {
@Value("${app.aws.s3.bucketFolder:null}")
private String bucketFolder;
/**
* AttributeName: currentURI
*/
private static final String ATTR_NAME_URI = "currentURI";
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
Object handler)
@@ -57,7 +63,7 @@ public class AdminURIInterceptor implements HandlerInterceptor {
throw new NoMatchingURIException(String.format("매핑되는 않은 URI - %s", requestURI));
}
request.setAttribute("currentURI", currentURI);
request.setAttribute(ATTR_NAME_URI, currentURI);
return true;
}
@@ -83,8 +89,8 @@ public class AdminURIInterceptor implements HandlerInterceptor {
URITopTier topTierOutput = topTierPortIn.connectRoleId(AppType.ADMIN,roleId);
modelAndView.addObject("topNode", recursiveMapping(topTierOutput));
if (modelAndView.getModelMap().getAttribute("currentURI") == null) {
modelAndView.addObject("currentURI", request.getAttribute("currentURI"));
if (modelAndView.getModelMap().getAttribute(ATTR_NAME_URI) == null) {
modelAndView.addObject(ATTR_NAME_URI, request.getAttribute(ATTR_NAME_URI));
}
modelAndView.addObject("menuHierarchy", uriAncestryPortIn.connect(AppType.ADMIN, request.getRequestURI()));

View File

@@ -1,8 +1,10 @@
package app.module.admin.usecase.admin.saveAdmin.adapters.web.validator;
import app.module.admin.usecase.admin.saveAdmin.adapters.web.model.AdminCreateBindingVO;
import app.module.core.config.application.util.MessageUtil;
import app.module.core.config.constants.CommonConstants;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
@@ -12,6 +14,9 @@ import java.util.Optional;
@Component
public class AdminCreateValidator implements Validator {
@Autowired
private MessageUtil messageUtil;
@Override
public boolean supports(Class<?> clazz) {
return AdminCreateBindingVO.class.equals(clazz);
@@ -23,30 +28,30 @@ public class AdminCreateValidator implements Validator {
// [1] 필수값 누락 체크
if(StringUtils.isBlank(vo.getRoleId())) {
errors.rejectValue("roleId", "error.roleId", "필수입력항목을 확인해주세요.");
errors.rejectValue("roleId", "error.roleId", messageUtil.getMessage("valid.common.required.ask"));
return;
}
if(StringUtils.isBlank(vo.getId())) {
errors.rejectValue("id", "error.id", "필수입력항목을 확인해주세요.");
errors.rejectValue("id", "error.id", messageUtil.getMessage("valid.common.required.ask"));
return;
}
if(StringUtils.isBlank(vo.getPassword())) {
errors.rejectValue("password", "error.password", "필수입력항목을 확인해주세요.");
errors.rejectValue("password", "error.password", messageUtil.getMessage("valid.common.required.ask"));
return;
}
// 권한 조사원으로 선택했을 경우
if("ROLE_RESEARCHER".equals(vo.getRoleId())) {
if(StringUtils.isBlank(vo.getName())) {
errors.rejectValue("name", "error.name", "필수입력항목을 확인해주세요.");
errors.rejectValue("name", "error.name", messageUtil.getMessage("valid.common.required.ask"));
return;
}
if(StringUtils.isBlank(vo.getPhone1())) {
errors.rejectValue("phone1", "error.phone1", "필수입력항목을 확인해주세요.");
errors.rejectValue("phone1", "error.phone1", messageUtil.getMessage("valid.common.required.ask"));
return;
}
if(StringUtils.isBlank(vo.getPhone2())) {
errors.rejectValue("phone2", "error.phone2", "필수입력항목을 확인해주세요.");
errors.rejectValue("phone2", "error.phone2", messageUtil.getMessage("valid.common.required.ask"));
return;
}
if (!vo.getPhone1().matches("^\\d{4}$")) {
@@ -60,7 +65,7 @@ public class AdminCreateValidator implements Validator {
}
if(vo.getAccountDisabled() == null) {
errors.rejectValue("accountDisabled", "error.accountDisabled", "필수입력항목을 확인해주세요.");
errors.rejectValue("accountDisabled", "error.accountDisabled", messageUtil.getMessage("valid.common.required.ask"));
return;
}
@@ -69,7 +74,7 @@ public class AdminCreateValidator implements Validator {
.filter(id -> !id.equals("ROLE_ADMIN"))
.ifPresent(nonAdmins -> {
if (vo.getRegionMainCode() == null || vo.getRegionMainCode().isBlank()) {
errors.rejectValue("regionMainCode", "valid.common.required","필수입력항목을 확인해주세요.");
errors.rejectValue("regionMainCode", "valid.common.required.ask");
}
});

View File

@@ -1,7 +1,9 @@
package app.module.admin.usecase.admin.saveAdmin.adapters.web.validator;
import app.module.admin.usecase.admin.saveAdmin.adapters.web.model.AdminUpdateBindingVO;
import app.module.core.config.application.util.MessageUtil;
import app.module.core.config.constants.CommonConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
@@ -11,6 +13,9 @@ import java.util.Optional;
@Component
public class AdminUpdateValidator implements Validator {
@Autowired
private MessageUtil messageUtil;
@Override
public boolean supports(Class<?> clazz) {
return AdminUpdateBindingVO.class.equals(clazz);
@@ -22,22 +27,22 @@ public class AdminUpdateValidator implements Validator {
// [1] 필수값 누락 체크
if(vo.getRoleId() == null || vo.getRoleId().isEmpty()) {
errors.rejectValue("roleId", "error.roleId", "필수입력항목을 확인해주세요.");
errors.rejectValue("roleId", "error.roleId", messageUtil.getMessage("valid.common.required.ask"));
return;
}
// 권한 조사원으로 선택했을 경우
if(vo.getRoleId() != null && "ROLE_RESEARCHER".equals(vo.getRoleId())) {
if(vo.getName() == null || vo.getName().isEmpty()) {
errors.rejectValue("name", "error.name", "필수입력항목을 확인해주세요.");
errors.rejectValue("name", "error.name", messageUtil.getMessage("valid.common.required.ask"));
return;
}
if(vo.getPhone1() == null || vo.getPhone1().isBlank()) {
errors.rejectValue("phone1", "error.phone1", "필수입력항목을 확인해주세요.");
errors.rejectValue("phone1", "error.phone1", messageUtil.getMessage("valid.common.required.ask"));
return;
}
if(vo.getPhone2() == null || vo.getPhone2().isBlank()) {
errors.rejectValue("phone2", "error.phone2", "필수입력항목을 확인해주세요.");
errors.rejectValue("phone2", "error.phone2", messageUtil.getMessage("valid.common.required.ask"));
return;
}
if (!vo.getPhone1().matches("^\\d{4}$")) {
@@ -52,7 +57,7 @@ public class AdminUpdateValidator implements Validator {
// 사용여부
if(vo.getAccountDisabled() == null) {
errors.rejectValue("accountDisabled", "error.accountDisabled", "필수입력항목을 확인해주세요.");
errors.rejectValue("accountDisabled", "error.accountDisabled", messageUtil.getMessage("valid.common.required.ask"));
return;
}
@@ -61,7 +66,7 @@ public class AdminUpdateValidator implements Validator {
.filter(id -> !id.equals("ROLE_ADMIN"))
.ifPresent(nonAdmins -> {
if (vo.getRegionMainCode() == null || vo.getRegionMainCode().isBlank()) {
errors.rejectValue("regionMainCode", "valid.common.required","필수입력항목을 확인해주세요.");
errors.rejectValue("regionMainCode", "valid.common.required",messageUtil.getMessage("valid.common.required.ask"));
}
});

View File

@@ -48,7 +48,6 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
@Transactional
public ExcelUploadResultVO operate(MultipartFile file) throws IOException {
// 엑셀 파일 읽기
Workbook workbook = WorkbookFactory.create(file.getInputStream());
Sheet sheet = workbook.getSheetAt(0);
int success = 0;
@@ -60,6 +59,8 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
List<UICodeElement> IndustryMiddleCodeList = uiCodeListMapper.findByLikeId("code.industry.middle");
List<String> errorList = new ArrayList<>();
int flag = 0;
// 첫 번째 행은 헤더로 간주하고 스킵
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
Row row = sheet.getRow(i);
@@ -68,30 +69,29 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
CheckHouseholdNum checkHouseholdNum = checkHouseholdNumMapper.checkHouseholdNum(new CheckHouseholdNumCmd(getCellValue(row.getCell(0)))).orElse(null);
ExcelUploadContactVO contactVO = getDivisionContact(row.getCell(3));
if(checkHouseholdNum != null && !checkHouseholdNum.getIsDuplicated() && contactVO != null) {
int flag = 0;
ExcelCreateHouseholdVO household = new ExcelCreateHouseholdVO();
household.setHouseholdNum(getCellValue(row.getCell(0))); // 임가번호
household.setOwnerName(getCellValue(row.getCell(1))); // 경영주명
household.setOwnerAge(getCellNumberValue(row.getCell(2))); // 연령
household.setTel(contactVO.getTel()); // 가구 연락처
household.setPhone(contactVO.getPhone()); // 연락처
household.setEncodedPassword(passwordEncoder.encode(contactVO.getPhoneLast())); // 비밀번호
household.setRegionMainCode(getUiCode(row.getCell(4),RegionMainCodeList,"code.region.main")); // 실사
household.setRegionSubCode(getUiCode(row.getCell(5),RegionSubCodeList,"code.region.sub")); // 지역
household.setRegionDetailCode(getUiCode(row.getCell(6),RegionDetailCodeList,"code.region.detail")); // 세부지역
household.setAddress(getCellValue(row.getCell(7))); // 전체주소
household.setIndustryLargeCode(getUiCode(row.getCell(8),IndustryLargeCodeList,"code.industry.large")); // 업종 대분류
household.setIndustryMiddleCode(getUiCode(row.getCell(9),IndustryMiddleCodeList,"code.industry.middle")); // 업종 중분류
household.setIndustrySubMiddle(getCellValue(row.getCell(10))); // 업종 중분류2
household.setIndustryDetail(getCellValue(row.getCell(11))); // 규모 / 세부품목
household.setResearcherSeq(getResearcherSeq(row.getCell(12))); // 조사원
household.setIsPanel(getIsPanel(row.getCell(13))); // 유지여부
household.setUsageType(getUsageType(row.getCell(14))); // 구분
household.setMemo(getCellValue(row.getCell(15))); // 비고
ExcelCreateHouseholdVO household = new ExcelCreateHouseholdVO();
household.setHouseholdNum(getCellValue(row.getCell(0))); // 임가번호
household.setOwnerName(getCellValue(row.getCell(1))); // 경영주명
household.setOwnerAge(getCellNumberValue(row.getCell(2))); // 연령
household.setTel(contactVO.getTel()); // 가구 연락처
household.setPhone(contactVO.getPhone()); // 연락처
household.setEncodedPassword(passwordEncoder.encode(contactVO.getPhoneLast())); // 비밀번호
household.setRegionMainCode(getUiCode(row.getCell(4),RegionMainCodeList,"code.region.main")); // 실사
household.setRegionSubCode(getUiCode(row.getCell(5),RegionSubCodeList,"code.region.sub")); // 지역
household.setRegionDetailCode(getUiCode(row.getCell(6),RegionDetailCodeList,"code.region.detail")); // 세부지역
household.setAddress(getCellValue(row.getCell(7))); // 전체주소
household.setIndustryLargeCode(getUiCode(row.getCell(8),IndustryLargeCodeList,"code.industry.large")); // 업종 대분류
household.setIndustryMiddleCode(getUiCode(row.getCell(9),IndustryMiddleCodeList,"code.industry.middle")); // 업종 중분류
household.setIndustrySubMiddle(getCellValue(row.getCell(10))); // 업종 중분류2
household.setIndustryDetail(getCellValue(row.getCell(11))); // 규모 / 세부품목
household.setResearcherSeq(getResearcherSeq(row.getCell(12))); // 조사원
household.setIsPanel(getIsPanel(row.getCell(13))); // 유지여부
household.setUsageType(getUsageType(row.getCell(14))); // 구분
household.setMemo(getCellValue(row.getCell(15))); // 비고
if (isValidHousehold(household, checkHouseholdNum, contactVO)) {
CreateHouseholdOutCmd cmd = new CreateHouseholdOutCmd(
null,
null,
household.getHouseholdNum(),
household.getOwnerName(),
household.getOwnerAge(),
@@ -118,22 +118,38 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
success += flag;
if(cmd.getRoleIds() != null && !cmd.getRoleIds().isEmpty()) {
if (cmd.getRoleIds() != null && !cmd.getRoleIds().isEmpty()) {
createHouseholdMapper.createHouseholdHasRole(AuditUtil.create(new CreateHouseholdHasRoleCmd(cmd.getSeq(), cmd.getRoleIds())));
}
if(cmd.getResearcherSeq() != null) {
if (cmd.getResearcherSeq() != null) {
createHouseholdMapper.createResearcherHasHousehold(AuditUtil.create(new CreateResearcherHasHouseholdCmd(cmd.getSeq(), cmd.getResearcherSeq())));
}
} else {
errorList.add(getCellValue(row.getCell(0)));
safeLogger.warn("[ EXCEL 누락 ] 임가번호={} 핸드폰번호={}", getCellValue(row.getCell(0)),getCellValue(row.getCell(3)));
errorList.add(household.getHouseholdNum());
safeLogger.warn(
"[EXCEL 누락] 임가번호={} 필수 필드 누락: checkHouseholdNum={}, isDuplicated={}, contactVO={}, householdNum={}, ownerName={}, ownerAge={}, tel={}, phone={}, regionMainCode={}, regionSubCode={}, regionDetailCode={}, address={}",
household.getHouseholdNum(),
checkHouseholdNum != null,
checkHouseholdNum != null ? checkHouseholdNum.getIsDuplicated() : null,
contactVO != null?contactVO:null,
household.getHouseholdNum(),
household.getOwnerName(),
household.getOwnerAge(),
household.getTel(),
household.getPhone(),
household.getRegionMainCode(),
household.getRegionSubCode(),
household.getRegionDetailCode(),
household.getAddress()
);
}
}
workbook.close();
createHouseholdMapper.createHouseholdMonthlyInputStatus();
return new ExcelUploadResultVO(sheet.getLastRowNum()-1 , success, errorList);
return new ExcelUploadResultVO(sheet.getLastRowNum() , success, errorList);
}
// 셀 값을 문자열로 변환
@@ -222,10 +238,36 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
}
private String getUsageType(Cell cell){
if (cell == null) return "MOBILE";
String returnValue = "MOBILE";
if (cell == null) {
return returnValue;
}
String usageType = cell.getStringCellValue().trim();
if("모바일".equals(usageType) ) return "MOBILE";
if("지류".equals(usageType) ) return "PAPER";
return "MOBILE";
if ("모바일".equals(usageType)) {
returnValue = "MOBILE";
}
if ("지류".equals(usageType)) {
returnValue = "PAPER";
}
return returnValue;
}
private boolean isValidHousehold(ExcelCreateHouseholdVO household, CheckHouseholdNum checkHouseholdNum, ExcelUploadContactVO contactVO) {
// checkHouseholdNum과 contactVO 유효성 검사
if (checkHouseholdNum == null || checkHouseholdNum.getIsDuplicated() || contactVO == null) {
return false;
}
// 필수 필드 검사: 임가번호, 경영주명, 연령, 연락처(tel 또는 phone), 실사, 지역, 세부지역, 전체 주소
return household.getHouseholdNum() != null && !household.getHouseholdNum().isEmpty() &&
household.getOwnerName() != null && !household.getOwnerName().isEmpty() &&
household.getOwnerAge() != null &&
(household.getTel() != null && !household.getTel().isEmpty() ||
household.getPhone() != null && !household.getPhone().isEmpty()) &&
household.getRegionMainCode() != null && !household.getRegionMainCode().isEmpty() &&
household.getRegionSubCode() != null && !household.getRegionSubCode().isEmpty() &&
household.getRegionDetailCode() != null && !household.getRegionDetailCode().isEmpty() &&
household.getAddress() != null && !household.getAddress().isEmpty();
}
}

View File

@@ -23,28 +23,28 @@ public class SaveDailyExpenseValidator implements Validator {
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"quantity", "valid.common.required",
"quantity", CommonConstants.VALID_CODE_NOTBLANK,
"수량을 입력해 주세요.");
}
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"unitCode", "valid.common.required",
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 선택해 주세요.");
}
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
errors.rejectValue(
"unitSelf", "valid.common.required",
"unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 입력해 주세요.");
}
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
errors.rejectValue(
"price", "valid.common.required",
"price", CommonConstants.VALID_CODE_NOTBLANK,
"현금 또는 현물평가액을 입력해 주세요.");
errors.rejectValue(
"estimatedValue", "valid.common.required",
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
"현금 또는 현물평가액을 입력해 주세요.");
}
}

View File

@@ -22,31 +22,31 @@ public class SaveDailyFarmingValidator implements Validator {
if ("code.record.farming.self".equals(vo.getProductCode()) && StringUtils.isBlank(vo.getProductSelf())) {
errors.rejectValue(
"productSelf", "valid.common.required",
"productSelf", CommonConstants.VALID_CODE_NOTBLANK,
"생산물을 입력해 주세요.");
}
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"quantity", "valid.common.required",
"quantity", CommonConstants.VALID_CODE_NOTBLANK,
"수량을 입력해 주세요.");
}
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"unitCode", "valid.common.required",
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 선택해 주세요.");
}
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
errors.rejectValue(
"unitSelf", "valid.common.required",
"unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 입력해 주세요.");
}
if (vo.getEstimatedValue() == null) {
errors.rejectValue(
"estimatedValue", "valid.common.required",
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
"현물평가액을 입력해 주세요.");
}
}

View File

@@ -22,25 +22,25 @@ public class SaveDailyForestryValidator implements Validator {
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"quantity", "valid.common.required",
"quantity", CommonConstants.VALID_CODE_NOTBLANK,
"수량을 입력해 주세요.");
}
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"unitCode", "valid.common.required",
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 선택해 주세요.");
}
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
errors.rejectValue(
"unitSelf", "valid.common.required",
"unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 입력해 주세요.");
}
if (vo.getEstimatedValue() == null) {
errors.rejectValue(
"estimatedValue", "valid.common.required",
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
"현물평가액을 입력해 주세요.");
}
}

View File

@@ -1,6 +1,7 @@
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.adapters.web.validator;
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.adapters.web.model.SaveDailyIncomeReqVO;
import app.module.core.config.constants.CommonConstants;
import lombok.RequiredArgsConstructor;
import org.apache.tika.utils.StringUtils;
import org.springframework.stereotype.Component;
@@ -22,28 +23,28 @@ public class SaveDailyIncomeValidator implements Validator {
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"quantity", "valid.common.required",
"quantity", CommonConstants.VALID_CODE_NOTBLANK,
"수량을 입력해 주세요.");
}
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"unitCode", "valid.common.required",
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 선택해 주세요.");
}
if ("code.record.unit.self".equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
errors.rejectValue(
"unitSelf", "valid.common.required",
"unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 입력해 주세요.");
}
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
errors.rejectValue(
"price", "valid.common.required",
"price", CommonConstants.VALID_CODE_NOTBLANK,
"현금 또는 현물평가액을 입력해 주세요.");
errors.rejectValue(
"estimatedValue", "valid.common.required",
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
"현금 또는 현물평가액을 입력해 주세요.");
}
}

View File

@@ -1,6 +1,7 @@
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.validator;
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model.SaveDailyPowerReqVO;
import app.module.core.config.constants.CommonConstants;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
@@ -20,10 +21,10 @@ public class SaveDailyPowerValidator implements Validator {
if (vo.getOwnedHours() == null && vo.getLeasedHours() == null) {
errors.rejectValue(
"ownedHours", "valid.common.required",
"ownedHours", CommonConstants.VALID_CODE_NOTBLANK,
"자가 사용시간 또는 임차 사용시간을 입력해 주세요.");
errors.rejectValue(
"leasedHours", "valid.common.required",
"leasedHours", CommonConstants.VALID_CODE_NOTBLANK,
"자가 사용시간 또는 임차 사용시간을 입력해 주세요.");
}
}

View File

@@ -22,37 +22,37 @@ public class SaveDailyWorkValidator implements Validator {
if (vo.getWorkLandArea() == null && !StringUtils.isBlank(vo.getAreaUnitCode())) {
errors.rejectValue(
"workLandArea", "valid.common.required",
"workLandArea", CommonConstants.VALID_CODE_NOTBLANK,
"작업 면적을 입력해 주세요.");
}
if (vo.getWorkLandArea() != null && StringUtils.isBlank(vo.getAreaUnitCode())) {
errors.rejectValue(
"areaUnitCode", "valid.common.required",
"areaUnitCode", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 선택해 주세요.");
}
if (CommonConstants.AREA_CODE_OTHER.equals(vo.getAreaUnitCode()) && StringUtils.isBlank(vo.getAreaUnitSelf())) {
errors.rejectValue(
"areaUnitSelf", "valid.common.required",
"areaUnitSelf", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 입력해 주세요.");
}
if (vo.getHarvestQuantity() == null && !StringUtils.isBlank(vo.getHarvestUnitCode())) {
errors.rejectValue(
"harvestQuantity", "valid.common.required",
"harvestQuantity", CommonConstants.VALID_CODE_NOTBLANK,
"수확량을 입력해 주세요.");
}
if (vo.getHarvestQuantity() != null && StringUtils.isBlank(vo.getHarvestUnitCode())) {
errors.rejectValue(
"harvestUnitCode", "valid.common.required",
"harvestUnitCode", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 선택해 주세요.");
}
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getHarvestUnitCode()) && StringUtils.isBlank(vo.getHarvestUnitSelf())) {
errors.rejectValue(
"harvestUnitSelf", "valid.common.required",
"harvestUnitSelf", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 입력해 주세요.");
}
@@ -61,16 +61,16 @@ public class SaveDailyWorkValidator implements Validator {
&& vo.getHiredMHours() == null && vo.getHiredFHours() == null
&& vo.getSharedMHours() == null && vo.getSharedFHours() == null
&& vo.getVolunteerMHours() == null && vo.getVolunteerFHours() == null) {
errors.rejectValue("ownerTime", "valid.common.required", "최소 1개의 노동투입시간을 입력해 주세요.");
errors.rejectValue("spouseTime", "valid.common.required");
errors.rejectValue("familyMHours", "valid.common.required");
errors.rejectValue("familyFHours", "valid.common.required");
errors.rejectValue("hiredMHours", "valid.common.required");
errors.rejectValue("hiredFHours", "valid.common.required");
errors.rejectValue("sharedMHours", "valid.common.required");
errors.rejectValue("sharedFHours", "valid.common.required");
errors.rejectValue("volunteerMHours", "valid.common.required");
errors.rejectValue("volunteerFHours", "valid.common.required");
errors.rejectValue("ownerTime", CommonConstants.VALID_CODE_NOTBLANK, "최소 1개의 노동투입시간을 입력해 주세요.");
errors.rejectValue("spouseTime", CommonConstants.VALID_CODE_NOTBLANK);
errors.rejectValue("familyMHours", CommonConstants.VALID_CODE_NOTBLANK);
errors.rejectValue("familyFHours", CommonConstants.VALID_CODE_NOTBLANK);
errors.rejectValue("hiredMHours", CommonConstants.VALID_CODE_NOTBLANK);
errors.rejectValue("hiredFHours", CommonConstants.VALID_CODE_NOTBLANK);
errors.rejectValue("sharedMHours", CommonConstants.VALID_CODE_NOTBLANK);
errors.rejectValue("sharedFHours", CommonConstants.VALID_CODE_NOTBLANK);
errors.rejectValue("volunteerMHours", CommonConstants.VALID_CODE_NOTBLANK);
errors.rejectValue("volunteerFHours", CommonConstants.VALID_CODE_NOTBLANK);
}
}
}

View File

@@ -94,7 +94,7 @@
)
</insert>
<select id="createHouseholdMonthlyInputStatus">
<select id="createHouseholdMonthlyInputStatus" resultType="java.lang.String">
select fn_monthly_input_status()
</select>
</mapper>

View File

@@ -1,4 +1,5 @@
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.remove.item=\uC0AD\uC81C\uD560 \uC544\uC774\uD15C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.

View File

@@ -36,4 +36,10 @@ public final class CommonConstants {
* 관리자 비밀번호 유효성 실패 메시지
*/
public static final String ADMIN_PASSWORD_MSG = "비밀번호는 5자, 숫자 + 특수문자(!@#$%_-) 1개 이상입니다.";
/**
* Validator NotBlank errorCode
*/
public static final String VALID_CODE_NOTBLANK = "valid.common.required";
}

View File

@@ -1,6 +1,7 @@
package app.module.front.usecase.daily.expense.adapters.web;
import app.module.core.config.application.exception.NoRecordDataException;
import app.module.core.config.application.logging.SafeLogger;
import app.module.core.config.application.util.CoreUtil;
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
@@ -11,17 +12,19 @@ import app.module.front.usecase.daily.expense.ports.DailyExpensePortIn;
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping(path = "/api/record/expense")
public class DailyExpenseController {
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(DailyExpenseController.class));
private final CoreUtil coreUtil;
private final DailyRecordPortIn dailyRecordPortIn;
private final DailyExpensePortIn dailyExpensePortIn;
@@ -52,7 +55,7 @@ public class DailyExpenseController {
formVO.setGroupNo(Integer.parseInt(groupNo));
formVO.setId(Long.parseLong(id));
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
safeLogger.debug("formVO: {}", formVO);
dailyExpensePortIn.create(formVO);
@@ -71,7 +74,7 @@ public class DailyExpenseController {
ResponseEntity<?> remove(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
, @Valid @RequestBody RemoveDailyExpenseReqVO formVO, BindingResult bindingResult) {
log.debug("before formVO: {}", formVO);
safeLogger.debug("before formVO: {}", formVO);
if (bindingResult.hasErrors()) {
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
.body(bindingResult.getFieldErrors());
@@ -82,7 +85,7 @@ public class DailyExpenseController {
formVO.setSearchMonth(dailyRecord.getRecordMonth());
formVO.setGroupNo(dailyRecord.getGroupNo());
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
safeLogger.debug("formVO: {}", formVO);
dailyExpensePortIn.remove(formVO);
@@ -104,7 +107,7 @@ public class DailyExpenseController {
formVO.setSearchMonth(dailyRecord.getRecordMonth());
formVO.setGroupNo(dailyRecord.getGroupNo());
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
safeLogger.debug("formVO: {}", formVO);
dailyExpensePortIn.remove(formVO);
@@ -119,7 +122,7 @@ public class DailyExpenseController {
*/
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
log.debug("getRecordUIReq: {}", reqVO);
safeLogger.debug("getRecordUIReq: {}", reqVO);
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
if (dailyRecord == null || dailyRecord.getId() == null) {

View File

@@ -2,6 +2,7 @@ package app.module.front.usecase.daily.expense.adapters.web;
import app.module.core.config.application.enums.DailySort;
import app.module.core.config.application.exception.NoRecordDataException;
import app.module.core.config.application.logging.SafeLogger;
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
@@ -10,7 +11,8 @@ import app.module.front.usecase.daily.expense.adapters.web.model.DailyExpenseUIR
import app.module.front.usecase.daily.expense.ports.DailyExpensePortIn;
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@@ -22,11 +24,12 @@ import org.thymeleaf.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Controller
@RequiredArgsConstructor
@RequestMapping(path = "/record/expense")
public class DailyExpenseUIController {
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(DailyExpenseUIController.class));
private final UICodeListPortIn uiCodeListPortIn;
private final DailyRecordPortIn dailyRecordPortIn;
private final DailyExpensePortIn dailyExpensePortIn;
@@ -48,7 +51,7 @@ public class DailyExpenseUIController {
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo, targetList);
DailyExpenseUIReqVO reqVO = new DailyExpenseUIReqVO(searchMonth, groupNo);
log.debug("reqVO: {}", reqVO);
safeLogger.debug("reqVO: {}", reqVO);
List<DailyExpenseDto> expenseList = dailyExpensePortIn.list(reqVO);
@@ -79,7 +82,7 @@ public class DailyExpenseUIController {
} else {
reqVO.setId(Long.parseLong(id));
}
log.debug("reqVO: {}", reqVO);
safeLogger.debug("reqVO: {}", reqVO);
DailyExpenseDto detail = new DailyExpenseDto();
if (reqVO.getId() != 0L) {
@@ -106,7 +109,7 @@ public class DailyExpenseUIController {
*/
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo, String targetList) {
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
log.debug("getRecordUIReq: {}", reqVO);
safeLogger.debug("getRecordUIReq: {}", reqVO);
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
if (dailyRecord == null || dailyRecord.getId() == null) {

View File

@@ -23,28 +23,28 @@ public class CreateDailyExpenseValidator implements Validator {
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"quantity", "valid.common.required",
"quantity", CommonConstants.VALID_CODE_NOTBLANK,
"수량을 입력해 주세요.");
}
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"unitCode", "valid.common.required",
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 선택해 주세요.");
}
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
errors.rejectValue(
"unitSelf", "valid.common.required",
"unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 입력해 주세요.");
}
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
errors.rejectValue(
"price", "valid.common.required",
"price", CommonConstants.VALID_CODE_NOTBLANK,
"현금 또는 현물평가액을 입력해 주세요.");
errors.rejectValue(
"estimatedValue", "valid.common.required",
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
"현금 또는 현물평가액을 입력해 주세요.");
}
}

View File

@@ -1,6 +1,7 @@
package app.module.front.usecase.daily.farming.adapters.web;
import app.module.core.config.application.exception.NoRecordDataException;
import app.module.core.config.application.logging.SafeLogger;
import app.module.core.config.application.util.CoreUtil;
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
@@ -11,17 +12,19 @@ import app.module.front.usecase.daily.farming.ports.application.DailyFarmingServ
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping(path = "/api/record/farming")
public class DailyFarmingController {
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(DailyFarmingController.class));
private final CoreUtil coreUtil;
private final DailyRecordPortIn dailyRecordPortIn;
private final DailyFarmingService dailyFarmingPortIn;
@@ -52,7 +55,7 @@ public class DailyFarmingController {
formVO.setGroupNo(Integer.parseInt(groupNo));
formVO.setId(Long.parseLong(id));
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
safeLogger.debug("formVO: {}", formVO);
dailyFarmingPortIn.create(formVO);
@@ -71,7 +74,7 @@ public class DailyFarmingController {
ResponseEntity<?> remove(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
, @Valid @RequestBody RemoveDailyFarmingReqVO formVO, BindingResult bindingResult) {
log.debug("before formVO: {}", formVO);
safeLogger.debug("before formVO: {}", formVO);
if (bindingResult.hasErrors()) {
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
.body(bindingResult.getFieldErrors());
@@ -82,7 +85,7 @@ public class DailyFarmingController {
formVO.setSearchMonth(dailyRecord.getRecordMonth());
formVO.setGroupNo(dailyRecord.getGroupNo());
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
safeLogger.debug("formVO: {}", formVO);
dailyFarmingPortIn.remove(formVO);
@@ -104,7 +107,7 @@ public class DailyFarmingController {
formVO.setSearchMonth(dailyRecord.getRecordMonth());
formVO.setGroupNo(dailyRecord.getGroupNo());
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
safeLogger.debug("formVO: {}", formVO);
dailyFarmingPortIn.remove(formVO);
@@ -119,7 +122,7 @@ public class DailyFarmingController {
*/
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
log.debug("getRecordUIReq: {}", reqVO);
safeLogger.debug("getRecordUIReq: {}", reqVO);
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
if (dailyRecord == null || dailyRecord.getId() == null) {

View File

@@ -2,6 +2,7 @@ package app.module.front.usecase.daily.farming.adapters.web;
import app.module.core.config.application.enums.DailySort;
import app.module.core.config.application.exception.NoRecordDataException;
import app.module.core.config.application.logging.SafeLogger;
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
@@ -10,7 +11,8 @@ import app.module.front.usecase.daily.farming.adapters.web.model.DailyFarmingUIR
import app.module.front.usecase.daily.farming.ports.application.DailyFarmingService;
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@@ -22,11 +24,12 @@ import org.thymeleaf.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Controller
@RequiredArgsConstructor
@RequestMapping(path = "/record/farming")
public class DailyFarmingUIController {
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(DailyFarmingUIController.class));
private final UICodeListPortIn uiCodeListPortIn;
private final DailyRecordPortIn dailyRecordPortIn;
private final DailyFarmingService dailyFarmingPortIn;
@@ -48,7 +51,7 @@ public class DailyFarmingUIController {
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo, targetList);
DailyFarmingUIReqVO reqVO = new DailyFarmingUIReqVO(searchMonth, groupNo);
log.debug("reqVO: {}", reqVO);
safeLogger.debug("reqVO: {}", reqVO);
List<DailyFarmingDto> farmingList = dailyFarmingPortIn.list(reqVO);
@@ -79,7 +82,7 @@ public class DailyFarmingUIController {
} else {
reqVO.setId(Long.parseLong(id));
}
log.debug("reqVO: {}", reqVO);
safeLogger.debug("reqVO: {}", reqVO);
DailyFarmingDto detail = new DailyFarmingDto();
if (reqVO.getId() != 0L) {
@@ -106,7 +109,7 @@ public class DailyFarmingUIController {
*/
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo, String targetList) {
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
log.debug("getRecordUIReq: {}", reqVO);
safeLogger.debug("getRecordUIReq: {}", reqVO);
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
if (dailyRecord == null || dailyRecord.getId() == null) {

View File

@@ -23,31 +23,31 @@ public class CreateDailyFarmingValidator implements Validator {
if ("code.record.farming.self".equals(vo.getProductCode()) && StringUtils.isBlank(vo.getProductSelf())) {
errors.rejectValue(
"productSelf", "valid.common.required",
"productSelf", CommonConstants.VALID_CODE_NOTBLANK,
"생산물을 입력해 주세요.");
}
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"quantity", "valid.common.required",
"quantity", CommonConstants.VALID_CODE_NOTBLANK,
"수량을 입력해 주세요.");
}
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"unitCode", "valid.common.required",
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 선택해 주세요.");
}
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
errors.rejectValue(
"unitSelf", "valid.common.required",
"unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 입력해 주세요.");
}
if (vo.getEstimatedValue() == null) {
errors.rejectValue(
"estimatedValue", "valid.common.required",
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
"현물평가액을 입력해 주세요.");
}
}

View File

@@ -1,6 +1,7 @@
package app.module.front.usecase.daily.forestry.adapters.web;
import app.module.core.config.application.exception.NoRecordDataException;
import app.module.core.config.application.logging.SafeLogger;
import app.module.core.config.application.util.CoreUtil;
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
@@ -11,17 +12,19 @@ import app.module.front.usecase.daily.forestry.ports.DailyForestryPortIn;
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping(path = "/api/record/forestry")
public class DailyForestryController {
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(DailyForestryController.class));
private final CoreUtil coreUtil;
private final DailyRecordPortIn dailyRecordService;
private final DailyForestryPortIn dailyForestryPortIn;
@@ -52,7 +55,7 @@ public class DailyForestryController {
formVO.setGroupNo(Integer.parseInt(groupNo));
formVO.setId(Long.parseLong(id));
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
safeLogger.debug("formVO: {}", formVO);
dailyForestryPortIn.create(formVO);
@@ -71,7 +74,7 @@ public class DailyForestryController {
ResponseEntity<?> remove(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
, @Valid @RequestBody RemoveDailyForestryReqVO formVO, BindingResult bindingResult) {
log.debug("before formVO: {}", formVO);
safeLogger.debug("before formVO: {}", formVO);
if (bindingResult.hasErrors()) {
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
.body(bindingResult.getFieldErrors());
@@ -82,7 +85,7 @@ public class DailyForestryController {
formVO.setSearchMonth(dailyRecord.getRecordMonth());
formVO.setGroupNo(dailyRecord.getGroupNo());
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
safeLogger.debug("formVO: {}", formVO);
dailyForestryPortIn.remove(formVO);
@@ -104,7 +107,7 @@ public class DailyForestryController {
formVO.setSearchMonth(dailyRecord.getRecordMonth());
formVO.setGroupNo(dailyRecord.getGroupNo());
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
safeLogger.debug("formVO: {}", formVO);
dailyForestryPortIn.remove(formVO);
@@ -119,7 +122,7 @@ public class DailyForestryController {
*/
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
log.debug("getRecordUIReq: {}", reqVO);
safeLogger.debug("getRecordUIReq: {}", reqVO);
DailyRecordDto dailyRecord = dailyRecordService.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
if (dailyRecord == null || dailyRecord.getId() == null) {

View File

@@ -2,6 +2,7 @@ package app.module.front.usecase.daily.forestry.adapters.web;
import app.module.core.config.application.enums.DailySort;
import app.module.core.config.application.exception.NoRecordDataException;
import app.module.core.config.application.logging.SafeLogger;
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
@@ -10,7 +11,8 @@ import app.module.front.usecase.daily.forestry.adapters.web.model.DailyForestryU
import app.module.front.usecase.daily.forestry.ports.DailyForestryPortIn;
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@@ -22,11 +24,12 @@ import org.thymeleaf.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Controller
@RequiredArgsConstructor
@RequestMapping(path = "/record/forestry")
public class DailyForestryUIController {
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(DailyForestryUIController.class));
private final UICodeListPortIn uiCodeListPortIn;
private final DailyRecordPortIn dailyRecordPortIn;
private final DailyForestryPortIn dailyForestryPortIn;
@@ -48,7 +51,7 @@ public class DailyForestryUIController {
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo, targetList);
DailyForestryUIReqVO reqVO = new DailyForestryUIReqVO(searchMonth, groupNo);
log.debug("reqVO: {}", reqVO);
safeLogger.debug("reqVO: {}", reqVO);
List<DailyForestryDto> forestryList = dailyForestryPortIn.list(reqVO);
@@ -79,7 +82,7 @@ public class DailyForestryUIController {
} else {
reqVO.setId(Long.parseLong(id));
}
log.debug("reqVO: {}", reqVO);
safeLogger.debug("reqVO: {}", reqVO);
DailyForestryDto detail = new DailyForestryDto();
if (reqVO.getId() != 0L) {
@@ -106,7 +109,7 @@ public class DailyForestryUIController {
*/
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo, String targetList) {
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
log.debug("getRecordUIReq: {}", reqVO);
safeLogger.debug("getRecordUIReq: {}", reqVO);
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
if (dailyRecord == null || dailyRecord.getId() == null) {

View File

@@ -23,25 +23,25 @@ public class CreateDailyForestryValidator implements Validator {
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"quantity", "valid.common.required",
"quantity", CommonConstants.VALID_CODE_NOTBLANK,
"수량을 입력해 주세요.");
}
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"unitCode", "valid.common.required",
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 선택해 주세요.");
}
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
errors.rejectValue(
"unitSelf", "valid.common.required",
"unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 입력해 주세요.");
}
if (vo.getEstimatedValue() == null) {
errors.rejectValue(
"estimatedValue", "valid.common.required",
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
"현물평가액을 입력해 주세요.");
}
}

View File

@@ -1,6 +1,7 @@
package app.module.front.usecase.daily.income.adapters.web;
import app.module.core.config.application.exception.NoRecordDataException;
import app.module.core.config.application.logging.SafeLogger;
import app.module.core.config.application.util.CoreUtil;
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
@@ -11,17 +12,19 @@ import app.module.front.usecase.daily.income.ports.DailyIncomePortIn;
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping(path = "/api/record/income")
public class DailyIncomeController {
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(DailyIncomeController.class));
private final CoreUtil coreUtil;
private final DailyRecordPortIn dailyRecordPortIn;
private final DailyIncomePortIn dailyIncomePortIn;
@@ -52,7 +55,7 @@ public class DailyIncomeController {
formVO.setGroupNo(Integer.parseInt(groupNo));
formVO.setId(Long.parseLong(id));
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
safeLogger.debug("formVO: {}", formVO);
dailyIncomePortIn.create(formVO);
@@ -71,7 +74,7 @@ public class DailyIncomeController {
ResponseEntity<?> remove(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
, @Valid @RequestBody RemoveDailyIncomeReqVO formVO, BindingResult bindingResult) {
log.debug("before formVO: {}", formVO);
safeLogger.debug("before formVO: {}", formVO);
if (bindingResult.hasErrors()) {
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
.body(bindingResult.getFieldErrors());
@@ -82,7 +85,7 @@ public class DailyIncomeController {
formVO.setSearchMonth(dailyRecord.getRecordMonth());
formVO.setGroupNo(dailyRecord.getGroupNo());
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
safeLogger.debug("formVO: {}", formVO);
dailyIncomePortIn.remove(formVO);
@@ -104,7 +107,7 @@ public class DailyIncomeController {
formVO.setSearchMonth(dailyRecord.getRecordMonth());
formVO.setGroupNo(dailyRecord.getGroupNo());
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
safeLogger.debug("formVO: {}", formVO);
dailyIncomePortIn.remove(formVO);
@@ -119,7 +122,7 @@ public class DailyIncomeController {
*/
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
log.debug("getRecordUIReq: {}", reqVO);
safeLogger.debug("getRecordUIReq: {}", reqVO);
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
if (dailyRecord == null || dailyRecord.getId() == null) {

View File

@@ -2,6 +2,7 @@ package app.module.front.usecase.daily.income.adapters.web;
import app.module.core.config.application.enums.DailySort;
import app.module.core.config.application.exception.NoRecordDataException;
import app.module.core.config.application.logging.SafeLogger;
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
@@ -10,8 +11,9 @@ import app.module.front.usecase.daily.income.adapters.web.model.DailyIncomeUIReq
import app.module.front.usecase.daily.income.ports.DailyIncomePortIn;
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@@ -22,11 +24,12 @@ import org.springframework.web.bind.annotation.RequestParam;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Controller
@RequiredArgsConstructor
@RequestMapping(path = "/record/income")
public class DailyIncomeUIController {
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(DailyIncomeUIController.class));
private final UICodeListPortIn uiCodeListPortIn;
private final DailyRecordPortIn dailyRecordPortIn;
private final DailyIncomePortIn dailyIncomePortIn;
@@ -48,7 +51,7 @@ public class DailyIncomeUIController {
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo, targetList);
DailyIncomeUIReqVO reqVO = new DailyIncomeUIReqVO(searchMonth, groupNo);
log.debug("reqVO: {}", reqVO);
safeLogger.debug("reqVO: {}", reqVO);
List<DailyIncomeDto> incomeList = dailyIncomePortIn.list(reqVO);
@@ -80,7 +83,7 @@ public class DailyIncomeUIController {
} else {
reqVO.setId(Long.parseLong(id));
}
log.debug("reqVO: {}", reqVO);
safeLogger.debug("reqVO: {}", reqVO);
DailyIncomeDto detail = new DailyIncomeDto();
if (reqVO.getId() != 0L) {
@@ -107,7 +110,7 @@ public class DailyIncomeUIController {
*/
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo, String targetList) {
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
log.debug("getRecordUIReq: {}", reqVO);
safeLogger.debug("getRecordUIReq: {}", reqVO);
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
if (dailyRecord == null || dailyRecord.getId() == null) {

View File

@@ -23,28 +23,28 @@ public class CreateDailyIncomeValidator implements Validator {
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"quantity", "valid.common.required",
"quantity", CommonConstants.VALID_CODE_NOTBLANK,
"수량을 입력해 주세요.");
}
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"unitCode", "valid.common.required",
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 선택해 주세요.");
}
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
errors.rejectValue(
"unitSelf", "valid.common.required",
"unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 입력해 주세요.");
}
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
errors.rejectValue(
"price", "valid.common.required",
"price", CommonConstants.VALID_CODE_NOTBLANK,
"현금 또는 현물평가액을 입력해 주세요.");
errors.rejectValue(
"estimatedValue", "valid.common.required",
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
"현금 또는 현물평가액을 입력해 주세요.");
}
}

View File

@@ -1,6 +1,7 @@
package app.module.front.usecase.daily.power.adapters.web;
import app.module.core.config.application.exception.NoRecordDataException;
import app.module.core.config.application.logging.SafeLogger;
import app.module.core.config.application.util.CoreUtil;
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
@@ -11,17 +12,19 @@ import app.module.front.usecase.daily.power.ports.DailyPowerPortIn;
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping(path = "/api/record/power")
public class DailyPowerController {
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(DailyPowerController.class));
private final CoreUtil coreUtil;
private final DailyRecordPortIn dailyRecordPortIn;
private final DailyPowerPortIn dailyPowerPortIn;
@@ -52,7 +55,7 @@ public class DailyPowerController {
formVO.setGroupNo(Integer.parseInt(groupNo));
formVO.setId(Long.parseLong(id));
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
safeLogger.debug("formVO: {}", formVO);
dailyPowerPortIn.create(formVO);
@@ -71,7 +74,7 @@ public class DailyPowerController {
ResponseEntity<?> remove(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
, @Valid @RequestBody RemoveDailyPowerReqVO formVO, BindingResult bindingResult) {
log.debug("before formVO: {}", formVO);
safeLogger.debug("before formVO: {}", formVO);
if (bindingResult.hasErrors()) {
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
.body(bindingResult.getFieldErrors());
@@ -82,7 +85,7 @@ public class DailyPowerController {
formVO.setSearchMonth(dailyRecord.getRecordMonth());
formVO.setGroupNo(dailyRecord.getGroupNo());
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
safeLogger.debug("formVO: {}", formVO);
dailyPowerPortIn.remove(formVO);
@@ -104,7 +107,7 @@ public class DailyPowerController {
formVO.setSearchMonth(dailyRecord.getRecordMonth());
formVO.setGroupNo(dailyRecord.getGroupNo());
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
safeLogger.debug("formVO: {}", formVO);
dailyPowerPortIn.remove(formVO);
@@ -119,7 +122,7 @@ public class DailyPowerController {
*/
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
log.debug("getRecordUIReq: {}", reqVO);
safeLogger.debug("getRecordUIReq: {}", reqVO);
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
if (dailyRecord == null || dailyRecord.getId() == null) {

View File

@@ -2,6 +2,7 @@ package app.module.front.usecase.daily.power.adapters.web;
import app.module.core.config.application.enums.DailySort;
import app.module.core.config.application.exception.NoRecordDataException;
import app.module.core.config.application.logging.SafeLogger;
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
import app.module.front.usecase.daily.power.adapters.persistence.model.DailyPowerDto;
@@ -9,7 +10,8 @@ import app.module.front.usecase.daily.power.adapters.web.model.DailyPowerUIReqVO
import app.module.front.usecase.daily.power.ports.DailyPowerPortIn;
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@@ -21,11 +23,12 @@ import org.thymeleaf.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Controller
@RequiredArgsConstructor
@RequestMapping(path = "/record/power")
public class DailyPowerUIController {
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(DailyPowerUIController.class));
private final DailyRecordPortIn dailyRecordPortIn;
private final DailyPowerPortIn dailyPowerPortIn;
@@ -46,7 +49,7 @@ public class DailyPowerUIController {
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo, targetList);
DailyPowerUIReqVO reqVO = new DailyPowerUIReqVO(searchMonth, groupNo);
log.debug("reqVO: {}", reqVO);
safeLogger.debug("reqVO: {}", reqVO);
List<DailyPowerDto> powerList = dailyPowerPortIn.list(reqVO);
@@ -77,7 +80,7 @@ public class DailyPowerUIController {
} else {
reqVO.setId(Long.parseLong(id));
}
log.debug("reqVO: {}", reqVO);
safeLogger.debug("reqVO: {}", reqVO);
DailyPowerDto detail = new DailyPowerDto();
if (reqVO.getId() != 0L) {
@@ -101,7 +104,7 @@ public class DailyPowerUIController {
*/
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo, String targetList) {
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
log.debug("getRecordUIReq: {}", reqVO);
safeLogger.debug("getRecordUIReq: {}", reqVO);
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
if (dailyRecord == null || dailyRecord.getId() == null) {

View File

@@ -1,5 +1,6 @@
package app.module.front.usecase.daily.power.adapters.web.validator;
import app.module.core.config.constants.CommonConstants;
import app.module.front.usecase.daily.power.adapters.web.model.CreateDailyPowerReqVO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
@@ -21,10 +22,10 @@ public class CreateDailyPowerValidator implements Validator {
if (vo.getOwnedHours() == null && vo.getLeasedHours() == null) {
errors.rejectValue(
"ownedHours", "valid.common.required",
"ownedHours", CommonConstants.VALID_CODE_NOTBLANK,
"자가 사용시간 또는 임차 사용시간을 입력해 주세요.");
errors.rejectValue(
"leasedHours", "valid.common.required",
"leasedHours", CommonConstants.VALID_CODE_NOTBLANK,
"자가 사용시간 또는 임차 사용시간을 입력해 주세요.");
}
}

View File

@@ -1,6 +1,7 @@
package app.module.front.usecase.daily.work.adapters.web;
import app.module.core.config.application.exception.NoRecordDataException;
import app.module.core.config.application.logging.SafeLogger;
import app.module.core.config.application.util.CoreUtil;
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
@@ -11,17 +12,19 @@ import app.module.front.usecase.daily.work.adapters.web.validator.CreateDailyWor
import app.module.front.usecase.daily.work.ports.DailyWorkPortIn;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping(path = "/api/record/work")
public class DailyWorkController {
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(DailyWorkController.class));
private final CoreUtil coreUtil;
private final DailyRecordPortIn dailyRecordPortIn;
private final DailyWorkPortIn dailyWorkPortIn;
@@ -53,7 +56,7 @@ public class DailyWorkController {
formVO.setGroupNo(Integer.parseInt(groupNo));
formVO.setId(Long.parseLong(id));
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
safeLogger.debug("formVO: {}", formVO);
dailyWorkPortIn.create(formVO);
@@ -73,7 +76,7 @@ public class DailyWorkController {
ResponseEntity<?> remove(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
, @Valid @RequestBody RemoveDailyWorkReqVO formVO, BindingResult bindingResult) {
log.debug("before formVO: {}", formVO);
safeLogger.debug("before formVO: {}", formVO);
if (bindingResult.hasErrors()) {
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
.body(bindingResult.getFieldErrors());
@@ -84,7 +87,7 @@ public class DailyWorkController {
formVO.setSearchMonth(dailyRecord.getRecordMonth());
formVO.setGroupNo(dailyRecord.getGroupNo());
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
safeLogger.debug("formVO: {}", formVO);
dailyWorkPortIn.remove(formVO);
@@ -107,7 +110,7 @@ public class DailyWorkController {
formVO.setSearchMonth(dailyRecord.getRecordMonth());
formVO.setGroupNo(dailyRecord.getGroupNo());
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
safeLogger.debug("formVO: {}", formVO);
dailyWorkPortIn.remove(formVO);
@@ -123,7 +126,7 @@ public class DailyWorkController {
*/
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
log.debug("getRecordUIReq: {}", reqVO);
safeLogger.debug("getRecordUIReq: {}", reqVO);
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
if (dailyRecord == null || dailyRecord.getId() == null) {

View File

@@ -2,6 +2,7 @@ package app.module.front.usecase.daily.work.adapters.web;
import app.module.core.config.application.enums.DailySort;
import app.module.core.config.application.exception.NoRecordDataException;
import app.module.core.config.application.logging.SafeLogger;
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
@@ -10,7 +11,8 @@ import app.module.front.usecase.daily.work.adapters.persistence.model.DailyWorkD
import app.module.front.usecase.daily.work.adapters.web.model.DailyWorkUIReqVO;
import app.module.front.usecase.daily.work.ports.DailyWorkPortIn;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@@ -22,11 +24,12 @@ import org.thymeleaf.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Controller
@RequiredArgsConstructor
@RequestMapping(path = "/record/work")
public class DailyWorkUIController {
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(DailyWorkUIController.class));
private final UICodeListPortIn uiCodeListPortIn;
private final DailyRecordPortIn dailyRecordPortIn;
private final DailyWorkPortIn dailyWorkPortIn;
@@ -48,7 +51,7 @@ public class DailyWorkUIController {
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo, targetList);
DailyWorkUIReqVO reqVO = new DailyWorkUIReqVO(searchMonth, groupNo);
log.debug("reqVO: {}", reqVO);
safeLogger.debug("reqVO: {}", reqVO);
List<DailyWorkDto> workList = dailyWorkPortIn.list(reqVO);
@@ -79,7 +82,7 @@ public class DailyWorkUIController {
} else {
reqVO.setId(Long.parseLong(id));
}
log.debug("reqVO: {}", reqVO);
safeLogger.debug("reqVO: {}", reqVO);
DailyWorkDto detail = new DailyWorkDto();
if (reqVO.getId() != 0L) {
@@ -107,7 +110,7 @@ public class DailyWorkUIController {
*/
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo, String targetList) {
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
log.debug("getRecordUIReq: {}", reqVO);
safeLogger.debug("getRecordUIReq: {}", reqVO);
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
if (dailyRecord == null || dailyRecord.getId() == null) {

View File

@@ -23,37 +23,37 @@ public class CreateDailyWorkValidator implements Validator {
if (vo.getWorkLandArea() == null && !StringUtils.isBlank(vo.getAreaUnitCode())) {
errors.rejectValue(
"workLandArea", "valid.common.required",
"workLandArea", CommonConstants.VALID_CODE_NOTBLANK,
"작업 면적을 입력해 주세요.");
}
if (vo.getWorkLandArea() != null && StringUtils.isBlank(vo.getAreaUnitCode())) {
errors.rejectValue(
"areaUnitCode", "valid.common.required",
"areaUnitCode", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 선택해 주세요.");
}
if (CommonConstants.AREA_CODE_OTHER.equals(vo.getAreaUnitCode()) && StringUtils.isBlank(vo.getAreaUnitSelf())) {
errors.rejectValue(
"areaUnitSelf", "valid.common.required",
"areaUnitSelf", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 입력해 주세요.");
}
if (vo.getHarvestQuantity() == null && !StringUtils.isBlank(vo.getHarvestUnitCode())) {
errors.rejectValue(
"harvestQuantity", "valid.common.required",
"harvestQuantity", CommonConstants.VALID_CODE_NOTBLANK,
"수확량을 입력해 주세요.");
}
if (vo.getHarvestQuantity() != null && StringUtils.isBlank(vo.getHarvestUnitCode())) {
errors.rejectValue(
"harvestUnitCode", "valid.common.required",
"harvestUnitCode", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 선택해 주세요.");
}
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getHarvestUnitCode()) && StringUtils.isBlank(vo.getHarvestUnitSelf())) {
errors.rejectValue(
"harvestUnitSelf", "valid.common.required",
"harvestUnitSelf", CommonConstants.VALID_CODE_NOTBLANK,
"단위를 입력해 주세요.");
}

View File

@@ -819,15 +819,16 @@
// 오늘 날짜가 해당 달의 마지막 날인지 확인
const today = new Date();
const lastDayOfMonth = new Date(viewDate.getFullYear(), viewDate.getMonth() + 1, 0); // 해당 달의 마지막 날
// 쿠키에서 마지막 alert 날짜 확인
const lastAlertDate = getCookie('lastAlertDate');
const todayDateString = today.toISOString().split('T')[0];
//const lastDayOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 0); // 해당 달의 마지막 날
const lastDayOfMonth = new Date(today.getFullYear(), today.getMonth(), 21); // TODO 삭제 테스트를 위해 22일로 수정
// 마지막 alert 날짜 확인
const lastAlertDate = sessionStorage.getItem('lastAlertDate');
const todayDateString = today.toDateString();
if (lastAlertDate !== todayDateString &&
today.getFullYear() === lastDayOfMonth.getFullYear() &&
today.getMonth() === lastDayOfMonth.getMonth() &&
today.getMonth() === lastDayOfMonth.getMonth() &&
today.getDate() === lastDayOfMonth.getDate()) {
ajaxUtil._ajaxSyncMethod(
ENV.httpUrl.alert.replace('{searchMonth}', searchMonth.replace('-', '')),
{},
@@ -862,6 +863,7 @@
message: msgTxt,
type:'alert',
callback: function () {
sessionStorage.setItem('lastAlertDate',lastDayOfMonth.toDateString());
},
});
}
@@ -879,20 +881,6 @@
},
};
// 쿠키 설정 함수
function setCookie(name, value, days) {
const expires = new Date();
expires.setTime(expires.getTime() + days * 24 * 60 * 60 * 1000);
document.cookie = `${name}=${value};expires=${expires.toUTCString()};path=/`;
}
// 쿠키 가져오기 함수
function getCookie(name) {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
return null;
}
</script>
<script id="dailyNoneTmpl" type="text/x-jsrender">
{{include tmpl="#titleTmpl" /}}