Merge branch 'susu' into dev
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package app.module.admin.config.application.util.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class EnumDto {
|
||||
private String id;
|
||||
private String codeText;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package app.module.admin.usecase.admin.checkAdminId.adapters.web;
|
||||
|
||||
import app.module.core.usecase.admin.checkAdminId.ports.CheckAdminIdPortIn;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class AdminIdDuplicateCheckPostController {
|
||||
|
||||
private final CheckAdminIdPortIn checkAdminIdPortIn;
|
||||
|
||||
@GetMapping("/api/settings/admin/idCheck")
|
||||
ResponseEntity<?> updateMappingHousehold(@RequestParam String id ) {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(checkAdminIdPortIn.connect(id));
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,9 @@ class AdminExcelController {
|
||||
new GetAdminsCmd(
|
||||
adminListFilterVO.getSearchField(),
|
||||
adminListFilterVO.getSearchValue(),
|
||||
adminListFilterVO.getSearchRole()));
|
||||
adminListFilterVO.getSearchRole(),
|
||||
adminListFilterVO.getSearchArea(),
|
||||
adminListFilterVO.getSearchDisabled()));
|
||||
|
||||
if (CollectionUtils.isNotEmpty(listOutput.getContent())) {
|
||||
// Header
|
||||
|
||||
@@ -37,11 +37,14 @@ class AdminListController {
|
||||
new GetAdminsCmd(
|
||||
adminListFilterVO.getSearchField(),
|
||||
adminListFilterVO.getSearchValue(),
|
||||
adminListFilterVO.getSearchRole()));
|
||||
adminListFilterVO.getSearchRole(),
|
||||
adminListFilterVO.getSearchArea(),
|
||||
adminListFilterVO.getSearchDisabled()));
|
||||
|
||||
model.addAttribute("listOutput", listOutput);
|
||||
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
||||
model.addAttribute("pageRows", uiCodeListPortIn.connect("code.pageable.rows"));
|
||||
model.addAttribute("regionMainCode", uiCodeListPortIn.connect("code.region.main"));
|
||||
|
||||
return "admin/adminList";
|
||||
}
|
||||
|
||||
@@ -12,4 +12,6 @@ public class AdminListFilterVO {
|
||||
private String searchField;
|
||||
private String searchValue;
|
||||
private String searchRole;
|
||||
private String searchArea;
|
||||
private String searchDisabled;
|
||||
}
|
||||
|
||||
@@ -18,8 +18,10 @@ public class AdminCreateGetController {
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
|
||||
@GetMapping(path = "/settings/admins/create")
|
||||
String operate(Model model, @ModelAttribute("bindingVO") AdminCreateBindingVO bindingVO) {
|
||||
String operate(Model model) {
|
||||
|
||||
AdminCreateBindingVO bindingVO = new AdminCreateBindingVO();
|
||||
model.addAttribute("bindingVO", bindingVO);
|
||||
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
||||
model.addAttribute("regionMainCode", uiCodeListPortIn.connect("code.region.main"));
|
||||
|
||||
|
||||
@@ -9,49 +9,42 @@ import app.module.core.usecase.role.list.ports.RoleListPortIn;
|
||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.validation.ObjectError;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
@Controller
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class AdminCreatePostController {
|
||||
|
||||
private final RoleListPortIn roleListPortIn;
|
||||
private final MessageUtil messageUtil;
|
||||
private final SaveAdminPortIn savePortIn;
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
private final AdminCreateValidator adminCreateValidator;
|
||||
|
||||
@PostMapping(path = "/settings/admins/create")
|
||||
String operate(
|
||||
RedirectAttributes redirectAttributes,
|
||||
Model model,
|
||||
@Valid @ModelAttribute("bindingVO") AdminCreateBindingVO bindingVO,
|
||||
BindingResult bindingResult) {
|
||||
|
||||
@PostMapping(path = "/api/settings/admin/create")
|
||||
ResponseEntity<?> operate(@RequestBody AdminCreateBindingVO bindingVO, BindingResult bindingResult ) {
|
||||
adminCreateValidator.validate(bindingVO, bindingResult);
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
||||
model.addAttribute("regionMainCode", uiCodeListPortIn.connect("code.region.main"));
|
||||
return "admin/adminCreateForm";
|
||||
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
.body(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
||||
}
|
||||
|
||||
savePortIn.connect(
|
||||
bindingVO.getSeq(),
|
||||
bindingVO.getId(),
|
||||
bindingVO.getPassword(),
|
||||
bindingVO.getRegionMainCode(),
|
||||
bindingVO.getAccountDisabled(),
|
||||
bindingVO.getRoleIds());
|
||||
|
||||
redirectAttributes.addFlashAttribute(
|
||||
"operationMessage",
|
||||
messageUtil.getMessage("operation.settings.admin.created", bindingVO.getId()));
|
||||
|
||||
return "redirect:/settings/admins";
|
||||
return ResponseEntity.status(HttpStatus.OK).body(
|
||||
savePortIn.apiConnect(bindingVO.getSeq(),
|
||||
bindingVO.getId(),
|
||||
bindingVO.getPassword(),
|
||||
bindingVO.getName(),
|
||||
"010"+bindingVO.getPhone1()+bindingVO.getPhone2(),
|
||||
bindingVO.getRegionMainCode(),
|
||||
bindingVO.getAccountDisabled(),
|
||||
bindingVO.getRoleId()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,8 @@ class AdminUpdateGetController {
|
||||
output.getSeq(),
|
||||
output.getId(),
|
||||
null,
|
||||
output.getName(),
|
||||
output.getPhone(),
|
||||
output.getRegionMainCode(),
|
||||
output.getPasswordUpdatedAt(),
|
||||
output.getAccountDisabled(),
|
||||
|
||||
@@ -16,6 +16,8 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
class AdminUpdatePostController {
|
||||
@@ -40,13 +42,15 @@ class AdminUpdatePostController {
|
||||
return "admin/adminUpdateForm";
|
||||
}
|
||||
|
||||
saveAdminPortIn.connect(
|
||||
saveAdminPortIn.apiConnect(
|
||||
bindingVO.getSeq(),
|
||||
bindingVO.getId(),
|
||||
bindingVO.getUpdatePassword(),
|
||||
bindingVO.getName(),
|
||||
bindingVO.getPhone(),
|
||||
bindingVO.getRegionMainCode(),
|
||||
bindingVO.getAccountDisabled(),
|
||||
bindingVO.getRoleIds());
|
||||
bindingVO.getRoleIds().stream().collect(Collectors.joining()));
|
||||
|
||||
redirectAttributes.addFlashAttribute(
|
||||
"operationMessage",
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
package app.module.admin.usecase.admin.saveAdmin.adapters.web.model;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AdminCreateBindingVO {
|
||||
private Long seq;
|
||||
private String id;
|
||||
private String password;
|
||||
|
||||
private String name;
|
||||
private String phone1;
|
||||
private String phone2;
|
||||
private String regionMainCode;
|
||||
/* @NotBlank(message = "{valid.common.required}")
|
||||
@Pattern(
|
||||
regexp =
|
||||
@@ -24,6 +27,5 @@ public class AdminCreateBindingVO {
|
||||
|
||||
private Boolean accountDisabled;
|
||||
/* private Boolean accountLocked;*/
|
||||
private List<String> roleIds;
|
||||
private String regionMainCode;
|
||||
private String roleId;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ public class AdminUpdateBindingVO implements AuditOutput {
|
||||
"^[\\w!#$%&’*+/=?`{|}~^-]+(?:\\.[\\w!#$%&’*+/=?`{|}~^-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,6}$",
|
||||
message = "{valid.common.email.wrong}")
|
||||
private String email;*/
|
||||
private String name;
|
||||
private String phone;
|
||||
private String regionMainCode;
|
||||
|
||||
private LocalDateTime passwordUpdatedAt;
|
||||
|
||||
@@ -10,7 +10,10 @@ import org.springframework.validation.Validator;
|
||||
@Component
|
||||
public class AdminCreateValidator implements Validator {
|
||||
|
||||
private final String PASSWORD_REGEX = "^((?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%_\\-])\\S{6,15})$";
|
||||
// 아이디: 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) {
|
||||
@@ -21,25 +24,50 @@ public class AdminCreateValidator implements Validator {
|
||||
public void validate(Object target, Errors errors) {
|
||||
AdminCreateBindingVO vo = (AdminCreateBindingVO) target;
|
||||
|
||||
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "valid.common.required");
|
||||
if (vo.getRoleId() == null || vo.getRoleId().isEmpty()) {
|
||||
errors.rejectValue("roleId", "error.roleId", "권한을 선택해주세요.");
|
||||
}
|
||||
|
||||
if (vo.getAccountDisabled() == null ) {
|
||||
errors.rejectValue("accountDisabled", "error.accountDisabled", "사용여부를 선택해주세요.");
|
||||
}
|
||||
|
||||
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "id", "valid.common.required","아이디는 필수입력값입니다.");
|
||||
Optional.ofNullable(vo.getId())
|
||||
.filter(id -> !id.matches(ID_REGEX))
|
||||
.ifPresent(id -> errors.rejectValue("id", "valid.common.id.wrong","아이디를 4~15자, 영문/숫자/한글/특수문자(_,-) 입니다."));
|
||||
|
||||
// 비밀번호 유효성 검사
|
||||
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "valid.common.required","비밀번호는 필수입력값입니다.");
|
||||
|
||||
Optional.ofNullable(vo.getPassword())
|
||||
.filter(password -> !password.matches(PASSWORD_REGEX))
|
||||
.ifPresent(password -> errors.rejectValue("password", "valid.common.password.wrong"));
|
||||
|
||||
Optional.ofNullable(vo.getRoleIds())
|
||||
.filter(ids -> ids.size() < 1)
|
||||
.ifPresent(
|
||||
ids ->
|
||||
errors.rejectValue(
|
||||
"roleIds", "valid.common.required.size.min", new Object[]{1}, ""));
|
||||
.ifPresent(password -> errors.rejectValue("password", "valid.common.password.wrong","비밀번호는 5자, 숫자 + 특수문자(!@#$%_-) 1개 이상입니다."));
|
||||
|
||||
if (vo.getRoleId() != null && "ROLE_RESEARCHER".equals(vo.getRoleId())) {
|
||||
if (vo.getName() == null || vo.getName().isBlank()) {
|
||||
errors.rejectValue("name", "error.name", "이름을 입력해주세요.");
|
||||
}
|
||||
if (vo.getName().length() > 4) {
|
||||
errors.rejectValue("name", "error.name", "이름은 4자리까지 입력가능합니다.");
|
||||
}
|
||||
if (vo.getPhone1() == null || vo.getPhone1().isBlank()) {
|
||||
errors.rejectValue("phone1", "error.phone1", "전화번호 앞자리를 입력해주세요.");
|
||||
} else if (!vo.getPhone1().matches("^\\d{4}$")) {
|
||||
errors.rejectValue("phone1", "error.phone1", "전화번호 앞자리는 4자리 숫자여야 합니다.");
|
||||
}
|
||||
if (vo.getPhone2() == null || vo.getPhone2().isBlank()) {
|
||||
errors.rejectValue("phone2", "error.phone2", "전화번호 뒷자리를 입력해주세요.");
|
||||
} else if (!vo.getPhone2().matches("^\\d{4}$")) {
|
||||
errors.rejectValue("phone2", "error.phone2", "전화번호 뒷자리는 4자리 숫자여야 합니다.");
|
||||
}
|
||||
}
|
||||
// ROLE_ADMIN이 아닌 경우 regionMainCode null체크
|
||||
Optional.ofNullable(vo.getRoleIds())
|
||||
.filter(ids -> ids.stream().noneMatch(role -> role.equals("ROLE_ADMIN")))
|
||||
Optional.ofNullable(vo.getRoleId())
|
||||
.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","실사지역은 필수입력값입니다.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package app.module.admin.usecase.researcher.adpaters.persistence;
|
||||
|
||||
import app.module.admin.config.application.enums.ManagementType;
|
||||
import app.module.admin.config.application.util.model.EnumDto;
|
||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersHouseholdVisitPopUpDto;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.*;
|
||||
import app.module.admin.usecase.researcher.getPopupHouseholds.adapters.persistence.GetPopupHouseholdsMapper;
|
||||
import app.module.admin.usecase.researcher.getPopupHouseholds.ports.application.domain.GetPopupHouseholds;
|
||||
import app.module.admin.usecase.researcher.getPopupHouseholds.ports.application.domain.GetPopupHouseholdsCmd;
|
||||
@@ -8,10 +12,7 @@ import app.module.admin.usecase.researcher.adpaters.persistence.model.Researcher
|
||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersHouseholdVisitDto;
|
||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersMappingHouseholdDto;
|
||||
import app.module.admin.usecase.researcher.ports.ResearcherPortOut;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.HouseholdSearchReqVO;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.MappingHouseholdListReqVO;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersDetailReqVO;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersListReqVO;
|
||||
import app.module.core.config.application.annotation.UpdateCommand;
|
||||
import app.module.core.config.application.util.CommonUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -21,6 +22,7 @@ import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@@ -28,7 +30,6 @@ import java.util.List;
|
||||
@RequiredArgsConstructor
|
||||
public class ResearcherDao implements ResearcherPortOut {
|
||||
private final ResearcherMapper researcherMapper;
|
||||
private final GetPopupHouseholdsMapper getPopupHouseholdsMapper;
|
||||
|
||||
@Override
|
||||
public Page<ResearchersDto> list(ResearchersListReqVO reqVO) {
|
||||
@@ -61,6 +62,21 @@ public class ResearcherDao implements ResearcherPortOut {
|
||||
return new PageImpl<>(result, pageable, total);
|
||||
}
|
||||
|
||||
@Override
|
||||
@UpdateCommand
|
||||
public Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO) {
|
||||
return researcherMapper.updateVisitHousehold(reqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResearchersHouseholdVisitPopUpDto visitHouseholdDetail(Integer id) {
|
||||
ResearchersHouseholdVisitDto result = researcherMapper.visitHouseholdDetail(id);
|
||||
List<EnumDto> managementTypeList = Arrays.stream(ManagementType.values())
|
||||
.map(type -> new EnumDto(type.name(), type.getDesc()))
|
||||
.toList();
|
||||
return new ResearchersHouseholdVisitPopUpDto(result, managementTypeList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer visitHouseholdDelete(List<Integer> selectIds) {
|
||||
String deletedBy = CommonUtil.getLoginUsername();
|
||||
|
||||
@@ -5,6 +5,7 @@ import app.module.admin.usecase.researcher.adpaters.persistence.model.Researcher
|
||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersMappingHouseholdDto;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersDetailReqVO;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersListReqVO;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersVisitDetailReqVO;
|
||||
import app.module.admin.usecase.researcher.getPopupHouseholds.ports.application.domain.GetPopupHouseholds;
|
||||
import app.module.admin.usecase.researcher.getPopupHouseholds.ports.application.domain.GetPopupHouseholdsCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -22,9 +23,12 @@ public interface ResearcherMapper {
|
||||
List<ResearchersMappingHouseholdDto> mappingHouseholdList(ResearchersDetailReqVO reqVO);
|
||||
Long mappingHouseholdListCountAll(ResearchersDetailReqVO reqVO);
|
||||
List<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO);
|
||||
ResearchersHouseholdVisitDto visitHouseholdDetail(Integer id);
|
||||
Long visitHouseholdListCountAll(ResearchersDetailReqVO reqVO);
|
||||
Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO);
|
||||
Integer visitHouseholdDelete(@Param("selectIds") List<Integer> selectIds,@Param("deletedBy") String deletedBy);
|
||||
void deleteHouseholdResearcherMapping(@Param("researcherSeq") Integer researcherSeq, @Param("householdSeq") Integer householdSeq, @Param("deletedBy") String deletedBy);
|
||||
Integer insertHouseholdResearcherMapping(@Param("researcherSeq") Integer researcherSeq, @Param("householdSeq") Integer householdSeq, @Param("createdBy") String createdBy);
|
||||
List<GetPopupHouseholds> getPopupHouseholds(@Param("pageable") Pageable pageable, @Param("cmd") GetPopupHouseholdsCmd cmd);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package app.module.admin.usecase.researcher.adpaters.persistence.model;
|
||||
|
||||
import app.module.admin.config.application.util.model.EnumDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class ResearchersHouseholdVisitPopUpDto {
|
||||
private ResearchersHouseholdVisitDto researchersHouseholdVisitDto;
|
||||
private List<EnumDto> managementTypeList;
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
package app.module.admin.usecase.researcher.adpaters.web;
|
||||
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.HouseholdSearchReqVO;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.MappingHouseholdListReqVO;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersDetailReqVO;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersListReqVO;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.*;
|
||||
import app.module.admin.usecase.researcher.ports.ResearcherPortIn;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -30,11 +27,21 @@ class ResearcherApiController {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(researcherPortIn.mappingHouseholdList(reqVO));
|
||||
}
|
||||
|
||||
@GetMapping(path = "/visitHouseholdList")
|
||||
@GetMapping(path = "/visitHousehold/list")
|
||||
ResponseEntity<?> visitHouseholdList( @ModelAttribute ResearchersDetailReqVO reqVO) {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(researcherPortIn.visitHouseholdList(reqVO));
|
||||
}
|
||||
|
||||
@PostMapping(path = "/visitHousehold")
|
||||
ResponseEntity<?> updateVisitHousehold(@RequestBody ResearchersVisitDetailReqVO reqVO) {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(researcherPortIn.updateVisitHousehold(reqVO));
|
||||
}
|
||||
|
||||
@GetMapping(path = "/visitHousehold/{id}")
|
||||
ResponseEntity<?> visitHouseholdDetail( @PathVariable Integer id) {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(researcherPortIn.visitHouseholdDetail(id));
|
||||
}
|
||||
|
||||
@DeleteMapping(path = "/visitHousehold/remove")
|
||||
ResponseEntity<?> visitHouseholdDelete( @RequestBody List<Integer> selectIds) {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(researcherPortIn.visitHouseholdDelete(selectIds));
|
||||
|
||||
@@ -40,4 +40,6 @@ class ResearcherController {
|
||||
return "researcher/detail";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package app.module.admin.usecase.researcher.adpaters.web.model;
|
||||
|
||||
import app.module.admin.config.application.enums.ManagementType;
|
||||
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class ResearchersVisitDetailReqVO {
|
||||
private String id;
|
||||
private String visitDate;
|
||||
private ManagementType managementType;
|
||||
private String content;
|
||||
private String isGiftSentFlag;
|
||||
}
|
||||
@@ -2,11 +2,9 @@ package app.module.admin.usecase.researcher.ports;
|
||||
|
||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersDto;
|
||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersHouseholdVisitDto;
|
||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersHouseholdVisitPopUpDto;
|
||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersMappingHouseholdDto;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.HouseholdSearchReqVO;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.MappingHouseholdListReqVO;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersDetailReqVO;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersListReqVO;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.*;
|
||||
import app.module.admin.usecase.researcher.getPopupHouseholds.ports.application.domain.GetPopupHouseholds;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
@@ -17,6 +15,8 @@ public interface ResearcherPortIn {
|
||||
ResearchersDto detail(Integer adminSeq);
|
||||
Page<ResearchersMappingHouseholdDto> mappingHouseholdList(ResearchersDetailReqVO reqVO);
|
||||
Page<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO);
|
||||
Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO);
|
||||
ResearchersHouseholdVisitPopUpDto visitHouseholdDetail(Integer id);
|
||||
Integer visitHouseholdDelete(List<Integer> selectIds);
|
||||
Page<GetPopupHouseholds> searchMappingHousehold(HouseholdSearchReqVO reqVO);
|
||||
Integer updateMappingHousehold(MappingHouseholdListReqVO reqVO);
|
||||
|
||||
@@ -2,11 +2,9 @@ package app.module.admin.usecase.researcher.ports;
|
||||
|
||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersDto;
|
||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersHouseholdVisitDto;
|
||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersHouseholdVisitPopUpDto;
|
||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersMappingHouseholdDto;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.HouseholdSearchReqVO;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.MappingHouseholdListReqVO;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersDetailReqVO;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersListReqVO;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.*;
|
||||
import app.module.admin.usecase.researcher.getPopupHouseholds.ports.application.domain.GetPopupHouseholds;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
@@ -17,6 +15,8 @@ public interface ResearcherPortOut {
|
||||
ResearchersDto detail(Integer adminSeq);
|
||||
Page<ResearchersMappingHouseholdDto> mappingHouseholdList(ResearchersDetailReqVO reqVO);
|
||||
Page<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO);
|
||||
Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO);
|
||||
ResearchersHouseholdVisitPopUpDto visitHouseholdDetail(Integer id);
|
||||
Integer visitHouseholdDelete(List<Integer> selectIds);
|
||||
Page<GetPopupHouseholds> searchMappingHousehold(HouseholdSearchReqVO reqVO);
|
||||
Integer updateMappingHousehold(MappingHouseholdListReqVO reqVO);
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package app.module.admin.usecase.researcher.ports.application;
|
||||
|
||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersHouseholdVisitPopUpDto;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.*;
|
||||
import app.module.admin.usecase.researcher.getPopupHouseholds.ports.application.domain.GetPopupHouseholds;
|
||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersDto;
|
||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersHouseholdVisitDto;
|
||||
import app.module.admin.usecase.researcher.adpaters.persistence.model.ResearchersMappingHouseholdDto;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.HouseholdSearchReqVO;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.MappingHouseholdListReqVO;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersDetailReqVO;
|
||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersListReqVO;
|
||||
import app.module.admin.usecase.researcher.ports.ResearcherPortIn;
|
||||
import app.module.admin.usecase.researcher.ports.ResearcherPortOut;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -25,26 +23,42 @@ class ResearcherService implements ResearcherPortIn {
|
||||
public Page<ResearchersDto> list(ResearchersListReqVO reqVO){
|
||||
return portOut.list(reqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResearchersDto detail(Integer adminSeq){
|
||||
return portOut.detail(adminSeq);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ResearchersMappingHouseholdDto> mappingHouseholdList(ResearchersDetailReqVO reqVO){
|
||||
return portOut.mappingHouseholdList(reqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ResearchersHouseholdVisitDto> visitHouseholdList(ResearchersDetailReqVO reqVO){
|
||||
return portOut.visitHouseholdList(reqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO) {
|
||||
return portOut.updateVisitHousehold(reqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResearchersHouseholdVisitPopUpDto visitHouseholdDetail(Integer id) {
|
||||
return portOut.visitHouseholdDetail(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer visitHouseholdDelete(List<Integer> selectIds){
|
||||
return portOut.visitHouseholdDelete(selectIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<GetPopupHouseholds> searchMappingHousehold(HouseholdSearchReqVO reqVO){
|
||||
return portOut.searchMappingHousehold(reqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer updateMappingHousehold(MappingHouseholdListReqVO reqVO){
|
||||
return portOut.updateMappingHousehold(reqVO);
|
||||
|
||||
@@ -148,8 +148,31 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="visitHouseholdDetail">
|
||||
select
|
||||
rhv.id,
|
||||
rhv.household_seq,
|
||||
rhv.visit_date,
|
||||
rhv.content,
|
||||
rhv.management_type,
|
||||
rhv.is_gift_sent as is_gift_sent_flag,
|
||||
rhv.created_at
|
||||
from household_visit rhv
|
||||
where rhv.is_deleted = false and rhv.id = #{id}
|
||||
</select>
|
||||
|
||||
<update id="updateVisitHousehold">
|
||||
update household_visit
|
||||
set visit_date = #{visitDate},
|
||||
content = #{content},
|
||||
management_type = #{managementType},
|
||||
is_gift_sent = #{isGiftSent},
|
||||
<include refid="common.fields.UpdateBaseSet" />
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="visitHouseholdDelete">
|
||||
update researcher_household_visit
|
||||
update household_visit
|
||||
set is_deleted = true,
|
||||
deleted_at = NOW(),
|
||||
deleted_by = #{deletedBy}
|
||||
|
||||
@@ -7,27 +7,28 @@
|
||||
<form
|
||||
method="post"
|
||||
th:action="@{/settings/admins/create}"
|
||||
th:object="${bindingVO}">
|
||||
th:object="${bindingVO}"
|
||||
name="adminCreateForm">
|
||||
|
||||
<table class="type-form">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><label for="roleIds">권한<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
<th><label for="roleId">권한<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
<td>
|
||||
<div class="d-flex">
|
||||
<div class="component-input">
|
||||
<div class="component-select">
|
||||
<select class="select-list" id="roleIds"
|
||||
th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
|
||||
th:field="*{roleIds}"
|
||||
<select class="select-list" id="roleId"
|
||||
th:classappend="${#fields.hasErrors('roleId')} ? 'is-invalid'"
|
||||
th:field="*{roleId}"
|
||||
onchange="onRoleChange(this);">
|
||||
<option value="">선택</option>
|
||||
<option th:each="role : ${roles}" th:text="${role.description}"
|
||||
th:value="${role.id}"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
|
||||
th:if="${#fields.hasErrors('roleIds')}">
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{roleId}"
|
||||
th:if="${#fields.hasErrors('roleId')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
@@ -40,13 +41,18 @@
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input id="id"
|
||||
name="id"
|
||||
th:classappend="${#fields.hasErrors('id')} ? 'is-invalid'"
|
||||
th:field="*{id}"/>
|
||||
<button type="button" class="btn btn-primary" onclick="adminIdCheckDuplicate();">
|
||||
<span class="btn-txt">중복확인</span>
|
||||
</button>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{id}"
|
||||
th:if="${#fields.hasErrors('id')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
<span>4~15자 / 영문,숫자,한글 가능/ 특수문자 _,- 사용가능</span>
|
||||
</div>
|
||||
</td>
|
||||
<th><label for="password">Password<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
@@ -61,11 +67,51 @@
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
<span>총 5자 / 숫자 + 특수문자 1개 이상 (!,@,#,$,%,_,-)</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="researcherArea"
|
||||
th:classappend="${bindingVO.roleId == 'ROLE_LOCAL_INSPECTOR'} ? 'd-none'">
|
||||
<th><label for="name">이름<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input id="name" type="text" name="name"
|
||||
th:classappend="${#fields.hasErrors('name')} ? 'is-invalid'"
|
||||
th:field="*{name}"/>
|
||||
<div class="invalid-feedback fw-bold"
|
||||
th:if="${#fields.hasErrors('name')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<th><label for="name">전화번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
<td>
|
||||
010-
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input id="phone1" name="phone1" type="number" maxlength="4" th:field="*{phone1}"
|
||||
th:classappend="${#fields.hasErrors('name')} ? 'is-invalid'"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input id="phone2" name="phone2" type="number" maxlength="4" th:field="*{phone2}"
|
||||
th:classappend="${#fields.hasErrors('name')} ? 'is-invalid'"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="invalid-feedback fw-bold"
|
||||
th:if="${#fields.hasErrors('phone1')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="regionMainCodeArea"
|
||||
th:classappend="${#lists.isEmpty(bindingVO.roleIds) or #lists.contains(bindingVO.roleIds, 'ROLE_ADMIN')} ? 'd-none'">
|
||||
th:classappend="${bindingVO.roleId != 'ROLE_ADMIN'} ? 'd-none'">
|
||||
<th><label for="regionMainCode">실사<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
<td>
|
||||
<div class="component-select">
|
||||
@@ -118,7 +164,7 @@
|
||||
<button type="button" class="btn btn-secondary" onclick="gotoList();return false;">
|
||||
<span class="btn-txt">목록으로 이동</span>
|
||||
</button>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<button type="button" class="btn btn-primary" onclick="createAdmin();">
|
||||
<span class="btn-txt">저장</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -137,14 +183,71 @@
|
||||
}
|
||||
|
||||
$(document).ready(() => {
|
||||
const roleSelect = document.getElementById('roleIds');
|
||||
const roleSelect = document.getElementById('roleId');
|
||||
onRoleChange(roleSelect);
|
||||
|
||||
});
|
||||
const onRoleChange = (el) => {
|
||||
const selectedValues = Array.from(el.selectedOptions).map(option => option.value);
|
||||
const isAdmin = !selectedValues.length || selectedValues.includes('ROLE_ADMIN');
|
||||
const idResearcher = !selectedValues.length || selectedValues.includes('ROLE_RESEARCHER');
|
||||
$('.regionMainCodeArea').toggle(!isAdmin);
|
||||
$('.researcherArea').toggle(idResearcher);
|
||||
};
|
||||
|
||||
let checkDuplicate = false;
|
||||
|
||||
const adminIdCheckDuplicate = () => {
|
||||
const f = document.adminCreateForm;
|
||||
if (!f.id.value) {
|
||||
alert("아이디를 입력해주세요.");
|
||||
return;
|
||||
}
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/settings/admin/idCheck',
|
||||
{ id : f.id.value },
|
||||
function(response) { // 성공
|
||||
const message = response > 0
|
||||
? "이미 사용하고 있는 아이디 입니다. 아이디를 입력해주세요."
|
||||
: "사용 가능한 아이디입니다.";
|
||||
alert(message);
|
||||
checkDuplicate = response <= 0;
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.log("error : ", code);
|
||||
if(code == 400) alert("아이디를 입력해주세요.");
|
||||
},
|
||||
'get',
|
||||
'json'
|
||||
);
|
||||
}
|
||||
const createAdmin = () => {
|
||||
if (!checkDuplicate) {
|
||||
alert("아이디 중복 확인을 해주세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
const f = document.adminCreateForm;
|
||||
let dataOj = $(f).serializeObject();
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/settings/admin/create',
|
||||
JSON.stringify(dataOj),
|
||||
function(response) { // 성공
|
||||
alert("등록이 완료되었습니다.");
|
||||
location.href = '/settings/admins';
|
||||
},
|
||||
function (code, rstData) {
|
||||
if(code == 422) alert(rstData.responseText);
|
||||
if(code == 200 ){
|
||||
alert("등록이 완료되었습니다.");
|
||||
location.href = '/settings/admins';
|
||||
}
|
||||
},
|
||||
'post',
|
||||
'json'
|
||||
);
|
||||
}
|
||||
</script>
|
||||
</th:block>
|
||||
|
||||
|
||||
@@ -17,14 +17,26 @@
|
||||
<div class="form-area">
|
||||
<div class="input-group">
|
||||
<div class="input-label">
|
||||
<p class="label-txt"><label for="searchField">검색필드</label></p>
|
||||
<p class="label-txt">권한</p>
|
||||
</div>
|
||||
<div class="component-select">
|
||||
<select class="select-list" id="searchRole" th:field="*{searchRole}">
|
||||
<option selected value="">전체</option>
|
||||
<option th:each="role : ${roles}" th:text="${role.description}"
|
||||
th:value="${role.id}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<div class="input-label">
|
||||
<p class="label-txt"><label for="searchField">정보</label></p>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<div class="component-select">
|
||||
<select class="select-list" id="searchField" th:field="*{searchField}">
|
||||
<option selected value="">선택</option>
|
||||
<option selected value="">전체</option>
|
||||
<option value="id">ID</option>
|
||||
<option value="email">Email</option>
|
||||
<option value="name">이름</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="component-input">
|
||||
@@ -38,13 +50,25 @@
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<div class="input-label">
|
||||
<p class="label-txt">권한</p>
|
||||
<p class="label-txt">실사</p>
|
||||
</div>
|
||||
<div class="component-select">
|
||||
<select class="select-list" id="searchRole" th:field="*{searchRole}">
|
||||
<select class="select-list" id="searchArea" th:field="*{searchArea}">
|
||||
<option selected value="">전체</option>
|
||||
<option th:each="role : ${roles}" th:text="${role.id}"
|
||||
th:value="${role.id}"></option>
|
||||
<option th:each="region : ${regionMainCode}" th:text="${region.codeText}"
|
||||
th:value="${region.id}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<div class="input-label">
|
||||
<p class="label-txt">계정사용여부</p>
|
||||
</div>
|
||||
<div class="component-select">
|
||||
<select class="select-list" id="searchDisabled" th:field="*{searchDisabled}">
|
||||
<option selected value="">전체</option>
|
||||
<option value="false">사용</option>
|
||||
<option value="true">미사용</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -123,11 +147,11 @@
|
||||
</section>
|
||||
|
||||
<section layout:fragment="script">
|
||||
<script th:inline="javascript">
|
||||
<!-- <script th:inline="javascript">
|
||||
// 목록 정렬 표기 및 갱신 기능 적용
|
||||
uiUtil.applyListSortNotation([[${listOutput.pageable.pageSize}]],
|
||||
[[${listOutput.pageable.sort.toString()}]]);
|
||||
</script>
|
||||
</script>-->
|
||||
|
||||
<script th:inline="javascript">
|
||||
// 검색
|
||||
@@ -146,6 +170,8 @@
|
||||
f.searchField.value = '';
|
||||
f.searchValue.value = '';
|
||||
f.searchRole.value = '';
|
||||
f.searchArea.value = '';
|
||||
f.searchDisabled.value = '';
|
||||
}
|
||||
|
||||
// 수정페이지 이동
|
||||
|
||||
@@ -57,6 +57,47 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="researcherArea"
|
||||
th:classappend="${#lists.isEmpty(bindingVO.roleIds) or #lists.contains(bindingVO.roleIds, 'ROLE_LOCAL_INSPECTOR')} ? 'd-none'">
|
||||
<th><label for="name">이름<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input id="name" type="text" name="name"
|
||||
th:classappend="${#fields.hasErrors('name')} ? 'is-invalid'"
|
||||
th:field="*{name}"/>
|
||||
<div class="invalid-feedback fw-bold"
|
||||
th:if="${#fields.hasErrors('name')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<th><label for="name">전화번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
<td>
|
||||
010-
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input id="phone1" name="phone1" type="number" maxlength="4"
|
||||
th:value="${bindingVO.phone != null ? bindingVO.phone.substring(3, 7) : ''}"
|
||||
th:classappend="${#fields.hasErrors('phone')} ? 'is-invalid'"/>
|
||||
</div>
|
||||
</div>
|
||||
-
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input id="phone2" name="phone2" type="number" maxlength="4"
|
||||
th:value="${bindingVO.phone != null ? bindingVO.phone.substring(7, 11) : ''}"
|
||||
th:classappend="${#fields.hasErrors('phone')} ? 'is-invalid'"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="invalid-feedback fw-bold"
|
||||
th:if="${#fields.hasErrors('phone')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
<input type="hidden" name="phone" id="phone" th:field="*{phone}"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="regionMainCodeArea"
|
||||
th:classappend="${#lists.isEmpty(bindingVO.roleIds) or #lists.contains(bindingVO.roleIds, 'ROLE_ADMIN')} ? 'd-none'">
|
||||
<th><label for="regionMainCode">실사<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
@@ -137,12 +178,7 @@
|
||||
<th:block layout:fragment="script">
|
||||
<script th:inline="javascript">
|
||||
function gotoList() {
|
||||
if (document.prevAdminParamForm) {
|
||||
const f = document.prevAdminParamForm;
|
||||
f.submit();
|
||||
} else {
|
||||
location.href = '/settings/admins';
|
||||
}
|
||||
location.href = '/settings/admins';
|
||||
}
|
||||
|
||||
$(document).ready(() => {
|
||||
@@ -156,12 +192,26 @@
|
||||
if (roleSelect) {
|
||||
onRoleChange(roleSelect);
|
||||
}
|
||||
|
||||
$('form').on('submit', function() {
|
||||
const phone1 = $('#phone1').val();
|
||||
const phone2 = $('#phone2').val();
|
||||
if (phone1 && phone2) {
|
||||
$('#phone').val('010' + phone1 + phone2);
|
||||
} else {
|
||||
$('#phone').val('');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
const onRoleChange = (el) => {
|
||||
const isAdmin = el.value === 'ROLE_ADMIN' || !el.value;
|
||||
const idResearcher = el.value === 'ROLE_RESEARCHER' || !el.value;
|
||||
$('.regionMainCodeArea').toggle(!isAdmin);
|
||||
$('.researcherArea').toggle(idResearcher);
|
||||
};
|
||||
|
||||
</script>
|
||||
</th:block>
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@
|
||||
};
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/researcher/visitHouseholdList',
|
||||
'/api/researcher/visitHousehold/list',
|
||||
dataObj,
|
||||
function (response) {
|
||||
$('#household-visit-totalElements').text(response.totalElements);
|
||||
@@ -268,10 +268,10 @@
|
||||
<tr data-id="${ct.id}">
|
||||
<td>
|
||||
<label>
|
||||
<input class="form-check-input" name="selectIds" type="checkbox" value="${ct.seq}"/>
|
||||
<input class="form-check-input" name="selectIds" type="checkbox" value="${ct.id}"/>
|
||||
</label>
|
||||
</td>
|
||||
<td class="underline"><a href="#" onclick="showHouseholdModal2(${ct.seq});">${ct.householdNum}</a></td>
|
||||
<td class="underline"><a href="#" onclick="showHouseholdModal2(${ct.id});">${ct.householdNum}</a></td>
|
||||
<td>${ct.ownerName}</td>
|
||||
<td>${ct.visitDate}</td>
|
||||
<td>${ct.managementType}</td>
|
||||
|
||||
@@ -13,56 +13,63 @@
|
||||
<div class="modal-content">
|
||||
<div class="modal-content-inner">
|
||||
<section>
|
||||
<table class="type-form confirm" th:object="${researcherDto}" >
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>방문일</th>
|
||||
<td>
|
||||
<span th:text="*{id}"></span>
|
||||
</td>
|
||||
<th>관리분야</th>
|
||||
<td>
|
||||
<span th:text="*{name}"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>내용</th>
|
||||
<td>
|
||||
<span th:text="*{regionMainCodeName}"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>답례품 전달</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<label class="radio-inner">
|
||||
<input type="radio" id="radio_status_keep" name="survey_status">
|
||||
<span class="radio-item">
|
||||
<span class="radio-txt">전달</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="component-input">
|
||||
<label class="radio-inner">
|
||||
<input type="radio" id="radio_status_drop" name="survey_status">
|
||||
<span class="radio-item">
|
||||
<span class="radio-txt">미전달</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<form autocomplete="off" method="get" name="householdVisitReqForm" >
|
||||
<input type="hidden" name="id" id="id" />
|
||||
<table class="type-form confirm" >
|
||||
<tbody id="household-visit-detail">
|
||||
<tr>
|
||||
<th>방문일</th>
|
||||
<td>
|
||||
<input id="visitDate" class="flatpickr" name="visitDate" type="text" placeholder="방문일을 선택하세요"/>
|
||||
</td>
|
||||
<th>관리분야</th>
|
||||
<td>
|
||||
<select id="managementType" name="managementType">
|
||||
<option value="">선택하세요</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>내용</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-textarea-field">
|
||||
<textarea id="content" name="content" class="textarea" placeholder=""></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>답례품 전달</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<label class="radio-inner">
|
||||
<input type="radio" id="is_gift_sent_y" name="isGiftSent">
|
||||
<span class="radio-item">
|
||||
<span class="radio-txt">전달</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="component-input">
|
||||
<label class="radio-inner">
|
||||
<input type="radio" id="is_gift_sent_n" name="isGiftSent">
|
||||
<span class="radio-item">
|
||||
<span class="radio-txt">미전달</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- 등록 버튼 -->
|
||||
<div class="component-btns bottom-btn-group" th:fragment="modalButtons">
|
||||
<div class="btns-row align-right">
|
||||
<button type="button" class="btn btn-primary" onclick="registerHouseholds()">
|
||||
<span class="btn-txt">등록</span>
|
||||
<button type="button" class="btn btn-primary" onclick="updateHouseholdVisit()">
|
||||
<span class="btn-txt">수정</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
<button class="modal-close" onclick="closeModal()"></button>
|
||||
@@ -70,17 +77,131 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<section layout:fragment="script">
|
||||
<script th:inline="javascript">
|
||||
let visitDatePicker;
|
||||
|
||||
<script th:inline="javascript">
|
||||
const showHouseholdModal2 = (seq) => {
|
||||
console.log(seq);
|
||||
document.querySelector(".modal02").ui.open();
|
||||
document.getElementById('visitDate').addEventListener('change', function (e) {
|
||||
console.log("날짜 변경됨:", e.target.value);
|
||||
});
|
||||
|
||||
const showHouseholdModal2 = (seq) => {
|
||||
document.querySelector(".modal02").ui.open();
|
||||
initFlatpickr();
|
||||
|
||||
};
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/researcher/visitHousehold/'+seq,
|
||||
null,
|
||||
function (response) {
|
||||
const managementTypeList =response.managementTypeList;
|
||||
if (managementTypeList.length > 0) {
|
||||
// select 박스에 managementTypeList 옵션 추가
|
||||
populateManagementType(managementTypeList);
|
||||
}
|
||||
const data = response.researchersHouseholdVisitDto;
|
||||
setFormData(data);
|
||||
},
|
||||
function (code, rstData) {
|
||||
},
|
||||
'get',
|
||||
'json',
|
||||
null
|
||||
);
|
||||
};
|
||||
|
||||
const setFormData = (data) => {
|
||||
// 폼 필드에 데이터 세팅
|
||||
const f = document.householdVisitReqForm;
|
||||
if (data.visitDate) {
|
||||
const visitDate = data.visitDate.substring(0, 10); // 'YYYY-MM-DD' 형식
|
||||
if (visitDatePicker) {
|
||||
f.visitDate.value = visitDate; // 입력 필드 먼저 설정
|
||||
visitDatePicker.setDate(visitDate); // Flatpickr 동기화
|
||||
}
|
||||
}
|
||||
if (data.managementType) {
|
||||
f.managementType.value= data.managementType;
|
||||
}
|
||||
f.content.value = data.content;
|
||||
f.id.value = data.id;
|
||||
const isGift = data.isGiftSentFlag;
|
||||
if (isGift === "t") {
|
||||
document.getElementById('is_gift_sent_y').checked = true;
|
||||
} else if (isGift === "f") {
|
||||
document.getElementById('is_gift_sent_n').checked = true;
|
||||
}
|
||||
};
|
||||
|
||||
const populateManagementType = (managementTypeList) => {
|
||||
const select = document.getElementById('managementType');
|
||||
select.innerHTML = '<option value="">선택하세요</option>'; // 초기화
|
||||
managementTypeList.forEach(item => {
|
||||
const option = document.createElement('option');
|
||||
option.value = item.id;
|
||||
option.textContent = item.codeText;
|
||||
select.appendChild(option);
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
const initFlatpickr = () => {
|
||||
// 기존 Flatpickr 인스턴스 제거
|
||||
if (visitDatePicker) {
|
||||
visitDatePicker.destroy();
|
||||
visitDatePicker = null;
|
||||
}
|
||||
|
||||
// 1. input 요소가 실제로 존재하는지 확인
|
||||
const input = document.getElementById('visitDate');
|
||||
if (!input) {
|
||||
console.warn('#visitDate input not found!');
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. input에 값이 있으면 flatpickr와 동기화
|
||||
const currentVal = input.value;
|
||||
|
||||
// 3. flatpickr 초기화
|
||||
visitDatePicker = flatpickr(input, {
|
||||
dateFormat: 'Y-m-d',
|
||||
defaultDate: currentVal || null, // 현재 값으로 초기 선택 날짜 설정
|
||||
enableTime: false,
|
||||
clickOpens: true,
|
||||
onChange: function (selectedDates, dateStr, instance) {
|
||||
console.log('날짜 선택됨:', dateStr);
|
||||
input.value = dateStr; // 수동으로 input 값 동기화
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const updateHouseholdVisit = () => {
|
||||
const form = document.forms['householdVisitReqForm'];
|
||||
const formData = new FormData(form);
|
||||
const data = Object.fromEntries(formData);
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/researcher/visitHousehold',
|
||||
JSON.stringify(data),
|
||||
function (response) {
|
||||
alert('수정 완료되었습니다.');
|
||||
closeModal();
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.error('Error updating data:', code, rstData);
|
||||
alert('수정에 실패했습니다.');
|
||||
},
|
||||
'post',
|
||||
'json',
|
||||
{'Content-Type': 'application/json'}
|
||||
);
|
||||
};
|
||||
const closeModal = () => {
|
||||
document.querySelector(".modal02").ui.close();
|
||||
if (visitDatePicker) {
|
||||
visitDatePicker.destroy();
|
||||
visitDatePicker = null;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</section>
|
||||
</div>
|
||||
</html>
|
||||
@@ -43,13 +43,13 @@ class AdminAuthFailHandlerTest {
|
||||
|
||||
@BeforeAll
|
||||
public void beforeAll() {
|
||||
saveAdminPortIn.connect(
|
||||
/* saveAdminPortIn.connect(
|
||||
1L,
|
||||
testUsername,
|
||||
"test.1@#$",
|
||||
null,
|
||||
false,
|
||||
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));
|
||||
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));*/
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -38,13 +38,13 @@ class AdminDetailsServiceTest {
|
||||
|
||||
@BeforeAll
|
||||
public void beforeAll() {
|
||||
saveAdminPortIn.connect(
|
||||
/* saveAdminPortIn.connect(
|
||||
1L,
|
||||
username,
|
||||
password,
|
||||
null,
|
||||
false,
|
||||
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));
|
||||
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class AdminCreateUpdateDaoTest {
|
||||
@DisplayName("operate - AdminCreateDao")
|
||||
void operate() {
|
||||
|
||||
saveAdminPortIn.connect(
|
||||
/* saveAdminPortIn.connect(
|
||||
1L,
|
||||
"admin_for_createDao_test",
|
||||
"test.1@#$",
|
||||
@@ -60,6 +60,6 @@ class AdminCreateUpdateDaoTest {
|
||||
assertEquals(
|
||||
1,
|
||||
adminViewPortIn.connect("admin_for_createDao_test").orElseThrow().getRoles().size(),
|
||||
"기존 권한들을 (내부적으로) 삭제하고 새로이 추가 등록되기에 withRoles 의 size 는 1이다.");
|
||||
"기존 권한들을 (내부적으로) 삭제하고 새로이 추가 등록되기에 withRoles 의 size 는 1이다.");*/
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user