래퍼 타입을 기본 타입으로 만들 수 있음, 코드 스타일 이슈, 필드는 로컬 변수일 수 있습니다
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package app.module.admin.usecase.admin.checkAdminId.adapters.web;
|
||||
|
||||
import app.module.core.config.constants.CommonConstants;
|
||||
import app.module.core.usecase.admin.checkAdminId.ports.CheckAdminIdPortIn;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -15,15 +16,13 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
class AdminIdDuplicateCheckPostController {
|
||||
|
||||
private final CheckAdminIdPortIn checkAdminIdPortIn;
|
||||
private final String ID_REGEX = "^[a-zA-Z0-9가-힣_-]{4,15}$";
|
||||
private final String INVALID_ID_MSG = "아이디는 4~15자, 영문/숫자/한글/특수문자(_,-)만 가능합니다.";
|
||||
|
||||
@GetMapping("/api/settings/admin/idCheck")
|
||||
ResponseEntity<?> selectIdCheck(@RequestParam String id ) {
|
||||
if (!id.matches(ID_REGEX)) {
|
||||
if (!id.matches(CommonConstants.ADMIN_ID_REGEX)) {
|
||||
return ResponseEntity
|
||||
.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
.body(INVALID_ID_MSG);
|
||||
.body(CommonConstants.ADMIN_ID_MSG);
|
||||
}
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(checkAdminIdPortIn.connect(id));
|
||||
|
||||
@@ -2,19 +2,16 @@ package app.module.admin.usecase.admin.saveAdmin.adapters.web.validator;
|
||||
|
||||
import app.module.admin.usecase.admin.saveAdmin.adapters.web.model.AdminCreateBindingVO;
|
||||
import java.util.Optional;
|
||||
|
||||
import app.module.core.config.constants.CommonConstants;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.validation.ValidationUtils;
|
||||
import org.springframework.validation.Validator;
|
||||
|
||||
@Component
|
||||
public class AdminCreateValidator implements Validator {
|
||||
|
||||
// 아이디: 4~15자, 영문/숫자/한글/특수문자(_,-) 허용
|
||||
private final String ID_REGEX = "^[a-zA-Z0-9가-힣_-]{4,15}$";
|
||||
// 비밀번호: 5자, 숫자 + 특수문자(!@#$%_-) 1개 이상
|
||||
private final String PASSWORD_REGEX = "^(?=.*[0-9])(?=.*[!@#$%_\\-]).{5}$";
|
||||
|
||||
@Override
|
||||
public boolean supports(Class<?> clazz) {
|
||||
return AdminCreateBindingVO.class.equals(clazz);
|
||||
@@ -25,30 +22,30 @@ public class AdminCreateValidator implements Validator {
|
||||
AdminCreateBindingVO vo = (AdminCreateBindingVO) target;
|
||||
|
||||
// [1] 필수값 누락 체크
|
||||
if(vo.getRoleId() == null || vo.getRoleId().isEmpty()) {
|
||||
if(StringUtils.isBlank(vo.getRoleId())) {
|
||||
errors.rejectValue("roleId", "error.roleId", "필수입력항목을 확인해주세요.");
|
||||
return;
|
||||
}
|
||||
if(vo.getId() == null || vo.getId().isBlank()) {
|
||||
if(StringUtils.isBlank(vo.getId())) {
|
||||
errors.rejectValue("id", "error.id", "필수입력항목을 확인해주세요.");
|
||||
return;
|
||||
}
|
||||
if(vo.getPassword() == null || vo.getPassword().isBlank()) {
|
||||
if(StringUtils.isBlank(vo.getPassword())) {
|
||||
errors.rejectValue("password", "error.password", "필수입력항목을 확인해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 권한 조사원으로 선택했을 경우
|
||||
if(vo.getRoleId() != null && "ROLE_RESEARCHER".equals(vo.getRoleId())) {
|
||||
if(vo.getName() == null || vo.getName().isEmpty()) {
|
||||
if("ROLE_RESEARCHER".equals(vo.getRoleId())) {
|
||||
if(StringUtils.isBlank(vo.getName())) {
|
||||
errors.rejectValue("name", "error.name", "필수입력항목을 확인해주세요.");
|
||||
return;
|
||||
}
|
||||
if(vo.getPhone1() == null || vo.getPhone1().isBlank()) {
|
||||
if(StringUtils.isBlank(vo.getPhone1())) {
|
||||
errors.rejectValue("phone1", "error.phone1", "필수입력항목을 확인해주세요.");
|
||||
return;
|
||||
}
|
||||
if(vo.getPhone2() == null || vo.getPhone2().isBlank()) {
|
||||
if(StringUtils.isBlank(vo.getPhone2())) {
|
||||
errors.rejectValue("phone2", "error.phone2", "필수입력항목을 확인해주세요.");
|
||||
return;
|
||||
}
|
||||
@@ -83,9 +80,9 @@ public class AdminCreateValidator implements Validator {
|
||||
}
|
||||
|
||||
// [3] 비밀번호 형식 검사
|
||||
if (!vo.getPassword().matches(PASSWORD_REGEX)) {
|
||||
if (!vo.getPassword().matches(CommonConstants.ADMIN_PASSWORD_REGEX)) {
|
||||
errors.rejectValue("password", "valid.common.password.wrong",
|
||||
"비밀번호는 5자, 숫자 + 특수문자(!@#$%_-) 1개 이상입니다.");
|
||||
CommonConstants.ADMIN_PASSWORD_MSG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,5 +8,5 @@ import lombok.RequiredArgsConstructor;
|
||||
public enum BatchLogType {
|
||||
AUTO_SMS,
|
||||
MONTHLY_STATUS,
|
||||
CARRYOVER;
|
||||
CARRYOVER
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
|
||||
|
||||
Workbook workbook = WorkbookFactory.create(file.getInputStream());
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
Integer success = 0;
|
||||
int success = 0;
|
||||
|
||||
List<UICodeElement> RegionMainCodeList = uiCodeListMapper.findByParentId("code.region.main");
|
||||
List<UICodeElement> RegionSubCodeList = uiCodeListMapper.findByParentId("code.region.sub");
|
||||
|
||||
@@ -14,4 +14,26 @@ public class CommonConstants {
|
||||
* 작업 면적의 직접입력 코드
|
||||
*/
|
||||
public static final String AREA_CODE_OTHER = "code.record.area.self";
|
||||
|
||||
/**
|
||||
* 관리자 아이디 생성 규칙
|
||||
* [정책] 아이디: 4~15자, 영문/숫자/한글/특수문자(_,-) 허용
|
||||
*/
|
||||
public static final String ADMIN_ID_REGEX = "^[a-zA-Z0-9가-힣_-]{4,15}$";
|
||||
|
||||
/**
|
||||
* 관리자 아이디 유효성 실패 메시지
|
||||
*/
|
||||
public static final String ADMIN_ID_MSG = "아이디는 4~15자, 영문/숫자/한글/특수문자(_,-)만 가능합니다.";
|
||||
|
||||
/**
|
||||
* 관리자 비밀번호 생성 규칙
|
||||
* [정책] 비밀번호: 5자, 숫자 + 특수문자(!@#$%_-) 1개 이상
|
||||
*/
|
||||
public static final String ADMIN_PASSWORD_REGEX = "^[a-zA-Z0-9가-힣_-]{4,15}$";
|
||||
|
||||
/**
|
||||
* 관리자 비밀번호 유효성 실패 메시지
|
||||
*/
|
||||
public static final String ADMIN_PASSWORD_MSG = "비밀번호는 5자, 숫자 + 특수문자(!@#$%_-) 1개 이상입니다.";
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ public class FrontPublicAccess {
|
||||
|
||||
private static final FrontPublicAccess INSTANCE = new FrontPublicAccess();
|
||||
|
||||
private List<String> publicAccessURIs = new ArrayList<>();
|
||||
private final List<String> publicAccessURIs = new ArrayList<>();
|
||||
|
||||
private FrontPublicAccess() {
|
||||
}
|
||||
|
||||
@@ -69,30 +69,24 @@ public class DailyStatusUIController {
|
||||
@GetMapping(path = "/{step}/{searchMonth}")
|
||||
public String detail(Model model, @PathVariable("step") String step, @PathVariable("searchMonth") String searchMonth) {
|
||||
switch (DailySort.valueOf(step.toUpperCase())) {
|
||||
case INCOME -> {
|
||||
case INCOME ->
|
||||
processStep(model, DailySort.INCOME,
|
||||
dailyIncomePortIn.monthList(new DailyIncomeUIReqVO(searchMonth, "")));
|
||||
}
|
||||
case WORK -> {
|
||||
case WORK ->
|
||||
processStep(model, DailySort.WORK,
|
||||
dailyWorkPortIn.monthList(new DailyWorkUIReqVO(searchMonth, "")));
|
||||
}
|
||||
case EXPENSE -> {
|
||||
case EXPENSE ->
|
||||
processStep(model, DailySort.EXPENSE,
|
||||
dailyExpensePortIn.monthList(new DailyExpenseUIReqVO(searchMonth, "")));
|
||||
}
|
||||
case POWER -> {
|
||||
case POWER ->
|
||||
processStep(model, DailySort.POWER,
|
||||
dailyPowerPortIn.monthList(new DailyPowerUIReqVO(searchMonth, "")));
|
||||
}
|
||||
case FORESTRY -> {
|
||||
case FORESTRY ->
|
||||
processStep(model, DailySort.FORESTRY,
|
||||
dailyForestryPortIn.monthList(new DailyForestryUIReqVO(searchMonth, "")));
|
||||
}
|
||||
case FARMING -> {
|
||||
case FARMING ->
|
||||
processStep(model, DailySort.FARMING,
|
||||
dailyFarmingPortIn.monthList(new DailyFarmingUIReqVO(searchMonth, "")));
|
||||
}
|
||||
default -> throw new NoMatchingURIException("잘못된 접근");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user