Merge branch 'dev' into 'deploy-dev-admin'
관리자 실사 추가 작업 중 See merge request korea-research/korea-research!4
This commit is contained in:
@@ -0,0 +1,33 @@
|
|||||||
|
package app.module.admin.config.application.util;
|
||||||
|
|
||||||
|
import app.module.admin.config.application.util.model.MonthOption;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class DateUiUtil {
|
||||||
|
private static final DateTimeFormatter VALUE_FORMAT = DateTimeFormatter.ofPattern("yyyyMM");
|
||||||
|
private static final DateTimeFormatter LABEL_FORMAT = DateTimeFormatter.ofPattern("yyyy년 M월");
|
||||||
|
|
||||||
|
public static List<MonthOption> getRecentMonths(int count) {
|
||||||
|
List<MonthOption> list = new ArrayList<>();
|
||||||
|
LocalDate now = LocalDate.now();
|
||||||
|
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
LocalDate date = now.minusMonths(i);
|
||||||
|
list.add(new MonthOption(
|
||||||
|
date.format(VALUE_FORMAT),
|
||||||
|
date.format(LABEL_FORMAT)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getCurrentMonthValue() {
|
||||||
|
return LocalDate.now().format(VALUE_FORMAT);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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 MonthOption {
|
||||||
|
private String value;
|
||||||
|
private String label;
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package app.module.admin.usecase.admin.saveAdmin.adapters.web;
|
|||||||
import app.module.admin.usecase.admin.saveAdmin.adapters.web.model.AdminCreateBindingVO;
|
import app.module.admin.usecase.admin.saveAdmin.adapters.web.model.AdminCreateBindingVO;
|
||||||
import app.module.core.config.application.enums.AppType;
|
import app.module.core.config.application.enums.AppType;
|
||||||
import app.module.core.usecase.role.list.ports.RoleListPortIn;
|
import app.module.core.usecase.role.list.ports.RoleListPortIn;
|
||||||
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
@@ -14,10 +15,14 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
|||||||
public class AdminCreateGetController {
|
public class AdminCreateGetController {
|
||||||
|
|
||||||
private final RoleListPortIn roleListPortIn;
|
private final RoleListPortIn roleListPortIn;
|
||||||
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
|
|
||||||
@GetMapping(path = "/settings/admins/create")
|
@GetMapping(path = "/settings/admins/create")
|
||||||
String operate(Model model, @ModelAttribute("bindingVO") AdminCreateBindingVO bindingVO) {
|
String operate(Model model, @ModelAttribute("bindingVO") AdminCreateBindingVO bindingVO) {
|
||||||
|
|
||||||
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
||||||
|
model.addAttribute("regionMainCode", uiCodeListPortIn.connect("code.region.main"));
|
||||||
|
|
||||||
return "admin/adminCreateForm";
|
return "admin/adminCreateForm";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import app.module.core.config.application.enums.AppType;
|
|||||||
import app.module.core.config.application.util.MessageUtil;
|
import app.module.core.config.application.util.MessageUtil;
|
||||||
import app.module.core.usecase.admin.saveAdmin.ports.SaveAdminPortIn;
|
import app.module.core.usecase.admin.saveAdmin.ports.SaveAdminPortIn;
|
||||||
import app.module.core.usecase.role.list.ports.RoleListPortIn;
|
import app.module.core.usecase.role.list.ports.RoleListPortIn;
|
||||||
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@@ -22,6 +23,7 @@ public class AdminCreatePostController {
|
|||||||
private final RoleListPortIn roleListPortIn;
|
private final RoleListPortIn roleListPortIn;
|
||||||
private final MessageUtil messageUtil;
|
private final MessageUtil messageUtil;
|
||||||
private final SaveAdminPortIn savePortIn;
|
private final SaveAdminPortIn savePortIn;
|
||||||
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
private final AdminCreateValidator adminCreateValidator;
|
private final AdminCreateValidator adminCreateValidator;
|
||||||
|
|
||||||
@PostMapping(path = "/settings/admins/create")
|
@PostMapping(path = "/settings/admins/create")
|
||||||
@@ -34,6 +36,7 @@ public class AdminCreatePostController {
|
|||||||
adminCreateValidator.validate(bindingVO, bindingResult);
|
adminCreateValidator.validate(bindingVO, bindingResult);
|
||||||
if (bindingResult.hasErrors()) {
|
if (bindingResult.hasErrors()) {
|
||||||
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
||||||
|
model.addAttribute("regionMainCode", uiCodeListPortIn.connect("code.region.main"));
|
||||||
return "admin/adminCreateForm";
|
return "admin/adminCreateForm";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,6 +45,7 @@ public class AdminCreatePostController {
|
|||||||
bindingVO.getId(),
|
bindingVO.getId(),
|
||||||
bindingVO.getPassword(),
|
bindingVO.getPassword(),
|
||||||
bindingVO.getEmail(),
|
bindingVO.getEmail(),
|
||||||
|
bindingVO.getRegionMainCode(),
|
||||||
bindingVO.getAccountDisabled(),
|
bindingVO.getAccountDisabled(),
|
||||||
bindingVO.getAccountLocked(),
|
bindingVO.getAccountLocked(),
|
||||||
bindingVO.getRoleIds());
|
bindingVO.getRoleIds());
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import app.module.core.config.application.util.MessageUtil;
|
|||||||
import app.module.core.usecase.admin.view.ports.AdminViewPortIn;
|
import app.module.core.usecase.admin.view.ports.AdminViewPortIn;
|
||||||
import app.module.core.usecase.admin.view.ports.application.domain.AdminView;
|
import app.module.core.usecase.admin.view.ports.application.domain.AdminView;
|
||||||
import app.module.core.usecase.role.list.ports.RoleListPortIn;
|
import app.module.core.usecase.role.list.ports.RoleListPortIn;
|
||||||
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -24,6 +25,7 @@ class AdminUpdateGetController {
|
|||||||
|
|
||||||
private final AdminViewPortIn adminViewPortIn;
|
private final AdminViewPortIn adminViewPortIn;
|
||||||
private final RoleListPortIn roleListPortIn;
|
private final RoleListPortIn roleListPortIn;
|
||||||
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
private final MessageUtil messageUtil;
|
private final MessageUtil messageUtil;
|
||||||
|
|
||||||
@GetMapping(path = "/settings/admins/update/{adminId}")
|
@GetMapping(path = "/settings/admins/update/{adminId}")
|
||||||
@@ -52,6 +54,7 @@ class AdminUpdateGetController {
|
|||||||
output.getId(),
|
output.getId(),
|
||||||
null,
|
null,
|
||||||
output.getEmail(),
|
output.getEmail(),
|
||||||
|
output.getRegionMainCode(),
|
||||||
output.getPasswordUpdatedAt(),
|
output.getPasswordUpdatedAt(),
|
||||||
output.getAccountDisabled(),
|
output.getAccountDisabled(),
|
||||||
output.getLoginFailCnt(),
|
output.getLoginFailCnt(),
|
||||||
@@ -60,6 +63,7 @@ class AdminUpdateGetController {
|
|||||||
|
|
||||||
model.addAttribute("bindingVO", bindingVO);
|
model.addAttribute("bindingVO", bindingVO);
|
||||||
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
||||||
|
model.addAttribute("regionMainCode", uiCodeListPortIn.connect("code.region.main"));
|
||||||
|
|
||||||
return "admin/adminUpdateForm";
|
return "admin/adminUpdateForm";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import app.module.core.config.application.enums.AppType;
|
|||||||
import app.module.core.config.application.util.MessageUtil;
|
import app.module.core.config.application.util.MessageUtil;
|
||||||
import app.module.core.usecase.admin.saveAdmin.ports.SaveAdminPortIn;
|
import app.module.core.usecase.admin.saveAdmin.ports.SaveAdminPortIn;
|
||||||
import app.module.core.usecase.role.list.ports.RoleListPortIn;
|
import app.module.core.usecase.role.list.ports.RoleListPortIn;
|
||||||
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@@ -21,6 +22,7 @@ class AdminUpdatePostController {
|
|||||||
|
|
||||||
private final AdminUpdateValidator adminUpdateValidator;
|
private final AdminUpdateValidator adminUpdateValidator;
|
||||||
private final RoleListPortIn roleListPortIn;
|
private final RoleListPortIn roleListPortIn;
|
||||||
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
private final SaveAdminPortIn saveAdminPortIn;
|
private final SaveAdminPortIn saveAdminPortIn;
|
||||||
private final MessageUtil messageUtil;
|
private final MessageUtil messageUtil;
|
||||||
|
|
||||||
@@ -34,6 +36,7 @@ class AdminUpdatePostController {
|
|||||||
adminUpdateValidator.validate(bindingVO, bindingResult);
|
adminUpdateValidator.validate(bindingVO, bindingResult);
|
||||||
if (bindingResult.hasErrors()) {
|
if (bindingResult.hasErrors()) {
|
||||||
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
||||||
|
model.addAttribute("regionMainCode", uiCodeListPortIn.connect("code.region.main"));
|
||||||
return "admin/adminUpdateForm";
|
return "admin/adminUpdateForm";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,6 +45,7 @@ class AdminUpdatePostController {
|
|||||||
bindingVO.getId(),
|
bindingVO.getId(),
|
||||||
bindingVO.getUpdatePassword(),
|
bindingVO.getUpdatePassword(),
|
||||||
bindingVO.getEmail(),
|
bindingVO.getEmail(),
|
||||||
|
bindingVO.getRegionMainCode(),
|
||||||
bindingVO.getAccountDisabled(),
|
bindingVO.getAccountDisabled(),
|
||||||
bindingVO.getAccountLocked(),
|
bindingVO.getAccountLocked(),
|
||||||
bindingVO.getRoleIds());
|
bindingVO.getRoleIds());
|
||||||
|
|||||||
@@ -25,4 +25,5 @@ public class AdminCreateBindingVO {
|
|||||||
private Boolean accountDisabled;
|
private Boolean accountDisabled;
|
||||||
private Boolean accountLocked;
|
private Boolean accountLocked;
|
||||||
private List<String> roleIds;
|
private List<String> roleIds;
|
||||||
|
private String regionMainCode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public class AdminUpdateBindingVO implements AuditOutput {
|
|||||||
"^[\\w!#$%&’*+/=?`{|}~^-]+(?:\\.[\\w!#$%&’*+/=?`{|}~^-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,6}$",
|
"^[\\w!#$%&’*+/=?`{|}~^-]+(?:\\.[\\w!#$%&’*+/=?`{|}~^-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,6}$",
|
||||||
message = "{valid.common.email.wrong}")
|
message = "{valid.common.email.wrong}")
|
||||||
private String email;
|
private String email;
|
||||||
|
private String regionMainCode;
|
||||||
|
|
||||||
private LocalDateTime passwordUpdatedAt;
|
private LocalDateTime passwordUpdatedAt;
|
||||||
private Boolean accountDisabled;
|
private Boolean accountDisabled;
|
||||||
|
|||||||
@@ -33,5 +33,14 @@ public class AdminCreateValidator implements Validator {
|
|||||||
ids ->
|
ids ->
|
||||||
errors.rejectValue(
|
errors.rejectValue(
|
||||||
"roleIds", "valid.common.required.size.min", new Object[]{1}, ""));
|
"roleIds", "valid.common.required.size.min", new Object[]{1}, ""));
|
||||||
|
|
||||||
|
// ROLE_ADMIN이 아닌 경우 regionMainCode null체크
|
||||||
|
Optional.ofNullable(vo.getRoleIds())
|
||||||
|
.filter(ids -> ids.stream().noneMatch(role -> role.equals("ROLE_ADMIN")))
|
||||||
|
.ifPresent(nonAdmins -> {
|
||||||
|
if (vo.getRegionMainCode() == null || vo.getRegionMainCode().isBlank()) {
|
||||||
|
errors.rejectValue("regionMainCode", "valid.common.required");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,5 +30,14 @@ public class AdminUpdateValidator implements Validator {
|
|||||||
Optional.ofNullable(vo.getUpdatePassword())
|
Optional.ofNullable(vo.getUpdatePassword())
|
||||||
.filter(s -> !s.trim().isEmpty() && !s.matches(PASSWORD_REGEX))
|
.filter(s -> !s.trim().isEmpty() && !s.matches(PASSWORD_REGEX))
|
||||||
.ifPresent(s -> errors.rejectValue("updatePassword", "valid.common.password.wrong"));
|
.ifPresent(s -> errors.rejectValue("updatePassword", "valid.common.password.wrong"));
|
||||||
|
|
||||||
|
// ROLE_ADMIN이 아닌 경우 regionMainCode null체크
|
||||||
|
Optional.ofNullable(vo.getRoleIds())
|
||||||
|
.filter(ids -> ids.stream().noneMatch(role -> role.equals("ROLE_ADMIN")))
|
||||||
|
.ifPresent(nonAdmins -> {
|
||||||
|
if (vo.getRegionMainCode() == null || vo.getRegionMainCode().isBlank()) {
|
||||||
|
errors.rejectValue("regionMainCode", "valid.common.required");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package app.module.admin.usecase.household.getHouseholdStatus.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatus;
|
||||||
|
import app.module.core.usecase.household.getHousehold.adapters.persistence.GetHouseholdMapper;
|
||||||
|
import java.util.Optional;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdStatus.ports.application.domain.GetHouseholdStatusCmd;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdStatus.ports.GetHouseholdStatusPortOut;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class GetHouseholdStatusDao implements GetHouseholdStatusPortOut {
|
||||||
|
|
||||||
|
private final GetHouseholdStatusMapper mapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<GetHouseholdsStatus> operate(GetHouseholdStatusCmd cmd) {
|
||||||
|
return mapper.getHouseholdStatusById(cmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package app.module.admin.usecase.household.getHouseholdStatus.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.getHouseholdStatus.ports.application.domain.GetHouseholdStatusCmd;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatus;
|
||||||
|
import java.util.Optional;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface GetHouseholdStatusMapper {
|
||||||
|
Optional<GetHouseholdsStatus> getHouseholdStatusById(GetHouseholdStatusCmd cmd);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package app.module.admin.usecase.household.getHouseholdStatus.ports;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.getHouseholdStatus.ports.application.domain.GetHouseholdStatusCmd;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatus;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public interface GetHouseholdStatusPortIn {
|
||||||
|
Optional<GetHouseholdsStatus> operate(GetHouseholdStatusCmd cmd);
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package app.module.admin.usecase.household.getHouseholdStatus.ports;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.getHouseholdStatus.ports.application.domain.GetHouseholdStatusCmd;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatus;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public interface GetHouseholdStatusPortOut {
|
||||||
|
Optional<GetHouseholdsStatus> operate(GetHouseholdStatusCmd cmd);
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package app.module.admin.usecase.household.getHouseholdStatus.ports.application;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatus;
|
||||||
|
import java.util.Optional;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdStatus.ports.application.domain.GetHouseholdStatusCmd;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdStatus.ports.GetHouseholdStatusPortIn;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdStatus.ports.GetHouseholdStatusPortOut;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class GetHouseholdStatusService implements GetHouseholdStatusPortIn {
|
||||||
|
private final GetHouseholdStatusPortOut portOut;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<GetHouseholdsStatus> operate(GetHouseholdStatusCmd cmd) {
|
||||||
|
return portOut.operate(cmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package app.module.admin.usecase.household.getHouseholdStatus.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class GetHouseholdStatus {
|
||||||
|
// 가구 일련번후
|
||||||
|
private Integer householdSeq;
|
||||||
|
// 임가번후
|
||||||
|
private String householdNum;
|
||||||
|
// 경영주명
|
||||||
|
private String householdName;
|
||||||
|
// 연령
|
||||||
|
private String householdAge;
|
||||||
|
// 가구 연락처
|
||||||
|
private String householdTel;
|
||||||
|
// 휴대폰번호
|
||||||
|
private String householdPhone;
|
||||||
|
// 실사
|
||||||
|
private String regionMainName;
|
||||||
|
// 지역
|
||||||
|
private String regionSubName;
|
||||||
|
// 세부지역
|
||||||
|
private String regionDetailName;
|
||||||
|
// 주소
|
||||||
|
private String address;
|
||||||
|
// 업종 대분류
|
||||||
|
private String industryLargeName;
|
||||||
|
// 업종 중분류1
|
||||||
|
private String industryMiddleName;
|
||||||
|
// 업종 중분류2
|
||||||
|
private String industrySubMiddleName;
|
||||||
|
// 규모/세부품목
|
||||||
|
private String industryDetailName;
|
||||||
|
// 유지여부
|
||||||
|
private Boolean isPanel;
|
||||||
|
// 비고
|
||||||
|
private Double memo;
|
||||||
|
// 조사원
|
||||||
|
private String researcherName;
|
||||||
|
// 조사원 연락처
|
||||||
|
private String researcherPhone;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package app.module.admin.usecase.household.getHouseholdStatus.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class GetHouseholdStatusCmd {
|
||||||
|
private Integer seq;
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package app.module.admin.usecase.household.getHouseholdStatusUI;
|
||||||
|
|
||||||
|
import app.module.admin.config.application.util.DateUiUtil;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdStatus.ports.GetHouseholdStatusPortIn;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdStatus.ports.application.domain.GetHouseholdStatusCmd;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdStatusUI.model.GetHouseholdStatusUIReqVO;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class GetHouseholdStatusUIController {
|
||||||
|
private final GetHouseholdStatusPortIn portIn;
|
||||||
|
|
||||||
|
@GetMapping(path = "/household/households/{seq}")
|
||||||
|
String operate(
|
||||||
|
@PathVariable Integer seq,
|
||||||
|
Model model,
|
||||||
|
@ModelAttribute("reqVO") GetHouseholdStatusUIReqVO reqVO) {
|
||||||
|
|
||||||
|
model.addAttribute("householdInfo", portIn.operate(new GetHouseholdStatusCmd(seq)).orElse(null));
|
||||||
|
model.addAttribute("monthList", DateUiUtil.getRecentMonths(13));
|
||||||
|
model.addAttribute("currentMonth", DateUiUtil.getCurrentMonthValue());
|
||||||
|
|
||||||
|
return "household/households/{seq}";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.module.admin.usecase.household.getHouseholesUI.model;
|
package app.module.admin.usecase.household.getHouseholdStatusUI.model;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@@ -9,5 +9,5 @@ import lombok.Setter;
|
|||||||
@Setter
|
@Setter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
public class GetHouseholdsUIReqVO {
|
public class GetHouseholdStatusUIReqVO {
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package app.module.admin.usecase.household.getHouseholdsStatus.adapters.persistence;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatus;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatusCmd;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.GetHouseholdsStatusPortOut;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.data.domain.PageImpl;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class GetHouseholdsStatusDao implements GetHouseholdsStatusPortOut {
|
||||||
|
private final GetHouseholdsStatusMapper mapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<GetHouseholdsStatus> operate(Pageable pageable, GetHouseholdsStatusCmd cmd) {
|
||||||
|
|
||||||
|
List<GetHouseholdsStatus> householdsStatus = mapper.getHouseholdsStatus(pageable, cmd);
|
||||||
|
|
||||||
|
return new PageImpl<>(householdsStatus, pageable,
|
||||||
|
householdsStatus.isEmpty() ? 0 : householdsStatus.get(0).getTotal());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package app.module.admin.usecase.household.getHouseholdsStatus.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatus;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatusCmd;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface GetHouseholdsStatusMapper {
|
||||||
|
List<GetHouseholdsStatus> getHouseholdsStatus(@Param("pageable") Pageable pageable,
|
||||||
|
@Param("cmd") GetHouseholdsStatusCmd cmd);
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package app.module.admin.usecase.household.getHouseholdsStatus.adapters.web;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.GetHouseholdsStatusPortIn;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatus;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatusCmd;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.data.web.PageableDefault;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.adapters.web.model.GetHouseholdsStatusReqVO;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.adapters.web.model.GetHouseholdsStatusResVO;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class GetHouseholdsStatusController {
|
||||||
|
private final GetHouseholdsStatusPortIn portIn;
|
||||||
|
|
||||||
|
@GetMapping(path = "/api/household/households")
|
||||||
|
ResponseEntity<Page<GetHouseholdsStatus>> operate(
|
||||||
|
@PageableDefault(size = 10) Pageable pageable,
|
||||||
|
GetHouseholdsStatusReqVO reqVO) {
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(
|
||||||
|
|
||||||
|
portIn.operate(pageable,
|
||||||
|
new GetHouseholdsStatusCmd(
|
||||||
|
reqVO.getRecordMonth(),
|
||||||
|
reqVO.getOwnerField(),
|
||||||
|
reqVO.getOwnerValue(),
|
||||||
|
reqVO.getRegionMainCode(),
|
||||||
|
reqVO.getRegionSubCode(),
|
||||||
|
reqVO.getRegionDetailCode(),
|
||||||
|
reqVO.getIndustryLargeCode(),
|
||||||
|
reqVO.getIndustryMiddleCode(),
|
||||||
|
reqVO.getProgressType() != null ? reqVO.getProgressType().name() : null,
|
||||||
|
reqVO.getIsFirstVisited(),
|
||||||
|
reqVO.getIsSecondVisited(),
|
||||||
|
reqVO.getIsGiftSent(),
|
||||||
|
reqVO.getResearcherField(),
|
||||||
|
reqVO.getResearcherValue(),
|
||||||
|
reqVO.getIsPanel()
|
||||||
|
))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package app.module.admin.usecase.household.getHouseholdsStatus.adapters.web.model;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.ProgressType;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class GetHouseholdsStatusReqVO {
|
||||||
|
// 연월
|
||||||
|
private String recordMonth;
|
||||||
|
// 경영주 검색 필드 (전체, 경영주명, 전화번호)
|
||||||
|
private String ownerField;
|
||||||
|
// 경영주 검색어
|
||||||
|
private String ownerValue;
|
||||||
|
// 실사
|
||||||
|
private String regionMainCode;
|
||||||
|
// 지역
|
||||||
|
private String regionSubCode;
|
||||||
|
// 세부지역
|
||||||
|
private String regionDetailCode;
|
||||||
|
// 업종 대분류
|
||||||
|
private String industryLargeCode;
|
||||||
|
// 업종 중분류1
|
||||||
|
private String industryMiddleCode;
|
||||||
|
// 당월 일계부 현황 (전체, 25% 미만, 25~50% 미만, 50~75% 미만, 75% 이상, 100% 완료)
|
||||||
|
private ProgressType progressType;
|
||||||
|
// 당월 1차 방문 여부
|
||||||
|
private Boolean isFirstVisited;
|
||||||
|
// 당월 2차 방문 여부
|
||||||
|
private Boolean isSecondVisited;
|
||||||
|
// 답례품 전달
|
||||||
|
private Boolean isGiftSent;
|
||||||
|
// 조사원 검색 필드 (전체, 이름, 전화번호)
|
||||||
|
private String researcherField;
|
||||||
|
// 조사원 검색어
|
||||||
|
private String researcherValue;
|
||||||
|
// 패널 유지 여부
|
||||||
|
private Boolean isPanel;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package app.module.admin.usecase.household.getHouseholdsStatus.adapters.web.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class GetHouseholdsStatusResVO {
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package app.module.admin.usecase.household.getHouseholdsStatus.ports;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatus;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatusCmd;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
public interface GetHouseholdsStatusPortIn {
|
||||||
|
Page<GetHouseholdsStatus> operate(Pageable pageable, GetHouseholdsStatusCmd cmd);
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package app.module.admin.usecase.household.getHouseholdsStatus.ports;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatus;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatusCmd;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
public interface GetHouseholdsStatusPortOut {
|
||||||
|
Page<GetHouseholdsStatus> operate(Pageable pageable, GetHouseholdsStatusCmd cmd);
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package app.module.admin.usecase.household.getHouseholdsStatus.ports.application;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatus;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatusCmd;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.GetHouseholdsStatusPortIn;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.GetHouseholdsStatusPortOut;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class GetHouseholdsStatusService implements GetHouseholdsStatusPortIn {
|
||||||
|
private final GetHouseholdsStatusPortOut portOut;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<GetHouseholdsStatus> operate(Pageable pageable, GetHouseholdsStatusCmd cmd) {
|
||||||
|
return portOut.operate(pageable, cmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class GetHouseholdsStatus {
|
||||||
|
private Integer householdSeq;
|
||||||
|
private String householdNum;
|
||||||
|
private String householdName;
|
||||||
|
private String householdPhone;
|
||||||
|
private String regionMainName;
|
||||||
|
private String regionSubName;
|
||||||
|
private String regionDetailName;
|
||||||
|
private String industryLargeName;
|
||||||
|
private String industryMiddleName;
|
||||||
|
private Boolean isPanel;
|
||||||
|
private Double progressPercent;
|
||||||
|
private String firstVisitDate;
|
||||||
|
private String secondVisitDate;
|
||||||
|
private Boolean isGiftSent;
|
||||||
|
private String researcherName;
|
||||||
|
private String researcherPhone;
|
||||||
|
private Integer total;
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class GetHouseholdsStatusCmd {
|
||||||
|
// 연월
|
||||||
|
private String recordMonth;
|
||||||
|
// 경영주 검색 필드 (전체, 경영주명, 전화번호)
|
||||||
|
private String ownerField;
|
||||||
|
// 경영주 검색어
|
||||||
|
private String ownerValue;
|
||||||
|
// 실사
|
||||||
|
private String regionMainCode;
|
||||||
|
// 지역
|
||||||
|
private String regionSubCode;
|
||||||
|
// 세부지역
|
||||||
|
private String regionDetailCode;
|
||||||
|
// 업종 대분류
|
||||||
|
private String industryLargeCode;
|
||||||
|
// 업종 중분류1
|
||||||
|
private String industryMiddleCode;
|
||||||
|
// 당월 일계부 현황 (전체, 25% 미만, 25~50% 미만, 50~75% 미만, 75% 이상, 100% 완료)
|
||||||
|
private String progressType;
|
||||||
|
// 당월 1차 방문 여부
|
||||||
|
private Boolean isFirstVisited;
|
||||||
|
// 당월 2차 방문 여부
|
||||||
|
private Boolean isSecondVisited;
|
||||||
|
// 답례품 전달
|
||||||
|
private Boolean isGiftSent;
|
||||||
|
// 조사원 검색 필드 (전체, 이름, 전화번호)
|
||||||
|
private String researcherField;
|
||||||
|
// 조사원 검색어
|
||||||
|
private String researcherValue;
|
||||||
|
// 패널 유지 여부
|
||||||
|
private Boolean isPanel;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public enum ProgressType {
|
||||||
|
ALL("전체"),
|
||||||
|
PROGRESS_25("25% 미만"),
|
||||||
|
PROGRESS_50("25~50% 미만"),
|
||||||
|
PROGRESS_75("50~75% 미만"),
|
||||||
|
PROGRESS_75_UP("75% 이상"),
|
||||||
|
PROGRESS_100("100% 완료");
|
||||||
|
|
||||||
|
private final String desc;
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package app.module.admin.usecase.household.getHouseholdsStatusUI;
|
||||||
|
|
||||||
|
import app.module.admin.config.application.util.DateUiUtil;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatusUI.model.GetHouseholdsUIReqVO;
|
||||||
|
import app.module.core.config.application.util.CommonUtil;
|
||||||
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class GetHouseholdsStatusUIController {
|
||||||
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
|
|
||||||
|
@GetMapping(path = "/household/households")
|
||||||
|
String operate(
|
||||||
|
Model model,
|
||||||
|
@ModelAttribute("reqVO") GetHouseholdsUIReqVO reqVO) {
|
||||||
|
|
||||||
|
// 로그인한 관리자 역할
|
||||||
|
model.addAttribute("userRole", CommonUtil.getLoginUserRole());
|
||||||
|
// 실사
|
||||||
|
model.addAttribute("regionMainList", uiCodeListPortIn.connect("code.region.main"));
|
||||||
|
// 지역
|
||||||
|
model.addAttribute("regionSubList", uiCodeListPortIn.connect("code.region.sub"));
|
||||||
|
// 세부지역
|
||||||
|
model.addAttribute("regionDetailList", uiCodeListPortIn.connect("code.region.detail"));
|
||||||
|
// 업종 대분류
|
||||||
|
model.addAttribute("industryLargeList", uiCodeListPortIn.connect("code.industry.large"));
|
||||||
|
// 업종 중분류1
|
||||||
|
model.addAttribute("industryMiddleList", uiCodeListPortIn.connect("code.industry.middle"));
|
||||||
|
|
||||||
|
model.addAttribute("monthList", DateUiUtil.getRecentMonths(13));
|
||||||
|
model.addAttribute("currentMonth", DateUiUtil.getCurrentMonthValue());
|
||||||
|
|
||||||
|
return "household/households";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package app.module.admin.usecase.household.getHouseholdsStatusUI.model;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.ProgressType;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class GetHouseholdsUIReqVO {
|
||||||
|
private Integer page;
|
||||||
|
private String sort;
|
||||||
|
private Integer size;
|
||||||
|
private String recordMonth;
|
||||||
|
private String ownerField;
|
||||||
|
private String ownerValue;
|
||||||
|
private String regionMainCode;
|
||||||
|
private String regionSubCode;
|
||||||
|
private String regionDetailCode;
|
||||||
|
private String industryLargeCode;
|
||||||
|
private String industryMiddleCode;
|
||||||
|
private ProgressType progressType;
|
||||||
|
private Boolean isFirstVisited;
|
||||||
|
private Boolean isSecondVisited;
|
||||||
|
private Boolean isGiftSent;
|
||||||
|
private String researcherField;
|
||||||
|
private String researcherValue;
|
||||||
|
private Boolean isPanel;
|
||||||
|
|
||||||
|
public Integer getPage() {
|
||||||
|
// 요청 페이지 넘버 - 초기값 `0`
|
||||||
|
return page != null ? page : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSize() {
|
||||||
|
// 페이지 당 아이템 수 - 초기값 `10`
|
||||||
|
return size != null ? size : 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package app.module.admin.usecase.household.getHouseholesUI;
|
|
||||||
|
|
||||||
import app.module.admin.usecase.household.getHouseholesUI.model.GetHouseholdsUIReqVO;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.Model;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
class GetHouseholdsUIController {
|
|
||||||
|
|
||||||
@GetMapping(path = "/household/households")
|
|
||||||
String operate(
|
|
||||||
Model model,
|
|
||||||
@ModelAttribute("reqVO") GetHouseholdsUIReqVO reqVO) {
|
|
||||||
|
|
||||||
return "household/households";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
|
<mapper
|
||||||
|
namespace="app.module.admin.usecase.household.getHouseholdStatus.adapters.persistence.GetHouseholdStatusMapper">
|
||||||
|
<select id="getHouseholdStatusById"
|
||||||
|
resultType="app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatus">
|
||||||
|
SELECT
|
||||||
|
h.seq AS householdSeq,
|
||||||
|
h.household_num AS householdNum,
|
||||||
|
h.owner_age AS householdAge,
|
||||||
|
h.tel AS householdTel,
|
||||||
|
h.phone AS householdPhone,
|
||||||
|
h.region_main_name AS regionMainName,
|
||||||
|
h.region_sub_name AS regionSubName,
|
||||||
|
h.region_detail_name AS regionDetailName,
|
||||||
|
h.address AS address,
|
||||||
|
h.industry_large_name AS industryLargeName,
|
||||||
|
h.industry_middle_name AS industryMiddleName,
|
||||||
|
h.industry_sub_middle AS industrySubMiddleName,
|
||||||
|
h.industry_detail AS industryDetailName,
|
||||||
|
h.is_panel AS isPanel,
|
||||||
|
h.memo AS memo,
|
||||||
|
r.researcher_name AS researcherName,
|
||||||
|
r.researcher_phone AS researcherPhone
|
||||||
|
FROM v_household_with_code h
|
||||||
|
LEFT JOIN v_household_researcher r ON h.seq = r.household_seq
|
||||||
|
WHERE h.seq = #{seq}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,177 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
|
<mapper
|
||||||
|
namespace="app.module.admin.usecase.household.getHouseholdsStatus.adapters.persistence.GetHouseholdsStatusMapper">
|
||||||
|
|
||||||
|
<select id="getHouseholdsStatus"
|
||||||
|
resultType="app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatus">
|
||||||
|
/* getHouseholdsStatus : 임가현황 리스트 조회 */
|
||||||
|
WITH record_progress AS (
|
||||||
|
SELECT ROUND(
|
||||||
|
100.0 *
|
||||||
|
(SELECT COUNT(*)
|
||||||
|
FROM daily_record
|
||||||
|
WHERE record_month = #{cmd.recordMonth} AND all_status = 'DONE')
|
||||||
|
/ NULLIF(
|
||||||
|
(SELECT COUNT(*)
|
||||||
|
FROM daily_day_group
|
||||||
|
WHERE end_day <= EXTRACT(DAY FROM CURRENT_DATE)), 0
|
||||||
|
),
|
||||||
|
1
|
||||||
|
) AS progress_percent
|
||||||
|
) /* 일계부 입력 진행 완료 퍼센테이지 (이번달 작성 완료일 수 / 현재날짜 기준 전체 입력 가능 날짜 수) */
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
hvr.*,
|
||||||
|
COUNT(*) OVER () AS total
|
||||||
|
FROM (
|
||||||
|
SELECT
|
||||||
|
h.seq AS householdSeq,
|
||||||
|
h.household_num AS householdNum,
|
||||||
|
h.owner_name AS householdName,
|
||||||
|
h.phone AS householdPhone,
|
||||||
|
h.region_main_code AS regionMainCode,
|
||||||
|
h.region_main_name AS regionMainName,
|
||||||
|
h.region_sub_code AS regionSubCode,
|
||||||
|
h.region_sub_name AS regionSubName,
|
||||||
|
h.region_detail_code AS regionDetailCode,
|
||||||
|
h.region_detail_name AS regionDetailName,
|
||||||
|
h.industry_large_code as industryLargeCode,
|
||||||
|
h.industry_large_name AS industryLargeName,
|
||||||
|
h.industry_middle_code as industryMiddleCode,
|
||||||
|
h.industry_middle_name AS industryMiddleName,
|
||||||
|
h.is_panel AS isPanel,
|
||||||
|
ps.progress_percent AS progressPercent,
|
||||||
|
v.first_visit_date AS firstVisitDate,
|
||||||
|
v.second_visit_date AS secondVisitDate,
|
||||||
|
COALESCE(v.is_gift_sent, false) AS isGiftSent,
|
||||||
|
r.researcher_name AS researcherName,
|
||||||
|
r.researcher_phone AS researcherPhone
|
||||||
|
FROM v_household_with_code h
|
||||||
|
LEFT JOIN v_household_visit v ON h.seq = v.household_seq
|
||||||
|
LEFT JOIN v_household_researcher r ON h.seq = r.household_seq
|
||||||
|
CROSS JOIN record_progress ps
|
||||||
|
) AS hvr
|
||||||
|
|
||||||
|
<where>
|
||||||
|
1=1
|
||||||
|
|
||||||
|
<if test="cmd.ownerField != null and cmd.ownerField != ''">
|
||||||
|
/* 경영주 검색 */
|
||||||
|
<choose>
|
||||||
|
<when test="cmd.ownerField eq 'name'">
|
||||||
|
AND hvr.householdName ILIKE '%' || #{cmd.ownerValue} || '%'
|
||||||
|
</when>
|
||||||
|
<when test="cmd.ownerField eq 'phone'">
|
||||||
|
AND hvr.householdPhone ILIKE '%' || #{cmd.ownerValue} || '%'
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="cmd.researcherField != null and cmd.researcherField != ''">
|
||||||
|
/* 조사원 검색 */
|
||||||
|
<choose>
|
||||||
|
<when test="cmd.researcherField eq 'name'">
|
||||||
|
AND hvr.researcherName ILIKE '%' || #{cmd.researcherValue} || '%'
|
||||||
|
</when>
|
||||||
|
<when test="cmd.researcherField eq 'phone'">
|
||||||
|
AND hvr.researcherPhone ILIKE '%' || #{cmd.researcherValue} || '%'
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="cmd.regionMainCode != null and cmd.regionMainCode != ''">
|
||||||
|
/* 실사 검색 */
|
||||||
|
AND hvr.regionMainCode = #{cmd.regionMainCode}
|
||||||
|
</if>
|
||||||
|
<if test="cmd.regionSubCode != null and cmd.regionSubCode != ''">
|
||||||
|
/* 지역 검색 */
|
||||||
|
AND hvr.regionSubCode = #{cmd.regionSubCode}
|
||||||
|
</if>
|
||||||
|
<if test="cmd.regionDetailCode != null and cmd.regionDetailCode != ''">
|
||||||
|
/* 세부지역 검색 */
|
||||||
|
AND hvr.regionDetailCode = #{cmd.regionDetailCode}
|
||||||
|
</if>
|
||||||
|
<if test="cmd.industryLargeCode != null and cmd.industryLargeCode != ''">
|
||||||
|
/* 업종 대분류 검색 */
|
||||||
|
AND hvr.industryLargeCode = #{cmd.industryLargeCode}
|
||||||
|
</if>
|
||||||
|
<if test="cmd.industryMiddleCode != null and cmd.industryMiddleCode != ''">
|
||||||
|
/* 업종 중분류1 검색*/
|
||||||
|
AND hvr.industryMiddleCode = #{cmd.industryMiddleCode}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="cmd.progressType != null and cmd.progressType != ''">
|
||||||
|
/* 일계부 현황 퍼센테이지 검색 */
|
||||||
|
<choose>
|
||||||
|
<when test="cmd.progressType eq 'PROGRESS_25'">
|
||||||
|
AND hvr.progressPercent < 25
|
||||||
|
</when>
|
||||||
|
<when test="cmd.progressType eq 'PROGRESS_50'">
|
||||||
|
AND hvr.progressPercent >= 25 AND hvr.progressPercent < 50
|
||||||
|
</when>
|
||||||
|
<when test="cmd.progressType eq 'PROGRESS_75'">
|
||||||
|
AND hvr.progressPercent >= 50 AND hvr.progressPercent < 75
|
||||||
|
</when>
|
||||||
|
<when test="cmd.progressType eq 'PROGRESS_75_UP'">
|
||||||
|
AND hvr.progressPercent > 75
|
||||||
|
</when>
|
||||||
|
<when test="cmd.progressType eq 'PROGRESS_100'">
|
||||||
|
AND hvr.progressPercent = 100
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="cmd.isFirstVisited != null">
|
||||||
|
/* 당월 1차 방문 여부 */
|
||||||
|
<choose>
|
||||||
|
<when test="cmd.isFirstVisited">
|
||||||
|
AND hvr.firstVisitDate is not null
|
||||||
|
</when>
|
||||||
|
<when test="!cmd.isFirstVisited">
|
||||||
|
AND hvr.firstVisitDate is null
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="cmd.isSecondVisited != null">
|
||||||
|
/* 당월 2차 방문 여부 */
|
||||||
|
<choose>
|
||||||
|
<when test="cmd.isSecondVisited">
|
||||||
|
AND hvr.secondVisitDate is not null
|
||||||
|
</when>
|
||||||
|
<when test="!cmd.isSecondVisited">
|
||||||
|
AND hvr.secondVisitDate is null
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="cmd.isGiftSent != null">
|
||||||
|
/* 답례품 전달 여부 */
|
||||||
|
<choose>
|
||||||
|
<when test="cmd.isGiftSent">
|
||||||
|
AND hvr.isGiftSent = true
|
||||||
|
</when>
|
||||||
|
<when test="!cmd.isGiftSent">
|
||||||
|
AND hvr.isGiftSent = false
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="cmd.isPanel != null">
|
||||||
|
/* 패널 유지 여부 */
|
||||||
|
<choose>
|
||||||
|
<when test="cmd.isPanel">
|
||||||
|
AND hvr.isPanel = true
|
||||||
|
</when>
|
||||||
|
<when test="!cmd.isPanel">
|
||||||
|
AND hvr.isPanel = false
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
|
||||||
|
OFFSET #{pageable.offset} ROWS FETCH NEXT #{pageable.pageSize} ROWS ONLY
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -9,13 +9,14 @@
|
|||||||
th:action="@{/settings/admins/create}"
|
th:action="@{/settings/admins/create}"
|
||||||
th:object="${bindingVO}">
|
th:object="${bindingVO}">
|
||||||
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-sm-2 col-form-label" for="id">ID *</label>
|
<label class="col-sm-2 col-form-label" for="id">ID *</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<input class="form-control" id="id" th:classappend="${#fields.hasErrors('id')} ? 'is-invalid'"
|
<input class="form-control" id="id"
|
||||||
|
th:classappend="${#fields.hasErrors('id')} ? 'is-invalid'"
|
||||||
th:field="*{id}"/>
|
th:field="*{id}"/>
|
||||||
<div class="invalid-feedback fw-bold" th:errors="*{id}" th:if="${#fields.hasErrors('id')}">
|
<div class="invalid-feedback fw-bold" th:errors="*{id}"
|
||||||
|
th:if="${#fields.hasErrors('id')}">
|
||||||
에러 메세지
|
에러 메세지
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -25,7 +26,9 @@
|
|||||||
<label class="col-sm-2 col-form-label" for="password">Password *</label>
|
<label class="col-sm-2 col-form-label" for="password">Password *</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
|
|
||||||
<input class="form-control" id="password" th:classappend="${#fields.hasErrors('password')} ? 'is-invalid'" th:field="*{password}"
|
<input class="form-control" id="password"
|
||||||
|
th:classappend="${#fields.hasErrors('password')} ? 'is-invalid'"
|
||||||
|
th:field="*{password}"
|
||||||
type="password"/>
|
type="password"/>
|
||||||
<div class="invalid-feedback fw-bold" th:errors="*{password}"
|
<div class="invalid-feedback fw-bold" th:errors="*{password}"
|
||||||
th:if="${#fields.hasErrors('password')}">
|
th:if="${#fields.hasErrors('password')}">
|
||||||
@@ -38,7 +41,9 @@
|
|||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-sm-2 col-form-label" for="email">Email *</label>
|
<label class="col-sm-2 col-form-label" for="email">Email *</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<input class="form-control" id="email" th:classappend="${#fields.hasErrors('email')} ? 'is-invalid'" th:field="*{email}"
|
<input class="form-control" id="email"
|
||||||
|
th:classappend="${#fields.hasErrors('email')} ? 'is-invalid'"
|
||||||
|
th:field="*{email}"
|
||||||
type="email"/>
|
type="email"/>
|
||||||
<div class="invalid-feedback fw-bold" th:errors="*{email}"
|
<div class="invalid-feedback fw-bold" th:errors="*{email}"
|
||||||
th:if="${#fields.hasErrors('email')}">
|
th:if="${#fields.hasErrors('email')}">
|
||||||
@@ -50,8 +55,10 @@
|
|||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-sm-2 col-form-label" for="roleIds">권한 *</label>
|
<label class="col-sm-2 col-form-label" for="roleIds">권한 *</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<select class="form-control" id="roleIds" multiple th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
|
<select class="form-control" id="roleIds" multiple
|
||||||
th:field="*{roleIds}">
|
th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
|
||||||
|
th:field="*{roleIds}"
|
||||||
|
onchange="onRoleChange(this);">
|
||||||
<option th:each="role : ${roles}" th:text="${role.id}"
|
<option th:each="role : ${roles}" th:text="${role.id}"
|
||||||
th:value="${role.id}"></option>
|
th:value="${role.id}"></option>
|
||||||
</select>
|
</select>
|
||||||
@@ -62,6 +69,20 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3 regionMainCodeArea" style="display: none;">
|
||||||
|
<label class="col-sm-2 col-form-label" for="regionMainCode">실사 *</label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<select class="form-select" id="regionMainCode" name="regionMainCode"
|
||||||
|
th:field="*{regionMainCode}">
|
||||||
|
<option value="">선택</option>
|
||||||
|
<option th:each="code : ${regionMainCode}"
|
||||||
|
th:value="${code.id}"
|
||||||
|
th:text="${code.codeText}">
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 활성화 -->
|
<!-- 활성화 -->
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-sm-2 col-form-label" for="inlineRadio1">비활성화 여부 *</label>
|
<label class="col-sm-2 col-form-label" for="inlineRadio1">비활성화 여부 *</label>
|
||||||
@@ -105,7 +126,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button class="btn btn-primary float-end" type="submit">저장</button>
|
<button class="btn btn-primary float-end" type="submit">저장</button>
|
||||||
<button class="btn btn-light" onclick="gotoList();return false;" type="button">목록으로 이동</button>
|
<button class="btn btn-light" onclick="gotoList();return false;" type="button">목록으로 이동
|
||||||
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -115,6 +137,12 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const onRoleChange = (el) => {
|
||||||
|
$('.regionMainCodeArea').toggle(el.value !== "ROLE_ADMIN");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -16,13 +16,15 @@
|
|||||||
<div class="row p-2 mb-2 border-secondary border-top border-bottom border-1">
|
<div class="row p-2 mb-2 border-secondary border-top border-bottom border-1">
|
||||||
<div class="col-5">
|
<div class="col-5">
|
||||||
<label class="col-sm-2 col-form-label" for="searchField">검색필드</label>
|
<label class="col-sm-2 col-form-label" for="searchField">검색필드</label>
|
||||||
<select class="form-select d-inline w-25" id="searchField" th:field="*{searchField}">
|
<select class="form-select d-inline w-25" id="searchField"
|
||||||
|
th:field="*{searchField}">
|
||||||
<option selected value="">선택</option>
|
<option selected value="">선택</option>
|
||||||
<option value="id">ID</option>
|
<option value="id">ID</option>
|
||||||
<option value="email">Email</option>
|
<option value="email">Email</option>
|
||||||
</select>
|
</select>
|
||||||
<label>
|
<label>
|
||||||
<input class="form-control d-inline" placeholder="검색어를 입력하세요." style="width: 250px;"
|
<input class="form-control d-inline" placeholder="검색어를 입력하세요."
|
||||||
|
style="width: 250px;"
|
||||||
th:field="*{searchValue}" type="text">
|
th:field="*{searchValue}" type="text">
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -57,7 +59,8 @@
|
|||||||
onchange="goSearch()">
|
onchange="goSearch()">
|
||||||
<option
|
<option
|
||||||
th:each="item : ${pageRows}"
|
th:each="item : ${pageRows}"
|
||||||
th:selected="${#strings.toString(listOutput.pageable.pageSize) eq item.codeValue}" th:text="${item.codeText}"
|
th:selected="${#strings.toString(listOutput.pageable.pageSize) eq item.codeValue}"
|
||||||
|
th:text="${item.codeText}"
|
||||||
th:value="${item.codeValue}"></option>
|
th:value="${item.codeValue}"></option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
@@ -69,16 +72,22 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th scope="col">#</th>
|
<th scope="col">#</th>
|
||||||
<th scope="col">
|
<th scope="col">
|
||||||
<label><input class="form-check-input" onchange="toggleCheckbox(this);" type="checkbox"/></label>
|
<label><input class="form-check-input" onchange="toggleCheckbox(this);"
|
||||||
|
type="checkbox"/></label>
|
||||||
</th>
|
</th>
|
||||||
<th scope="col"><a class="order-able" data-sort-field="id" href="#">ID</a></th>
|
<th scope="col"><a class="order-able" data-sort-field="id" href="#">ID</a></th>
|
||||||
<th class="text-secondary" scope="col">권한</th>
|
<th class="text-secondary" scope="col">권한</th>
|
||||||
<th scope="col"><a class="order-able" data-sort-field="email" href="#">Email</a></th>
|
<th scope="col"><a class="order-able" data-sort-field="email" href="#">Email</a>
|
||||||
<th scope="col"><a class="order-able" data-sort-field="accountDisabled" href="#">활성화</a>
|
</th>
|
||||||
|
<th scope="col"><a class="order-able" data-sort-field="accountDisabled"
|
||||||
|
href="#">활성화</a>
|
||||||
|
</th>
|
||||||
|
<th scope="col"><a class="order-able" data-sort-field="accountLocked"
|
||||||
|
href="#">계정잠김</a></th>
|
||||||
|
<th scope="col"><a class="order-able" data-sort-field="createdAt" href="#">등록일</a>
|
||||||
|
</th>
|
||||||
|
<th scope="col"><a class="order-able" data-sort-field="updatedAt" href="#">수정일</a>
|
||||||
</th>
|
</th>
|
||||||
<th scope="col"><a class="order-able" data-sort-field="accountLocked" href="#">계정잠김</a></th>
|
|
||||||
<th scope="col"><a class="order-able" data-sort-field="createdAt" href="#">등록일</a></th>
|
|
||||||
<th scope="col"><a class="order-able" data-sort-field="updatedAt" href="#">수정일</a></th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -90,7 +99,8 @@
|
|||||||
<td><label><input class="form-check-input" name="checkedIds" th:value="${item.id}"
|
<td><label><input class="form-check-input" name="checkedIds" th:value="${item.id}"
|
||||||
type="checkbox"/></label>
|
type="checkbox"/></label>
|
||||||
</td>
|
</td>
|
||||||
<td><a th:href="|javascript:goUpdate('${item.id}')|" th:text="${item.id}">아이디</a></td>
|
<td><a th:href="|javascript:goUpdate('${item.id}')|" th:text="${item.id}">아이디</a>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span th:each="role, status : ${item.roles}"
|
<span th:each="role, status : ${item.roles}"
|
||||||
th:text="${role.getId()} + ${!status.last ? ', ': ''}"></span>
|
th:text="${role.getId()} + ${!status.last ? ', ': ''}"></span>
|
||||||
|
|||||||
@@ -36,7 +36,9 @@
|
|||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-sm-2 col-form-label" for="email">Email *</label>
|
<label class="col-sm-2 col-form-label" for="email">Email *</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<input class="form-control" id="email" th:classappend="${#fields.hasErrors('email')} ? 'is-invalid'" th:field="*{email}"
|
<input class="form-control" id="email"
|
||||||
|
th:classappend="${#fields.hasErrors('email')} ? 'is-invalid'"
|
||||||
|
th:field="*{email}"
|
||||||
type="email"/>
|
type="email"/>
|
||||||
<div class="invalid-feedback fw-bold" th:errors="*{email}"
|
<div class="invalid-feedback fw-bold" th:errors="*{email}"
|
||||||
th:if="${#fields.hasErrors('email')}">
|
th:if="${#fields.hasErrors('email')}">
|
||||||
@@ -48,8 +50,10 @@
|
|||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-sm-2 col-form-label" for="roleIds">권한 *</label>
|
<label class="col-sm-2 col-form-label" for="roleIds">권한 *</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<select class="form-control" id="roleIds" multiple th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
|
<select class="form-control" id="roleIds" multiple
|
||||||
th:field="*{roleIds}">
|
th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
|
||||||
|
th:field="*{roleIds}"
|
||||||
|
onchange="onRoleChange(this);">
|
||||||
<option th:each="role : ${roles}" th:text="${role.id}"
|
<option th:each="role : ${roles}" th:text="${role.id}"
|
||||||
th:value="${role.id}"></option>
|
th:value="${role.id}"></option>
|
||||||
</select>
|
</select>
|
||||||
@@ -60,6 +64,26 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3 regionMainCodeArea"
|
||||||
|
th:style="${#lists.contains(bindingVO.roleIds, 'ROLE_ADMIN')} ? 'display: none;' : 'display: flex;'">
|
||||||
|
<label class="col-sm-2 col-form-label" for="regionMainCode">실사 *</label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<select class="form-select" id="regionMainCode" name="regionMainCode"
|
||||||
|
th:classappend="${#fields.hasErrors('regionMainCode')} ? 'is-invalid'"
|
||||||
|
th:field="*{regionMainCode}">
|
||||||
|
<option value="">선택</option>
|
||||||
|
<option th:each="code : ${regionMainCode}"
|
||||||
|
th:value="${code.id}"
|
||||||
|
th:text="${code.codeText}">
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<div class="invalid-feedback fw-bold" th:errors="*{regionMainCode}"
|
||||||
|
th:if="${#fields.hasErrors('regionMainCode')}">
|
||||||
|
에러 메세지
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 활성화 -->
|
<!-- 활성화 -->
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-sm-2 col-form-label" for="inlineRadio1">비활성화 여부 *</label>
|
<label class="col-sm-2 col-form-label" for="inlineRadio1">비활성화 여부 *</label>
|
||||||
@@ -108,10 +132,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button class="btn btn-primary float-end" type="submit">저장</button>
|
<button class="btn btn-primary float-end" type="submit">저장</button>
|
||||||
<button class="btn btn-light" onclick="gotoList();return false;" type="button">목록으로 이동</button>
|
<button class="btn btn-light" onclick="gotoList();return false;" type="button">목록으로 이동
|
||||||
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<!-- 이전 목록페이지의 검색 및 정렬조건 폼 -->
|
<!-- 이전 목록페이지의 검색 및 정렬조건 폼 -->
|
||||||
|
<th:block th:if="${listStatus != null}">
|
||||||
<form method="get" name="prevAdminParamForm"
|
<form method="get" name="prevAdminParamForm"
|
||||||
th:action="@{/settings/admins}"
|
th:action="@{/settings/admins}"
|
||||||
th:object="${listStatus}">
|
th:object="${listStatus}">
|
||||||
@@ -123,11 +149,12 @@
|
|||||||
<input name="sort" th:value="${pageable.sort}" type="hidden"/>
|
<input name="sort" th:value="${pageable.sort}" type="hidden"/>
|
||||||
</th:block>
|
</th:block>
|
||||||
</form>
|
</form>
|
||||||
|
</th:block>
|
||||||
|
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
function gotoList() {
|
function gotoList() {
|
||||||
if (document.prevParamForm) {
|
if (document.prevAdminParamForm) {
|
||||||
const f = document.prevParamForm;
|
const f = document.prevAdminParamForm;
|
||||||
f.sort.value = convertToPageableSortValue(f.sort.value);
|
f.sort.value = convertToPageableSortValue(f.sort.value);
|
||||||
f.submit();
|
f.submit();
|
||||||
} else {
|
} else {
|
||||||
@@ -143,6 +170,12 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const onRoleChange = (el) => {
|
||||||
|
$('.regionMainCodeArea').toggle(el.value !== "ROLE_ADMIN");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -3,7 +3,244 @@
|
|||||||
layout:decorate="~{layout/layout}">
|
layout:decorate="~{layout/layout}">
|
||||||
|
|
||||||
<section layout:fragment="content">
|
<section layout:fragment="content">
|
||||||
<h1>/household/households</h1>
|
<form autocomplete="off" method="get" name="reqForm" th:action="@{/household/households}"
|
||||||
|
th:object="${reqVO}">
|
||||||
|
|
||||||
|
<input name="page" th:field="*{page}" type="hidden"/>
|
||||||
|
<input name="size" th:field="*{size}" type="hidden"/>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label>입력월</label>
|
||||||
|
<select name="recordMonth" th:field="*{recordMonth}">
|
||||||
|
<option th:each="month : ${monthList}"
|
||||||
|
th:value="${month.value}"
|
||||||
|
th:text="${month.label}"
|
||||||
|
th:selected="${month.value == currentMonth}">
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<label>경영주</label>
|
||||||
|
<select name="ownerField" th:field="*{ownerField}">
|
||||||
|
<option value="">전체</option>
|
||||||
|
<option value="name">이름</option>
|
||||||
|
<option value="phone">전화번호</option>
|
||||||
|
</select>
|
||||||
|
<input type="text" name="ownerValue" placeholder="" th:field="*{ownerValue}">
|
||||||
|
|
||||||
|
<label>실사</label>
|
||||||
|
<select name="regionMainCode" th:field="*{regionMainCode}">
|
||||||
|
<option value="">전체</option>
|
||||||
|
<option th:each="item : ${regionMainList}"
|
||||||
|
th:value="${item.id}"
|
||||||
|
th:text="${item.codeText}">
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<label>지역</label>
|
||||||
|
<select name="regionSubCode" th:field="*{regionSubCode}">
|
||||||
|
<option value="">전체</option>
|
||||||
|
<option th:each="item : ${regionSubList}"
|
||||||
|
th:value="${item.id}"
|
||||||
|
th:text="${item.codeValue + '. ' + item.codeText}">
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<label>세부지역</label>
|
||||||
|
<select name="regionDetailCode" th:field="*{regionDetailCode}">
|
||||||
|
<option value="">전체</option>
|
||||||
|
<option th:each="item : ${regionDetailList}"
|
||||||
|
th:value="${item.id}"
|
||||||
|
th:text="${item.codeValue + '. ' + item.codeText}">
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<label>업종 대분류</label>
|
||||||
|
<select name="industryLargeCode" th:field="*{industryLargeCode}">
|
||||||
|
<option value="">전체</option>
|
||||||
|
<option th:each="item : ${industryLargeList}"
|
||||||
|
th:value="${item.id}"
|
||||||
|
th:text="${item.codeValue + '. ' + item.codeText}">
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<label>업종 중분류</label>
|
||||||
|
<select name="industryMiddleCode" th:field="*{industryMiddleCode}">
|
||||||
|
<option value="">전체</option>
|
||||||
|
<option th:each="item : ${industryMiddleList}"
|
||||||
|
th:value="${item.id}"
|
||||||
|
th:text="${item.codeValue + '. ' + item.codeText}">
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<label>일계부 현황</label>
|
||||||
|
<select name="progressType" th:field="*{progressType}">
|
||||||
|
<option value="">전체</option>
|
||||||
|
<option value="PROGRESS_25">25% 미만</option>
|
||||||
|
<option value="PROGRESS_50">25~50% 미만</option>
|
||||||
|
<option value="PROGRESS_75">50~75% 미만</option>
|
||||||
|
<option value="PROGRESS_75_UP">75% 이상</option>
|
||||||
|
<option value="PROGRESS_100">100% 완료</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<label>당월 1차 방문</label>
|
||||||
|
<select name="isFirstVisited" th:field="*{isFirstVisited}">
|
||||||
|
<option value="">전체</option>
|
||||||
|
<option value="true">방문</option>
|
||||||
|
<option value="false">미방문</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<label>당월 2차 방문</label>
|
||||||
|
<select name="isSecondVisited" th:field="*{isSecondVisited}">
|
||||||
|
<option value="">전체</option>
|
||||||
|
<option value="true">방문</option>
|
||||||
|
<option value="false">미방문</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<label>답례품 전달</label>
|
||||||
|
<select name="isGiftSent" th:field="*{isGiftSent}">
|
||||||
|
<option value="">전체</option>
|
||||||
|
<option value="true">전달</option>
|
||||||
|
<option value="false">미전달</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<label>조사원</label>
|
||||||
|
<select name="researcherField" th:field="*{researcherField}">
|
||||||
|
<option value="">전체</option>
|
||||||
|
<option value="name">이름</option>
|
||||||
|
<option value="phone">전화번호</option>
|
||||||
|
</select>
|
||||||
|
<input type="text" name="researcherValue" placeholder="" th:field="*{researcherValue}">
|
||||||
|
|
||||||
|
<label>패널 유지 여부</label>
|
||||||
|
<select name="isPanel" th:field="*{isPanel}">
|
||||||
|
<option value="">전체</option>
|
||||||
|
<option value="true">유지</option>
|
||||||
|
<option value="false">비유지</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<button type="reset" onclick="location.href = location.pathname">초기화</button>
|
||||||
|
<button type="submit">검색</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>총 <span id="totalElements">100</span>건</p>
|
||||||
|
|
||||||
|
<table border="1" style="width: 100%; ">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 40px;"><input type="checkbox"></th>
|
||||||
|
<th style="width: 80px;">임가번호</th>
|
||||||
|
<th style="width: 80px;">경영주명</th>
|
||||||
|
<th style="width: 120px;">휴대전화</th>
|
||||||
|
<th style="width: 60px;">실사</th>
|
||||||
|
<th style="width: 100px;">지역</th>
|
||||||
|
<th style="width: 100px;">세부지역</th>
|
||||||
|
<th style="width: 120px;">업종 대분류</th>
|
||||||
|
<th style="width: 120px;">업종 중분류</th>
|
||||||
|
<th style="width: 120px;">당월 일계부 현황</th>
|
||||||
|
<th style="width: 100px;">1차 방문일</th>
|
||||||
|
<th style="width: 100px;">2차 방문일</th>
|
||||||
|
<th style="width: 100px;">답례품 전달</th>
|
||||||
|
<th style="width: 80px;">조사원</th>
|
||||||
|
<th style="width: 120px;">조사원 휴대전화</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="listTBody">
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="row paging"></div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<!-- <button>엑셀 다운로드</button>-->
|
||||||
|
<!-- <button>임가 등록</button>-->
|
||||||
|
<!-- <button>조사원 매핑</button>-->
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section layout:fragment="script">
|
||||||
|
<script th:inline="javascript">
|
||||||
|
// TODO : ajax 공통화 작업 후 수정해야
|
||||||
|
const getHouseholds = (pageNo) => {
|
||||||
|
const f = document.reqForm;
|
||||||
|
f.page.value = pageNo;
|
||||||
|
|
||||||
|
let dataOj = $(f).serializeObject();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
method: 'GET',
|
||||||
|
url: '/api/household/households',
|
||||||
|
data: dataOj,
|
||||||
|
success(response) {
|
||||||
|
console.log("response", response);
|
||||||
|
|
||||||
|
$('#totalElements').text(response.totalElements);
|
||||||
|
|
||||||
|
// List 구성하기
|
||||||
|
const tbody = $('#listTBody');
|
||||||
|
tbody.empty();
|
||||||
|
|
||||||
|
$(response.content).each((idx, ct) => {
|
||||||
|
tbody.append(
|
||||||
|
`
|
||||||
|
<tr>
|
||||||
|
<td><input type="checkbox"></td>
|
||||||
|
<td><a href="/household/households/${ct.householdSeq}">${ct.householdNum}</a></td> <!-- 임가번호 -->
|
||||||
|
<td>${ct.householdName}</td> <!-- 경영주 이름 -->
|
||||||
|
<td>${ct.householdPhone}</td> <!-- 경영주 번호 -->
|
||||||
|
<td>${ct.regionMainName}</td> <!-- 실사 -->
|
||||||
|
<td>${ct.regionSubName}</td> <!-- 지역 -->
|
||||||
|
<td>${ct.regionDetailName}</td> <!-- 세부지역 -->
|
||||||
|
<td>${isEmpty(ct.industryLargeName)}</td> <!-- 업종 대분류 -->
|
||||||
|
<td>${isEmpty(ct.industryMiddleName)}</td> <!-- 업종 중분류1 -->
|
||||||
|
<td>${ct.progressPercent}%</td> <!-- 임가 진행 상황 -->
|
||||||
|
<td>${isEmpty(ct.firstVisitDate)}</td> <!-- 1차방문날짜 -->
|
||||||
|
<td>${isEmpty(ct.secondVisitDate)}</td> <!-- 2차방문날짜 -->
|
||||||
|
<td>${ct.isGiftSent ? "전달" : "미전달"}</td> <!-- 답례품 -->
|
||||||
|
<td>${isEmpty(ct.researcherName)}</td> <!-- 조사원이름 -->
|
||||||
|
<td>${isEmpty(ct.researcherPhone)}</td> <!-- 조사원번호 -->
|
||||||
|
</tr>
|
||||||
|
`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!$(response.content).length) {
|
||||||
|
tbody.append(`
|
||||||
|
<tr>
|
||||||
|
<td colspan="15" class="text-center text-muted">게시물이 존재하지 않습니다.</td>
|
||||||
|
</tr>
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pagination 구성하기
|
||||||
|
const paging = $('.paging');
|
||||||
|
paging.empty();
|
||||||
|
paging.append(
|
||||||
|
uiUtil.getPagingUI(pageNo, f.size.value, response.totalPages,
|
||||||
|
(movePageNo) => {
|
||||||
|
f.page.value = movePageNo;
|
||||||
|
goSearch();
|
||||||
|
}));
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 최초 리스트 로드
|
||||||
|
getHouseholds(document.reqForm.page.value);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script th:inline="javascript">
|
||||||
|
const goSearch = () => {
|
||||||
|
const f = document.reqForm;
|
||||||
|
f.method = 'GET';
|
||||||
|
f.submit();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function isEmpty(value, fallback = '-') {
|
||||||
|
return value !== null && value !== undefined && value !== '' ? value : fallback;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
|
||||||
|
layout:decorate="~{layout/layout}">
|
||||||
|
|
||||||
|
<section layout:fragment="content">
|
||||||
|
<h1>/household/households/{seq}</h1>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -48,6 +48,7 @@ class AdminAuthFailHandlerTest {
|
|||||||
testUsername,
|
testUsername,
|
||||||
"test.1@#$",
|
"test.1@#$",
|
||||||
"xx4@test.com",
|
"xx4@test.com",
|
||||||
|
null,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));
|
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ class AdminDetailsServiceTest {
|
|||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
"xx1@test.com",
|
"xx1@test.com",
|
||||||
|
null,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));
|
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class AdminCreateUpdateDaoTest {
|
|||||||
"admin_for_createDao_test",
|
"admin_for_createDao_test",
|
||||||
"test.1@#$",
|
"test.1@#$",
|
||||||
"admin_for_createDao_test@test.com",
|
"admin_for_createDao_test@test.com",
|
||||||
|
null,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));
|
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));
|
||||||
@@ -56,6 +57,7 @@ class AdminCreateUpdateDaoTest {
|
|||||||
"admin_for_createDao_test",
|
"admin_for_createDao_test",
|
||||||
"test.1@#$",
|
"test.1@#$",
|
||||||
"admin_for_createDao_test@test.com",
|
"admin_for_createDao_test@test.com",
|
||||||
|
null,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
List.of("ROLE_STAFF"));
|
List.of("ROLE_STAFF"));
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ class CreateAdminController {
|
|||||||
reqVO.getId(),
|
reqVO.getId(),
|
||||||
reqVO.getPassword(),
|
reqVO.getPassword(),
|
||||||
reqVO.getEmail(),
|
reqVO.getEmail(),
|
||||||
|
reqVO.getRegionMainCode(),
|
||||||
reqVO.getAccountDisabled(),
|
reqVO.getAccountDisabled(),
|
||||||
reqVO.getAccountLocked(),
|
reqVO.getAccountLocked(),
|
||||||
reqVO.getRoleIds());
|
reqVO.getRoleIds());
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ public class CreateAdminReqVO {
|
|||||||
@Schema(description = "email", example = "admin-email@email.com")
|
@Schema(description = "email", example = "admin-email@email.com")
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
|
@Schema(description = "실사지역코드", example = "code.region.main.1")
|
||||||
|
private String regionMainCode;
|
||||||
|
|
||||||
@Schema(description = "계정 비활성화", example = "false")
|
@Schema(description = "계정 비활성화", example = "false")
|
||||||
private Boolean accountDisabled;
|
private Boolean accountDisabled;
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ class UpdateAdminController {
|
|||||||
reqVO.getId(),
|
reqVO.getId(),
|
||||||
reqVO.getUpdatePassword(),
|
reqVO.getUpdatePassword(),
|
||||||
reqVO.getEmail(),
|
reqVO.getEmail(),
|
||||||
|
reqVO.getRegionMainCode(),
|
||||||
reqVO.getAccountDisabled(),
|
reqVO.getAccountDisabled(),
|
||||||
reqVO.getAccountLocked(),
|
reqVO.getAccountLocked(),
|
||||||
reqVO.getRoleIds());
|
reqVO.getRoleIds());
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ public class UpdateAdminReqVO {
|
|||||||
@Schema(description = "email", example = "staff@new-staff.com")
|
@Schema(description = "email", example = "staff@new-staff.com")
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
|
@Schema(description = "실사지역코드", example = "code.region.main.1")
|
||||||
|
private String regionMainCode;
|
||||||
|
|
||||||
@Schema(description = "계정 비활성화 여부", example = "false")
|
@Schema(description = "계정 비활성화 여부", example = "false")
|
||||||
private Boolean accountDisabled;
|
private Boolean accountDisabled;
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ public class AuditCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void delete() {
|
public void delete() {
|
||||||
this.updatedAt = LocalDateTime.now();
|
|
||||||
this.updatedBy = getCurrentUsername();
|
|
||||||
this.deletedAt = LocalDateTime.now();
|
this.deletedAt = LocalDateTime.now();
|
||||||
this.deletedBy = getCurrentUsername();
|
this.deletedBy = getCurrentUsername();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public class InitAdminData implements ApplicationRunner {
|
|||||||
"test-admin",
|
"test-admin",
|
||||||
"admin1@#$",
|
"admin1@#$",
|
||||||
"admin@framework.org",
|
"admin@framework.org",
|
||||||
|
null,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
List.of("ROLE_ADMIN"));
|
List.of("ROLE_ADMIN"));
|
||||||
@@ -43,6 +44,7 @@ public class InitAdminData implements ApplicationRunner {
|
|||||||
"test-analyst",
|
"test-analyst",
|
||||||
"analyst1@#$",
|
"analyst1@#$",
|
||||||
"analyst@framework.org",
|
"analyst@framework.org",
|
||||||
|
"code.region.main.1",
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
List.of("ROLE_ANALYST"));
|
List.of("ROLE_ANALYST"));
|
||||||
@@ -53,6 +55,7 @@ public class InitAdminData implements ApplicationRunner {
|
|||||||
"test-researcher",
|
"test-researcher",
|
||||||
"researcher1@#$",
|
"researcher1@#$",
|
||||||
"researcher@framework.org",
|
"researcher@framework.org",
|
||||||
|
"code.region.main.1",
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
List.of("ROLE_RESEARCHER"));
|
List.of("ROLE_RESEARCHER"));
|
||||||
|
|||||||
@@ -27,23 +27,24 @@ public class InitFrontUserData implements ApplicationRunner {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
createHouseholdPortIn.operate(new CreateHouseholdInCmd(
|
// createHouseholdPortIn.operate(new CreateHouseholdInCmd(
|
||||||
"11111",
|
// "11111",
|
||||||
"테스트임가",
|
// "테스트임가",
|
||||||
58,
|
// 58,
|
||||||
null,
|
// null,
|
||||||
"01011111111",
|
// "010-1111-1111",
|
||||||
"서울",
|
// "code.region.main.1", // 서울
|
||||||
"마포구",
|
// "code.region.sub.31", // 경기도
|
||||||
"와와빌딩 2층",
|
// "code.region.detail.9", // 경기
|
||||||
14,
|
// "경기도 성남시 분당구 산성대로 437번길",
|
||||||
13,
|
// null,
|
||||||
11,
|
// null,
|
||||||
10,
|
// null,
|
||||||
10,
|
// null,
|
||||||
true,
|
// null,
|
||||||
null,
|
// true,
|
||||||
null
|
// null,
|
||||||
));
|
// null
|
||||||
|
// ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,22 +47,22 @@ public class InitUICodeData implements ApplicationRunner {
|
|||||||
|
|
||||||
uiCodeSavePortIn.connect(
|
uiCodeSavePortIn.connect(
|
||||||
new UICodeSaveCommand(
|
new UICodeSaveCommand(
|
||||||
UICODE_PAGEABLE_ROWS + ".10", UICODE_PAGEABLE_ROWS, 1, "10", "10", null, true),
|
UICODE_PAGEABLE_ROWS + ".10", UICODE_PAGEABLE_ROWS, 0, "10", "10", null, true),
|
||||||
false);
|
false);
|
||||||
|
|
||||||
uiCodeSavePortIn.connect(
|
uiCodeSavePortIn.connect(
|
||||||
new UICodeSaveCommand(
|
new UICodeSaveCommand(
|
||||||
UICODE_PAGEABLE_ROWS + ".20", UICODE_PAGEABLE_ROWS, 2, "20", "20", null, true),
|
UICODE_PAGEABLE_ROWS + ".20", UICODE_PAGEABLE_ROWS, 1, "20", "20", null, true),
|
||||||
false);
|
false);
|
||||||
|
|
||||||
uiCodeSavePortIn.connect(
|
uiCodeSavePortIn.connect(
|
||||||
new UICodeSaveCommand(
|
new UICodeSaveCommand(
|
||||||
UICODE_PAGEABLE_ROWS + ".50", UICODE_PAGEABLE_ROWS, 3, "50", "50", null, true),
|
UICODE_PAGEABLE_ROWS + ".50", UICODE_PAGEABLE_ROWS, 2, "50", "50", null, true),
|
||||||
false);
|
false);
|
||||||
|
|
||||||
uiCodeSavePortIn.connect(
|
uiCodeSavePortIn.connect(
|
||||||
new UICodeSaveCommand(
|
new UICodeSaveCommand(
|
||||||
UICODE_PAGEABLE_ROWS + ".100", UICODE_PAGEABLE_ROWS, 4, "100", "100", null, true),
|
UICODE_PAGEABLE_ROWS + ".100", UICODE_PAGEABLE_ROWS, 3, "100", "100", null, true),
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ public class RemoveInitData implements ApplicationRunner {
|
|||||||
mapper.deleteAllAdminHasRole();
|
mapper.deleteAllAdminHasRole();
|
||||||
mapper.deleteAllAdmin();
|
mapper.deleteAllAdmin();
|
||||||
|
|
||||||
mapper.deleteAllHouseholdHasRole();
|
// mapper.deleteAllHouseholdHasRole();
|
||||||
mapper.deleteAllHousehold();
|
// mapper.deleteAllHousehold();
|
||||||
|
|
||||||
mapper.deleteAllRoleHasPrivilege();
|
mapper.deleteAllRoleHasPrivilege();
|
||||||
mapper.deleteAllPrivilege();
|
mapper.deleteAllPrivilege();
|
||||||
@@ -44,7 +44,7 @@ public class RemoveInitData implements ApplicationRunner {
|
|||||||
mapper.deleteAllFrontUserHasRole();
|
mapper.deleteAllFrontUserHasRole();
|
||||||
mapper.deleteAllFrontUser();
|
mapper.deleteAllFrontUser();
|
||||||
|
|
||||||
mapper.deleteAllRole();
|
// mapper.deleteAllRole();
|
||||||
|
|
||||||
mapper.deleteAllUicode();
|
mapper.deleteAllUicode();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package app.module.core.config.application.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public enum UiCodeType {
|
||||||
|
REGION_MAIN("code.region.main"),
|
||||||
|
REGION_SUB("code.region.sub");
|
||||||
|
private final String desc;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package app.module.core.config.application.exception;
|
||||||
|
|
||||||
|
public class NoRecordDataException extends RuntimeException {
|
||||||
|
/**
|
||||||
|
* 생성자
|
||||||
|
*/
|
||||||
|
public NoRecordDataException() {
|
||||||
|
super("데이터 없음");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 생성자
|
||||||
|
*
|
||||||
|
* @param message 예외 메시지
|
||||||
|
*/
|
||||||
|
public NoRecordDataException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@ public interface SaveAdminPortIn {
|
|||||||
String id,
|
String id,
|
||||||
String password,
|
String password,
|
||||||
String email,
|
String email,
|
||||||
|
String regionMainCode,
|
||||||
Boolean accountDisabled,
|
Boolean accountDisabled,
|
||||||
Boolean accountLocked,
|
Boolean accountLocked,
|
||||||
List<String> roleIds);
|
List<String> roleIds);
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public class SaveAdminService implements SaveAdminPortIn {
|
|||||||
String id,
|
String id,
|
||||||
String password,
|
String password,
|
||||||
String email,
|
String email,
|
||||||
|
String regionMainCode,
|
||||||
Boolean accountDisabled,
|
Boolean accountDisabled,
|
||||||
Boolean accountLocked,
|
Boolean accountLocked,
|
||||||
List<String> roleIds) {
|
List<String> roleIds) {
|
||||||
@@ -58,6 +59,7 @@ public class SaveAdminService implements SaveAdminPortIn {
|
|||||||
password,
|
password,
|
||||||
passwordUpdatedAt,
|
passwordUpdatedAt,
|
||||||
email,
|
email,
|
||||||
|
regionMainCode,
|
||||||
accountDisabled,
|
accountDisabled,
|
||||||
loginFailCnt,
|
loginFailCnt,
|
||||||
accountLocked,
|
accountLocked,
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public class SaveAdminCmd extends AuditCommand {
|
|||||||
private String encodedPassword;
|
private String encodedPassword;
|
||||||
private LocalDateTime passwordUpdatedAt;
|
private LocalDateTime passwordUpdatedAt;
|
||||||
private String email;
|
private String email;
|
||||||
|
private String regionMainCode;
|
||||||
private Boolean accountDisabled;
|
private Boolean accountDisabled;
|
||||||
private Integer loginFailCnt;
|
private Integer loginFailCnt;
|
||||||
private Boolean accountLocked;
|
private Boolean accountLocked;
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ public class AdminView implements Serializable {
|
|||||||
private String password;
|
private String password;
|
||||||
private String email;
|
private String email;
|
||||||
private String name;
|
private String name;
|
||||||
private String contact;
|
private String phone;
|
||||||
|
private String regionMainCode;
|
||||||
private Integer inspectionArea;
|
private Integer inspectionArea;
|
||||||
private LocalDateTime passwordUpdatedAt;
|
private LocalDateTime passwordUpdatedAt;
|
||||||
private Boolean accountDisabled;
|
private Boolean accountDisabled;
|
||||||
|
|||||||
@@ -27,13 +27,14 @@ class CreateHouseholdService implements CreateHouseholdPortIn {
|
|||||||
inCmd.getTel(),
|
inCmd.getTel(),
|
||||||
inCmd.getPhone(),
|
inCmd.getPhone(),
|
||||||
passwordEncoder.encode(StringUtils.right(inCmd.getPhone(), 4)), // 비밀번호 핸드폰 뒤 네자리
|
passwordEncoder.encode(StringUtils.right(inCmd.getPhone(), 4)), // 비밀번호 핸드폰 뒤 네자리
|
||||||
inCmd.getRegion(),
|
inCmd.getRegionMainCode(),
|
||||||
inCmd.getCity(),
|
inCmd.getRegionSubCode(),
|
||||||
inCmd.getAddressDetail(),
|
inCmd.getRegionDetailCode(),
|
||||||
|
inCmd.getAddress(),
|
||||||
inCmd.getIndustryLargeCode(),
|
inCmd.getIndustryLargeCode(),
|
||||||
inCmd.getIndustryMiddleCode(),
|
inCmd.getIndustryMiddleCode(),
|
||||||
inCmd.getIndustrySmallCode(),
|
inCmd.getIndustrySubMiddle(),
|
||||||
inCmd.getScaleCode(),
|
inCmd.getIndustryDetail(),
|
||||||
inCmd.getEmploymentCode(),
|
inCmd.getEmploymentCode(),
|
||||||
inCmd.getIsPanel(),
|
inCmd.getIsPanel(),
|
||||||
inCmd.getMemo(),
|
inCmd.getMemo(),
|
||||||
|
|||||||
@@ -15,13 +15,14 @@ public class CreateHouseholdInCmd {
|
|||||||
private Integer ownerAge;
|
private Integer ownerAge;
|
||||||
private String tel;
|
private String tel;
|
||||||
private String phone;
|
private String phone;
|
||||||
private String region;
|
private String regionMainCode;
|
||||||
private String city;
|
private String regionSubCode;
|
||||||
private String addressDetail;
|
private String regionDetailCode;
|
||||||
|
private String address;
|
||||||
private Integer industryLargeCode;
|
private Integer industryLargeCode;
|
||||||
private Integer industryMiddleCode;
|
private Integer industryMiddleCode;
|
||||||
private Integer industrySmallCode;
|
private Integer industrySubMiddle;
|
||||||
private Integer scaleCode;
|
private Integer industryDetail;
|
||||||
private Integer employmentCode;
|
private Integer employmentCode;
|
||||||
private Boolean isPanel;
|
private Boolean isPanel;
|
||||||
private String memo;
|
private String memo;
|
||||||
|
|||||||
@@ -19,13 +19,14 @@ public class CreateHouseholdOutCmd extends AuditCommand {
|
|||||||
private String tel;
|
private String tel;
|
||||||
private String phone;
|
private String phone;
|
||||||
private String encodedPassword;
|
private String encodedPassword;
|
||||||
private String region;
|
private String regionMainCode;
|
||||||
private String city;
|
private String regionSubCode;
|
||||||
private String addressDetail;
|
private String regionDetailCode;
|
||||||
|
private String address;
|
||||||
private Integer industryLargeCode;
|
private Integer industryLargeCode;
|
||||||
private Integer industryMiddleCode;
|
private Integer industryMiddleCode;
|
||||||
private Integer industrySmallCode;
|
private Integer industrySubMiddle;
|
||||||
private Integer scaleCode;
|
private Integer industryDetail;
|
||||||
private Integer employmentCode;
|
private Integer employmentCode;
|
||||||
private Boolean isPanel;
|
private Boolean isPanel;
|
||||||
private String memo;
|
private String memo;
|
||||||
|
|||||||
@@ -22,14 +22,15 @@ public class GetHousehold {
|
|||||||
private String tel;
|
private String tel;
|
||||||
private String phone;
|
private String phone;
|
||||||
private String password;
|
private String password;
|
||||||
private String region;
|
private String regionMainCode;
|
||||||
private String city;
|
private String regionSubCode;
|
||||||
private String addressDetail;
|
private String regionDetailCode;
|
||||||
private Integer industryLargeCode;
|
private String address;
|
||||||
private Integer industryMiddleCode;
|
private String industryLargeCode;
|
||||||
private Integer industrySmallCode;
|
private String industryMiddleCode;
|
||||||
private Integer scaleCode;
|
private String industrySubMiddle;
|
||||||
private Integer employmentCode;
|
private String industryDetail;
|
||||||
|
private String employmentCode;
|
||||||
private Boolean isPanel;
|
private Boolean isPanel;
|
||||||
private String memo;
|
private String memo;
|
||||||
private String dropReason;
|
private String dropReason;
|
||||||
|
|||||||
@@ -18,7 +18,5 @@ public class UpdateFrontHouseholdCmd extends AuditCommand {
|
|||||||
private Integer ownerAge;
|
private Integer ownerAge;
|
||||||
private String tel;
|
private String tel;
|
||||||
private String phone;
|
private String phone;
|
||||||
private String region;
|
private String address;
|
||||||
private String city;
|
|
||||||
private String addressDetail;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ spring:
|
|||||||
sql:
|
sql:
|
||||||
init:
|
init:
|
||||||
schema-locations: classpath:sql/schema/*.sql
|
schema-locations: classpath:sql/schema/*.sql
|
||||||
|
data-locations: classpath:sql/data/*.sql
|
||||||
|
|
||||||
# ==============================================
|
# ==============================================
|
||||||
# 암호화 설정
|
# 암호화 설정
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
a.password,
|
a.password,
|
||||||
a.email,
|
a.email,
|
||||||
a.name,
|
a.name,
|
||||||
a.contact,
|
a.phone,
|
||||||
a.inspection_area,
|
a.region_main_code,
|
||||||
a.password_updated_at,
|
a.password_updated_at,
|
||||||
a.account_disabled,
|
a.account_disabled,
|
||||||
a.login_fail_cnt,
|
a.login_fail_cnt,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
id,
|
id,
|
||||||
password,
|
password,
|
||||||
email,
|
email,
|
||||||
|
region_main_code,
|
||||||
password_updated_at,
|
password_updated_at,
|
||||||
account_disabled,
|
account_disabled,
|
||||||
login_fail_cnt,
|
login_fail_cnt,
|
||||||
@@ -22,6 +23,7 @@
|
|||||||
#{id},
|
#{id},
|
||||||
#{encodedPassword},
|
#{encodedPassword},
|
||||||
#{email},
|
#{email},
|
||||||
|
#{regionMainCode},
|
||||||
#{passwordUpdatedAt},
|
#{passwordUpdatedAt},
|
||||||
#{accountDisabled},
|
#{accountDisabled},
|
||||||
#{loginFailCnt},
|
#{loginFailCnt},
|
||||||
@@ -35,6 +37,7 @@
|
|||||||
SET
|
SET
|
||||||
password = #{encodedPassword},
|
password = #{encodedPassword},
|
||||||
email = #{email},
|
email = #{email},
|
||||||
|
region_main_code = #{regionMainCode},
|
||||||
password_updated_at = #{passwordUpdatedAt},
|
password_updated_at = #{passwordUpdatedAt},
|
||||||
account_disabled = #{accountDisabled},
|
account_disabled = #{accountDisabled},
|
||||||
login_fail_cnt = #{loginFailCnt},
|
login_fail_cnt = #{loginFailCnt},
|
||||||
|
|||||||
@@ -32,8 +32,6 @@
|
|||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="DeleteBaseSet">
|
<sql id="DeleteBaseSet">
|
||||||
updated_by = #{updatedBy},
|
|
||||||
updated_at = #{updatedAt},
|
|
||||||
deleted_by = #{deletedBy},
|
deleted_by = #{deletedBy},
|
||||||
deleted_at = #{deletedAt},
|
deleted_at = #{deletedAt},
|
||||||
is_deleted = true
|
is_deleted = true
|
||||||
|
|||||||
@@ -17,13 +17,14 @@
|
|||||||
tel,
|
tel,
|
||||||
phone,
|
phone,
|
||||||
password,
|
password,
|
||||||
region,
|
region_main_code,
|
||||||
city,
|
region_sub_code,
|
||||||
address_detail,
|
region_detail_code,
|
||||||
|
address,
|
||||||
industry_large_code,
|
industry_large_code,
|
||||||
industry_middle_code,
|
industry_middle_code,
|
||||||
industry_small_code,
|
industry_sub_middle,
|
||||||
scale_code,
|
industry_detail,
|
||||||
employment_code,
|
employment_code,
|
||||||
is_panel,
|
is_panel,
|
||||||
memo,
|
memo,
|
||||||
@@ -37,13 +38,14 @@
|
|||||||
#{tel},
|
#{tel},
|
||||||
#{phone},
|
#{phone},
|
||||||
#{encodedPassword},
|
#{encodedPassword},
|
||||||
#{region},
|
#{regionMainCode},
|
||||||
#{city},
|
#{regionSubCode},
|
||||||
#{addressDetail},
|
#{regionDetailCode},
|
||||||
|
#{address},
|
||||||
#{industryLargeCode},
|
#{industryLargeCode},
|
||||||
#{industryMiddleCode},
|
#{industryMiddleCode},
|
||||||
#{industrySmallCode},
|
#{industrySubMiddle},
|
||||||
#{scaleCode},
|
#{industryDetail},
|
||||||
#{employmentCode},
|
#{employmentCode},
|
||||||
#{isPanel},
|
#{isPanel},
|
||||||
#{memo},
|
#{memo},
|
||||||
|
|||||||
@@ -14,13 +14,14 @@
|
|||||||
tel,
|
tel,
|
||||||
phone,
|
phone,
|
||||||
password,
|
password,
|
||||||
region,
|
region_main_code,
|
||||||
city,
|
region_sub_code,
|
||||||
address_detail,
|
region_detail_code,
|
||||||
|
address,
|
||||||
industry_large_code,
|
industry_large_code,
|
||||||
industry_middle_code,
|
industry_middle_code,
|
||||||
industry_small_code,
|
industry_sub_middle,
|
||||||
scale_code,
|
industry_detail,
|
||||||
employment_code,
|
employment_code,
|
||||||
is_panel,
|
is_panel,
|
||||||
memo,
|
memo,
|
||||||
|
|||||||
@@ -11,9 +11,7 @@
|
|||||||
owner_age = #{ownerAge},
|
owner_age = #{ownerAge},
|
||||||
tel = #{tel},
|
tel = #{tel},
|
||||||
phone = #{phone},
|
phone = #{phone},
|
||||||
region = #{region},
|
address = #{address},
|
||||||
city = #{city},
|
|
||||||
address_detail = #{addressDetail},
|
|
||||||
<include refid="common.fields.UpdateBaseSet" />
|
<include refid="common.fields.UpdateBaseSet" />
|
||||||
WHERE seq = ${seq}
|
WHERE seq = ${seq}
|
||||||
</update>
|
</update>
|
||||||
|
|||||||
44
core/src/main/resources/sql/data/01_init-data.sql
Normal file
44
core/src/main/resources/sql/data/01_init-data.sql
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
-- 초기 구동시 필요한 권한, 역할 데이터 등록
|
||||||
|
|
||||||
|
-- 권한
|
||||||
|
INSERT INTO privilege
|
||||||
|
(id, description, app_type, order_no, created_at, created_by, updated_at, updated_by, is_deleted)
|
||||||
|
VALUES
|
||||||
|
('ADMIN_API', 'ADMIN API 이용 권한', 'ADMIN', 0, CURRENT_TIMESTAMP, 'INIT_DATA',CURRENT_TIMESTAMP, 'INIT_DATA',false),
|
||||||
|
('ADMIN_ACCESS', 'ADMIN 사이트 접근 권한', 'ADMIN', 1, CURRENT_TIMESTAMP, 'INIT_DATA', CURRENT_TIMESTAMP, 'INIT_DATA', false),
|
||||||
|
('FRONT_API', 'Front API 사용권한', 'FRONT', 0, CURRENT_TIMESTAMP, 'INIT_DATA', CURRENT_TIMESTAMP, 'INIT_DATA', false),
|
||||||
|
('FRONT_ACCESS', 'Front 사이트 접근 권한', 'FRONT', 1, CURRENT_TIMESTAMP, 'INIT_DATA', CURRENT_TIMESTAMP, 'INIT_DATA', false);
|
||||||
|
|
||||||
|
-- 역할
|
||||||
|
INSERT INTO role
|
||||||
|
(id, description, app_type, order_no, created_at, created_by, updated_at, updated_by, is_deleted)
|
||||||
|
VALUES
|
||||||
|
('ROLE_ADMIN', '관리자', 'ADMIN', 0, CURRENT_TIMESTAMP, 'INIT_DATA', CURRENT_TIMESTAMP, 'INIT_DATA', false),
|
||||||
|
('ROLE_ANALYST', '연구원', 'ADMIN', 1, CURRENT_TIMESTAMP, 'INIT_DATA', CURRENT_TIMESTAMP, 'INIT_DATA', false),
|
||||||
|
('ROLE_RESEARCHER', '조사원', 'ADMIN', 2, CURRENT_TIMESTAMP, 'INIT_DATA', CURRENT_TIMESTAMP, 'INIT_DATA', false),
|
||||||
|
('ROLE_GENERAL', '일반 사용자', 'FRONT', 0, CURRENT_TIMESTAMP, 'INIT_DATA', CURRENT_TIMESTAMP, 'INIT_DATA', false);
|
||||||
|
|
||||||
|
-- 역할 권한 매핑
|
||||||
|
INSERT INTO role_has_privilege
|
||||||
|
(role_id, privilege_id, created_at, created_by, updated_at, updated_by, is_deleted)
|
||||||
|
VALUES
|
||||||
|
-- ROLE_ADMIN
|
||||||
|
('ROLE_ADMIN', 'ADMIN_API', CURRENT_TIMESTAMP, 'INIT_DATA', CURRENT_TIMESTAMP, 'INIT_DATA',
|
||||||
|
false),
|
||||||
|
('ROLE_ADMIN', 'ADMIN_ACCESS', CURRENT_TIMESTAMP, 'INIT_DATA', CURRENT_TIMESTAMP, 'INIT_DATA',
|
||||||
|
false),
|
||||||
|
-- ROLE_ANALYST
|
||||||
|
('ROLE_ANALYST', 'ADMIN_API', CURRENT_TIMESTAMP, 'INIT_DATA', CURRENT_TIMESTAMP, 'INIT_DATA',
|
||||||
|
false),
|
||||||
|
('ROLE_ANALYST', 'ADMIN_ACCESS', CURRENT_TIMESTAMP, 'INIT_DATA', CURRENT_TIMESTAMP, 'INIT_DATA',
|
||||||
|
false),
|
||||||
|
-- ROLE_RESEARCHER
|
||||||
|
('ROLE_RESEARCHER', 'ADMIN_API', CURRENT_TIMESTAMP, 'INIT_DATA', CURRENT_TIMESTAMP, 'INIT_DATA',
|
||||||
|
false),
|
||||||
|
('ROLE_RESEARCHER', 'ADMIN_ACCESS', CURRENT_TIMESTAMP, 'INIT_DATA', CURRENT_TIMESTAMP, 'INIT_DATA',
|
||||||
|
false),
|
||||||
|
-- ROLE_GENERAL
|
||||||
|
('ROLE_GENERAL', 'FRONT_API', CURRENT_TIMESTAMP, 'INIT_DATA', CURRENT_TIMESTAMP, 'INIT_DATA',
|
||||||
|
false),
|
||||||
|
('ROLE_GENERAL', 'FRONT_ACCESS', CURRENT_TIMESTAMP, 'INIT_DATA', CURRENT_TIMESTAMP, 'INIT_DATA',
|
||||||
|
false);
|
||||||
134
core/src/main/resources/sql/data/02_uicode.sql
Normal file
134
core/src/main/resources/sql/data/02_uicode.sql
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
-- UI CODE 기본 data 등록
|
||||||
|
INSERT INTO uicode
|
||||||
|
(id, parent_id, code_text, code_value, msg_code, in_use, order_no, created_at, created_by, updated_at, updated_by, deleted_at, deleted_by, is_deleted)
|
||||||
|
VALUES
|
||||||
|
('code', NULL, 'UI Code', '', NULL, true, 0, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.pageable', 'code', 'Pageable', '', NULL, true, 0, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.pageable.rows', 'code.pageable', 'ROW 갯수', '', NULL, true, 0, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.pageable.rows.10', 'code.pageable.rows', '10', '10', NULL, true, 0, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.pageable.rows.20', 'code.pageable.rows', '20', '20', NULL, true, 1, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.pageable.rows.50', 'code.pageable.rows', '50', '50', NULL, true, 2, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.pageable.rows.100', 'code.pageable.rows', '100', '100', NULL, true, 3, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false);
|
||||||
|
|
||||||
|
|
||||||
|
-- ============================================
|
||||||
|
-- 조사지역 관련 UICODE 등록
|
||||||
|
-- ============================================
|
||||||
|
INSERT INTO uicode
|
||||||
|
(id, parent_id, code_text, code_value, msg_code, in_use, order_no, created_at, created_by, updated_at, updated_by, deleted_at, deleted_by, is_deleted)
|
||||||
|
values
|
||||||
|
('code.region', 'code', '조사 지역', '', NULL, true, 1, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false);
|
||||||
|
|
||||||
|
-- 실사
|
||||||
|
INSERT INTO uicode
|
||||||
|
(id, parent_id, code_text, code_value, msg_code, in_use, order_no, created_at, created_by, updated_at, updated_by, deleted_at, deleted_by, is_deleted)
|
||||||
|
values
|
||||||
|
('code.region.main', 'code.region', '실사', '', NULL, true, 0, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.main.1', 'code.region.main', '서울', '1', NULL, true, 0, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.main.2', 'code.region.main', '강원', '2', NULL, true, 1, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.main.3', 'code.region.main', '대전', '3', NULL, true, 2, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.main.4', 'code.region.main', '광주', '4', NULL, true, 3, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.main.5', 'code.region.main', '대구', '5', NULL, true, 4, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.main.6', 'code.region.main', '부산', '6', NULL, true, 5, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false);
|
||||||
|
|
||||||
|
-- 지역
|
||||||
|
INSERT INTO uicode
|
||||||
|
(id, parent_id, code_text, code_value, msg_code, in_use, order_no, created_at, created_by, updated_at, updated_by, deleted_at, deleted_by, is_deleted)
|
||||||
|
VALUES
|
||||||
|
('code.region.sub', 'code.region', '지역', '', NULL, true, 1, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.sub.31', 'code.region.sub', '경기도', '31', NULL, true, 0, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.sub.32', 'code.region.sub', '강원도', '32', NULL, true, 1, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.sub.33', 'code.region.sub', '충청북도', '33', NULL, true, 2, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.sub.34', 'code.region.sub', '충청남도', '34', NULL, true, 3, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.sub.35', 'code.region.sub', '전라북도', '35', NULL, true, 4, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.sub.36', 'code.region.sub', '전라남도', '36', NULL, true, 5, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.sub.37', 'code.region.sub', '경상북도', '37', NULL, true, 6, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.sub.38', 'code.region.sub', '경상남도', '38', NULL, true, 7, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.sub.40', 'code.region.sub', '특광역시', '40', NULL, true, 8, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false);
|
||||||
|
|
||||||
|
-- 세부지역
|
||||||
|
INSERT INTO uicode
|
||||||
|
(id, parent_id, code_text, code_value, msg_code, in_use, order_no, created_at, created_by, updated_at, updated_by, deleted_at, deleted_by, is_deleted)
|
||||||
|
VALUES
|
||||||
|
('code.region.detail', 'code.region', '세부지역', '', NULL, true, 2, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.detail.2', 'code.region.detail', '부산', '2', NULL, true, 0, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.detail.3', 'code.region.detail', '대구', '3', NULL, true, 1, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.detail.5', 'code.region.detail', '광주', '5', NULL, true, 2, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.detail.6', 'code.region.detail', '대전', '6', NULL, true, 3, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.detail.7', 'code.region.detail', '울산', '7', NULL, true, 4, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.detail.8', 'code.region.detail', '세종', '8', NULL, true, 5, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.detail.9', 'code.region.detail', '경기', '9', NULL, true, 6, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.detail.10', 'code.region.detail', '강원', '10', NULL, true, 7, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.detail.11', 'code.region.detail', '충북', '11', NULL, true, 8, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.detail.12', 'code.region.detail', '충남', '12', NULL, true, 9, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.detail.13', 'code.region.detail', '전북', '13', NULL, true, 10, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.detail.14', 'code.region.detail', '전남', '14', NULL, true, 11, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.detail.15', 'code.region.detail', '경북', '15', NULL, true, 12, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.region.detail.16', 'code.region.detail', '경남', '16', NULL, true, 13, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- ============================================
|
||||||
|
-- 업종 관련 UICODE 등록
|
||||||
|
-- ============================================
|
||||||
|
INSERT INTO uicode
|
||||||
|
(id, parent_id, code_text, code_value, msg_code, in_use, order_no, created_at, created_by, updated_at, updated_by, deleted_at, deleted_by, is_deleted)
|
||||||
|
VALUES
|
||||||
|
('code.industry', 'code', '업종', '', NULL, true, 2, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false);
|
||||||
|
|
||||||
|
-- 업종 대분류
|
||||||
|
INSERT INTO uicode
|
||||||
|
(id, parent_id, code_text, code_value, msg_code, in_use, order_no, created_at, created_by, updated_at, updated_by, deleted_at, deleted_by, is_deleted)
|
||||||
|
VALUES
|
||||||
|
('code.industry.large', 'code.industry', '업종 대분류', '', NULL, true, 0, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.industry.large.10', 'code.industry.large', '육림업', '10', NULL, true, 0, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.industry.large.20', 'code.industry.large', '벌목업', '20', NULL, true, 1, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.industry.large.30', 'code.industry.large', '채취업', '30', NULL, true, 2, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.industry.large.40', 'code.industry.large', '수실류재배업', '40', NULL, true, 3, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.industry.large.50', 'code.industry.large', '비수실류재배업', '50', NULL, true, 4, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false);
|
||||||
|
|
||||||
|
-- 업종 중분류
|
||||||
|
INSERT INTO uicode
|
||||||
|
(id, parent_id, code_text, code_value, msg_code, in_use, order_no, created_at, created_by, updated_at, updated_by, deleted_at, deleted_by, is_deleted)
|
||||||
|
VALUES
|
||||||
|
('code.industry.middle', 'code.industry', '업종 중분류', '', NULL, true, 1, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.industry.middle.10', 'code.industry.middle', '육림업', '10', NULL, true, 0, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.industry.middle.20', 'code.industry.middle', '벌목업', '20', NULL, true, 1, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.industry.middle.31', 'code.industry.middle', '송이채취업', '31', NULL, true, 2, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.industry.middle.32', 'code.industry.middle', '기타채취업', '32', NULL, true, 3, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.industry.middle.41', 'code.industry.middle', '밤재배업', '41', NULL, true, 4, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.industry.middle.42', 'code.industry.middle', '대추재배업', '42', NULL, true, 5, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.industry.middle.43', 'code.industry.middle', '은행·오가재배업', '43', NULL, true, 6, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.industry.middle.44', 'code.industry.middle', '기타수실류', '44', NULL, true, 7, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.industry.middle.51', 'code.industry.middle', '표고버섯재배업', '51', NULL, true, 8, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.industry.middle.52', 'code.industry.middle', '광산송이재배업', '52', NULL, true, 9, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.industry.middle.53', 'code.industry.middle', '양송이류재배업', '53', NULL, true, 10, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false),
|
||||||
|
('code.industry.middle.54', 'code.industry.middle', '산나물재배업', '54', NULL, true, 11, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', NULL, NULL, false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- ============================================
|
||||||
|
-- 일계부 관련 UICODE 등록
|
||||||
|
-- ============================================
|
||||||
|
INSERT INTO uicode
|
||||||
|
(id, parent_id, code_text, code_value, msg_code, in_use, order_no, created_at, created_by, updated_at, updated_by, deleted_at, deleted_by, is_deleted)
|
||||||
|
VALUES
|
||||||
|
-- 일계부
|
||||||
|
('code.record', 'code', '일계부 Code', NULL, NULL, true, 0, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||||
|
|
||||||
|
-- 재배형태
|
||||||
|
('code.record.crop', 'code.record', '재배형태', NULL, NULL, true, 0, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||||
|
('code.record.crop.11', 'code.record.crop', '당년산/일반', '11', NULL, true, 0, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||||
|
('code.record.crop.12', 'code.record.crop', '당년산/유기농', '12', NULL, true, 1, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||||
|
('code.record.crop.13', 'code.record.crop', '당년산/무농약', '13', NULL, true, 2, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||||
|
('code.record.crop.15', 'code.record.crop', '당년산/GAP 인증', '15', NULL, true, 3, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||||
|
|
||||||
|
-- 단위 Code
|
||||||
|
('code.record.unit', 'code.record', '단위 Code', NULL, NULL, true, 0, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||||
|
('code.record.unit.gram', 'code.record.unit', 'g', 'g', NULL, true, 0, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||||
|
('code.record.unit.kg', 'code.record.unit', 'kg', 'kg', NULL, true, 1, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||||
|
|
||||||
|
-- 수입 종류
|
||||||
|
('code.record.income', 'code.record', '단위 Code', NULL, NULL, true, 0, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||||
|
('code.record.income.01', 'code.record.income', '종류1', '01', NULL, true, 0, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||||
|
('code.record.income.02', 'code.record.income', '종류2', '02', NULL, true, 1, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false);
|
||||||
49
core/src/main/resources/sql/data/03_admin.sql
Normal file
49
core/src/main/resources/sql/data/03_admin.sql
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
-- 관리자
|
||||||
|
INSERT INTO admin
|
||||||
|
(seq, id, email, "password", password_updated_at, "name", contact, region_main_code,
|
||||||
|
account_disabled, login_fail_cnt, account_locked,
|
||||||
|
created_at, created_by, updated_at, updated_by, is_deleted)
|
||||||
|
values
|
||||||
|
(1, 'test-admin', 'admin@test.com', crypt('admin1@#$', gen_salt('bf')), NOW(), '관리자', NULL, NULL,
|
||||||
|
false, 0, false, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', false),
|
||||||
|
|
||||||
|
(2, 'test-analyst', 'analyst@test.com', crypt('analyst1@#$', gen_salt('bf')), NOW(), '연구자', NULL, 'code.region.main.1',
|
||||||
|
false, 0, false, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', false),
|
||||||
|
|
||||||
|
(3, 'test-researcher', 'researcher@test.com', crypt('researcher1@#$', gen_salt('bf')), NOW(), '조사원', NULL, 'code.region.main.1',
|
||||||
|
false, 0, false, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', false),
|
||||||
|
|
||||||
|
(4, 'researcher1', 'researcher1@test.com', crypt('researcher1@#$', gen_salt('bf')), NOW(), '송지영', '010-9900-8202', 'code.region.main.1',
|
||||||
|
false, 0, false, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', false),
|
||||||
|
|
||||||
|
(5, 'researcher2', 'researcher2@test.com', crypt('researcher1@#$', gen_salt('bf')), NOW(), '여문자', '010-8337-1634', 'code.region.main.1',
|
||||||
|
false, 0, false, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', false),
|
||||||
|
|
||||||
|
(6, 'researcher3', 'researcher3@test.com', crypt('researcher1@#$', gen_salt('bf')), NOW(), '유정화', '010-2777-5371', 'code.region.main.1',
|
||||||
|
false, 0, false, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', false),
|
||||||
|
|
||||||
|
(7, 'researcher4', 'researcher4@test.com', crypt('researcher1@#$', gen_salt('bf')), NOW(), '최명주', '010-3550-0903', 'code.region.main.1',
|
||||||
|
false, 0, false, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', false),
|
||||||
|
|
||||||
|
(8, 'researcher5', 'researcher5@test.com', crypt('researcher1@#$', gen_salt('bf')), NOW(), '허인순', '010-2320-4943', 'code.region.main.1',
|
||||||
|
false, 0, false, NOW(), 'INIT_DATA', NOW(), 'INIT_DATA', false);
|
||||||
|
|
||||||
|
|
||||||
|
-- 관리자 역할 매핑
|
||||||
|
-- 관리자
|
||||||
|
INSERT INTO admin_has_role (admin_seq, role_id, created_at, created_by, is_deleted)
|
||||||
|
VALUES (1, 'ROLE_ADMIN', NOW(), 'INIT_DATA', false);
|
||||||
|
|
||||||
|
-- 연구원
|
||||||
|
INSERT INTO admin_has_role (admin_seq, role_id, created_at, created_by, is_deleted)
|
||||||
|
VALUES (2, 'ROLE_ANALYST', NOW(), 'INIT_DATA', false);
|
||||||
|
|
||||||
|
-- 조사원
|
||||||
|
INSERT INTO admin_has_role (admin_seq, role_id, created_at, created_by, is_deleted)
|
||||||
|
VALUES
|
||||||
|
(3, 'ROLE_RESEARCHER', NOW(), 'INIT_DATA', false),
|
||||||
|
(4, 'ROLE_RESEARCHER', NOW(), 'INIT_DATA', false),
|
||||||
|
(5, 'ROLE_RESEARCHER', NOW(), 'INIT_DATA', false),
|
||||||
|
(6, 'ROLE_RESEARCHER', NOW(), 'INIT_DATA', false),
|
||||||
|
(7, 'ROLE_RESEARCHER', NOW(), 'INIT_DATA', false),
|
||||||
|
(8, 'ROLE_RESEARCHER', NOW(), 'INIT_DATA', false);
|
||||||
@@ -13,6 +13,24 @@ DROP TABLE IF EXISTS researcher_has_household;
|
|||||||
DROP TABLE IF EXISTS researcher_has_area;
|
DROP TABLE IF EXISTS researcher_has_area;
|
||||||
DROP TABLE IF EXISTS research_area;
|
DROP TABLE IF EXISTS research_area;
|
||||||
|
|
||||||
|
-- NEW 일계부 연관 테이블(hj)
|
||||||
|
DROP TABLE IF EXISTS daily_income;
|
||||||
|
DROP TABLE IF EXISTS daily_expense;
|
||||||
|
DROP TABLE IF EXISTS daily_work;
|
||||||
|
DROP TABLE IF EXISTS daily_power;
|
||||||
|
DROP TABLE IF EXISTS daily_forestry;
|
||||||
|
DROP TABLE IF EXISTS daily_farming;
|
||||||
|
DROP TABLE IF EXISTS daily_record;
|
||||||
|
DROP TABLE IF EXISTS daily_day_group;
|
||||||
|
|
||||||
|
DROP SEQUENCE IF EXISTS daily_income_seq;
|
||||||
|
DROP SEQUENCE IF EXISTS daily_expense_seq;
|
||||||
|
DROP SEQUENCE IF EXISTS daily_work_seq;
|
||||||
|
DROP SEQUENCE IF EXISTS daily_power_seq;
|
||||||
|
DROP SEQUENCE IF EXISTS daily_forestry_seq;
|
||||||
|
DROP SEQUENCE IF EXISTS daily_farming_seq;
|
||||||
|
DROP SEQUENCE IF EXISTS daily_record_seq;
|
||||||
|
|
||||||
-- household 연관 테이블
|
-- household 연관 테이블
|
||||||
DROP TABLE IF EXISTS suggestion;
|
DROP TABLE IF EXISTS suggestion;
|
||||||
DROP TABLE IF EXISTS upload_receipt_files;
|
DROP TABLE IF EXISTS upload_receipt_files;
|
||||||
|
|||||||
@@ -186,8 +186,8 @@ CREATE TABLE admin (
|
|||||||
password varchar(255), -- 비밀번호
|
password varchar(255), -- 비밀번호
|
||||||
password_updated_at timestamp(6) NOT NULL, -- 비밀번호 수정일
|
password_updated_at timestamp(6) NOT NULL, -- 비밀번호 수정일
|
||||||
name varchar(4), -- 관리자 이름
|
name varchar(4), -- 관리자 이름
|
||||||
contact varchar(15), -- 연락처
|
phone varchar(255), -- 연락처
|
||||||
inspection_area varchar(10), -- 실사지역
|
region_main_code varchar(255), -- 실사(공통코드)
|
||||||
account_disabled boolean, -- 계정 비활성화 여부
|
account_disabled boolean, -- 계정 비활성화 여부
|
||||||
login_fail_cnt integer, -- 로그인 실패 횟수
|
login_fail_cnt integer, -- 로그인 실패 횟수
|
||||||
account_locked boolean, -- 계정 잠김 여부
|
account_locked boolean, -- 계정 잠김 여부
|
||||||
@@ -210,8 +210,8 @@ COMMENT ON COLUMN admin.email IS '이메일';
|
|||||||
COMMENT ON COLUMN admin.password IS '비밀번호';
|
COMMENT ON COLUMN admin.password IS '비밀번호';
|
||||||
COMMENT ON COLUMN admin.password_updated_at IS '비밀번호 수정일';
|
COMMENT ON COLUMN admin.password_updated_at IS '비밀번호 수정일';
|
||||||
COMMENT ON COLUMN admin.name IS '관리자 이름';
|
COMMENT ON COLUMN admin.name IS '관리자 이름';
|
||||||
COMMENT ON COLUMN admin.contact IS '연락처';
|
COMMENT ON COLUMN admin.phone IS '연락처';
|
||||||
COMMENT ON COLUMN admin.inspection_area IS '실사지역';
|
COMMENT ON COLUMN admin.region_main_code IS '실사';
|
||||||
COMMENT ON COLUMN admin.account_disabled IS '계정 비활성화 여부';
|
COMMENT ON COLUMN admin.account_disabled IS '계정 비활성화 여부';
|
||||||
COMMENT ON COLUMN admin.login_fail_cnt IS '로그인 실패 횟수';
|
COMMENT ON COLUMN admin.login_fail_cnt IS '로그인 실패 횟수';
|
||||||
COMMENT ON COLUMN admin.account_locked IS '계정 잠김 여부';
|
COMMENT ON COLUMN admin.account_locked IS '계정 잠김 여부';
|
||||||
@@ -272,19 +272,20 @@ CREATE SEQUENCE household_seq START WITH 1 INCREMENT BY 1 CACHE 1 NO CYCLE;
|
|||||||
CREATE TABLE household (
|
CREATE TABLE household (
|
||||||
seq bigint NOT NULL DEFAULT nextval('household_seq'), -- 가구 일련번호 (PK)
|
seq bigint NOT NULL DEFAULT nextval('household_seq'), -- 가구 일련번호 (PK)
|
||||||
household_num varchar(255) NOT NULL, -- 가구 번호
|
household_num varchar(255) NOT NULL, -- 가구 번호
|
||||||
owner_name varchar(10) NOT NULL, -- 소유자 이름
|
owner_name varchar(255) NOT NULL, -- 경영주 이름
|
||||||
owner_age integer NOT NULL, -- 소유자 나이
|
owner_age integer NOT NULL, -- 경영주 나이
|
||||||
tel varchar(20), -- 유선 전화번호
|
tel varchar(20), -- 유선 전화번호
|
||||||
phone varchar(15) NOT NULL, -- 휴대폰 번호
|
phone varchar(255) NOT NULL, -- 휴대폰 번호
|
||||||
password varchar(255) NOT NULL, -- 비밀번호
|
password varchar(255) NOT NULL, -- 비밀번호
|
||||||
region varchar(255), -- 지역
|
region_main_code varchar(255), -- 실사(공통코드)
|
||||||
city varchar(255), -- 도시
|
region_sub_code varchar(255), -- 지역(공통코드)
|
||||||
address_detail varchar(100), -- 상세 주소
|
region_detail_code varchar(255), -- 상세지역(공통코드)
|
||||||
industry_large_code varchar(255), -- 산업 대분류 코드(매핑코드)
|
address varchar(255), -- 전체 주소
|
||||||
industry_middle_code varchar(255), -- 산업 중분류 코드(매핑코드)
|
industry_large_code varchar(255), -- 업종 대분류 코드(공통코드)
|
||||||
industry_small_code varchar(255), -- 산업 소분류 코드(매핑코드)
|
industry_middle_code varchar(255), -- 업종 중분류1 코드(공통코드)
|
||||||
scale_code varchar(255), -- 사업장 규모 코드(매핑코드)
|
industry_sub_middle varchar(255), -- 업종 중분류2
|
||||||
employment_code varchar(255), -- 전/겸업 코드(매핑코드)
|
industry_detail varchar(255), -- 규모/세부품목
|
||||||
|
employment_code varchar(255), -- 전/겸업 코드(공통코드) -- TODO: 필요한지 체크
|
||||||
is_panel boolean DEFAULT true, -- 패널 여부
|
is_panel boolean DEFAULT true, -- 패널 여부
|
||||||
memo varchar(255), -- 메모
|
memo varchar(255), -- 메모
|
||||||
drop_reason varchar(50), -- 탈락 사유
|
drop_reason varchar(50), -- 탈락 사유
|
||||||
@@ -300,22 +301,22 @@ CREATE TABLE household (
|
|||||||
);
|
);
|
||||||
|
|
||||||
COMMENT ON TABLE household IS '가구(패널) 정보 테이블';
|
COMMENT ON TABLE household IS '가구(패널) 정보 테이블';
|
||||||
|
|
||||||
COMMENT ON COLUMN household.seq IS '가구 일련번호 (PK)';
|
COMMENT ON COLUMN household.seq IS '가구 일련번호 (PK)';
|
||||||
COMMENT ON COLUMN household.household_num IS '가구 번호';
|
COMMENT ON COLUMN household.household_num IS '가구 번호';
|
||||||
COMMENT ON COLUMN household.owner_name IS '소유자 이름';
|
COMMENT ON COLUMN household.owner_name IS '경영주 이름';
|
||||||
COMMENT ON COLUMN household.owner_age IS '소유자 나이';
|
COMMENT ON COLUMN household.owner_age IS '경영주 나이';
|
||||||
COMMENT ON COLUMN household.tel IS '유선 전화번호';
|
COMMENT ON COLUMN household.tel IS '유선 전화번호';
|
||||||
COMMENT ON COLUMN household.phone IS '휴대폰 번호';
|
COMMENT ON COLUMN household.phone IS '휴대폰 번호';
|
||||||
COMMENT ON COLUMN household.password IS '비밀번호';
|
COMMENT ON COLUMN household.password IS '비밀번호';
|
||||||
COMMENT ON COLUMN household.region IS '지역';
|
COMMENT ON COLUMN household.region_main_code IS '실사(공통코드)';
|
||||||
COMMENT ON COLUMN household.city IS '도시';
|
COMMENT ON COLUMN household.region_sub_code IS '지역(공통코드)';
|
||||||
COMMENT ON COLUMN household.address_detail IS '상세 주소';
|
COMMENT ON COLUMN household.region_detail_code IS '상세지역(공통코드)';
|
||||||
COMMENT ON COLUMN household.industry_large_code IS '산업 대분류 코드 (매핑코드)';
|
COMMENT ON COLUMN household.address IS '전체 주소';
|
||||||
COMMENT ON COLUMN household.industry_middle_code IS '산업 중분류 코드(매핑코드)';
|
COMMENT ON COLUMN household.industry_large_code IS '업종 대분류 코드(공통코드)';
|
||||||
COMMENT ON COLUMN household.industry_small_code IS '산업 소분류 코드(매핑코드)';
|
COMMENT ON COLUMN household.industry_middle_code IS '업종 중분류1 코드(공통코드)';
|
||||||
COMMENT ON COLUMN household.scale_code IS '사업장 규모 코드(매핑코드)';
|
COMMENT ON COLUMN household.industry_sub_middle IS '업종 중분류2';
|
||||||
COMMENT ON COLUMN household.employment_code IS '전/겸업 코드(매핑코드)';
|
COMMENT ON COLUMN household.industry_detail IS '규모/세부품목';
|
||||||
|
COMMENT ON COLUMN household.employment_code IS '전/겸업 코드(공통코드)';
|
||||||
COMMENT ON COLUMN household.is_panel IS '패널 여부';
|
COMMENT ON COLUMN household.is_panel IS '패널 여부';
|
||||||
COMMENT ON COLUMN household.memo IS '메모';
|
COMMENT ON COLUMN household.memo IS '메모';
|
||||||
COMMENT ON COLUMN household.drop_reason IS '탈락 사유';
|
COMMENT ON COLUMN household.drop_reason IS '탈락 사유';
|
||||||
@@ -1019,8 +1020,7 @@ CREATE TABLE researcher_household_visit (
|
|||||||
admin_seq bigint NOT NULL, -- 관리자 일련번호 (조사원)
|
admin_seq bigint NOT NULL, -- 관리자 일련번호 (조사원)
|
||||||
household_seq bigint NOT NULL, -- 임가 일련번호
|
household_seq bigint NOT NULL, -- 임가 일련번호
|
||||||
is_gift_sent boolean, -- 답례품 전달 여부
|
is_gift_sent boolean, -- 답례품 전달 여부
|
||||||
is_recall boolean, -- 회수 여부
|
memo varchar(255), -- 메모
|
||||||
note varchar(255), -- 특이사항 기재란
|
|
||||||
visit_date date, -- 방문 날짜(yyyy-mm-dd)
|
visit_date date, -- 방문 날짜(yyyy-mm-dd)
|
||||||
created_at timestamp(6), -- 생성일
|
created_at timestamp(6), -- 생성일
|
||||||
created_by varchar(255), -- 생성자
|
created_by varchar(255), -- 생성자
|
||||||
@@ -1041,8 +1041,7 @@ COMMENT ON COLUMN researcher_household_visit.id IS '조사원임가방문정보
|
|||||||
COMMENT ON COLUMN researcher_household_visit.admin_seq IS '관리자 일련번호(조사원)';
|
COMMENT ON COLUMN researcher_household_visit.admin_seq IS '관리자 일련번호(조사원)';
|
||||||
COMMENT ON COLUMN researcher_household_visit.household_seq IS '임가 일련번호';
|
COMMENT ON COLUMN researcher_household_visit.household_seq IS '임가 일련번호';
|
||||||
COMMENT ON COLUMN researcher_household_visit.is_gift_sent IS '답례품 전달 여부';
|
COMMENT ON COLUMN researcher_household_visit.is_gift_sent IS '답례품 전달 여부';
|
||||||
COMMENT ON COLUMN researcher_household_visit.is_recall IS '회수 여부';
|
COMMENT ON COLUMN researcher_household_visit.memo IS '메모';
|
||||||
COMMENT ON COLUMN researcher_household_visit.note IS '특이사항 기재란';
|
|
||||||
COMMENT ON COLUMN researcher_household_visit.visit_date IS '방문날짜(yyyy-mm-dd)';
|
COMMENT ON COLUMN researcher_household_visit.visit_date IS '방문날짜(yyyy-mm-dd)';
|
||||||
COMMENT ON COLUMN researcher_household_visit.created_at IS '생성일';
|
COMMENT ON COLUMN researcher_household_visit.created_at IS '생성일';
|
||||||
COMMENT ON COLUMN researcher_household_visit.created_by IS '생성자';
|
COMMENT ON COLUMN researcher_household_visit.created_by IS '생성자';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
-- ============================================
|
-- ============================================
|
||||||
-- 임가 일계부 입력 관련 테이블 S
|
-- 임가 일계부 입력 관련 테이블 S
|
||||||
-- ============================================
|
-- ============================================
|
||||||
|
/*
|
||||||
DROP TABLE IF EXISTS daily_income;
|
DROP TABLE IF EXISTS daily_income;
|
||||||
DROP TABLE IF EXISTS daily_expense;
|
DROP TABLE IF EXISTS daily_expense;
|
||||||
DROP TABLE IF EXISTS daily_work;
|
DROP TABLE IF EXISTS daily_work;
|
||||||
@@ -19,6 +19,7 @@ DROP SEQUENCE IF EXISTS daily_power_seq;
|
|||||||
DROP SEQUENCE IF EXISTS daily_forestry_seq;
|
DROP SEQUENCE IF EXISTS daily_forestry_seq;
|
||||||
DROP SEQUENCE IF EXISTS daily_farming_seq;
|
DROP SEQUENCE IF EXISTS daily_farming_seq;
|
||||||
DROP SEQUENCE IF EXISTS daily_record_seq;
|
DROP SEQUENCE IF EXISTS daily_record_seq;
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
-- ============================================
|
-- ============================================
|
||||||
@@ -84,7 +85,7 @@ CREATE SEQUENCE daily_record_seq START WITH 1 INCREMENT BY 1 CACHE 1 NO CYCLE;
|
|||||||
CREATE TABLE daily_record (
|
CREATE TABLE daily_record (
|
||||||
id bigint DEFAULT nextval('daily_record_seq') NOT NULL, -- 일계부 작성상태 ID
|
id bigint DEFAULT nextval('daily_record_seq') NOT NULL, -- 일계부 작성상태 ID
|
||||||
household_seq bigint NOT NULL, -- 임가 일련번호 (FK)
|
household_seq bigint NOT NULL, -- 임가 일련번호 (FK)
|
||||||
month varchar(7) NOT NULL, -- 조사시행 월 (yyyy-mm)
|
record_month varchar(7) NOT NULL, -- 조사시행 월 (yyyy-mm)
|
||||||
day_group_no smallint, -- 일계부 작성일자 그룹 번호
|
day_group_no smallint, -- 일계부 작성일자 그룹 번호
|
||||||
start_date date, -- 작성시작일(yyyy-mm-dd)
|
start_date date, -- 작성시작일(yyyy-mm-dd)
|
||||||
end_date date, -- 작성종료일(yyyy-mm-dd)
|
end_date date, -- 작성종료일(yyyy-mm-dd)
|
||||||
@@ -111,7 +112,7 @@ COMMENT ON TABLE daily_record IS '일계부 일별 작성상태';
|
|||||||
|
|
||||||
COMMENT ON COLUMN daily_record.id IS '일계부 작성상태 ID';
|
COMMENT ON COLUMN daily_record.id IS '일계부 작성상태 ID';
|
||||||
COMMENT ON COLUMN daily_record.household_seq IS '임가 일련번호';
|
COMMENT ON COLUMN daily_record.household_seq IS '임가 일련번호';
|
||||||
COMMENT ON COLUMN daily_record.month IS '조사시행 월 (yyyy-mm)';
|
COMMENT ON COLUMN daily_record.record_month IS '조사시행 월 (yyyy-mm)';
|
||||||
COMMENT ON COLUMN daily_record.start_date IS '작성시작일(yyyy-mm-dd)';
|
COMMENT ON COLUMN daily_record.start_date IS '작성시작일(yyyy-mm-dd)';
|
||||||
COMMENT ON COLUMN daily_record.end_date IS '작성종료일(yyyy-mm-dd)';
|
COMMENT ON COLUMN daily_record.end_date IS '작성종료일(yyyy-mm-dd)';
|
||||||
COMMENT ON COLUMN daily_record.day_group_no IS '일계부 작성일자 그룹 번호';
|
COMMENT ON COLUMN daily_record.day_group_no IS '일계부 작성일자 그룹 번호';
|
||||||
@@ -140,15 +141,17 @@ CREATE SEQUENCE daily_income_seq START WITH 1 INCREMENT BY 1 CACHE 1 NO CYCLE;
|
|||||||
CREATE TABLE daily_income (
|
CREATE TABLE daily_income (
|
||||||
id bigint DEFAULT nextval('daily_income_seq') NOT NULL, -- 일계부 수입 ID
|
id bigint DEFAULT nextval('daily_income_seq') NOT NULL, -- 일계부 수입 ID
|
||||||
daily_record_seq bigint NOT NULL, -- 일계부 작성상태 일련번호 (FK)
|
daily_record_seq bigint NOT NULL, -- 일계부 작성상태 일련번호 (FK)
|
||||||
|
input_type varchar(5), -- 입력 구분(SELF, OCR)
|
||||||
is_credit boolean, -- 외상판매 여부
|
is_credit boolean, -- 외상판매 여부
|
||||||
|
expense_mark_code varchar(10), -- 지출부호
|
||||||
crop_code varchar(255), -- 재배형태 코드 (매핑코드)
|
crop_code varchar(255), -- 재배형태 코드 (매핑코드)
|
||||||
category_code varchar(255) NOT NULL, -- 수입 종류(매핑코드)
|
category_code varchar(255), -- 수입 종류(매핑코드)
|
||||||
category_name varchar(30) NOT NULL, -- 수입 종류(직접입력)
|
category_self varchar(30), -- 수입 종류(직접입력)
|
||||||
source_purpose varchar(10), -- 수입원(용도)
|
source_purpose varchar(10), -- 수입원(용도)
|
||||||
quantity decimal(6,2) NOT NULL, -- 수량
|
quantity decimal(6,2), -- 수량
|
||||||
unit_code varchar(10) NOT NULL, -- 단위 (매핑코드)
|
unit_code varchar(255), -- 단위 (매핑코드)
|
||||||
price integer NOT NULL, -- 현금(원)
|
price integer, -- 현금(원)
|
||||||
estimated_value integer NOT NULL, -- 현물(평가액)
|
estimated_value integer, -- 현물(평가액)
|
||||||
created_at timestamp(6), -- 생성일
|
created_at timestamp(6), -- 생성일
|
||||||
created_by varchar(255), -- 생성자
|
created_by varchar(255), -- 생성자
|
||||||
updated_at timestamp(6), -- 수정일
|
updated_at timestamp(6), -- 수정일
|
||||||
@@ -165,10 +168,12 @@ COMMENT ON TABLE daily_income IS '수입내역 - 일계부';
|
|||||||
|
|
||||||
COMMENT ON COLUMN daily_income.id IS '일계부 수입 ID';
|
COMMENT ON COLUMN daily_income.id IS '일계부 수입 ID';
|
||||||
COMMENT ON COLUMN daily_income.daily_record_seq IS '일계부 작성상태 일련번호';
|
COMMENT ON COLUMN daily_income.daily_record_seq IS '일계부 작성상태 일련번호';
|
||||||
|
COMMENT ON COLUMN daily_income.input_type IS '입력 구분(SELF, OCR)';
|
||||||
COMMENT ON COLUMN daily_income.is_credit IS '외상판매 여부';
|
COMMENT ON COLUMN daily_income.is_credit IS '외상판매 여부';
|
||||||
|
COMMENT ON COLUMN daily_income.expense_mark_code IS '지출부호';
|
||||||
COMMENT ON COLUMN daily_income.crop_code IS '재배형태 코드 (매핑코드)';
|
COMMENT ON COLUMN daily_income.crop_code IS '재배형태 코드 (매핑코드)';
|
||||||
COMMENT ON COLUMN daily_income.category_code IS '수입 종류(매핑코드)';
|
COMMENT ON COLUMN daily_income.category_code IS '수입 종류(매핑코드)';
|
||||||
COMMENT ON COLUMN daily_income.category_name IS '수입 종류(직접입력)';
|
COMMENT ON COLUMN daily_income.category_self IS '수입 종류(직접입력)';
|
||||||
COMMENT ON COLUMN daily_income.source_purpose IS '수입원(용도)';
|
COMMENT ON COLUMN daily_income.source_purpose IS '수입원(용도)';
|
||||||
COMMENT ON COLUMN daily_income.quantity IS '수량';
|
COMMENT ON COLUMN daily_income.quantity IS '수량';
|
||||||
COMMENT ON COLUMN daily_income.unit_code IS '단위 (매핑코드)';
|
COMMENT ON COLUMN daily_income.unit_code IS '단위 (매핑코드)';
|
||||||
@@ -192,15 +197,16 @@ CREATE SEQUENCE daily_expense_seq START WITH 1 INCREMENT BY 1 CACHE 1 NO CYCLE;
|
|||||||
CREATE TABLE daily_expense (
|
CREATE TABLE daily_expense (
|
||||||
id bigint DEFAULT nextval('daily_expense_seq') NOT NULL, -- 일계부 지출 ID
|
id bigint DEFAULT nextval('daily_expense_seq') NOT NULL, -- 일계부 지출 ID
|
||||||
daily_record_seq bigint NOT NULL, -- 일계부 작성상태 일련번호 (FK)
|
daily_record_seq bigint NOT NULL, -- 일계부 작성상태 일련번호 (FK)
|
||||||
|
input_type varchar(5), -- 입력 구분(SELF, OCR)
|
||||||
is_credit boolean, -- 외상판매 여부
|
is_credit boolean, -- 외상판매 여부
|
||||||
crop_code varchar(255), -- 재배형태 코드 (매핑코드)
|
income_mark_code varchar(10), -- 수입부호 TODO : 수입종류와 다른것인지 판단 필요. 일단 다르다는 전제조건으로 생성
|
||||||
category_code varchar(255) NOT NULL, -- 지출 종류(매핑코드)
|
category_code varchar(255), -- 수입 종류(매핑코드)
|
||||||
category_name varchar(30) NOT NULL, -- 지출 종류(직접입력)
|
category_self varchar(30), -- 수입 종류(직접입력)
|
||||||
source_purpose varchar(10), -- 지출원(용도)
|
source_purpose varchar(10), -- 수입원(용도)
|
||||||
quantity decimal(6,2) NOT NULL, -- 수량
|
quantity decimal(6,2), -- 수량
|
||||||
unit_code varchar(10) NOT NULL, -- 단위 (매핑코드)
|
unit_code varchar(255), -- 단위 (매핑코드)
|
||||||
price integer NOT NULL, -- 현금(원)
|
price integer, -- 현금(원)
|
||||||
estimated_value integer NOT NULL, -- 현물(평가액)
|
estimated_value integer, -- 현물(평가액)
|
||||||
created_at timestamp(6), -- 생성일
|
created_at timestamp(6), -- 생성일
|
||||||
created_by varchar(255), -- 생성자
|
created_by varchar(255), -- 생성자
|
||||||
updated_at timestamp(6), -- 수정일
|
updated_at timestamp(6), -- 수정일
|
||||||
@@ -217,10 +223,11 @@ COMMENT ON TABLE daily_expense IS '지출내역 - 일계부';
|
|||||||
|
|
||||||
COMMENT ON COLUMN daily_expense.id IS '일계부 지출 ID';
|
COMMENT ON COLUMN daily_expense.id IS '일계부 지출 ID';
|
||||||
COMMENT ON COLUMN daily_expense.daily_record_seq IS '일계부 작성상태 일련번호';
|
COMMENT ON COLUMN daily_expense.daily_record_seq IS '일계부 작성상태 일련번호';
|
||||||
|
COMMENT ON COLUMN daily_expense.input_type IS '입력 구분(SELF, OCR)';
|
||||||
COMMENT ON COLUMN daily_expense.is_credit IS '외상판매 여부';
|
COMMENT ON COLUMN daily_expense.is_credit IS '외상판매 여부';
|
||||||
COMMENT ON COLUMN daily_expense.crop_code IS '재배형태 코드 (매핑코드)';
|
COMMENT ON COLUMN daily_expense.income_mark_code IS '수입부호';
|
||||||
COMMENT ON COLUMN daily_expense.category_code IS '지출 종류(매핑코드)';
|
COMMENT ON COLUMN daily_expense.category_code IS '지출 종류(매핑코드)';
|
||||||
COMMENT ON COLUMN daily_expense.category_name IS '지출 종류(직접입력)';
|
COMMENT ON COLUMN daily_expense.category_self IS '지출 종류(직접입력)';
|
||||||
COMMENT ON COLUMN daily_expense.source_purpose IS '지출원(용도)';
|
COMMENT ON COLUMN daily_expense.source_purpose IS '지출원(용도)';
|
||||||
COMMENT ON COLUMN daily_expense.quantity IS '수량';
|
COMMENT ON COLUMN daily_expense.quantity IS '수량';
|
||||||
COMMENT ON COLUMN daily_expense.unit_code IS '단위 (매핑코드)';
|
COMMENT ON COLUMN daily_expense.unit_code IS '단위 (매핑코드)';
|
||||||
|
|||||||
82
core/src/main/resources/sql/schema/04_create-view.sql
Normal file
82
core/src/main/resources/sql/schema/04_create-view.sql
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
-- DROP VIEW
|
||||||
|
DROP VIEW v_uicode_view_name;
|
||||||
|
DROP VIEW v_household_with_code;
|
||||||
|
DROP VIEW v_household_researcher;
|
||||||
|
|
||||||
|
|
||||||
|
-- CREATE VIEW
|
||||||
|
-- ============================================
|
||||||
|
-- VIEW : v_uicode_view_name
|
||||||
|
-- DESC : 코드값과 텍스트를 조합하여 표시용 이름(name)으로 제공
|
||||||
|
-- ============================================
|
||||||
|
CREATE VIEW v_uicode_view_name AS
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
code_value || '. ' || code_text AS name
|
||||||
|
FROM uicode;
|
||||||
|
|
||||||
|
|
||||||
|
-- ============================================
|
||||||
|
-- VIEW : v_household_with_code
|
||||||
|
-- DESC : household 테이블과 코드명 정보를 조인한 임가 정보 뷰
|
||||||
|
-- ============================================
|
||||||
|
CREATE VIEW v_household_with_code AS
|
||||||
|
SELECT
|
||||||
|
h.seq,
|
||||||
|
h.household_num,
|
||||||
|
h.owner_name,
|
||||||
|
h.owner_age,
|
||||||
|
h.tel,
|
||||||
|
h.phone,
|
||||||
|
h.address,
|
||||||
|
h.region_main_code,
|
||||||
|
main.code_text AS region_main_name,
|
||||||
|
h.region_sub_code,
|
||||||
|
sub.name AS region_sub_name,
|
||||||
|
h.region_detail_code,
|
||||||
|
detail.name AS region_detail_name,
|
||||||
|
h.industry_large_code,
|
||||||
|
ind_large.name AS industry_large_name,
|
||||||
|
h.industry_middle_code,
|
||||||
|
ind_middle.name AS industry_middle_name,
|
||||||
|
h.industry_sub_middle,
|
||||||
|
h.industry_detail,
|
||||||
|
h.is_panel,
|
||||||
|
h.memo
|
||||||
|
FROM household h
|
||||||
|
LEFT JOIN uicode main ON h.region_main_code = main.id
|
||||||
|
LEFT JOIN v_uicode_view_name sub ON h.region_sub_code = sub.id
|
||||||
|
LEFT JOIN v_uicode_view_name detail ON h.region_detail_code = detail.id
|
||||||
|
LEFT JOIN v_uicode_view_name ind_large ON h.industry_large_code = ind_large.id
|
||||||
|
LEFT JOIN v_uicode_view_name ind_middle ON h.industry_middle_code = ind_middle.id
|
||||||
|
WHERE h.is_deleted = false;
|
||||||
|
|
||||||
|
|
||||||
|
-- ============================================
|
||||||
|
-- VIEW : v_household_visit
|
||||||
|
-- DESC : 임가별 방문 정보 뷰 (1차 방문일, 2차 방문일 정보 제공)
|
||||||
|
-- ============================================
|
||||||
|
CREATE VIEW v_household_visit AS
|
||||||
|
SELECT
|
||||||
|
rhh.household_seq AS household_seq,
|
||||||
|
MIN(v.visit_date) AS first_visit_date,
|
||||||
|
MAX(v.visit_date) AS second_visit_date,
|
||||||
|
BOOL_OR(v.is_gift_sent) AS is_gift_sent
|
||||||
|
FROM researcher_household_visit v
|
||||||
|
JOIN researcher_has_household rhh ON v.household_seq = rhh.household_seq
|
||||||
|
WHERE rhh.is_deleted = false
|
||||||
|
GROUP BY rhh.household_seq;
|
||||||
|
|
||||||
|
|
||||||
|
-- ============================================
|
||||||
|
-- VIEW : v_household_researcher
|
||||||
|
-- DESC : 임가별 매핑된 조사원 정보 뷰
|
||||||
|
-- ============================================
|
||||||
|
CREATE VIEW v_household_researcher AS
|
||||||
|
SELECT
|
||||||
|
rhh.household_seq,
|
||||||
|
a.name AS researcher_name,
|
||||||
|
a.phone AS researcher_phone
|
||||||
|
FROM researcher_has_household rhh
|
||||||
|
JOIN admin a ON rhh.admin_seq = a.seq
|
||||||
|
WHERE rhh.is_deleted = false;
|
||||||
4
front/.gitignore
vendored
4
front/.gitignore
vendored
@@ -31,3 +31,7 @@ build/
|
|||||||
|
|
||||||
### VS Code ###
|
### VS Code ###
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|
||||||
|
### Project
|
||||||
|
**/resources/static/pages/**
|
||||||
|
**/resources/static/guide/**
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package app.module.front.config.adapters.persistence.component;
|
||||||
|
|
||||||
|
import app.module.core.config.application.util.CommonUtil;
|
||||||
|
import app.module.front.config.application.security.FrontHouseholdUser;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class FrontAuditCommand {
|
||||||
|
private Long householdSeq;
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
private String createdBy;
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
private String updatedBy;
|
||||||
|
private LocalDateTime deletedAt;
|
||||||
|
private String deletedBy;
|
||||||
|
|
||||||
|
public void create() {
|
||||||
|
this.householdSeq = getCurrentUserSeq();
|
||||||
|
this.createdAt = LocalDateTime.now();
|
||||||
|
this.createdBy = getCurrentUsername();
|
||||||
|
this.updatedAt = LocalDateTime.now();
|
||||||
|
this.updatedBy = getCurrentUsername();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update() {
|
||||||
|
this.householdSeq = getCurrentUserSeq();
|
||||||
|
this.updatedAt = LocalDateTime.now();
|
||||||
|
this.updatedBy = getCurrentUsername();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete() {
|
||||||
|
this.householdSeq = getCurrentUserSeq();
|
||||||
|
this.deletedAt = LocalDateTime.now();
|
||||||
|
this.deletedBy = getCurrentUsername();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Long getCurrentUserSeq() {
|
||||||
|
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
|
|
||||||
|
Object principal = authentication.getPrincipal();
|
||||||
|
Long userseq = null;
|
||||||
|
|
||||||
|
if (principal instanceof UserDetails) {
|
||||||
|
userseq = ((FrontHouseholdUser) principal).getHouseholdSeq();
|
||||||
|
}
|
||||||
|
|
||||||
|
return userseq;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getCurrentUsername() {
|
||||||
|
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
|
|
||||||
|
return authentication != null && authentication.isAuthenticated()
|
||||||
|
? CommonUtil.getLoginUsername() : "INIT_DATA";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package app.module.front.config.application.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApiResponse<T> {
|
||||||
|
private String code;
|
||||||
|
private String message;
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
public ApiResponse(String code, String message, T data) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ApiResponse<T> success(T data) {
|
||||||
|
return new ApiResponse<>("SUCCESS", null, data);
|
||||||
|
}
|
||||||
|
public static <T> ApiResponse<T> success(String message) {
|
||||||
|
return new ApiResponse<>("SUCCESS", message, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static <T> ApiResponse<T> failure(T data) {
|
||||||
|
return new ApiResponse<>("ERROR", null, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ApiResponse<T> failure(String message) {
|
||||||
|
return new ApiResponse<>("ERROR", message, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static <T> ApiResponse<T> make(String errorCode, String message,T data) {
|
||||||
|
return new ApiResponse<>(errorCode, message, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -40,6 +40,7 @@ public class FrontDetailService implements UserDetailsService {
|
|||||||
.orElseThrow(() -> new UsernameNotFoundException("Invalid username or password."));
|
.orElseThrow(() -> new UsernameNotFoundException("Invalid username or password."));
|
||||||
|
|
||||||
return new FrontHouseholdUser(
|
return new FrontHouseholdUser(
|
||||||
|
getHousehold.getSeq(),
|
||||||
getHousehold.getHouseholdNum(),
|
getHousehold.getHouseholdNum(),
|
||||||
getHousehold.getPassword(),
|
getHousehold.getPassword(),
|
||||||
true,
|
true,
|
||||||
|
|||||||
@@ -8,9 +8,11 @@ import org.springframework.security.core.userdetails.User;
|
|||||||
@Getter
|
@Getter
|
||||||
public class FrontHouseholdUser extends User {
|
public class FrontHouseholdUser extends User {
|
||||||
|
|
||||||
|
private Long householdSeq;
|
||||||
private String ownerName;
|
private String ownerName;
|
||||||
|
|
||||||
public FrontHouseholdUser(
|
public FrontHouseholdUser(
|
||||||
|
Long householdSeq,
|
||||||
String householdNum,
|
String householdNum,
|
||||||
String password,
|
String password,
|
||||||
boolean enabled,
|
boolean enabled,
|
||||||
@@ -27,6 +29,7 @@ public class FrontHouseholdUser extends User {
|
|||||||
credentialsNonExpired,
|
credentialsNonExpired,
|
||||||
accountNonLocked,
|
accountNonLocked,
|
||||||
authorities);
|
authorities);
|
||||||
|
this.householdSeq = householdSeq;
|
||||||
this.ownerName = ownerName;
|
this.ownerName = ownerName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package app.module.front.config.application.util;
|
||||||
|
|
||||||
|
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
|
||||||
|
|
||||||
|
public class AuditUtil {
|
||||||
|
private AuditUtil() {}
|
||||||
|
|
||||||
|
public static <T extends FrontAuditCommand> T create(T cmd) {
|
||||||
|
cmd.create();
|
||||||
|
return cmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T extends FrontAuditCommand> T update(T cmd) {
|
||||||
|
cmd.update();
|
||||||
|
return cmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T extends FrontAuditCommand> T delete(T cmd) {
|
||||||
|
cmd.delete();
|
||||||
|
return cmd;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package app.module.front.config.application.util;
|
||||||
|
|
||||||
|
import app.module.core.config.adapters.web.security.domain.SocialUser;
|
||||||
|
import app.module.front.config.application.security.FrontHouseholdUser;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
import org.springframework.security.oauth2.core.user.DefaultOAuth2User;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class AuthUtil {
|
||||||
|
public static Long getUserSeq() {
|
||||||
|
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
|
if (authentication == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object principal = authentication.getPrincipal();
|
||||||
|
Long userseq = null;
|
||||||
|
|
||||||
|
if (principal instanceof UserDetails) {
|
||||||
|
userseq = ((FrontHouseholdUser) principal).getHouseholdSeq();
|
||||||
|
}
|
||||||
|
|
||||||
|
return userseq;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package app.module.front.usecase.daily.calendar.persistence;
|
||||||
|
|
||||||
|
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordCalendarDto;
|
||||||
|
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordStatusDto;
|
||||||
|
import app.module.front.usecase.daily.calendar.web.model.RecordCalendarUIReqVO;
|
||||||
|
import app.module.front.usecase.daily.record.web.model.CreateDailyRecordReqVO;
|
||||||
|
import app.module.front.usecase.daily.record.persistence.model.UpdateDailyRecordStatusCmd;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface RecordCalendarMapper {
|
||||||
|
|
||||||
|
List<DailyRecordCalendarDto> getCalendarByDailyRecord(RecordCalendarUIReqVO reqVO);
|
||||||
|
|
||||||
|
DailyRecordStatusDto getDailyRecordStatus(RecordCalendarUIReqVO reqVO);
|
||||||
|
|
||||||
|
int getStartDayByDailyGroupNo(@Param("groupNo") Integer groupNo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 등록 여부
|
||||||
|
* @param householdSeq
|
||||||
|
* @param recordMonth
|
||||||
|
* @param dayGroupNo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Long getDailyRecordExistCount(@Param("householdSeq") Long householdSeq, @Param("recordMonth") String recordMonth, @Param("dayGroupNo") Integer dayGroupNo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 등록(생성)
|
||||||
|
* @param command
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Long createDailyRecord(CreateDailyRecordReqVO command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 상태 수정
|
||||||
|
* @param command
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int updateDailyRecordStatus(UpdateDailyRecordStatusCmd command);
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package app.module.front.usecase.daily.calendar.persistence.model;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class DailyRecordCalendarDto {
|
||||||
|
private String groupNo;
|
||||||
|
private Integer startDay;
|
||||||
|
private Integer endDay;
|
||||||
|
private String startDate;
|
||||||
|
private String dailyId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package app.module.front.usecase.daily.calendar.persistence.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ToString
|
||||||
|
public class DailyRecordStatusDto {
|
||||||
|
/**
|
||||||
|
* 일계부 일련번호
|
||||||
|
*/
|
||||||
|
private Long dailyId;
|
||||||
|
private LocalDate startDate;
|
||||||
|
private LocalDate endDate;
|
||||||
|
/**
|
||||||
|
* 특정일 입력 상태 TODO enum
|
||||||
|
*/
|
||||||
|
private String allStatus;
|
||||||
|
/**
|
||||||
|
* 수입 입력 상태 TODO enum
|
||||||
|
*/
|
||||||
|
private String incomeStatus;
|
||||||
|
/**
|
||||||
|
* 수입 입력 개수
|
||||||
|
*/
|
||||||
|
private Integer incomeCount;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package app.module.front.usecase.daily.calendar.service;
|
||||||
|
|
||||||
|
|
||||||
|
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordCalendarDto;
|
||||||
|
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordStatusDto;
|
||||||
|
import app.module.front.usecase.daily.calendar.web.model.RecordCalendarUIReqVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface RecordCalendarService {
|
||||||
|
List<DailyRecordCalendarDto> getCalendarByDailyRecord(RecordCalendarUIReqVO reqVO);
|
||||||
|
|
||||||
|
DailyRecordStatusDto getDailyRecordStatus(RecordCalendarUIReqVO reqVO);
|
||||||
|
|
||||||
|
int getStartDayByDailyGroupNo(RecordCalendarUIReqVO reqVO);
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package app.module.front.usecase.daily.calendar.service;
|
||||||
|
|
||||||
|
import app.module.front.usecase.daily.calendar.persistence.RecordCalendarMapper;
|
||||||
|
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordCalendarDto;
|
||||||
|
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordStatusDto;
|
||||||
|
import app.module.front.usecase.daily.calendar.web.model.RecordCalendarUIReqVO;
|
||||||
|
import app.module.front.usecase.daily.record.persistence.DailyRecordMapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class RecordCalendarServiceImpl implements RecordCalendarService {
|
||||||
|
private final RecordCalendarMapper recordCalendarMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DailyRecordCalendarDto> getCalendarByDailyRecord(RecordCalendarUIReqVO reqVO) {
|
||||||
|
int lastDay = reqVO.getSearchDate().withDayOfMonth(reqVO.getSearchDate().lengthOfMonth()).getDayOfMonth();
|
||||||
|
|
||||||
|
List<DailyRecordCalendarDto> list = recordCalendarMapper.getCalendarByDailyRecord(reqVO);
|
||||||
|
|
||||||
|
List<DailyRecordCalendarDto> refineList = new ArrayList<DailyRecordCalendarDto>();
|
||||||
|
for (DailyRecordCalendarDto record : list) {
|
||||||
|
record.setStartDate(reqVO.getSearchMonth() + String.format("%02d", record.getStartDay()));
|
||||||
|
|
||||||
|
if ((lastDay == 28 || lastDay == 30) && record.getStartDay() == lastDay) {
|
||||||
|
record.setEndDay(lastDay);
|
||||||
|
refineList.add(record);
|
||||||
|
} else if (record.getStartDay() <= lastDay && record.getEndDay() <= lastDay) {
|
||||||
|
refineList.add(record);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return refineList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DailyRecordStatusDto getDailyRecordStatus(RecordCalendarUIReqVO reqVO) {
|
||||||
|
return recordCalendarMapper.getDailyRecordStatus(reqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getStartDayByDailyGroupNo(RecordCalendarUIReqVO reqVO) {
|
||||||
|
return recordCalendarMapper.getStartDayByDailyGroupNo(reqVO.getGroupNo());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package app.module.front.usecase.daily.calendar.web;
|
||||||
|
|
||||||
|
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordCalendarDto;
|
||||||
|
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordStatusDto;
|
||||||
|
import app.module.front.usecase.daily.calendar.service.RecordCalendarService;
|
||||||
|
import app.module.front.usecase.daily.calendar.web.model.RecordCalendarUIReqVO;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.YearMonth;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Controller
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping(path = "/record/calendar")
|
||||||
|
public class RecordCalendarController {
|
||||||
|
private final RecordCalendarService recordCalendarService;
|
||||||
|
|
||||||
|
@GetMapping(path = "")
|
||||||
|
public String index(Model model, @RequestParam(value = "searchDay", required = false) String searchDay) {
|
||||||
|
RecordCalendarUIReqVO reqVO = new RecordCalendarUIReqVO(searchDay, getAccessId());
|
||||||
|
log.debug("reqVO: {}", reqVO);
|
||||||
|
|
||||||
|
model.addAttribute("reqVO", reqVO);
|
||||||
|
model.addAttribute("calendarList", recordCalendarService.getCalendarByDailyRecord(reqVO));
|
||||||
|
|
||||||
|
return "record/calendar";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(path = "/{searchMonth}/{groupNo}")
|
||||||
|
public String detail(Model model
|
||||||
|
, @PathVariable(required = true) String searchMonth
|
||||||
|
, @PathVariable(required = true) String groupNo) {
|
||||||
|
|
||||||
|
RecordCalendarUIReqVO reqVO = new RecordCalendarUIReqVO();
|
||||||
|
reqVO.setSearchMonth(searchMonth);
|
||||||
|
reqVO.setGroupNo(Integer.parseInt(groupNo));
|
||||||
|
reqVO.setHouseholdSeq(getAccessId());
|
||||||
|
log.debug("reqVO: {}", reqVO);
|
||||||
|
|
||||||
|
DailyRecordStatusDto detail = recordCalendarService.getDailyRecordStatus(reqVO);
|
||||||
|
if (detail == null) {
|
||||||
|
int startDay = recordCalendarService.getStartDayByDailyGroupNo(reqVO);
|
||||||
|
reqVO.setSearchDay(reqVO.getSearchMonth() + String.format("%02d", startDay));
|
||||||
|
}
|
||||||
|
|
||||||
|
//uiCodeListPortIn.connect("code.pageable.rows");
|
||||||
|
|
||||||
|
model.addAttribute("reqVO", reqVO);
|
||||||
|
model.addAttribute("detail", detail);
|
||||||
|
|
||||||
|
return "record/calendar-wrap";
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO : 로그인 SEQ
|
||||||
|
private Long getAccessId() {
|
||||||
|
return 2L;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package app.module.front.usecase.daily.calendar.web.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.apache.tika.utils.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.YearMonth;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.time.format.DateTimeParseException;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ToString
|
||||||
|
public class RecordCalendarUIReqVO {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(RecordCalendarUIReqVO.class);
|
||||||
|
|
||||||
|
public RecordCalendarUIReqVO() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public RecordCalendarUIReqVO(String searchDay, Long accessId) {
|
||||||
|
if (StringUtils.isBlank(searchDay) || searchDay.length() != 8) {
|
||||||
|
searchDay = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
SimpleDateFormat beforeSdf = new SimpleDateFormat("yyyyMMdd", Locale.KOREAN);
|
||||||
|
SimpleDateFormat afterSdf = new SimpleDateFormat("yyyy-MM-dd", Locale.KOREAN);
|
||||||
|
SimpleDateFormat monthSdf = new SimpleDateFormat("yyyyMM", Locale.KOREAN);
|
||||||
|
|
||||||
|
Date formatDate = beforeSdf.parse(searchDay);
|
||||||
|
|
||||||
|
setSearchDate(LocalDate.parse(afterSdf.format(formatDate)));
|
||||||
|
setSearchMonth(monthSdf.format(formatDate));
|
||||||
|
setSearchDay(beforeSdf.format(formatDate));
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.warn("[DateParse] target={}", searchDay, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
setHouseholdSeq(accessId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 검색 일(yyyyMMdd)
|
||||||
|
*/
|
||||||
|
private String searchDay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 검색 월(yyyyMM)
|
||||||
|
*/
|
||||||
|
private String searchMonth;
|
||||||
|
private Integer groupNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 검색 일(yyyy-MM-dd)
|
||||||
|
*/
|
||||||
|
private LocalDate searchDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 임가회원 일련번호
|
||||||
|
*/
|
||||||
|
private Long householdSeq;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package app.module.front.usecase.daily.expense.persistence;
|
||||||
|
|
||||||
|
import app.module.front.usecase.daily.expense.persistence.model.CreateDailyExpenseCmd;
|
||||||
|
import app.module.front.usecase.daily.expense.persistence.model.DailyExpenseDto;
|
||||||
|
import app.module.front.usecase.daily.expense.persistence.model.RemoveDailyExpenseCmd;
|
||||||
|
import app.module.front.usecase.daily.expense.web.model.DailyExpenseUIReqVO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface DailyExpenseMapper {
|
||||||
|
/**
|
||||||
|
* 일계부 지출 목록 조회
|
||||||
|
*
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
* @return 수입 목록
|
||||||
|
*/
|
||||||
|
List<DailyExpenseDto> getDailyExpenseList(DailyExpenseUIReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 지출 데이터 존재 여부
|
||||||
|
*
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
* @return 중복 개수
|
||||||
|
*/
|
||||||
|
Integer getRecordExistCount(DailyExpenseUIReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 지출 등록
|
||||||
|
*
|
||||||
|
* @param command 등록 데이터
|
||||||
|
*/
|
||||||
|
void createDailyExpense(CreateDailyExpenseCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 지출 수정
|
||||||
|
*
|
||||||
|
* @param command 수정 데이터
|
||||||
|
*/
|
||||||
|
void updateDailyExpense(CreateDailyExpenseCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 지출 삭제
|
||||||
|
*
|
||||||
|
* @param command 삭제 데이터
|
||||||
|
*/
|
||||||
|
void removeDailyExpense(RemoveDailyExpenseCmd command);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package app.module.front.usecase.daily.expense.persistence.model;
|
||||||
|
|
||||||
|
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class CreateDailyExpenseCmd extends FrontAuditCommand {
|
||||||
|
private Long id;
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
private String inputType;
|
||||||
|
private Boolean credit;
|
||||||
|
private String incomeMarkCode;
|
||||||
|
private String categoryCode;
|
||||||
|
private String categorySelf;
|
||||||
|
private String sourcePurpose;
|
||||||
|
private Integer quantity;
|
||||||
|
private String unitCode;
|
||||||
|
private Integer price;
|
||||||
|
private Integer estimatedValue;
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package app.module.front.usecase.daily.expense.persistence.model;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class DailyExpenseDto {
|
||||||
|
private Long id;
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
// TODO : SELF, OCR
|
||||||
|
private String inputType;
|
||||||
|
private Boolean credit;
|
||||||
|
private String categoryCode;
|
||||||
|
private String categoryLabel;
|
||||||
|
private String categorySelf;
|
||||||
|
private String sourcePurpose;
|
||||||
|
private Integer quantity;
|
||||||
|
private String unitCode;
|
||||||
|
private String unitLabel;
|
||||||
|
private Integer price;
|
||||||
|
private Integer estimatedValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 수정 가능 여부
|
||||||
|
* @return true=가능, false=불가능(등록 상태)
|
||||||
|
*/
|
||||||
|
public boolean isUpdated() {
|
||||||
|
return this.id != null && this.id != 0L;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package app.module.front.usecase.daily.expense.persistence.model;
|
||||||
|
|
||||||
|
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class RemoveDailyExpenseCmd extends FrontAuditCommand {
|
||||||
|
private String searchMonth;
|
||||||
|
private Integer groupNo;
|
||||||
|
private Long id;
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package app.module.front.usecase.daily.expense.service;
|
||||||
|
|
||||||
|
import app.module.front.usecase.daily.expense.persistence.model.DailyExpenseDto;
|
||||||
|
import app.module.front.usecase.daily.expense.web.model.CreateDailyExpenseReqVO;
|
||||||
|
import app.module.front.usecase.daily.expense.web.model.DailyExpenseUIReqVO;
|
||||||
|
import app.module.front.usecase.daily.expense.web.model.RemoveDailyExpenseReqVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface DailyExpenseService {
|
||||||
|
/**
|
||||||
|
* 일계부 수입 목록 조회
|
||||||
|
*
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<DailyExpenseDto> getDailyExpenseList(DailyExpenseUIReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 수입 조회
|
||||||
|
*
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
DailyExpenseDto getDailyExpense(DailyExpenseUIReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 수입 등록
|
||||||
|
*
|
||||||
|
* @param formVO 입력 데이터
|
||||||
|
*/
|
||||||
|
void create(CreateDailyExpenseReqVO formVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 수입 삭제
|
||||||
|
*
|
||||||
|
* @param formVO 삭제 검색 조건
|
||||||
|
*/
|
||||||
|
void remove(RemoveDailyExpenseReqVO formVO);
|
||||||
|
}
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
package app.module.front.usecase.daily.expense.service;
|
||||||
|
|
||||||
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
|
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
|
||||||
|
import app.module.front.config.application.util.AuditUtil;
|
||||||
|
import app.module.front.usecase.daily.expense.persistence.DailyExpenseMapper;
|
||||||
|
import app.module.front.usecase.daily.expense.persistence.model.CreateDailyExpenseCmd;
|
||||||
|
import app.module.front.usecase.daily.expense.persistence.model.DailyExpenseDto;
|
||||||
|
import app.module.front.usecase.daily.expense.persistence.model.RemoveDailyExpenseCmd;
|
||||||
|
import app.module.front.usecase.daily.expense.web.model.CreateDailyExpenseReqVO;
|
||||||
|
import app.module.front.usecase.daily.expense.web.model.DailyExpenseUIReqVO;
|
||||||
|
import app.module.front.usecase.daily.expense.web.model.RemoveDailyExpenseReqVO;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class DailyExpenseServiceImpl implements DailyExpenseService {
|
||||||
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
|
private final DailyExpenseMapper DailyExpenseMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DailyExpenseDto> getDailyExpenseList(DailyExpenseUIReqVO reqVO) {
|
||||||
|
return this.getRefineIncomeList(reqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DailyExpenseDto getDailyExpense(DailyExpenseUIReqVO reqVO) {
|
||||||
|
List<DailyExpenseDto> list = this.getRefineIncomeList(reqVO);
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return list.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<DailyExpenseDto> getRefineIncomeList(DailyExpenseUIReqVO reqVO) {
|
||||||
|
List<DailyExpenseDto> list = DailyExpenseMapper.getDailyExpenseList(reqVO);
|
||||||
|
|
||||||
|
List<UICodeElement> recordIncome = uiCodeListPortIn.connect("code.record.expense");
|
||||||
|
List<UICodeElement> recordUnit = uiCodeListPortIn.connect("code.record.unit");
|
||||||
|
|
||||||
|
for (DailyExpenseDto dto : list) {
|
||||||
|
dto.setCategoryLabel(this.getCodeLabel(dto.getCategoryCode(), recordIncome));
|
||||||
|
dto.setUnitLabel(this.getCodeLabel(dto.getUnitCode(), recordUnit));
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 코드명 조회
|
||||||
|
* @param code 코드
|
||||||
|
* @param codeList 공통 코드 목록
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getCodeLabel(String code, List<UICodeElement> codeList) {
|
||||||
|
String returnValue = null;
|
||||||
|
for (UICodeElement codeSetup : codeList) {
|
||||||
|
if (codeSetup.getCodeValue().equalsIgnoreCase(code)) {
|
||||||
|
returnValue = codeSetup.getCodeText();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create(CreateDailyExpenseReqVO formVO) {
|
||||||
|
CreateDailyExpenseCmd command = AuditUtil.create(
|
||||||
|
new CreateDailyExpenseCmd(
|
||||||
|
formVO.getId(),
|
||||||
|
formVO.getDailyRecordSeq(),
|
||||||
|
formVO.getInputType(),
|
||||||
|
formVO.getCredit(),
|
||||||
|
(formVO.getCredit() ? "52210" : null), // [정책] 외상판매 Y 일 경우 수입부호 52210 적재
|
||||||
|
formVO.getCategoryCode(),
|
||||||
|
formVO.getCategorySelf(),
|
||||||
|
formVO.getSourcePurpose(),
|
||||||
|
formVO.getQuantity(),
|
||||||
|
formVO.getUnitCode(),
|
||||||
|
formVO.getPrice(),
|
||||||
|
formVO.getEstimatedValue()));
|
||||||
|
|
||||||
|
DailyExpenseUIReqVO existReqVO = new DailyExpenseUIReqVO(formVO.getSearchMonth(), formVO.getGroupNo());
|
||||||
|
existReqVO.setId(formVO.getId());
|
||||||
|
|
||||||
|
Integer existCount = DailyExpenseMapper.getRecordExistCount(existReqVO);
|
||||||
|
if (existCount == 0) {
|
||||||
|
DailyExpenseMapper.createDailyExpense(command);
|
||||||
|
|
||||||
|
log.debug("[CreateDailyExpense] record={}", command);
|
||||||
|
} else {
|
||||||
|
DailyExpenseMapper.updateDailyExpense(command);
|
||||||
|
|
||||||
|
log.debug("[UpdateDailyExpense] record={}", command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove(RemoveDailyExpenseReqVO formVO) {
|
||||||
|
Long id = formVO.getId() != null ? Long.parseLong(formVO.getId()) : null;
|
||||||
|
RemoveDailyExpenseCmd command = AuditUtil.delete(
|
||||||
|
new RemoveDailyExpenseCmd(
|
||||||
|
formVO.getSearchMonth(),
|
||||||
|
formVO.getGroupNo(),
|
||||||
|
id,
|
||||||
|
formVO.getDailyRecordSeq()));
|
||||||
|
|
||||||
|
DailyExpenseUIReqVO existReqVO = new DailyExpenseUIReqVO(formVO.getSearchMonth(), formVO.getGroupNo());
|
||||||
|
existReqVO.setId(id);
|
||||||
|
|
||||||
|
Integer existCount = DailyExpenseMapper.getRecordExistCount(existReqVO);
|
||||||
|
if (existCount != 0) {
|
||||||
|
DailyExpenseMapper.removeDailyExpense(command);
|
||||||
|
|
||||||
|
log.debug("[RemoveDailyExpense] record={}", command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
package app.module.front.usecase.daily.expense.web;
|
||||||
|
|
||||||
|
import app.module.core.config.application.exception.NoRecordDataException;
|
||||||
|
import app.module.core.config.application.util.CoreUtil;
|
||||||
|
import app.module.front.usecase.daily.expense.service.DailyExpenseService;
|
||||||
|
import app.module.front.usecase.daily.expense.web.model.CreateDailyExpenseReqVO;
|
||||||
|
import app.module.front.usecase.daily.expense.web.model.RemoveDailyExpenseReqVO;
|
||||||
|
import app.module.front.usecase.daily.expense.web.validator.CreateDailyExpenseValidator;
|
||||||
|
import app.module.front.usecase.daily.record.persistence.model.DailyRecordDto;
|
||||||
|
import app.module.front.usecase.daily.record.service.DailyRecordService;
|
||||||
|
import app.module.front.usecase.daily.record.web.model.DailyRecordUIReqVO;
|
||||||
|
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.validation.BindingResult;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping(path = "/api/record/expense")
|
||||||
|
public class DailyExpenseController {
|
||||||
|
private final CoreUtil coreUtil;
|
||||||
|
private final DailyRecordService dailyRecordService;
|
||||||
|
private final DailyExpenseService DailyExpenseService;
|
||||||
|
private final CreateDailyExpenseValidator createDailyExpenseValidator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 지출 등록 처리
|
||||||
|
*
|
||||||
|
* @param searchMonth 검색 월(yyyyMM)
|
||||||
|
* @param groupNo 검색 그룹
|
||||||
|
* @param id 수입 일련번호
|
||||||
|
* @param formVO 입력 데이터
|
||||||
|
* @param bindingResult BindingResult
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(path = "/{searchMonth}/{groupNo}/form/{id}")
|
||||||
|
ResponseEntity<?> create(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
|
||||||
|
, @PathVariable("id") String id
|
||||||
|
, @Valid @RequestBody CreateDailyExpenseReqVO formVO, BindingResult bindingResult) {
|
||||||
|
|
||||||
|
createDailyExpenseValidator.validate(formVO, bindingResult);
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return coreUtil.getErrorInfo(bindingResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo);
|
||||||
|
|
||||||
|
formVO.setSearchMonth(searchMonth);
|
||||||
|
formVO.setGroupNo(Integer.parseInt(groupNo));
|
||||||
|
formVO.setId(Long.parseLong(id));
|
||||||
|
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||||
|
log.debug("formVO: {}", formVO);
|
||||||
|
|
||||||
|
DailyExpenseService.create(formVO);
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 지출 삭제 처리
|
||||||
|
*
|
||||||
|
* @param searchMonth 검색 월(yyyyMM)
|
||||||
|
* @param groupNo 검색 그룹
|
||||||
|
* @param formVO 입력 데이터
|
||||||
|
* @param bindingResult BindingResult
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(path = "/{searchMonth}/{groupNo}/remove")
|
||||||
|
ResponseEntity<?> remove(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
|
||||||
|
, @Valid @RequestBody RemoveDailyExpenseReqVO formVO, BindingResult bindingResult) {
|
||||||
|
|
||||||
|
log.debug("before formVO: {}", formVO);
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||||
|
.body(bindingResult.getFieldErrors());
|
||||||
|
}
|
||||||
|
|
||||||
|
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo);
|
||||||
|
|
||||||
|
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||||
|
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||||
|
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||||
|
log.debug("formVO: {}", formVO);
|
||||||
|
|
||||||
|
DailyExpenseService.remove(formVO);
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 지출 전체 삭제 처리
|
||||||
|
*
|
||||||
|
* @param searchMonth 검색 월(yyyyMM)
|
||||||
|
* @param groupNo 검색 그룹
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(path = "/{searchMonth}/{groupNo}/reset")
|
||||||
|
ResponseEntity<?> removeAll(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo) {
|
||||||
|
|
||||||
|
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo);
|
||||||
|
|
||||||
|
RemoveDailyExpenseReqVO formVO = new RemoveDailyExpenseReqVO();
|
||||||
|
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||||
|
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||||
|
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||||
|
log.debug("formVO: {}", formVO);
|
||||||
|
|
||||||
|
DailyExpenseService.remove(formVO);
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 유효성 체크 및 데이터 조회
|
||||||
|
*
|
||||||
|
* @param searchMonth 검색 월(yyyyMM)
|
||||||
|
* @param groupNo 검색 그룹
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
|
||||||
|
DailyRecordUIReqVO reqVO = new DailyRecordUIReqVO(searchMonth, groupNo);
|
||||||
|
log.debug("getRecordUIReq: {}", reqVO);
|
||||||
|
|
||||||
|
DailyRecordDto dailyRecord = dailyRecordService.getDailyRecord(reqVO);
|
||||||
|
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||||
|
throw new NoRecordDataException();
|
||||||
|
}
|
||||||
|
|
||||||
|
return dailyRecord;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
package app.module.front.usecase.daily.expense.web;
|
||||||
|
|
||||||
|
import app.module.core.config.application.exception.NoRecordDataException;
|
||||||
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
|
import app.module.front.usecase.daily.expense.persistence.model.DailyExpenseDto;
|
||||||
|
import app.module.front.usecase.daily.expense.service.DailyExpenseService;
|
||||||
|
import app.module.front.usecase.daily.expense.web.model.DailyExpenseUIReqVO;
|
||||||
|
import app.module.front.usecase.daily.record.persistence.model.DailyRecordDto;
|
||||||
|
import app.module.front.usecase.daily.record.service.DailyRecordService;
|
||||||
|
import app.module.front.usecase.daily.record.web.model.DailyRecordUIReqVO;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.thymeleaf.util.StringUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Controller
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping(path = "/record/expense")
|
||||||
|
public class DailyExpenseUIController {
|
||||||
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
|
private final DailyRecordService dailyRecordService;
|
||||||
|
private final DailyExpenseService DailyExpenseService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 지출 목록 화면
|
||||||
|
*
|
||||||
|
* @param model Model
|
||||||
|
* @param searchMonth 검색 월(yyyyMM)
|
||||||
|
* @param groupNo 검색 그룹
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(path = "/{searchMonth}/{groupNo}")
|
||||||
|
public String index(Model model, @PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo) {
|
||||||
|
|
||||||
|
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo);
|
||||||
|
|
||||||
|
DailyExpenseUIReqVO reqVO = new DailyExpenseUIReqVO(searchMonth, groupNo);
|
||||||
|
log.debug("reqVO: {}", reqVO);
|
||||||
|
|
||||||
|
List<DailyExpenseDto> expenseList = DailyExpenseService.getDailyExpenseList(reqVO);
|
||||||
|
|
||||||
|
model.addAttribute("reqVO", reqVO);
|
||||||
|
model.addAttribute("dailyRecord", dailyRecord);
|
||||||
|
model.addAttribute("expenseList", expenseList);
|
||||||
|
|
||||||
|
return "record/expense/index";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 지출 등록 화면
|
||||||
|
*
|
||||||
|
* @param model Model
|
||||||
|
* @param searchMonth 검색 월(yyyyMM)
|
||||||
|
* @param groupNo 검색 그룹
|
||||||
|
* @param id 수입 일련번호
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(path = "/{searchMonth}/{groupNo}/form/{id}")
|
||||||
|
public String formBySelf(Model model, @PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
|
||||||
|
, @PathVariable("id") String id) {
|
||||||
|
|
||||||
|
DailyExpenseUIReqVO reqVO = new DailyExpenseUIReqVO(searchMonth, groupNo);
|
||||||
|
if (StringUtils.isEmpty(id)) {
|
||||||
|
reqVO.setId(0L);
|
||||||
|
} else {
|
||||||
|
reqVO.setId(Long.parseLong(id));
|
||||||
|
}
|
||||||
|
log.debug("reqVO: {}", reqVO);
|
||||||
|
|
||||||
|
DailyExpenseDto detail = new DailyExpenseDto();
|
||||||
|
if (reqVO.getId() != 0L) {
|
||||||
|
detail = DailyExpenseService.getDailyExpense(reqVO);
|
||||||
|
if (detail == null || !detail.isUpdated()) {
|
||||||
|
throw new NoRecordDataException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
model.addAttribute("recordExpense", uiCodeListPortIn.connect("code.record.expense"));
|
||||||
|
model.addAttribute("recordCrop", uiCodeListPortIn.connect("code.record.crop"));
|
||||||
|
model.addAttribute("recordUnit", uiCodeListPortIn.connect("code.record.unit"));
|
||||||
|
|
||||||
|
model.addAttribute("reqVO", reqVO);
|
||||||
|
model.addAttribute("detail", detail);
|
||||||
|
|
||||||
|
return "record/expense/form";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 유효성 체크 및 데이터 조회
|
||||||
|
*
|
||||||
|
* @param searchMonth 검색 월(yyyyMM)
|
||||||
|
* @param groupNo 검색 그룹
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
|
||||||
|
DailyRecordUIReqVO reqVO = new DailyRecordUIReqVO(searchMonth, groupNo);
|
||||||
|
log.debug("getRecordUIReq: {}", reqVO);
|
||||||
|
|
||||||
|
DailyRecordDto dailyRecord = dailyRecordService.getDailyRecord(reqVO);
|
||||||
|
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||||
|
throw new NoRecordDataException();
|
||||||
|
}
|
||||||
|
|
||||||
|
return dailyRecord;
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user