Merge branch 'dev' into 0623_fetch
This commit is contained in:
@@ -58,7 +58,7 @@ public class RoleUpdateAspect {
|
||||
|
||||
if (beforeAdmin.isPresent()) {
|
||||
List<String> beforeRoles =
|
||||
beforeAdmin.get().getRoles().stream().map(CoreRole::getId).toList();
|
||||
beforeAdmin.stream().map(r -> r.getRole().getId()).toList();
|
||||
if (beforeRoles.size() != currentRoles.size()
|
||||
|| currentRoles.stream().anyMatch(item -> !beforeRoles.contains(item))) {
|
||||
createLog = true;
|
||||
|
||||
@@ -44,14 +44,14 @@ public class AdminDetailsService implements UserDetailsService {
|
||||
adminUser.getSeq(),
|
||||
adminUser.getId(),
|
||||
adminUser.getPassword(),
|
||||
adminUser.getRoles().stream().map(CoreRole::getId).findFirst().orElse(null),
|
||||
adminUser.getRole().getId(),
|
||||
adminUser.getRegionMainCode(),
|
||||
adminUser.getLastLoginIp(),
|
||||
!accountDisabled,
|
||||
true,
|
||||
isCredentialsNonExpired(adminUser.getPasswordUpdatedAt()),
|
||||
!accountLocked,
|
||||
getAuthorities(adminUser.getRoles()),
|
||||
getAuthorities(Stream.of(adminUser.getRole()).toList()),
|
||||
passwordValidPeriodDays - getDaysPassedFrom(adminUser.getPasswordUpdatedAt()));
|
||||
}
|
||||
|
||||
|
||||
@@ -41,9 +41,9 @@ public class AdminCreatePostController {
|
||||
savePortIn.apiConnect(bindingVO.getSeq(),
|
||||
bindingVO.getId(),
|
||||
bindingVO.getPassword(),
|
||||
bindingVO.getName(),
|
||||
"010-"+bindingVO.getPhone1()+"-"+bindingVO.getPhone2(),
|
||||
bindingVO.getRegionMainCode(),
|
||||
"ROLE_RESEARCHER".equals(bindingVO.getRoleId())?bindingVO.getName():null,
|
||||
"ROLE_RESEARCHER".equals(bindingVO.getRoleId())?"010-"+bindingVO.getPhone1()+"-"+bindingVO.getPhone2():null,
|
||||
!"ROLE_ADMIN".equals(bindingVO.getRoleId())?bindingVO.getRegionMainCode():null,
|
||||
bindingVO.getAccountDisabled(),
|
||||
bindingVO.getRoleId()));
|
||||
}
|
||||
|
||||
@@ -46,19 +46,16 @@ class AdminUpdateGetController {
|
||||
|
||||
AdminUpdateBindingVO bindingVO =
|
||||
new AdminUpdateBindingVO(
|
||||
output.getCreatedBy(),
|
||||
output.getCreatedAt(),
|
||||
output.getUpdatedBy(),
|
||||
output.getUpdatedAt(),
|
||||
output.getSeq(),
|
||||
output.getId(),
|
||||
null,
|
||||
output.getName(),
|
||||
output.getPhone(),
|
||||
output.getPhone() != null&& output.getPhone().matches("\\d{3}-\\d{4}-\\d{4}")?output.getPhone().split("-")[1] : "",
|
||||
output.getPhone() != null&& output.getPhone().matches("\\d{3}-\\d{4}-\\d{4}")?output.getPhone().split("-")[2] : "",
|
||||
output.getRegionMainCode(),
|
||||
output.getPasswordUpdatedAt(),
|
||||
output.getAccountDisabled(),
|
||||
output.getRoles().stream().map(CoreRole::getId).collect(Collectors.toList()));
|
||||
output.getRole().getId());
|
||||
|
||||
model.addAttribute("bindingVO", bindingVO);
|
||||
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
||||
|
||||
@@ -9,16 +9,20 @@ import app.module.core.usecase.role.list.ports.RoleListPortIn;
|
||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Controller
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class AdminUpdatePostController {
|
||||
|
||||
@@ -28,34 +32,24 @@ class AdminUpdatePostController {
|
||||
private final SaveAdminPortIn saveAdminPortIn;
|
||||
private final MessageUtil messageUtil;
|
||||
|
||||
@PostMapping(path = "/settings/admins/update/{id}")
|
||||
String operate(
|
||||
Model model,
|
||||
RedirectAttributes redirectAttributes,
|
||||
@Valid @ModelAttribute("bindingVO") AdminUpdateBindingVO bindingVO,
|
||||
BindingResult bindingResult) {
|
||||
@PostMapping(path = "/api/settings/admin/update")
|
||||
ResponseEntity<?> operate( @RequestBody AdminUpdateBindingVO bindingVO, BindingResult bindingResult) {
|
||||
|
||||
adminUpdateValidator.validate(bindingVO, bindingResult);
|
||||
if (bindingResult.hasErrors()) {
|
||||
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
||||
model.addAttribute("regionMainCode", uiCodeListPortIn.connect("code.region.main"));
|
||||
return "admin/adminUpdateForm";
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY.value())
|
||||
.body(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
||||
}
|
||||
|
||||
saveAdminPortIn.apiConnect(
|
||||
bindingVO.getSeq(),
|
||||
bindingVO.getId(),
|
||||
bindingVO.getUpdatePassword(),
|
||||
bindingVO.getName(),
|
||||
bindingVO.getPhone(),
|
||||
bindingVO.getRegionMainCode(),
|
||||
bindingVO.getAccountDisabled(),
|
||||
bindingVO.getRoleIds().stream().collect(Collectors.joining()));
|
||||
|
||||
redirectAttributes.addFlashAttribute(
|
||||
"operationMessage",
|
||||
messageUtil.getMessage("operation.settings.admin.updated", bindingVO.getId()));
|
||||
|
||||
return "redirect:/settings/admins";
|
||||
return ResponseEntity.status(HttpStatus.OK).body(
|
||||
saveAdminPortIn.apiConnect(
|
||||
bindingVO.getSeq(),
|
||||
bindingVO.getId(),
|
||||
bindingVO.getUpdatePassword(),
|
||||
"ROLE_RESEARCHER".equals(bindingVO.getRoleId())?bindingVO.getName():null,
|
||||
"ROLE_RESEARCHER".equals(bindingVO.getRoleId())?"010-"+bindingVO.getPhone1()+"-"+bindingVO.getPhone2():null,
|
||||
!"ROLE_ADMIN".equals(bindingVO.getRoleId())? bindingVO.getRegionMainCode():null,
|
||||
bindingVO.getAccountDisabled(),
|
||||
bindingVO.getRoleId()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,16 @@
|
||||
package app.module.admin.usecase.admin.saveAdmin.adapters.web.model;
|
||||
|
||||
import app.module.core.config.application.component.AuditOutput;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class AdminUpdateBindingVO implements AuditOutput {
|
||||
|
||||
private final String createdBy;
|
||||
|
||||
private final LocalDateTime createdAt;
|
||||
|
||||
private final String updatedBy;
|
||||
|
||||
private final LocalDateTime updatedAt;
|
||||
@NoArgsConstructor
|
||||
public class AdminUpdateBindingVO{
|
||||
|
||||
private Long seq;
|
||||
private String id;
|
||||
@@ -33,12 +23,13 @@ public class AdminUpdateBindingVO implements AuditOutput {
|
||||
message = "{valid.common.email.wrong}")
|
||||
private String email;*/
|
||||
private String name;
|
||||
private String phone;
|
||||
private String phone1;
|
||||
private String phone2;
|
||||
private String regionMainCode;
|
||||
|
||||
private LocalDateTime passwordUpdatedAt;
|
||||
private Boolean accountDisabled;
|
||||
/* private Integer loginFailCnt;
|
||||
private Boolean accountLocked;*/
|
||||
private List<String> roleIds;
|
||||
private String roleId;
|
||||
}
|
||||
|
||||
@@ -4,12 +4,14 @@ import app.module.admin.usecase.admin.saveAdmin.adapters.web.model.AdminUpdateBi
|
||||
import java.util.Optional;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.validation.ValidationUtils;
|
||||
import org.springframework.validation.Validator;
|
||||
|
||||
@Component
|
||||
public class AdminUpdateValidator implements Validator {
|
||||
|
||||
private final String PASSWORD_REGEX = "^((?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%_\\-])\\S{6,15})$";
|
||||
// 비밀번호: 5자, 숫자 + 특수문자(!@#$%_-) 1개 이상
|
||||
private final String PASSWORD_REGEX = "^(?=.*[0-9])(?=.*[!@#$%_\\-]).{5}$";
|
||||
|
||||
@Override
|
||||
public boolean supports(Class<?> clazz) {
|
||||
@@ -20,23 +22,38 @@ public class AdminUpdateValidator implements Validator {
|
||||
public void validate(Object target, Errors errors) {
|
||||
AdminUpdateBindingVO vo = (AdminUpdateBindingVO) target;
|
||||
|
||||
Optional.ofNullable(vo.getRoleIds())
|
||||
.filter(ids -> ids.size() < 1)
|
||||
.ifPresent(
|
||||
ids ->
|
||||
errors.rejectValue(
|
||||
"roleIds", "valid.common.required.size.min", new Object[]{1}, ""));
|
||||
if (vo.getRoleId() == null || vo.getRoleId().isEmpty()) {
|
||||
errors.rejectValue("roleId", "error.roleId", "권한을 선택해주세요.");
|
||||
}
|
||||
|
||||
Optional.ofNullable(vo.getUpdatePassword())
|
||||
.filter(s -> !s.trim().isEmpty() && !s.matches(PASSWORD_REGEX))
|
||||
.ifPresent(s -> errors.rejectValue("updatePassword", "valid.common.password.wrong"));
|
||||
.filter(password -> !password.trim().isEmpty() && !password.matches(PASSWORD_REGEX))
|
||||
.ifPresent(password -> errors.rejectValue("updatePassword", "valid.common.password.wrong","비밀번호는 5자, 숫자 + 특수문자(!@#$%_-) 1개 이상입니다."));
|
||||
|
||||
if (vo.getRoleId() != null && "ROLE_RESEARCHER".equals(vo.getRoleId())) {
|
||||
if (vo.getName() == null || vo.getName().isBlank()) {
|
||||
errors.rejectValue("name", "error.name", "이름을 입력해주세요.");
|
||||
}
|
||||
if (vo.getName().length() > 4) {
|
||||
errors.rejectValue("name", "error.name", "이름은 4자리까지 입력가능합니다.");
|
||||
}
|
||||
if (vo.getPhone1() == null || vo.getPhone1().isBlank()) {
|
||||
errors.rejectValue("phone1", "error.phone1", "전화번호 앞자리를 입력해주세요.");
|
||||
} else if (!vo.getPhone1().matches("^\\d{4}$")) {
|
||||
errors.rejectValue("phone1", "error.phone1", "전화번호 앞자리는 4자리 숫자여야 합니다.");
|
||||
}
|
||||
if (vo.getPhone2() == null || vo.getPhone2().isBlank()) {
|
||||
errors.rejectValue("phone2", "error.phone2", "전화번호 뒷자리를 입력해주세요.");
|
||||
} else if (!vo.getPhone2().matches("^\\d{4}$")) {
|
||||
errors.rejectValue("phone2", "error.phone2", "전화번호 뒷자리는 4자리 숫자여야 합니다.");
|
||||
}
|
||||
}
|
||||
// ROLE_ADMIN이 아닌 경우 regionMainCode null체크
|
||||
Optional.ofNullable(vo.getRoleIds())
|
||||
.filter(ids -> ids.stream().noneMatch(role -> role.equals("ROLE_ADMIN")))
|
||||
Optional.ofNullable(vo.getRoleId())
|
||||
.filter(id -> !id.equals("ROLE_ADMIN"))
|
||||
.ifPresent(nonAdmins -> {
|
||||
if (vo.getRegionMainCode() == null || vo.getRegionMainCode().isBlank()) {
|
||||
errors.rejectValue("regionMainCode", "valid.common.required");
|
||||
errors.rejectValue("regionMainCode", "valid.common.required","실사지역을 선택해주세요.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class HomeController {
|
||||
.ifPresent(
|
||||
loginUser -> {
|
||||
model.addAttribute("loginUser", loginUser);
|
||||
model.addAttribute("loginUserRoles", loginUser.getRoles());
|
||||
model.addAttribute("loginUserRoles", loginUser.getRole());
|
||||
});
|
||||
|
||||
return "home";
|
||||
|
||||
@@ -4,6 +4,7 @@ import app.module.admin.config.application.util.AdminUtil;
|
||||
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 app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
@@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
@RequiredArgsConstructor
|
||||
class GetHouseholdStatusUIController {
|
||||
private final GetHouseholdStatusPortIn getHouseholdStatusPortIn;
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
|
||||
@GetMapping(path = "/households/{seq}")
|
||||
String operate(
|
||||
@@ -30,6 +32,8 @@ class GetHouseholdStatusUIController {
|
||||
model.addAttribute("recordMonth", recordMonth);
|
||||
model.addAttribute("userRole", AdminUtil.getLoginUserRole());
|
||||
|
||||
model.addAttribute("unitCodes", uiCodeListPortIn.connect("code.record.unit"));
|
||||
|
||||
// 임가 상세 정보
|
||||
model.addAttribute("householdInfo",
|
||||
getHouseholdStatusPortIn.operate(new GetHouseholdStatusCmd(seq)).orElse(null));
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.adapters.persistence;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.ports.application.domain.GetForestProductStatus;
|
||||
import app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.ports.application.domain.GetForestProductStatusCmd;
|
||||
import app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.ports.GetForestProductStatusPortOut;
|
||||
import java.util.Optional;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class GetForestProductStatusDao implements GetForestProductStatusPortOut {
|
||||
private final GetForestProductStatusMapper mapper;
|
||||
|
||||
@Override
|
||||
public Optional<GetForestProductStatus> operate(GetForestProductStatusCmd cmd) {
|
||||
return mapper.getForestProductStatus(cmd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.adapters.persistence;
|
||||
|
||||
import app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.ports.application.domain.GetForestProductStatus;
|
||||
import app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.ports.application.domain.GetForestProductStatusCmd;
|
||||
import java.util.Optional;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface GetForestProductStatusMapper {
|
||||
Optional<GetForestProductStatus> getForestProductStatus(GetForestProductStatusCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.adapters.web;
|
||||
|
||||
import app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.ports.GetForestProductStatusPortIn;
|
||||
import app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.ports.application.domain.GetForestProductStatusCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class GetForestProductStatusController {
|
||||
private final GetForestProductStatusPortIn portIn;
|
||||
|
||||
@GetMapping(path = "/api/forestProduct/{id}")
|
||||
ResponseEntity<?> operate(@PathVariable Long id) {
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(portIn.operate(new GetForestProductStatusCmd(id)).orElse(null));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetForestProductStatusReqVO {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetForestProductStatusResVO {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.ports;
|
||||
|
||||
import java.util.Optional;
|
||||
import app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.ports.application.domain.GetForestProductStatus;
|
||||
import app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.ports.application.domain.GetForestProductStatusCmd;
|
||||
|
||||
public interface GetForestProductStatusPortIn {
|
||||
Optional<GetForestProductStatus> operate(GetForestProductStatusCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.ports;
|
||||
|
||||
import java.util.Optional;
|
||||
import app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.ports.application.domain.GetForestProductStatus;
|
||||
import app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.ports.application.domain.GetForestProductStatusCmd;
|
||||
|
||||
public interface GetForestProductStatusPortOut {
|
||||
Optional<GetForestProductStatus> operate(GetForestProductStatusCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.ports.application;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.ports.application.domain.GetForestProductStatus;
|
||||
import app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.ports.application.domain.GetForestProductStatusCmd;
|
||||
import app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.ports.GetForestProductStatusPortIn;
|
||||
import app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.ports.GetForestProductStatusPortOut;
|
||||
import java.util.Optional;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class GetForestProductStatusService implements GetForestProductStatusPortIn {
|
||||
private final GetForestProductStatusPortOut portOut;
|
||||
|
||||
@Override
|
||||
public Optional<GetForestProductStatus> operate(GetForestProductStatusCmd cmd) {
|
||||
return portOut.operate(cmd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetForestProductStatus {
|
||||
private Long id;
|
||||
private String streetNum;
|
||||
private String landType;
|
||||
private String town;
|
||||
private String cropName;
|
||||
private String landArea;
|
||||
private String mainYield;
|
||||
private String mainYieldUnitCode;
|
||||
private String mainYieldUnit;
|
||||
private String mainSaleAmount;
|
||||
private String mainSaleUnitCode;
|
||||
private String mainSaleUnit;
|
||||
private String subYield;
|
||||
private String subYieldUnitCode;
|
||||
private String subYieldUnit;
|
||||
private String subSaleAmount;
|
||||
private String subSaleUnitCode;
|
||||
private String subSaleUnit;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetForestProductStatusCmd {
|
||||
private Long id;
|
||||
}
|
||||
@@ -30,7 +30,7 @@ class RemoveHouseholdVisitInfosController {
|
||||
}
|
||||
|
||||
portIn.operate(
|
||||
new RemoveHouseholdVisitInfosCmd(reqVO.getHouseholdSeq(), reqVO.getRemoveIds()));
|
||||
new RemoveHouseholdVisitInfosCmd(reqVO.getHouseholdSeq(), reqVO.getVisitRemoveIds()));
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new RemoveHouseholdVisitInfosResVO(
|
||||
messageUtil.getMessage("operation.common.remove.done")));
|
||||
|
||||
@@ -13,5 +13,5 @@ import lombok.Setter;
|
||||
@EqualsAndHashCode
|
||||
public class RemoveHouseholdVisitInfosReqVO {
|
||||
private Long householdSeq;
|
||||
private List<Long> removeIds;
|
||||
private List<Long> visitRemoveIds;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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.tab.forestProduct.getForestProductStatus.adapters.persistence.GetForestProductStatusMapper">
|
||||
<select id="getForestProductStatus"
|
||||
resultType="app.module.admin.usecase.household.tab.forestProduct.getForestProductStatus.ports.application.domain.GetForestProductStatus">
|
||||
/* getForestProductStatus : 임산물 현황 상세 조회 */
|
||||
SELECT id,
|
||||
street_num,
|
||||
land_type,
|
||||
town,
|
||||
crop_name,
|
||||
land_area,
|
||||
main_yield,
|
||||
main_yield_unit_code,
|
||||
main_yield_unit,
|
||||
main_sale_amount,
|
||||
main_sale_unit_code,
|
||||
main_sale_unit,
|
||||
sub_yield,
|
||||
sub_yield_unit_code,
|
||||
sub_yield_unit,
|
||||
sub_sale_amount,
|
||||
sub_sale_unit_code,
|
||||
sub_sale_unit
|
||||
FROM forest_product
|
||||
WHERE id = #{id}
|
||||
AND is_deleted = false
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -13,12 +13,12 @@
|
||||
max(u.code_text) AS region_main_code_name,
|
||||
case a.account_disabled when false then '사용' when true then '미사용' end account_disabled_flag
|
||||
from admin a
|
||||
join admin_has_role ahr ON a.seq = ahr.admin_seq
|
||||
join admin_has_role ahr ON a.seq = ahr.admin_seq and ahr.is_deleted = false
|
||||
left join uicode u ON u.parent_id = 'code.region.main' AND u.id = a.region_main_code
|
||||
left join researcher_has_household rhh ON rhh.admin_seq = a.seq
|
||||
left join household h ON h.seq = rhh.household_seq AND h.is_panel IS true
|
||||
left join researcher_has_household rhh ON rhh.admin_seq = a.seq and rhh.is_deleted = false
|
||||
left join household h ON h.seq = rhh.household_seq AND h.is_panel IS true and h.is_deleted = false
|
||||
where
|
||||
ahr.role_id = 'ROLE_RESEARCHER' and ahr.is_deleted = false
|
||||
ahr.role_id = 'ROLE_RESEARCHER'
|
||||
<if test="searchField == 'name' and searchValue != null and searchValue != ''">
|
||||
and a.name LIKE CONCAT('%', #{searchValue}, '%')
|
||||
</if>
|
||||
|
||||
@@ -1356,6 +1356,11 @@ template {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 1620px) {
|
||||
.component-modal .modal-container .modal-content {
|
||||
max-height: 520px !important;
|
||||
}
|
||||
}
|
||||
@media (max-width: 1024px) {
|
||||
a .hide-txt {
|
||||
font-size: 0;
|
||||
@@ -6841,7 +6846,7 @@ table:not(.type-form) tr:hover {
|
||||
}
|
||||
table.type-form {
|
||||
border: 1px solid #dee2e6;
|
||||
table-layout: fixed;
|
||||
table-layout: auto;
|
||||
}
|
||||
table.type-form tbody tr {
|
||||
height: 100%;
|
||||
@@ -6889,6 +6894,9 @@ table.type-form tbody th {
|
||||
color: #212529;
|
||||
font-weight: 600;
|
||||
}
|
||||
table.type-form tbody th[colspan="6"] {
|
||||
padding: 20px 24px;
|
||||
}
|
||||
table.type-form .component-input {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -6945,7 +6953,8 @@ table tbody td:last-of-type {
|
||||
border-right: none;
|
||||
}
|
||||
table tbody th {
|
||||
width: 16rem;
|
||||
min-width: 14rem;
|
||||
max-width: 16rem;
|
||||
}
|
||||
|
||||
.summary-area ul {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -465,4 +465,8 @@ const formatNumberWithComma = (value) => {
|
||||
return Number(value).toLocaleString();
|
||||
}
|
||||
|
||||
const limitMaxLength = (el) => {
|
||||
const maxLength = parseInt(el.getAttribute('maxlength'), 10);
|
||||
el.value = el.value.replace(/\D/g, '').slice(0, maxLength);
|
||||
}
|
||||
|
||||
|
||||
@@ -235,19 +235,18 @@
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/settings/admin/create',
|
||||
JSON.stringify(dataOj),
|
||||
function(response) { // 성공
|
||||
alert("등록이 완료되었습니다.");
|
||||
location.href = '/settings/admins';
|
||||
function(response) {
|
||||
},
|
||||
function (code, rstData) {
|
||||
if(code == 422) alert(rstData.responseText);
|
||||
if(code == 200 ){
|
||||
if(code === 422) alert(rstData.responseText);
|
||||
if(code === 200 ){
|
||||
alert("등록이 완료되었습니다.");
|
||||
location.href = '/settings/admins';
|
||||
}
|
||||
},
|
||||
'post',
|
||||
'json'
|
||||
'json',
|
||||
{ handle422Type: 'alert' }
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -96,13 +96,12 @@
|
||||
<label><input class="form-check-input" onchange="toggleCheckbox(this);"
|
||||
type="checkbox"/></label>
|
||||
</th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="id" href="#">아이디</a></th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="id" href="#">이름</a></th>
|
||||
<th class="text-secondary" scope="col">권한</th></th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="id" 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="createdAt" href="#">생성일</a>
|
||||
</th>
|
||||
<th scope="col">아이디</th>
|
||||
<th scope="col">이름</th>
|
||||
<th scope="col">권한</th>
|
||||
<th scope="col">실사</th>
|
||||
<th scope="col">계정사용여부</th>
|
||||
<th scope="col">생성일</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -166,12 +165,9 @@
|
||||
f.searchDisabled.value = '';
|
||||
}
|
||||
|
||||
// 수정페이지 이동
|
||||
|
||||
function goUpdate(adminId) {
|
||||
const f = document.adminParamForm;
|
||||
f.action = '/settings/admins/update/' + adminId;
|
||||
f.method = 'get';
|
||||
f.submit();
|
||||
location.href = '/settings/admins/update/' + adminId; // 쿼리 파라미터 없이 이동
|
||||
}
|
||||
|
||||
// 체크박스 선택/해제
|
||||
|
||||
@@ -6,28 +6,34 @@
|
||||
<form
|
||||
method="post"
|
||||
th:action="${'/settings/admins/update/' + bindingVO.id}"
|
||||
th:object="${bindingVO}">
|
||||
th:object="${bindingVO}"
|
||||
name="adminUpdateForm"
|
||||
onsubmit="event.preventDefault(); updateAdmin(); return false;">
|
||||
<div class="content-inner">
|
||||
<input type="hidden" name="seq" th:field="*{seq}"/>
|
||||
|
||||
<table class="type-form">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th> <label for="roleIds">권한<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
<th> <label for="roleId">권한<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
<td>
|
||||
<div class="component-select">
|
||||
<select class="select-list" id="roleIds"
|
||||
th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
|
||||
th:field="*{roleIds}"
|
||||
onchange="onRoleChange(this);">
|
||||
<option value="">선택</option>
|
||||
<option th:each="role : ${roles}" th:text="${role.description}"
|
||||
th:value="${role.id}"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
|
||||
th:if="${#fields.hasErrors('roleIds')}">
|
||||
에러 메세지
|
||||
<div class="d-flex">
|
||||
<div class="component-input">
|
||||
<div class="component-select">
|
||||
<select class="select-list" id="roleId"
|
||||
th:classappend="${#fields.hasErrors('roleId')} ? 'is-invalid'"
|
||||
th:field="*{roleId}"
|
||||
onchange="onRoleChange(this);">
|
||||
<option value="">선택</option>
|
||||
<option th:each="role : ${roles}" th:text="${role.description}"
|
||||
th:value="${role.id}"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{roleId}"
|
||||
th:if="${#fields.hasErrors('roleId')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -40,24 +46,25 @@
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<th><label for="password">비밀번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
<th><label for="updatePassword">비밀번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input id="password" placeholder="암호를 변경하고 싶다면 입력하세요"
|
||||
<input id="updatePassword" placeholder="암호를 변경하고 싶다면 입력하세요"
|
||||
th:classappend="${#fields.hasErrors('updatePassword')} ? 'is-invalid'"
|
||||
th:field="*{updatePassword}"
|
||||
type="password"/>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{updatePassword}"
|
||||
th:if="${#fields.hasErrors('updatePassword')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{updatePassword}"
|
||||
th:if="${#fields.hasErrors('updatePassword')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
<span>총 5자 / 숫자 + 특수문자 1개 이상 (!,@,#,$,%,_,-)</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="researcherArea"
|
||||
th:classappend="${#lists.isEmpty(bindingVO.roleIds) or #lists.contains(bindingVO.roleIds, 'ROLE_LOCAL_INSPECTOR')} ? 'd-none'">
|
||||
th:classappend="${#lists.isEmpty(bindingVO.roleId) or #lists.contains(bindingVO.roleId, 'ROLE_LOCAL_INSPECTOR')} ? 'd-none'">
|
||||
<th><label for="name">이름<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
@@ -83,25 +90,28 @@
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="number" id="phone1" name="phone1" placeholder=""
|
||||
th:value="${bindingVO.phone != null ? bindingVO.phone.substring(4, 8) : ''}">
|
||||
th:value="${bindingVO.phone1 != null ? bindingVO.phone1 : ''}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="invalid-feedback fw-bold"
|
||||
th:if="${#fields.hasErrors('phone1')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="number" id="phone2" name="phone2" placeholder=""
|
||||
th:value="${bindingVO.phone != null ? bindingVO.phone.substring(9, 13) : ''}">
|
||||
th:value="${bindingVO.phone2 != null ? bindingVO.phone2 : ''}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="invalid-feedback fw-bold"
|
||||
th:if="${#fields.hasErrors('phone2')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
<div class="invalid-feedback fw-bold"
|
||||
th:if="${#fields.hasErrors('phone')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
<input type="hidden" name="phone" id="phone" th:field="*{phone}"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="regionMainCodeArea"
|
||||
th:classappend="${#lists.isEmpty(bindingVO.roleIds) or #lists.contains(bindingVO.roleIds, 'ROLE_ADMIN')} ? 'd-none'">
|
||||
th:classappend="${#lists.isEmpty(bindingVO.roleId) or #lists.contains(bindingVO.roleId, 'ROLE_ADMIN')} ? 'd-none'">
|
||||
<th><label for="regionMainCode">실사<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
<td>
|
||||
<div class="component-select">
|
||||
@@ -128,16 +138,16 @@
|
||||
<label for="inlineRadio1" class="radio-inner">
|
||||
<input id="inlineRadio1" th:field="*{accountDisabled}" type="radio" value="true">
|
||||
<span class="radio-item">
|
||||
<span class="radio-txt">미사용</span>
|
||||
</span>
|
||||
<span class="radio-txt">미사용</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="component-input">
|
||||
<label for="inlineRadio2" class="radio-inner">
|
||||
<input id="inlineRadio2" th:field="*{accountDisabled}" type="radio" value="false">
|
||||
<span class="radio-item">
|
||||
<span class="radio-txt">사용</span>
|
||||
</span>
|
||||
<span class="radio-txt">사용</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{accountDisabled}"
|
||||
@@ -148,6 +158,7 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- <div th:replace="common/components :: auditArea"></div>-->
|
||||
|
||||
<div class="component-btns bottom-btn-group">
|
||||
@@ -155,12 +166,13 @@
|
||||
<button type="button" class="btn btn-secondary" onclick="gotoList();return false;">
|
||||
<span class="btn-txt">목록</span>
|
||||
</button>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<button type="button" class="btn btn-primary" onclick="updateAdmin();">
|
||||
<span class="btn-txt">저장</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- 이전 목록페이지의 검색 및 정렬조건 폼 -->
|
||||
@@ -185,18 +197,14 @@
|
||||
}
|
||||
|
||||
$(document).ready(() => {
|
||||
showAudit([[${bindingVO.id}]], [[${bindingVO.createdBy}]],
|
||||
[[${#temporals.format(bindingVO.createdAt, "yyyy-MM-dd'T'HH:mm:ss")}]],
|
||||
[[${bindingVO.updatedBy}]],
|
||||
[[${#temporals.format(bindingVO.updatedAt, "yyyy-MM-dd'T'HH:mm:ss")}]]);
|
||||
|
||||
// 초기 로드 시 roleIds에 따라 regionMainCodeArea 표시/숨김
|
||||
const roleSelect = document.getElementById('roleIds');
|
||||
// 초기 로드 시 roleId에 따라 regionMainCodeArea 표시/숨김
|
||||
const roleSelect = document.getElementById('roleId');
|
||||
if (roleSelect) {
|
||||
onRoleChange(roleSelect);
|
||||
}
|
||||
|
||||
$('form').on('submit', function() {
|
||||
/* $('form').on('submit', function() {
|
||||
const phone1 = $('#phone1').val();
|
||||
const phone2 = $('#phone2').val();
|
||||
if (phone1 && phone2) {
|
||||
@@ -204,7 +212,7 @@
|
||||
} else {
|
||||
$('#phone').val('');
|
||||
}
|
||||
});
|
||||
});*/
|
||||
|
||||
});
|
||||
|
||||
@@ -215,6 +223,29 @@
|
||||
$('.researcherArea').toggle(idResearcher);
|
||||
};
|
||||
|
||||
const updateAdmin = () => {
|
||||
|
||||
const f = document.adminUpdateForm;
|
||||
let dataOj = $(f).serializeObject();
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/settings/admin/update',
|
||||
JSON.stringify(dataOj),
|
||||
function(response) {
|
||||
},
|
||||
function (code, rstData) {
|
||||
if(code === 422) alert(rstData.responseText);
|
||||
if(code === 200 ){
|
||||
alert("수정이 완료되었습니다.");
|
||||
location.href = '/settings/admins';
|
||||
}
|
||||
},
|
||||
'post',
|
||||
'json',
|
||||
{ handle422Type: 'alert' }
|
||||
);
|
||||
}
|
||||
|
||||
</script>
|
||||
</th:block>
|
||||
|
||||
|
||||
@@ -7,6 +7,14 @@
|
||||
<div class="content-inner">
|
||||
<!-- 테이블 영역 -->
|
||||
<table class="type-form">
|
||||
<colgroup>
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>임가번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||
|
||||
@@ -0,0 +1,353 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
|
||||
layout:decorate="~{layout/layout}">
|
||||
|
||||
<div class="layer-wrap" th:fragment="modalFragment">
|
||||
<!-- 임산물 현황 등록 모달 폼 -->
|
||||
<form autocomplete="off" method="get" name="reqForestProductForm">
|
||||
<input type="hidden" name="forestProductId">
|
||||
<input type="hidden" name="householdSeq" th:value="${seq}">
|
||||
<input type="hidden" name="recordMonth">
|
||||
|
||||
<div class="component-modal mypage-wrap modal01 modal-forest-product" data-props-dimm-click="true" data-state="close">
|
||||
<div class="modal-dimm"></div>
|
||||
<div class="modal-frame">
|
||||
<div class="modal-container">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-tit">
|
||||
임산물 현황 등록
|
||||
</h3>
|
||||
</div>
|
||||
<div class="modal-content">
|
||||
<div class="modal-content-inner">
|
||||
<!-- <i class="ico-required-mark" role="img" aria-label="필수">*</i><p>필수입력</p>-->
|
||||
<table class="type-form confirm">
|
||||
<colgroup>
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<th>지번</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="text" id="streetNum" name="streetNum">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<th>지목</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="text" id="landType" name="landType">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<th>읍면동</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="text" id="town" name="town">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>재배 작물명<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="text" id="cropName" name="cropName">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<th>면적(평)</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="number" id="landArea" name="landArea"
|
||||
maxlength="30" inputmode="numeric" oninput="limitMaxLength(this);">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<th>가능면적(평)</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="number" id="availableArea" name="availableArea"
|
||||
maxlength="30" inputmode="numeric" oninput="limitMaxLength(this);">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th colspan="6">주생산물</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>수확량</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="number" id="mainYield" name="mainYield"
|
||||
maxlength="10" inputmode="numeric" oninput="limitMaxLength(this);">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<th>단위</th>
|
||||
<td colspan="2">
|
||||
<div class="d-flex">
|
||||
<div class="component-select">
|
||||
<select class="select-list" name="mainYieldUnitCode" onchange="selectedUnit(this);" required>
|
||||
<option value="">선택</option>
|
||||
<option th:each="item : ${unitCodes}"
|
||||
th:value="${item.id}"
|
||||
th:text="${item.codeText}">
|
||||
</select>
|
||||
</div>
|
||||
<div class="component-input unit-self-input">
|
||||
<div class="input-field">
|
||||
<input type="text" id="mainYieldUnit" name="mainYieldUnit" disabled>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>판매량</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="number" id="mainSaleAmount" name="mainSaleAmount"
|
||||
maxlength="10" inputmode="numeric" oninput="limitMaxLength(this);">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<th>단위</th>
|
||||
<td colspan="2">
|
||||
<div class="d-flex">
|
||||
<div class="component-select">
|
||||
<select class="select-list" name="mainSaleUnitCode" onchange="selectedUnit(this);" required>
|
||||
<option value="">선택</option>
|
||||
<option th:each="item : ${unitCodes}"
|
||||
th:value="${item.id}"
|
||||
th:text="${item.codeText}">
|
||||
</select>
|
||||
</div>
|
||||
<div class="component-input unit-self-input">
|
||||
<div class="input-field">
|
||||
<input type="text" id="mainSaleUnit" name="mainSaleUnit" disabled>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th colspan="6">부생산물</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>수확량</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="number" id="subYield" name="subYield"
|
||||
maxlength="10" inputmode="numeric" oninput="limitMaxLength(this);">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<th>단위</th>
|
||||
<td colspan="2">
|
||||
<div class="d-flex">
|
||||
<div class="component-select">
|
||||
<select class="select-list" name="subYieldUnitCode" onchange="selectedUnit(this);" required>
|
||||
<option value="">선택</option>
|
||||
<option th:each="item : ${unitCodes}"
|
||||
th:value="${item.id}"
|
||||
th:text="${item.codeText}">
|
||||
</select>
|
||||
</div>
|
||||
<div class="component-input unit-self-input">
|
||||
<div class="input-field">
|
||||
<input type="text" id="subYieldUnit" name="subYieldUnit" disabled>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>판매량</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="number" id="subSaleAmount" name="subSaleAmount"
|
||||
maxlength="10" inputmode="numeric" oninput="limitMaxLength(this);">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<th>단위</th>
|
||||
<td colspan="2">
|
||||
<div class="d-flex">
|
||||
<div class="component-select">
|
||||
<select class="select-list" name="subSaleUnitCode" onchange="selectedUnit(this);" required>
|
||||
<option value="">선택</option>
|
||||
<option th:each="item : ${unitCodes}"
|
||||
th:value="${item.id}"
|
||||
th:text="${item.codeText}">
|
||||
</select>
|
||||
</div>
|
||||
<div class="component-input unit-self-input">
|
||||
<div class="input-field">
|
||||
<input type="text" id="subSaleUnit" name="subSaleUnit" disabled>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<div class="btns-row align-right">
|
||||
<button type="button" class="btn btn-primary">
|
||||
<span class="btn-txt">등록</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="button" class="modal-close"></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
// 임산물현황등록 모달창 띄우기
|
||||
const showForestProductModal = (id) => {
|
||||
const f = document.reqForestProductForm;
|
||||
f.recordMonth.value = document.reqForm.recordMonth.value;
|
||||
|
||||
resetForestProductForm();
|
||||
|
||||
if(id != null) {
|
||||
f.forestProductId.value = id;
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
`/api/forestProduct/${id}`,
|
||||
{},
|
||||
(response) => {
|
||||
console.log("임산물현황 상세 응답값 : ", response);
|
||||
setForestProductFormData(response);
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.log("error : ", code);
|
||||
},
|
||||
'get',
|
||||
'json'
|
||||
);
|
||||
}
|
||||
|
||||
document.querySelector(".modal-forest-product").ui.open();
|
||||
}
|
||||
|
||||
// 임산물현황등록 상세 값 set
|
||||
const setForestProductFormData = (data) => {
|
||||
const form = document.reqForestProductForm;
|
||||
if (!form) return;
|
||||
|
||||
form.forestProductId.value = data.id || '';
|
||||
form.streetNum.value = data.streetNum || '';
|
||||
form.landType.value = data.landType || '';
|
||||
form.town.value = data.town || '';
|
||||
form.cropName.value = data.cropName || '';
|
||||
form.landArea.value = data.landArea ?? '';
|
||||
form.availableArea.value = data.availableArea ?? '';
|
||||
form.mainYield.value = data.mainYield ?? '';
|
||||
form.mainSaleAmount.value = data.mainSaleAmount ?? '';
|
||||
form.subYield.value = data.subYield ?? '';
|
||||
form.subSaleAmount.value = data.subSaleAmount ?? '';
|
||||
form.mainYieldUnit.value = data.mainYieldUnit || '';
|
||||
form.mainSaleUnit.value = data.mainSaleUnit || '';
|
||||
form.subYieldUnit.value = data.subYieldUnit || '';
|
||||
form.subSaleUnit.value = data.subSaleUnit || '';
|
||||
|
||||
const unitSelectNames = [
|
||||
'mainYieldUnitCode',
|
||||
'mainSaleUnitCode',
|
||||
'subYieldUnitCode',
|
||||
'subSaleUnitCode'
|
||||
];
|
||||
|
||||
unitSelectNames.forEach((name) => {
|
||||
const select = form.querySelector(`select[name=${name}]`);
|
||||
const value = data[name] || '';
|
||||
if (select) {
|
||||
select.value = value;
|
||||
|
||||
// unit-self-input 처리
|
||||
const tr = select.closest('tr');
|
||||
const unitArea = tr?.querySelector('.unit-self-input');
|
||||
const unitInput = unitArea?.querySelector('input');
|
||||
if (!unitArea || !unitInput) return;
|
||||
|
||||
if (value === 'code.record.unit.self') {
|
||||
unitInput.disabled = false;
|
||||
unitArea.classList.remove('input-disabled');
|
||||
} else {
|
||||
unitInput.disabled = true;
|
||||
unitInput.value = '';
|
||||
unitArea.classList.add('input-disabled');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// form 초기화
|
||||
const resetForestProductForm = () => {
|
||||
const form = document.reqForestProductForm;
|
||||
if (!form) return;
|
||||
|
||||
// 모든 input 초기화
|
||||
form.querySelectorAll('input').forEach((input) => {
|
||||
input.value = '';
|
||||
|
||||
// 단위 직접입력는 다시 비활성화하고 클래스 추가
|
||||
if (input.closest('.unit-self-input')) {
|
||||
input.disabled = true;
|
||||
input.closest('.unit-self-input').classList.add('input-disabled');
|
||||
}
|
||||
});
|
||||
|
||||
// 모든 select 초기화
|
||||
form.querySelectorAll('select').forEach((select) => {
|
||||
select.selectedIndex = 0;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</html>
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="layer-wrap" th:fragment="modalFragment">
|
||||
<form autocomplete="off" method="get" name="reqVisitForm">
|
||||
<input type="hidden" name="visitInfoId">
|
||||
<input type="hidden" name="householdSeq">
|
||||
<input type="hidden" name="householdSeq" th:value="${seq}">
|
||||
|
||||
<div class="component-modal mypage-wrap modal01 modal-visit-info" data-props-dimm-click="true" data-state="close">
|
||||
<div class="modal-dimm"></div>
|
||||
@@ -19,6 +19,14 @@
|
||||
<div class="modal-content">
|
||||
<div class="modal-content-inner">
|
||||
<table class="type-form confirm">
|
||||
<colgroup>
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
@@ -107,7 +115,7 @@
|
||||
|
||||
<script th:inline="javascript">
|
||||
// form 초기화
|
||||
const resetForm = () => {
|
||||
const resetVisitForm = () => {
|
||||
const form = document.reqVisitForm;
|
||||
if (!form) return;
|
||||
|
||||
@@ -125,9 +133,8 @@
|
||||
// 임가방문정보 모달창 띄우기
|
||||
const showVisitInfoModal = (id) => {
|
||||
const f = document.reqVisitForm;
|
||||
f.householdSeq.value = householdSeq;
|
||||
|
||||
resetForm();
|
||||
resetVisitForm();
|
||||
|
||||
if(id != null) {
|
||||
f.visitInfoId.value = id;
|
||||
@@ -137,7 +144,7 @@
|
||||
{},
|
||||
(response) => {
|
||||
console.log("임가방문정보 상세 응답값 : ", response);
|
||||
setFormData(response);
|
||||
setVisitFormData(response);
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.log("error : ", code);
|
||||
@@ -151,7 +158,7 @@
|
||||
}
|
||||
|
||||
// 임가방문정보 상세 값 set
|
||||
const setFormData = (data) => {
|
||||
const setVisitFormData = (data) => {
|
||||
const form = document.reqVisitForm;
|
||||
if (!form) return;
|
||||
|
||||
@@ -184,7 +191,7 @@
|
||||
(response) => { // 성공
|
||||
alert("등록이 완료되었습니다.");
|
||||
document.querySelector(".modal-visit-info").ui.close();
|
||||
getVisitInfo(0);
|
||||
getVisitInfo();
|
||||
},
|
||||
function (code, rstData) {
|
||||
if(code == 422) alert(rstData.responseText);
|
||||
|
||||
@@ -451,7 +451,7 @@
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<label class="checkbox-inner">
|
||||
<input type="checkbox" id="temp_checkbox_000${item.id}" name="temp_checkbox_000${item.id}" value="${item.id}">
|
||||
<input type="checkbox" id="checkbox_work_${item.id}" name="checkbox_work" value="${item.id}">
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
@@ -501,7 +501,7 @@
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<label class="checkbox-inner">
|
||||
<input type="checkbox" id="temp_checkbox_000${item.id}" name="temp_checkbox_000${item.id}" value="${item.id}">
|
||||
<input type="checkbox" id="checkbox_expense_${item.id}" name="checkbox_expense" value="${item.id}">
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
@@ -542,7 +542,7 @@
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<label class="checkbox-inner">
|
||||
<input type="checkbox" id="temp_checkbox_000${item.id}" name="temp_checkbox_000${item.id}" value="${item.id}">
|
||||
<input type="checkbox" id="checkbox_power_${item.id}" name="checkbox_power" value="${item.id}">
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
@@ -579,7 +579,7 @@
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<label class="checkbox-inner">
|
||||
<input type="checkbox" id="temp_checkbox_000${item.id}" name="temp_checkbox_000${item.id}" value="${item.id}">
|
||||
<input type="checkbox" id="checkbox_forestry_${item.id}" name="checkbox_forestry" value="${item.id}">
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
@@ -618,7 +618,7 @@
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<label class="checkbox-inner">
|
||||
<input type="checkbox" id="temp_checkbox_000${item.id}" name="temp_checkbox_000${item.id}" value="${item.id}">
|
||||
<input type="checkbox" id="checkbox_farming_${item.id}" name="checkbox_farming" value="${item.id}">
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<button type="button" class="btn small btn-secondary">
|
||||
<span class=" btn-txt">삭제</span>
|
||||
</button>
|
||||
<button type="button" class="btn small btn-primary">
|
||||
<button type="button" class="btn small btn-primary" onclick="showForestProductModal();">
|
||||
<span class="btn-txt">추가</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -93,7 +93,9 @@
|
||||
<td>${ifNullHyphen(item.landType)}</td><!-- 지목 -->
|
||||
<td>${ifNullHyphen(item.town)}</td><!-- 읍면동 -->
|
||||
<td>${ifNullHyphen(item.availableArea)}</td><!-- 가능면적(평) -->
|
||||
<td>${ifNullHyphen(item.cropName)}</td><!-- 재배작물명 -->
|
||||
<td class="underline">
|
||||
<a href="javascript:void(0);" onclick="showForestProductModal(${item.id});">${ifNullHyphen(item.cropName)}</a>
|
||||
</td><!-- 재배작물명 -->
|
||||
<td>${ifNullHyphen(item.landArea)}</td><!-- 면적(평) -->
|
||||
<td class="align-right">${ifNullHyphen(item.mainYield)}</td><!-- 주생산물 수확량 -->
|
||||
<td>${ifNullHyphen(item.mainYieldUnitText)}</td><!-- 주생산물 수확량 단위 -->
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<label class="checkbox-inner">
|
||||
<input type="checkbox" id="removeIds_${item.id}" name="removeIds" value="${item.id}">
|
||||
<input type="checkbox" id="visitRemoveIds_${item.id}" name="visitRemoveIds" value="${item.id}">
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
@@ -96,24 +96,27 @@
|
||||
|
||||
// 임가방문정보 삭제
|
||||
const goDeleteVisitInfo = () => {
|
||||
const infoIds = $('input[name=removeIds]:checked');
|
||||
if(infoIds.length <= 0) {
|
||||
const checkedIds = Array.from(
|
||||
document.querySelectorAll('input[name="visitRemoveIds"]:checked')
|
||||
).map(el => Number(el.value));
|
||||
|
||||
if(checkedIds.length <= 0) {
|
||||
alert("임가방문정보를 선택해주세요.");
|
||||
return
|
||||
}
|
||||
|
||||
if(confirm("선택하신 내용을 삭제하시겠습니까? 삭제한 항목은 복구할 수 없습니다.")) {
|
||||
const f = document.reqForm;
|
||||
let dataOj = $(f).serializeObject();
|
||||
|
||||
console.log("dataOj", dataOj);
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/visitInfo/remove',
|
||||
JSON.stringify(dataOj),
|
||||
JSON.stringify({
|
||||
householdSeq: f.householdSeq.value,
|
||||
visitRemoveIds: checkedIds
|
||||
}),
|
||||
(response) => { // 성공
|
||||
alert("방문정보가 삭제되었습니다.");
|
||||
getVisitInfo(0);
|
||||
getVisitInfo();
|
||||
},
|
||||
function (code, rstData) {
|
||||
if(code == 422) alert(rstData.responseText);
|
||||
|
||||
@@ -9,6 +9,14 @@
|
||||
<div class="content-inner">
|
||||
<!-- 테이블 영역 -->
|
||||
<table class="type-form">
|
||||
<colgroup>
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>임가번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||
|
||||
@@ -9,6 +9,14 @@
|
||||
<div class="content-inner">
|
||||
<section>
|
||||
<table class="type-form confirm">
|
||||
<colgroup>
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>임가번호</th>
|
||||
@@ -175,13 +183,12 @@
|
||||
|
||||
<!-- 임가방문정보 모달 -->
|
||||
<th:block th:replace="households/modal/modal-visit-info :: modalFragment"/>
|
||||
|
||||
<!-- 임산물현황등록 모달 -->
|
||||
<th:block th:replace="households/modal/modal-forest-product :: modalFragment"/>
|
||||
</section>
|
||||
|
||||
<section layout:fragment="script">
|
||||
<script th:inline="javascript">
|
||||
const householdSeq = document.reqForm.householdSeq.value;
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// 일계부 완료상태
|
||||
const statusInfoMap = {
|
||||
@@ -301,6 +308,22 @@
|
||||
|
||||
$(target).append(`<tr><td colspan="${length}" style="text-align: center;">${noDataText}</td></tr>`);
|
||||
}
|
||||
|
||||
// 단위 선택 (직접입력 선택시 input 활성화)
|
||||
const selectedUnit = (el) => {
|
||||
const tr = el.closest('tr');
|
||||
const unitArea = tr.querySelector('.unit-self-input');
|
||||
const unitInput = tr.querySelector('.unit-self-input input');
|
||||
|
||||
if (el.value === 'code.record.unit.self') {
|
||||
unitInput.disabled = false;
|
||||
unitArea.classList.remove('input-disabled');
|
||||
} else {
|
||||
unitInput.disabled = true;
|
||||
unitInput.value = '';
|
||||
unitArea.classList.add('input-disabled');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<div class="row paging"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-content" data-tab-value="tab2" th:unless="${activeProfile != 'local'}">
|
||||
@@ -144,6 +145,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<div class="row paging"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -16,6 +16,14 @@
|
||||
<form autocomplete="off" method="get" name="householdVisitReqForm" >
|
||||
<input type="hidden" name="id" id="id" />
|
||||
<table class="type-form confirm" >
|
||||
<colgroup>
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
</colgroup>
|
||||
<tbody id="household-visit-detail">
|
||||
<tr>
|
||||
<th>방문일</th>
|
||||
|
||||
@@ -14,8 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
@SpringBootTest
|
||||
@TestPropertySource("classpath:application-override.properties")
|
||||
|
||||
|
||||
@Slf4j
|
||||
class AdminCreateUpdateDaoTest {
|
||||
|
||||
@@ -23,12 +23,12 @@ class AdminCreateUpdateDaoTest {
|
||||
System.setProperty("com.amazonaws.sdk.disableEc2Metadata", "true");
|
||||
}
|
||||
|
||||
@Autowired
|
||||
/* @Autowired
|
||||
SaveAdminPortOut adminCreateUpdateDao;
|
||||
@Autowired
|
||||
AdminViewPortIn adminViewPortIn;
|
||||
@Autowired
|
||||
SaveAdminPortIn saveAdminPortIn;
|
||||
SaveAdminPortIn saveAdminPortIn;*/
|
||||
|
||||
@Test
|
||||
@DisplayName("operate - AdminCreateDao")
|
||||
|
||||
Reference in New Issue
Block a user